Friday, July 4, 2008

Beyond the Automated Build

After the automated build completes, the usefulness of the build system does not come to an end. For one thing, the jhalfs directory contains files with the names of each of the build steps completed thus far. It also contains a directory of logs from which it is possible to determine what files were installed by each step.

There is yet more usefulness.
By removing 2 flag files, making some edits to the Makefile, and creating another file in lfs-tools/custom/tools, the make can be started again from the host system under the same conditions it was started in the first place. So you can set it up to automatically build more packages. And you'll get the logs and records of the packages being installed. The 2 flag files to remove are mk_CUSTOM_TOOLS and mk_BLFS_TOOL. Apparently, their presence tells make that everything has been done.

I added rsync using that approach. There were 3 things to do including 2 edits to the Makefile:

1- Add 2000-rsync to the end of the CUSTOM_TOOLS: line.

2- Add a 2000-rsync block of code at the end of the file.
The block of code is very similar to the blocks of code for the other custom tools except that it references to rsync instead of the other programs. The reference after 2000-rsync:, namely 1999-blfs_bootscripts, is the last stept that must have been completed before the 2000-rsync section will run.

2000-rsync: 1999-blfs_bootscripts
@$(call echo_message, Building)
@export BASHBIN=$(SHELL) && $(SHELL) progress_bar.sh $@ $$PPID &
@echo "$(nl_)`date`$(nl_)" >logs/$@
@$(PRT_DU_CR) >>logs/$@
@$(call remove_existing_dirs2,rsync-2.6.8.tar.gz)
@$(call unpack2,rsync-2.6.8.tar.gz)
@$(call get_pkg_root2)
@source envars && \
$(crCMDSDIR)/custom-tools/$@ >>logs/$@ 2>&1 && \
$(PRT_DU_CR) >>logs/$@
@$(call remove_build_dirs2,rsync)
@touch /var/lib/jhalfs/BLFS/rsync-2.6.8
@$(call housekeeping)

3- Create a 2000-rsync file in the lfs-commands/custom-tools directory:

#!/bin/bash
set -e
cd $PKGDIR
./configure --prefix=/usr &&
make
make install
ldconfig
exit


Remember to remove the flag files mk_CUSTOM_TOOLS and mk_BLFS_TOOL.

Then, boot up the host system that was used in the original build.

Mount the lfs system's partition on /mnt/build_dir

Set up the virtual filesystems for a chroot:

export LFS=/mnt/build_dir &&
mount -v --bind /dev $LFS/dev &&
mount -vt devpts devpts $LFS/dev/pts &&
mount -vt tmpfs shm $LFS/dev/shm &&
mount -vt proc proc $LFS/proc &&
mount -vt sysfs sysfs

Logged in as jhalfs,
cd /mnt/build_dir/jhalfs
make

I thought something like this would work and it did. This could come in handy if I decide to install something with a lot of packages like Gnome or KDE. I might even try using the blfs_tool just to see if there is an optimal build order for them. I would still need to work through the BLFS book in order to prepare the setups. When everything is setup, I can let the computer do the tedious typing.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

Click blog title for the latest post