Use of unionfs to build lfs in stage 5 en 6.

Stef Bon stef at bononline.tk
Mon Nov 20 16:11:52 PST 2006


Hello all,

well I've posted a howto on howtoforge with something about LFS:

http://www.howtoforge.com/ihlfs_full_control_over_what_youre_installing

It's about the control you can get over a installation (or everything that
does modifications on your system) with the use of unionfs and chroot.

You all know that the mainwebsite www.linuxfromscratch.org is not there
anymore?


But now something else:

I've been working with the unionfs in combination with the chroot and I
thought we also could use it for building LFS.

In stead of creating a tools directory on the new partition where the system
will be installed, and creating a link to it,

you can also do:

mount -t unionfs -o dirs=/mnt/lfs:/=ro unionfs /mnt/union

and 

mount --bind /dev /mnt/union/dev 
mount -t devpts devpts /mnt/union/dev/pts
mount -t tmpfs shm /mnt/union/dev/shm
mount -t sysfs sysfs /mnt/union/sys
mount -t proc proc /mnt/union/proc

After these steps make the new "virtual" environment complete with a chroot:

chroot /mnt/union /bin/bash --login

Now you can compile everything in this chrooted environment as normal, thus
without the /tools directory: so with normal options like --prefix=/usr in
stead of the --prefix=/tools.

This works - I think - in step 5. When everything is done in chapter 5, and
the chroot session is ended, in /mnt/lfs there should be a temporary
system, with all the normal paths. I've not tested this, but there is a
hint about this:

http://www.nl.linuxfromscratch.org/hints/downloads/files/package_management_using_trip.txt

In chapter 6 the unionfs is not necessary anymore. And the tools directory
is not used, which is making things easier. But there the unionfs may be
used for packagemanagement.


What do you think? 
The existing situation works, but this new construction looks good.

Stef Bon
Voorburg




More information about the lfs-dev mailing list