On Sunday 21 August 2011 04:04:05 Matthew Finkel wrote:

> On Sat, Aug 20, 2011 at 10:46 PM, Dale <rdalek1...@gmail.com> wrote:
> > How hard is it to set up a 64 bit machine to compile programs for a 32
> > bit system?
> > 
> > Dale
> > 
> > :-)  :-)
> 
> It's actually quite easy. IIRC, when I did it last, the only difference
> is that when you chroot into the subsystem you need prefix the command
> with linux32, e.g. linux32 chroot /path/to/chroot /bin/bash

Yes, just follow this guide: 
http://www.gentoo.org/proj/en/base/amd64/howtos/chroot.xml

I did that and it was straightforward as far as I remember. I did spend some 
time thinking at a few stages, to get an understanding of what I was doing 
rather than just blindly following somebody else's prescription.

Then it's a matter of writing some simple scripts to mount the packages 
directory on the big host. Here's mine, most of which I scrounged from 
somewhere:

$ cat /etc/init.d/atom
#!/sbin/runscript

depend() {
   need localmount
   need bootmisc
}

start() {
    ebegin "Mounting 32-bit chroot dirs"
    mount -o bind /dev /mnt/atom/dev >/dev/null
    mount -o bind /dev/pts /mnt/atom/dev/pts >/dev/null
    mount -o bind /dev/shm /mnt/atom/dev/shm >/dev/null
    mount -t proc /proc /mnt/atom/proc >/dev/null
    mount -o bind /sys /mnt/atom/sys >/dev/null
    mount -o bind /tmp /mnt/atom/tmp >/dev/null
    mount -t nfs -o vers=3 192.168.2.2:/usr/portage/packages 
/mnt/atom/usr/portage/packages
    eend $? "An error occurred while attempting to mount 32-bit chroot 
directories"
    ebegin "Copying 32-bit chroot files"
    cp -pf /etc/resolv.conf /mnt/atom/etc/ >/dev/null
    cp -pf /etc/passwd /mnt/atom/etc/ >/dev/null
    cp -pf /etc/shadow /mnt/atom/etc/ >/dev/null
    cp -pf /etc/group /mnt/atom/etc/ >/dev/null
    cp -pf /etc/hosts /mnt/atom/etc/ > /dev/null
    cp -Ppf /etc/localtime /mnt/atom/etc/ >/dev/null
    eend $? "An error occurred while attempting to copy 32-bit chroot files."
}

stop() {
    ebegin "Unmounting 32-bit chroot dirs"
    umount -f /mnt/atom/dev/pts >/dev/null
    umount -f /mnt/atom/dev/shm >/dev/null
    umount -f /mnt/atom/dev >/dev/null
    umount -f /mnt/atom/proc >/dev/null
    umount -f /mnt/atom/sys >/dev/null
    umount -f /mnt/atom/tmp >/dev/null
    umount -f /mnt/atom/usr/portage/packages >/dev/null
    eend $? "An error occurred while attempting to unmount 32-bit chroot 
directories"
}

I could list the steps of my daily routine to upgrade both the client and 
the chroot if that would help.

-- 
Rgds
Peter           Linux Counter 5290, 1994-04-23

Reply via email to