On Wednesday, 28 March 2018 16:14:49 BST the...@sys-concept.com wrote:
> On 03/28/2018 01:32 AM, Peter Humphrey wrote:
[...]
> > I have a similar system, but Atom N270. I wouldn't want to compile much on
> > it, and certainly not GCC. I NFS-export its $PORTDIR to this much more
> > powerful box, do the emerging here and then just install packages on the
> > Atom. Still not exactly fast, but incomparably better.
> 
> I should have done it as well, it is a bit too late I have only
> 45-packages left to compile out of 710.
> Is it better use NFS or distcc?
> Do you have a good link how to do it with: "NFS-export  $PORTDIR"

I think NFS may be simpler to operate, but that may be because I'm more
familiar with it. You just need something like this in the Atom's /etc/
exports: /usr/portage 
192.168.1.5(rw,no_subtree_check,anonuid=250,anongid=250,no_wdelay)

That IP address is the big beast host, and of course 250 is the portage user.

I don't know of a guide on the web, but basically, the method is to construct
a 32-bit chroot on your host system and install a mirror of your Atom system
in it. Copy your Atom's /etc/portage directory into the chroot and adjust
things like --jobs to suit the chroot host, but make sure all the USE flags
are the same as on the Atom. It'll take an hour or two to build the system,
but you only have to do it once, and of course it'll be done at the speed of
your host machine. You don't need to keep running etc-update or equivalent;
just build the binaries.

My chroot is /mnt/atom and this script starts it ready to chroot into:

$ cat /etc/init.d/atom
#!/sbin/openrc-run

depend() {
   need localmount
   need bootmisc
}

start() {
    ebegin "Mounting 32-bit chroot dirs under /mnt/atom"
    mount -t proc /proc /mnt/atom/proc
    mount --rbind /dev /mnt/atom/dev
    mount --rbind /sys /mnt/atom/sys
    mount -t tmpfs tmpfs -o noatime,nosuid,nodev,noexec,mode=1777 /mnt/atom/tmp
    mount -t tmpfs tmpfs -o noatime,uid=portage,gid=portage,mode=0775 
/mnt/atom/var/tmp/portage
    mount -t nfs -o vers=3 192.168.1.2:/usr/portage /mnt/atom/usr/portage
    rm -f /mnt/atom/etc/mtab
    cp /etc/mtab.atom /mnt/atom/etc/mtab
    eend $? "Error mounting 32-bit chroot directories"
}

stop() {
    ebegin "Unmounting 32-bit /mnt/atom chroot dirs"
    rm /mnt/atom/etc/mtab
    ln -s /proc/self/mounts /mnt/atom/etc/mtab
    umount -R /mnt/atom
    mount /mnt/atom
}

You may prefer not to bother with tmpfs, but I have 32GB RAM on my host, so
it's efficient here. That IP address is the Atom machine.

No doubt someone more skilled than me at bash scripting could improve on my
script; suggestions welcome.

After updating the chroot you can emerge -k or -K on your Atom machine, after
syncing which will now be the most time-consuming part of the operation.

Let me know if anything isn't clear.

Thanks to Neil Bothwick, who showed me how to do this several years ago.

-- 
Regards
Peter


Reply via email to