Automating Linux From Scratch with jhalfs
Building Linux From Scratch is long and tedious. I wanted to do the automated build. However, searches for howto instructions did not lead me to any instructions that actually worked. It was a brainstorm that suggested the possibility that the live cd might provide all the necessary tools to automatically build the stable version of lfs. In fact, I could not find the XML version of the stable version of the LFS BOOK anywhere other than on the live cd.
Some observations that helped me to successfully build Automated Linux From Scratch were:
2008-02-18: Build Automated Linux From Scratch (ALFS)
My target partition: /dev/sda13 (on this run)
Host system: Previously built linux from scratch (or any?)
Required: sudo must be installed and must allow the regular user "su to root"
(This is a jhalfs idiosyncrasy)
The (fictitious) name of the regular user: regular_user (substitiute actual)
As root {
Download the Official LFS LiveCD into current the directory
x86 (contains official LFS-6.3 book): lfslivecd-x86-6.3-r2160.iso
http://www.linuxfromscratch.org/livecd/download.html
Create new ext2 partition on /dev/sda13
Create directory: mkdir /mnt/build_dir
mount /dev/sda13 /mnt/build_dir
mkdir /mnt/build_dir/sources
mkdir /mnt/build_dir/BOOK
mkdir /tmp/livecd
mount lfslivecd-x86-6.3-r2160.iso /tmp/livecd -t iso9660 -o loop
cp /tmp/livecd/lfs-sources/* /mnt/build_dir/sources/
mkdir /tmp/rootext2
mount /tmp/livecd/root.ext2 /tmp/rootext2 -o loop
cp -a /tmp/rootext2/usr/share/LFS-BOOK-6.3-HTML /mnt/build_dir/BOOK/
cp -a /tmp/rootext2/usr/share/LFS-BOOK-6.3-XML /mnt/build_dir/BOOK/
cp -a /tmp/rootext2/home/jhalfs/jhalfs-2.3.1 /mnt/build_dir/
mv /mnt/build_dir/jhalfs-2.3.1 /mnt/build_dir/jhalfs
cp -a /tmp/rootext2/home/jhalfs/jhalfs-2.3.1 /mnt/build_dir/
mv /mnt/build_dir/jhalfs-2.3.1 /mnt/build_dir/jhalfs-blfs
umount /tmp/rootext2
umount /tmp/livecd
cd /mnt/build_dir/sources
tar -xjf linux-2.6.22.5.tar.bz2
mv linux-2.6.22.5 linux-2.6.22.5.unpacked
cd linux-2.6.22.5.unpacked
make mrproper
# If you have a .config file you wish to use copy it here
# Ex: cp /boot/config-2.6.22.5 .config
# LFS recommends:
# It is often better to explore all the configuration menus
# and create the kernel configuration from scratch.
make menuconfig
chown -R regular_user:regular_user /mnt/build_dir
}
As regular_user {
cd /mnt/build_dir/jhalfs
make
}
The reason for the chown (change owner) to the regular_user is that jhalfs won't let you build the system as root.
I seem to recall that make failed because sudo was prompting for password and the progress bar overwrote the prompt and then the login timed out. I might have typed make again, seen the password prompt, typed the password, and then it finished everything.
Next time, I'll change the sudoers file (via. visudo) to let the regular_user do sudo with NOPASSWD during the build:
# User privilege specification
root ALL=(ALL) ALL
regular_user lfs=(ALL) NOPASSWD: ALL
In the above, lfs is the hostname of the system.
# When done, we'll try make in /mnt/build_dir/jhalfs-blfs and see what happens.
Glean the "make" config settings from this log of the process:
Tue Feb 19 09:01:30 EST 2008
Book version is: 6.3
jhalfs configuration settings:
BOOK.............. /mnt/build_dir/BOOK/LFS-BOOK-6.3-XML
CUSTOM_TOOLS...... n
BLFS_TOOL......... n
LUSER............. regular_user
LGROUP............ regular_user
LHOME............. /home
BUILDDIR.......... /mnt/build_dir
CLEAN............. n
GETPKG............ n
RUNMAKE........... n
TEST.............. 1
BOMB_TEST......... n
STRIP............. y
VIMLANG........... y
FSTAB.............
CONFIG............ /mnt/build_dir/sources/linux-2.6.22.5.unpacked/.config
TIMEZONE.......... GMT
PAGE.............. letter
LANG.............. en_US.iso88591
INSTALL_LOG....... n
COMPARE........... n
OPTIMIZE.......... 0
REPORT............ y
REBUILD_MAKEFILE.. n
CPU type:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 8
model name : Pentium III (Coppermine)
stepping : 6
cpu MHz : 803.056
cache size : 256 KB
Memory info:
total used free shared buffers cached
Mem: 1555772 1137928 417844 0 230648 728004
-/+ buffers/cache: 179276 1376496
Swap: 3148700 0 3148700
================================================================================
The SBU unit value is equal to 473 seconds.
Total time required to build the systen: 85.5 SBU
Total Installed files disk usage: 538940.000 KB or 526.309 MB
================================================================================
Jhalfs automatically built the base system in 11.5 hours which is a small fraction of the time it took me to build LFS manually.
It worked!
But this is not the whole story.
There is much more work to do before there is a graphical user interface.
Very briefly, this is yet to do:
lynx2-8-6
bc-1.06
dhcpcd-2.0.8
expat-2.0.0
freetype-2.1.10
fontconfig-2.3.2
Linux-PAM-0.99.4.0
shadow-4.0.15
libpng-1.2.12
xcbuild
nss-3.11.3
zip-2.32
pkg-config-0.20
glib-2.10.3
libIDL-0.8.7
atk-1.11.4
cairo-1.2.4
pango-1.12.3
jpeg-6b
tiff-3.8.2
gtk+-2.8.20
subversion-1.3.1
gpm-1.20.1
libxml2-2.6.26
tidy
xterm
The xcbuild indicates the installation of the X Windows System.
I chose to install Xorg-6.9.0 because I understood the instructions better.
Linux-PAM may be unnecessary, but since many distros
have this, i decided to install it. But it is not an easy install.
I tried to use jhalfs to install xfce from the BLFS book, but based on the results of the attempt, I decided to install the rest from the BLFS book by hand.
Correction: I later discovered that various releases of the XML versions of the books are available via subversion under svn://svn.linuxfromscratch.org/LFS/tags and svn://svn.linuxfromscratch.org/BLFS/tags.Jhalfs-2.3.1 defaults to building the development version, but I wanted to build the stable version.
Some observations that helped me to successfully build Automated Linux From Scratch were:
- jhalfs is the official implementation
- jhalfs builds from XML versions of the LFS BOOK -- not from the HTML versions.
- An XML version of the LFS BOOK can be found on the Live Cd.
- jhalfs can also be found on the Live Cd.
- The Live Cd contains all the LFS sources needed to build the system
2008-02-18: Build Automated Linux From Scratch (ALFS)
My target partition: /dev/sda13 (on this run)
Host system: Previously built linux from scratch (or any?)
Required: sudo must be installed and must allow the regular user "su to root"
(This is a jhalfs idiosyncrasy)
The (fictitious) name of the regular user: regular_user (substitiute actual)
As root {
Download the Official LFS LiveCD into current the directory
x86 (contains official LFS-6.3 book): lfslivecd-x86-6.3-r2160.iso
http://www.linuxfromscratch.org/livecd/download.html
Create new ext2 partition on /dev/sda13
Create directory: mkdir /mnt/build_dir
mount /dev/sda13 /mnt/build_dir
mkdir /mnt/build_dir/sources
mkdir /mnt/build_dir/BOOK
mkdir /tmp/livecd
mount lfslivecd-x86-6.3-r2160.iso /tmp/livecd -t iso9660 -o loop
cp /tmp/livecd/lfs-sources/* /mnt/build_dir/sources/
mkdir /tmp/rootext2
mount /tmp/livecd/root.ext2 /tmp/rootext2 -o loop
cp -a /tmp/rootext2/usr/share/LFS-BOOK-6.3-HTML /mnt/build_dir/BOOK/
cp -a /tmp/rootext2/usr/share/LFS-BOOK-6.3-XML /mnt/build_dir/BOOK/
cp -a /tmp/rootext2/home/jhalfs/jhalfs-2.3.1 /mnt/build_dir/
mv /mnt/build_dir/jhalfs-2.3.1 /mnt/build_dir/jhalfs
cp -a /tmp/rootext2/home/jhalfs/jhalfs-2.3.1 /mnt/build_dir/
mv /mnt/build_dir/jhalfs-2.3.1 /mnt/build_dir/jhalfs-blfs
umount /tmp/rootext2
umount /tmp/livecd
cd /mnt/build_dir/sources
tar -xjf linux-2.6.22.5.tar.bz2
mv linux-2.6.22.5 linux-2.6.22.5.unpacked
cd linux-2.6.22.5.unpacked
make mrproper
# If you have a .config file you wish to use copy it here
# Ex: cp /boot/config-2.6.22.5 .config
# LFS recommends:
# It is often better to explore all the configuration menus
# and create the kernel configuration from scratch.
make menuconfig
chown -R regular_user:regular_user /mnt/build_dir
}
As regular_user {
cd /mnt/build_dir/jhalfs
make
}
The reason for the chown (change owner) to the regular_user is that jhalfs won't let you build the system as root.
I seem to recall that make failed because sudo was prompting for password and the progress bar overwrote the prompt and then the login timed out. I might have typed make again, seen the password prompt, typed the password, and then it finished everything.
Next time, I'll change the sudoers file (via. visudo) to let the regular_user do sudo with NOPASSWD during the build:
# User privilege specification
root ALL=(ALL) ALL
regular_user lfs=(ALL) NOPASSWD: ALL
In the above, lfs is the hostname of the system.
# When done, we'll try make in /mnt/build_dir/jhalfs-blfs and see what happens.
Glean the "make" config settings from this log of the process:
Tue Feb 19 09:01:30 EST 2008
Book version is: 6.3
jhalfs configuration settings:
BOOK.............. /mnt/build_dir/BOOK/LFS-BOOK-6.3-XML
CUSTOM_TOOLS...... n
BLFS_TOOL......... n
LUSER............. regular_user
LGROUP............ regular_user
LHOME............. /home
BUILDDIR.......... /mnt/build_dir
CLEAN............. n
GETPKG............ n
RUNMAKE........... n
TEST.............. 1
BOMB_TEST......... n
STRIP............. y
VIMLANG........... y
FSTAB.............
CONFIG............ /mnt/build_dir/sources/linux-2.6.22.5.unpacked/.config
TIMEZONE.......... GMT
PAGE.............. letter
LANG.............. en_US.iso88591
INSTALL_LOG....... n
COMPARE........... n
OPTIMIZE.......... 0
REPORT............ y
REBUILD_MAKEFILE.. n
CPU type:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 8
model name : Pentium III (Coppermine)
stepping : 6
cpu MHz : 803.056
cache size : 256 KB
Memory info:
total used free shared buffers cached
Mem: 1555772 1137928 417844 0 230648 728004
-/+ buffers/cache: 179276 1376496
Swap: 3148700 0 3148700
================================================================================
The SBU unit value is equal to 473 seconds.
Total time required to build the systen: 85.5 SBU
Total Installed files disk usage: 538940.000 KB or 526.309 MB
================================================================================
Jhalfs automatically built the base system in 11.5 hours which is a small fraction of the time it took me to build LFS manually.
It worked!
But this is not the whole story.
There is much more work to do before there is a graphical user interface.
Very briefly, this is yet to do:
lynx2-8-6
bc-1.06
dhcpcd-2.0.8
expat-2.0.0
freetype-2.1.10
fontconfig-2.3.2
Linux-PAM-0.99.4.0
shadow-4.0.15
libpng-1.2.12
xcbuild
nss-3.11.3
zip-2.32
pkg-config-0.20
glib-2.10.3
libIDL-0.8.7
atk-1.11.4
cairo-1.2.4
pango-1.12.3
jpeg-6b
tiff-3.8.2
gtk+-2.8.20
subversion-1.3.1
gpm-1.20.1
libxml2-2.6.26
tidy
xterm
The xcbuild indicates the installation of the X Windows System.
I chose to install Xorg-6.9.0 because I understood the instructions better.
Linux-PAM may be unnecessary, but since many distros
have this, i decided to install it. But it is not an easy install.
I tried to use jhalfs to install xfce from the BLFS book, but based on the results of the attempt, I decided to install the rest from the BLFS book by hand.
1 Comments:
wow
this is a great guide
i couldnt make out from head to toe as to how one can use jhalfs
instructions worked like a charm
thakns a lot
Post a Comment
Subscribe to Post Comments [Atom]
Click blog title for the latest post