[lfs-dev] Putting a copy util-linux in /tools

Bruce Dubbs bruce.dubbs at gmail.com
Sat Jan 18 13:38:07 PST 2014


I've been working the last few days to put util-linux into Chapter 5 so 
it is available when other programs are built and in order to do the 
final Chapter 6 build of util-linux after udev.

What I've come up with is this:

Chapter 5:  Add util-linux:

./configure --prefix=/tools --disable-makeinstall-chown
make
make install

The --disable-makeinstall-chown is to avoid a chown command during 
install when the process is being done by the lfs user.

Chapter 6:  Virtual File systems

mkdir -pv $LFS/{dev,proc,sys,run}
mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3
mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run
if [ -h $LFS/dev/shm ]; then
   mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi

Mount /run as a tmpfs.  We need to create /run here in the first 
command, but it simplifies the case when $LFS/dev/shm is a symlink.

Chapter 6: e2fsprogs

mkdir -v build
cd build
export LD_LIBRARY_PATH=/tools/lib
LDFLAGS="-L /tools/lib -luuid -lblkid" \
CFLAGS="-I /tools/include"         \
../configure --prefix=/usr         \
              --with-root-prefix="" \
              --enable-elf-shlibs   \
              --disable-libblkid    \
              --disable-libuuid     \
              --disable-uuidd       \
              --disable-fsck
make
make -k check >> $TEST_LOG 2>&1 || true
make install
make install-libs
unset LD_LIBRARY_PATH
chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
gunzip -v /usr/share/info/libext2fs.info.gz
install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info
makeinfo -o      doc/com_err.info ../lib/et/com_err.texinfo
install -v -m644 doc/com_err.info /usr/share/info
install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info

This one is a little complex because we want to use the external 
versions of libblkid and libuuid.  Since the standard locations for 
these libraries is not available we need to use LD_LIBRARY_PATH, 
LDFLAGS, and CFLAGS so it finds needed headers and libraries.

Chapter 6: udev

tar -xvf ../udev-lfs-208-1.tar.bz2
sed -i "s:I src :& -I /tools/include :" udev-lfs-208-1/Makefile.lfs
sed -i "s:lkmod:& -L /tools/lib :" udev-lfs-208-1/Makefile.lfs
make -f udev-lfs-208-1/Makefile.lfs
make -f udev-lfs-208-1/Makefile.lfs install
export LD_LIBRARY_PATH=/tools/lib
build/udevadm hwdb --update
bash udev-lfs-208-1/init-net-rules.sh
unset LD_LIBRARY_PATH

I added the seds above to test, but the final solution is to modify the 
  udev-lfs-208-1.tar.bz2 tarball.

------

I checked the library linkages in the final result and everything looks 
OK.  Since this is a fairly large change, I though I'd run it by others 
before committing.  Please let me know what you think.

   -- Bruce



More information about the lfs-dev mailing list