1. LFS‎ > ‎

6. building LFS

created : 2010-01-28   updated : 2010-01-31
 
Preparing Virtual Kernel File Systems
Various file systems exported by the kernel are used to communicate to and from the kernel itself. These file systems are virtual in that no disk space is used for them. The content of the file systems resides in memory.
Begin by creating directories onto which the file systems will be mounted:
 
mkdir -pv $LFS/{dev,proc,sys}
 

 

Creating Initial Device Nodes
When the kernel boots the system, it requires the presence of a few device nodes, in particular the console and null devices. The device nodes will be created on the hard disk so that they are available before udevd has been started, and additionally when Linux is started with init=/bin/bash. Create the devices by running the following commands:
 
mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3
 
Mounting and Populating /dev
The recommended method of populating the /dev directory with devices is to mount a virtual filesystem (such as tmpfs) on the /dev directory, and allow the devices to be created dynamically on that virtual filesystem as they are detected or accessed. This is generally done during the boot process by Udev. Since this new system does not yet have Udev and has not yet been booted, it is necessary to mount and populate /dev manually. This is accomplished by bind mounting the host system's /dev directory. A bind mount is a special type of mount that allows you to create a mirror of a directory or mount point to some other location. Use the following command to achieve this:
 
mount -v --bind /dev $LFS/dev
 
 
Mounting Virtual Kernel File Systems
Now mount the remaining virtual kernel filesystems:
 
mount -vt devpts devpts $LFS/dev/pts
mount -vt tmpfs shm $LFS/dev/shm
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
 
 
Entering the Chroot Environment
It is time to enter the chroot environment to begin building and installing the final LFS system. As user root, run the following command to enter the realm that is, at the moment, populated with only the temporary tools:
 
chroot "$LFS" /tools/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
/tools/bin/bash --login +h
  
 
The -i option given to the env command will clear all variables of the chroot environment. After that, only the HOME, TERM, PS1, and PATH variables are set again. The TERM=$TERM construct will set the TERM variable inside chroot to the same value as outside chroot. This variable is needed for programs like vim and less to operate properly. If other variables are needed, such as CFLAGS or CXXFLAGS, this is a good place to set them again.
 
From this point on, there is no need to use the LFS variable anymore, because all work will be restricted to the LFS file system. This is because the Bash shell is told that $LFS is now the root (/) directory.
Notice that /tools/bin comes last in the PATH. This means that a temporary tool will no longer be used once its final version is installed. This occurs when the shell does not “remember” the locations of executed binaries—for this reason, hashing is switched off by passing the +h option to bash.
Note that the bash prompt will say I have no name! This is normal because the /etc/passwd file has not been created yet.
 
Creating Directories
 
mkdir -pv /{bin,boot,etc/opt,home,lib,mnt,opt}
mkdir -pv /{media/{floppy,cdrom},sbin,srv,var}
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{doc,info,locale,man}
mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8}
for dir in /usr /usr/local; do
ln -sv share/{man,doc,info} $dir
done
case $(uname -m) in
x86_64) ln -sv lib /lib64 && ln -sv lib /usr/lib64 ;;
esac
mkdir -v /var/{lock,log,mail,run,spool}
mkdir -pv /var/{opt,cache,lib/{misc,locate},local}
 
 
 
Creating Essential Files and Symlinks
ln -sv /tools/bin/{bash,cat,echo,pwd,stty} /bin
ln -sv /tools/bin/perl /usr/bin
ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
ln -sv /tools/lib/libstdc++.so{,.6} /usr/lib
ln -sv bash /bin/sh
 
 
A proper Linux system maintains a list of the mounted file systems in the file /etc/mtab. Normally, this file would be created when we mount a new file system. Since we will not be mounting any file systems inside our chroot environment, create an empty file for utilities that expect the presence of /etc/mtab:
 
touch /etc/mtab
 
Create the /etc/passwd file by running the following command:
 
cat > /etc/passwd << "EOF"
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false
EOF
 
The actual password for root (the “x” used here is just a placeholder) will be set later.
 
Create the /etc/group file by running the following command:
 
cat > /etc/group << "EOF"
root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
tty:x:4:
tape:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
mail:x:34:
nogroup:x:99:
EOF
 
 
To remove the “I have no name!” prompt, start a new shell.
exec /tools/bin/bash --login +h
 
Initialize the log files and give them proper permissions:
 
touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
chgrp -v utmp /var/run/utmp /var/log/lastlog
chmod -v 664 /var/run/utmp /var/log/lastlog
 
After reboot
Note : If you need to reboot during the build , you need to do the following, /mnt/lfs  and /dev/sdb1 must be changed to suit your needs
 
export LFS=/mnt/lfs
mount /dev/sdb1 $LFS
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 $LFS/sys
chroot "$LFS" /tools/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
/tools/bin/bash --login +h
 
Linux-2.6.30.2 API Headers
The Linux API Headers expose the kernel's API for use by Glibc.
Approximate build time: 0.1 SBU
Required disk space: 403 MB
 
Unpack source :
 
cd /sources
rm -rf linux-2.6.30.2
tar -jxvf linux-2.6.30.2.tar.bz2
cd linux-2.6.30.2
 
 
Build and install :
 
time {
make mrproper &&
make headers_check &&
make INSTALL_HDR_PATH=dest headers_install &&
cp -rv dest/include/* /usr/include ;
}
 
 
Time taken :
real    1m23.351s
user    0m15.413s
sys     0m32.034s
 
 
Man-pages-3.22
The Man-pages package contains over 1,900 man pages.
 
Approximate build time: less than 0.1 SBU
Required disk space: 21 MB
 
Unpack source :
 
cd /sources
tar jxvf man-pages-3.22.tar.bz2
cd man-pages-3.22
Build and install :
 
time make install
Time taken :
real    0m0.836s
user    0m0.060s
sys     0m0.312s
 
 
Glibc-2.10.1
The Glibc package contains the main C library. This library provides the basic routines for allocating memory, searching directories, opening and closing files, reading and writing files, string handling, pattern matching, arithmetic, and so on.
 
Approximate build time: 16.9 SBU testsuite included
Required disk space: 637 MB testsuite included
 
Unpack sources :
cd /sources
rm -rf glibc-2.10.1
rm -rf glibc-build
tar -jxvf glibc-2.10.1.tar.bz2
cd glibc-2.10.1
Add IDN support :
 
tar -xvf ../glibc-libidn-2.10.1.tar.bz2
mv -v glibc-libidn-2.10.1 libidn
 
Patch test-installation.pl
 
DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
scripts/test-installation.pl
unset DL
 
Change default program interpreter to /bin/bash
 
sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
 
Fix an error in one of the make check routines. Note that the escaped newline in the second sed is required:
 
sed -i s/utf8/UTF-8/ libio/tst-fgetwc.c
sed -i '/tst-fgetws-ENV/ a\
tst-fgetwc-ENV = LOCPATH=$(common-objpfx)localedata' libio/Makefile
 
Fix an error in the constants that get passed to the futex system call in some cases, causing certain pthread_mutex operations to fail:
 
sed -i \
-e 's/FUTEX_WAIT\( | FUTEX_CLOCK_REALTIME, reg\)/FUTEX_WAIT_BITSET\1/' \
nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:
 
mkdir -v ../glibc-build
cd ../glibc-build
 
Add the needed compiler flags to CFLAGS for x86 machines.
 
case `uname -m` in
i?86) echo "CFLAGS += -march=i486 -mtune=native -O3 -pipe" > configparms ;;
esac
 
Build :
 
time {
../glibc-2.10.1/configure --prefix=/usr \
--disable-profile --enable-add-ons \
--enable-kernel=2.6.18 --libexecdir=/usr/lib/glibc &&
  make;
}
 
real    48m15.554s
user    14m58.380s
sys     11m30.751s
 
 
The meaning of the new configure options:
--libexecdir=/usr/lib/glibc
This changes the location of the pt_chown program from its default of /usr/libexec to /usr/lib/glibc.
Check :
 
time {
cp -v ../glibc-2.10.1/iconvdata/gconv-modules iconvdata &&
make -k check 2>&1 | tee glibc-check-log &&
grep Error glibc-check-log ;
}
 
Result :
 
make[1]: Target `check' not remade because of errors.
make[1]: Leaving directory `/sources/glibc-2.10.1'
make: *** [check] Error 2
make[2]: [/sources/glibc-build/posix/annexc.out] Error 1 (ignored)
make[2]: *** [/sources/glibc-build/nptl/tst-cond20.out] Error 1
make[2]: *** [/sources/glibc-build/nptl/tst-cond21.out] Error 1
make[1]: *** [nptl/tests] Error 2
make: *** [check] Error 2
real    41m11.480s
user    13m37.731s
sys     7m53.330s
 
 
I decided to ignored the error and go ahead.
 
Install :
 
time make install
 
 
real    8m50.384s
user    2m36.330s
sys     1m25.929s
 
Install Locale :
 
mkdir -pv /usr/lib/locale
localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
localedef -i de_DE -f ISO-8859-1 de_DE
localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
localedef -i de_DE -f UTF-8 de_DE.UTF-8
localedef -i en_HK -f ISO-8859-1 en_HK
localedef -i en_PH -f ISO-8859-1 en_PH
localedef -i en_US -f ISO-8859-1 en_US
localedef -i en_US -f UTF-8 en_US.UTF-8
localedef -i es_MX -f ISO-8859-1 es_MX
localedef -i fa_IR -f UTF-8 fa_IR
localedef -i fr_FR -f ISO-8859-1 fr_FR
localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
localedef -i it_IT -f ISO-8859-1 it_IT
localedef -i ja_JP -f EUC-JP ja_JP
localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
localedef -i zh_CN -f GB18030 zh_CN.GB18030
 
 
Install all locales listed in the glibc-2.10.1/localedata/SUPPORTED file :
make localedata/install-locales
 
 
Create a new file /etc/nsswitch.conf by running the following:
 
cat > /etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
# End /etc/nsswitch.conf
EOF
One way to determine the local time zone, run the following script:
tzselect
 
I chose Asia/Hong_Kong
Then create the /etc/localtime file by running:
 
cp -v --remove-destination /usr/share/zoneinfo/Asia/Hong_Kong \
/etc/localtime
The meaning of the cp option:
--remove-destination
This is needed to force removal of the already existing symbolic link. The reason for copying the file instead of using a symlink is to cover the situation where /usr is on a separate partition. This could be important when booted into single user mode.
 
By default, the dynamic loader (/lib/ld-linux.so.2) searches through /lib and /usr/lib for dynamic libraries that are needed by programs as they are run. However, if there are libraries in directories other than /lib and /usr/lib, these need to be added to the /etc/ld.so.conf file in order for the dynamic loader to find them. Two directories that are commonly known to contain additional libraries are /usr/local/lib and /opt/lib, so add those directories to the dynamic loader's search path.
 
Create a new file /etc/ld.so.conf by running the following:
 
cat > /etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf
/usr/local/lib
/opt/lib
# End /etc/ld.so.conf
EOF
 
Re-adjusting the Toolchain
Now that the final C libraries have been installed, it is time to adjust the toolchain again. The toolchain will be adjusted so that it will link any newly compiled program against these new libraries.  Now, the chain will be guided from /tools/lib directory to the LFS /{,usr/}lib directories.
First, backup the /tools linker, and replace it with the adjusted linker we made in chapter 5. We'll also create a link to its counterpart in /tools/$(gcc -dumpmachine)/bin:
 
mv -v /tools/bin/{ld,ld-old}
mv -v /tools/$(gcc -dumpmachine)/bin/{ld,ld-old}
mv -v /tools/bin/{ld-new,ld}
ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
 

 

 
Next, amend the GCC specs file so that it points to the new dynamic linker. Simply deleting all instances of “/tools”.
 
gcc -dumpspecs | sed -e 's@/tools@@g' \
-e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
-e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
`dirname $(gcc --print-libgcc-file-name)`/specs
 
Testing :
echo 'main(){}' > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
readelf -l a.out | grep ': /lib'
 
Output :
[Requesting program interpreter: /lib/ld-linux.so.2]
 
 
Now make sure that we're setup to use the correct startfiles:
 
grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
 
If everything is working correctly, there should be no errors, and the output of the last command will be:
/usr/lib/crt1.o succeeded
/usr/lib/crti.o succeeded
/usr/lib/crtn.o succeeded
 
 
Verify that the compiler is searching for the correct header files:
 
grep -B1 '^ /usr/include' dummy.log
 
 
This command should return successfully with the following output:
#include <...> search starts here:
/usr/include
 
 
Next, verify that the new linker is being used with the correct search paths:
 
grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
 
If everything is working correctly, there should be no errors, and the output of the last command (allowing for platform-specific target triplets) will be:
SEARCH_DIR("/tools/i686-pc-linux-gnu/lib")
SEARCH_DIR("/usr/lib")
SEARCH_DIR("/lib");
 
 
Next make sure that we're using the correct libc:
grep "/lib.*/libc.so.6 " dummy.log
If everything is working correctly, there should be no errors, and the output of the last command (allowing for a lib64 directory on 64-bit hosts) will be:
attempt to open /lib/libc.so.6 succeeded
 
Lastly, make sure GCC is using the correct dynamic linker:
 
grep found dummy.log
 
If everything is working correctly, there should be no errors, and the output of the last command will be (allowing for platform-specific differences in dynamic linker name and a lib64 directory on 64-bit hosts):
found ld-linux.so.2 at /lib/ld-linux.so.2
 
Once everything is working correctly, clean up the test files:
 
rm -v dummy.c a.out dummy.log
 
 
Zlib-1.2.3
The Zlib package contains compression and decompression routines used by some programs.
 
Approximate build time: less than 0.1 SBU
Required disk space: 2.8 MB
 
Unpack source :
 
cd /sources
tar -jxvf zlib-1.2.3.tar.bz2
cd zlib-1.2.3
Build and install :
 
time {
./configure --prefix=/usr --shared --libdir=/lib &&
make &&
make install ;
}
 
real    0m16.823s
user    0m5.444s
sys     0m2.808s
 
 
The previous command installed a .so file in /lib. We will remove it and relink it into /usr/lib:
 
rm -v /lib/libz.so
ln -sfv ../../lib/libz.so.1.2.3 /usr/lib/libz.so
 
Build the static library:
 
time {
make clean &&
./configure --prefix=/usr &&
make &&
make install ;
}
 
real    0m14.619s
user    0m5.716s
sys     0m2.240s
 
 
Fix the permissions on the static library:
 
chmod -v 644 /usr/lib/libz.a
 
 
 
Binutils-2.19.1
The Binutils package contains a linker, an assembler, and other tools for handling object files.
 
Approximate build time: 2.1 SBU testsuite included
Required disk space: 222 MB testsuite included
 
Unpack source :
 
cd /sources
rm -rf binutils-2.19.1
rm -rf binutils-build
tar -jxvf binutils-2.19.1.tar.bz2
cd binutils-2.19.1
 
Verify that the PTYs are working properly inside the chroot environment :
 
expect -c "spawn ls"
 
This command should output the following:
spawn ls
  
Suppress the installation of an outdated standards.info file as a newer one is installed later on in the Autoconf
instructions:
 
rm -fv etc/standards.info
sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in
 

 

 
Fix an issue that causes one of the tests to fail to compile against Glibc-2.10.1:
 
sed -i -e 's/getline/get_line/' libiberty/testsuite/test-demangle.c
 
The Binutils documentation recommends building Binutils outside of the source directory in a dedicated build directory:
 
mkdir -v ../binutils-build
cd ../binutils-build
 
Build :
time {
../binutils-2.19.1/configure --prefix=/usr \
--enable-shared &&
make tooldir=/usr ;
}
real    14m5.092s
user    3m58.331s
sys     4m0.223s
 
The meaning of the make parameter:
tooldir=/usr
Normally, the tooldir (the directory where the executables will ultimately be located) is set to $(exec_prefix)/$(target_alias). For example, x86_64 machines would expand that to /usr/x86_64-unknown-linux-gnu. Because this is a custom system, this target-specific directory in /usr is not required.
$(exec_prefix)/$(target_alias) would be used if the system was used to cross-compile (for example, compiling a package on an Intel machine that generates code that can be executed on PowerPC machines).
 
Test the results:
time make check
It had no error.  Time taken :
real    9m13.751s
user    2m25.561s
sys     4m24.397s
 
Install the package:
time  {
make tooldir=/usr install &&
cp -v ../binutils-2.19.1/include/libiberty.h /usr/include ;
}
 
real    0m39.252s
user    0m5.616s
sys     0m12.833s
 
 
GMP-4.3.1
The GMP package contains math libraries. These have useful functions for arbitrary precision arithmetic.
 
Approximate build time: 1.7 SBU testsuite included
Required disk space: 39 MB testsuite included
 
 
Unpack source :
 
cd /sources
tar -jxvf gmp-4.3.1.tar.bz2
cd gmp-4.3.1
 
Build :
 
time {
./configure --prefix=/usr --enable-cxx --enable-mpbsd &&
make ;
}
 
real    16m49.860s
user    3m37.418s
sys     6m1.263s
 
The meaning of the new configure options:
--enable-cxx
This parameter enables C++ support
--enable-mpbsd
This builds the Berkeley MP compatibility library
 
Test :
 
time make check 2>&1 | tee gmp-check-log
real    8m54.193s
user    2m22.609s
sys     2m45.822s
 
Ensure that all 143 tests in the test suite passed. Check the results by issuing the following command:
 
awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log
143
 
Install the package:
 
time {
make install &&
mkdir -v /usr/share/doc/gmp-4.3.1 &&
cp -v doc/{isa_abi_headache,configuration} doc/*.html \
/usr/share/doc/gmp-4.3.1 ;
}
 
real    0m9.685s
user    0m1.676s
sys     0m3.328s
 
 
MPFR-2.4.1
The MPFR package contains functions for multiple precision math.
 
Approximate build time: 1.1 SBU testsuite included
Required disk space: 27.1 MB testsuite included
 
Unpack source :
cd /sources
tar -jxvf mpfr-2.4.1.tar.bz2
cd mpfr-2.4.1
Build :
 
time {
./configure --prefix=/usr --enable-thread-safe &&
make ;
}
real    5m59.559s
user    1m30.498s
sys     1m35.586s
 
Test the results and ensure that all 148 tests passed:
 
time make check
All 148 tests passed
real    6m31.548s
user    1m59.495s
sys     1m41.990s
 
Install the package:
 
time make install
real    0m3.266s
user    0m0.936s
sys     0m0.736s
 
Install the documentation :
 
make html
mkdir -pv /usr/share/doc/mpfr-2.4.1
find . -name \*.html -type f -exec cp -v \{} /usr/share/doc/mpfr-2.4.1 \;
 
 
GCC-4.4.1
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.
 
Approximate build time: 44 SBU testsuite included
Required disk space: 1.1 GB testsuite included
 
Unpack source :
 
cd /sources
rm -rf gcc-4.4.1
rm -rf gcc-build
tar -jxvf gcc-4.4.1.tar.bz2
cd gcc-4.4.1
  
 
Apply a sed substitution that will suppress the installation of libiberty.a. The version of libiberty.a provided by Binutils will be used instead:
 
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
 
Apply the following sed to force the build to use the -fomit-framepointer compiler flag in order to ensure consistent compiler builds:
 
case `uname -m` in
i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' \
gcc/Makefile.in ;;
esac
 
The fixincludes script is known to occasionally erroneously attempt to "fix" the system headers installed so far. As the headers up to this point are known to not require fixing, issue the following command to prevent the fixincludes script from running:
 
sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
 
The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:
 
mkdir -v ../gcc-build
cd ../gcc-build
 
Build :
 
time {
../gcc-4.4.1/configure --prefix=/usr \
--libexecdir=/usr/lib --enable-shared \
--enable-threads=posix --enable-__cxa_atexit \
--enable-clocale=gnu --enable-languages=c,c++ \
--disable-multilib --disable-bootstrap &&
make ;
}
real    49m34.447s
user    19m1.859s
sys     11m11.062s
 
 
Test the results, but do not stop at errors:
 
time make -k check
real    206m29.472s
user    91m13.270s
sys     86m45.129s
 
The above check got error, I continued anyway.
To receive a summary of the test suite results, run:
 
time ../gcc-4.4.1/contrib/test_summary
 
Install the package:
 
time make install
real    0m51.881s
user    0m8.241s
sys     0m19.009s
 
Create symlink:
 
ln -sv ../usr/bin/cpp /lib
ln -sv gcc /usr/bin/cc
 
Testing :
 
echo 'main(){}' > dummy.c
cc dummy.c -v -Wl,--verbose &> dummy.log
readelf -l a.out | grep ': /lib'
 
If everything is working correctly, there should be no errors, and the output of the last command will be (allowing for platform-specific differences in dynamic linker name):
[Requesting program interpreter: /lib/ld-linux.so.2]
 
Now make sure that we're setup to use the correct startfiles:
 
grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
If everything is working correctly, there should be no errors, and the output of the last command will be:
/usr/lib/gcc/i686-pc-linux-gnu/4.4.1/../../../crt1.o succeeded
/usr/lib/gcc/i686-pc-linux-gnu/4.4.1/../../../crti.o succeeded
/usr/lib/gcc/i686-pc-linux-gnu/4.4.1/../../../crtn.o succeeded
 
Depending on your machine architecture, the above may differ slightly, the difference usually being the name of the directory after /usr/lib/gcc. If your machine is a 64-bit system, you may also see a directory named lib64 towards the end of the string. The important thing to look for here is that gcc has found all three crt*.o files under the /usr/lib directory.
 
Verify that the compiler is searching for the correct header files:
 
grep -B4 '^ /usr/include' dummy.log
 
This command should return successfully with the following output:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.4.1/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.4.1/include-fixed
 /usr/include
 
Again, note that the directory named after your target triplet may be different than the above, depending on your architecture
 
Next, verify that the new linker is being used with the correct search paths:
 
grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
 
If everything is working correctly, there should be no errors, and the output of the last command (allowing for platform-specific target triplets) will be:
SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
SEARCH_DIR("/usr/local/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("/usr/lib");
 
A 64-bit system may see a few more directories. For example, here is the output from an x86_64 machine:
SEARCH_DIR("/usr/x86_64-unknown-linux-gnu/lib64")
SEARCH_DIR("/usr/local/lib64")
SEARCH_DIR("/lib64")
SEARCH_DIR("/usr/lib64")
SEARCH_DIR("/usr/x86_64-unknown-linux-gnu/lib")
SEARCH_DIR("/usr/local/lib")
SEARCH_DIR("/lib")
SEARCH_DIR("/usr/lib");
 
Next make sure that we're using the correct libc:
 
grep "/lib.*/libc.so.6 " dummy.log
If everything is working correctly, there should be no errors, and the output of the last command (allowing for a lib64 directory on 64-bit hosts) will be:
attempt to open /lib/libc.so.6 succeeded
 
Lastly, make sure GCC is using the correct dynamic linker:
 
grep found dummy.log
 
If everything is working correctly, there should be no errors, and the output of the last command will be (allowing for platform-specific differences in dynamic linker name and a lib64 directory on 64-bit hosts):
found ld-linux.so.2 at /lib/ld-linux.so.2
Once everything is working correctly, clean up the test files:
 
rm -v dummy.c a.out dummy.log
 
 
Sed-4.2.1
The Sed package contains a stream editor.
 
Approximate build time: 0.2 SBU
Required disk space: 8.3 MB
 
Unpack the source :
 
cd /sources
rm -rf sed-4.2.1
tar -jxvf sed-4.2.1.tar.bz2
cd sed-4.2.1
  
 
Build :
 
time {
./configure --prefix=/usr --bindir=/bin --htmldir=/usr/share/doc/sed-4.2.1 &&
make &&
make html &&
make install &&
make -C doc install-html ;
}
real    2m21.952s
user    0m25.566s
sys     0m40.991s
 
The meaning of the new configure option:
--htmldir
This sets the directory where the HTML documentation will be installed to.
check :
 
time make check
===================
All 65 tests passed
===================
real    0m33.516s
user    0m12.077s
sys     0m7.636s
 
 
Pkg-config-0.23
The pkg-config package contains a tool for passing the include path and/or library paths to build tools during the configure and make file execution.
 
Approximate build time: 0.3 SBU
Required disk space: 11.5 MB
 
Unpack source :
 
cd /sources
tar zxvf pkg-config-0.23.tar.gz
cd pkg-config-0.23
 
Build and install:
 
time {
./configure --prefix=/usr &&
make &&
make install ;
}
real    4m17.240s
user    0m57.924s
sys     1m15.261s
 
 
To test the results, issue:
 
time make check
==================
All 6 tests passed
==================
real    0m2.633s
user    0m0.460s
sys     0m0.772s
 
 
Ncurses-5.7
The Ncurses package contains libraries for terminal-independent handling of character screens.
 
Approximate build time: 0.8 SBU
Required disk space: 35 MB
 
Unpack source :
 
cd /sources
rm -rf ncurses-5.7
tar -zxvf ncurses-5.7.tar.gz
cd ncurses-5.7
 
Build and install :
 
time {
./configure --prefix=/usr --with-shared --without-debug --enable-widec &&
make &&
make install ;
}
real    7m40.206s
user    2m13.008s
sys     1m51.283s
 
The meaning of the configure option:
--enable-widec
This switch causes wide-character libraries (e.g., libncursesw.so.5.7) to be built instead of normal ones (e.g., libncurses.so.5.7). These wide-character libraries are usable in both multibyte and traditional 8-bit locales, while normal libraries work properly only in 8-bit locales. Wide-character and normal libraries are source-compatible, but not binary-compatible.
 
Move the libraries to the /lib directory, where they are expected to reside:
 
mv -v /usr/lib/libncursesw.so.5* /lib
 

 

Because the libraries have been moved, one symlink points to a non-existent file. Recreate it:
 
ln -sfv ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so
Many applications still expect the linker to be able to find non-wide-character Ncurses libraries. Trick such applications into linking with wide-character libraries by means of symlinks and linker scripts:
 
for lib in ncurses form panel menu ; do \
rm -vf /usr/lib/lib${lib}.so ; \
echo "INPUT(-l${lib}w)" >/usr/lib/lib${lib}.so ; \
ln -sfv lib${lib}w.a /usr/lib/lib${lib}.a ; \
done
ln -sfv libncurses++w.a /usr/lib/libncurses++.a
Finally, make sure that old applications that look for -lcurses at build time are still buildable:
 
rm -vf /usr/lib/libcursesw.so
echo "INPUT(-lncursesw)" >/usr/lib/libcursesw.so
ln -sfv libncurses.so /usr/lib/libcurses.so
ln -sfv libncursesw.a /usr/lib/libcursesw.a
ln -sfv libncurses.a /usr/lib/libcurses.a
 
If desired, install the Ncurses documentation:
 
mkdir -v /usr/share/doc/ncurses-5.7
cp -v -R doc/* /usr/share/doc/ncurses-5.7
 
The instructions above don't create non-wide-character Ncurses libraries since no package installed by compiling from sources would link against them at runtime. If you must have such libraries because of some binary-only application, build them with the following commands:
 
time {
make distclean &&
./configure --prefix=/usr --with-shared --without-normal \
--without-debug --without-cxx-binding &&
make sources libs &&
cp -av lib/lib*.so.5* /usr/lib ;
}
real    3m4.579s
user    0m48.719s
sys     0m47.235s
 
 
Util-linux-ng-2.16
The Util-linux-ng package contains miscellaneous utility programs. Among them are utilities for handling file systems, consoles, partitions, and messages.
 
Approximate build time: 0.6 SBU
Required disk space: 40 MB
 
Unpack source :
 
cd /sources
tar -jxvf util-linux-ng-2.16.tar.bz2
cd util-linux-ng-2.16
 
FHS compliance notes
The FHS recommends using the /var/lib/hwclock directory instead of the usual /etc directory as the location for the adjtime file. To make the hwclock program FHS-compliant, run the following:
 
sed -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' \
-i $(grep -rl '/etc/adjtime' .)
mkdir -pv /var/lib/hwclock
 
Build and install :
 
time {
./configure --enable-arch --enable-partx --enable-write &&
make &&
make install ;
}
real    6m29.146s
user    1m40.358s
sys     1m45.367s
 
The meaning of the configure options:
--enable-arch
Enables building the arch program
--enable-partx
Enables building the addpart, delpart and partx programs
--enable-write
Enables building the write program
 
E2fsprogs-1.41.8
The E2fsprogs package contains the utilities for handling the ext2 file system. It also supports the ext3 and ext4 journaling file systems.
 
Approximate build time: 0.7 SBU testsuite included
Required disk space: 41 MB testsuite included
 
Unpack source :
 
cd /sources
tar -zxvf e2fsprogs-1.41.8.tar.gz
cd e2fsprogs-1.41.8

 

Make sure the version date is in a format compatible with configure:
 
sed -i -e "s/July/Jul/" version.h
 
The E2fsprogs documentation recommends that the package be built in a subdirectory of the source tree:
 
mkdir -v build
cd build
 
Build and install :
 
time {
../configure --prefix=/usr --with-root-prefix="" \
--enable-elf-shlibs --disable-libblkid --disable-libuuid \
--disable-uuidd --disable-fsck &&
make &&
make install &&
make install-libs ;
}
real    5m3.798s
user    1m18.573s
sys     1m20.365s
 
The meaning of the configure options:
--with-root-prefix=""
Certain programs (such as the e2fsck program) are considered essential programs. When, for example, /usr is not mounted, these programs still need to be available. They belong in directories like /lib and /sbin. If this option is not passed to E2fsprogs' configure, the programs are installed into the /usr directory.
--enable-elf-shlibs
This creates the shared libraries which some programs in this package use.
--disable-*
This prevents E2fsprogs from building and installing the libuuid and libblkid libraries, the uuidd daemon, and the fsck wrapper, as Util-Linux-NG installed all of them earlier.
 
To test the results, issue: (256 MB of memory required)
 
time make check
102 tests succeeded     0 tests failed
real    2m0.069s
user    0m15.409s
sys     0m25.694s
Make the installed static libraries writable so debugging symbols can be removed later:
 
chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
 
This package installs a gzipped .info file but doesn't update the system-wide dir file. Unzip this file and then update the system dir file using the following commands.
 
gunzip -v /usr/share/info/libext2fs.info.gz
install-info --dir-file=/usr/share/info/dir \
/usr/share/info/libext2fs.info
 
If desired, create and install some additional documentation by issuing the following commands:
 
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
 
 
Coreutils-7.4
The Coreutils package contains utilities for showing and setting the basic system characteristics.
 
Approximate build time: 3.2 SBU testsuite included
Required disk space: 98 MB testsuite included
 
Unpack source :
 
cd /sources
rm -rf coreutils-7.4
tar -zxvf coreutils-7.4.tar.gz
cd coreutils-7.4
 
A known issue with the uname program from this package is that the -p switch always returns unknown. The following patch fixes this behavior for Intel architectures:
 
case `uname -m` in
i?86 | x86_64) patch -Np1 -i ../coreutils-7.4-uname-1.patch ;;
esac
 
POSIX requires that programs from Coreutils recognize character boundaries correctly even in multibyte locales. The following patch fixes this non-compliance and other internationalization-related bugs:
 
patch -Np1 -i ../coreutils-7.4-i18n-1.patch
 
Build and install :
 
time {
./configure --prefix=/usr \
--enable-no-install-program=kill,uptime &&
make &&
make install ;
}
real    10m25.893s
user    2m50.823s
sys     2m49.791s
 
The meaning of the configure options:
--enable-no-install-program=kill,uptime
The purpose of this switch is to prevent Coreutils from installing binaries that will be installed by other packages later.
 
Now the test suite is ready to be run. First, run the tests that are meant to be run as user root:
 
time make NON_ROOT_USERNAME=nobody check-root
======================
All 12 tests passed
(7 tests were not run)
======================
real    0m29.719s
user    0m5.344s
sys     0m6.768s
  
We're going to run the remainder of the tests as the nobody user. Certain tests, however, require that the user be a member of more than one group. So that these tests are not skipped we'll add a temporary group and make the user nobody a part of it:
 
echo "dummy:x:1000:nobody" >> /etc/group
Fix some of the permissions so that the non-root user can compile and run the tests:
 
chown -Rv nobody config.log {gnulib-tests,lib,src}/.deps
Now run the tests:
 
time su-tools nobody -s /bin/bash -c "make RUN_EXPENSIVE_TESTS=yes check" || true

======================

All 124 tests passed
(4 tests were not run)
======================
real    17m36.372s
user    2m54.499s
sys     5m54.374s

 

Remove the temporary group:
 
sed -i '/dummy/d' /etc/group
 
 
Move programs to the locations specified by the FHS:
 
mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin
mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin
mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin
mv -v /usr/bin/chroot /usr/sbin
Some of the scripts in the LFS-Bootscripts package depend on head, sleep, and nice. As /usr may not be available during the early stages of booting, those binaries need to be on the root partition:
 
mv -v /usr/bin/{head,sleep,nice} /bin
 
 
Iana-Etc-2.30
The Iana-Etc package provides data for network services and protocols.
 
Approximate build time: less than 0.1 SBU
Required disk space: 2.3 MB
 
Unpack source :
 
cd /sources
tar -jxvf iana-etc-2.30.tar.bz2
cd iana-etc-2.30
 
Build and install :
 
time {
make &&
make install ;
}
 
 
M4-1.4.13
The M4 package contains a macro processor.
 
Approximate build time: 0.4 SBU testsuite included
Required disk space: 14.2 MB
 
Unpack source :
 
cd /sources
rm -rf m4-1.4.13
tar -jxvf m4-1.4.13.tar.bz2
cd m4-1.4.13
Build and install :
 
time {
./configure --prefix=/usr &&
make &&
make install ;
}
real    2m43.481s
user    0m35.602s
sys     0m50.059s
 
 
To test the results, issue:
 
time make check
 
 
====================
All 76 tests passed
(1 test was not run)
====================
real    1m50.616s
user    0m27.582s
sys     0m29.554s
 
 
Bison-2.4.1
The Bison package contains a parser generator.
 
Approximate build time: 1.1 SBU
Required disk space: 19.2 MB
 
Unpack source :
 
cd /sources
tar -jxvf bison-2.4.1.tar.bz2
cd bison-2.4.1
 
Build and install :
 
time {
./configure --prefix=/usr &&
echo '#define YYENABLE_NLS 1' >> config.h &&
make &&
make install ;
}
 
real    2m34.087s
user    0m38.262s
sys     0m43.971s
 
 
The configure system causes Bison to be built without support for internationalization of error messages if a bison program is not already in $PATH. The above echo command is used to fix that.
 
To test the results (about 0.5 SBU), issue:
 
time make check
 
 
 
224 tests were successful.
16 tests were skipped.
real    6m58.247s
user    2m6.316s
sys     2m6.360s
 
 
Procps-3.2.8
The Procps package contains programs for monitoring processes.
 
Approximate build time: 0.1 SBU
Required disk space: 2.3 MB
 
Unpack source :
 
cd /sources
tar -zxvf procps-3.2.8.tar.gz
cd procps-3.2.8
Apply a patch to fix a unicode related issue in the watch program:
 
patch -Np1 -i ../procps-3.2.8-watch_unicode-1.patch
 
Build and install:
 
time {
make &&
make install ;
}
 
real    0m41.846s
user    0m14.301s
sys     0m6.908s
 
 
 
Grep-2.5.4
The Grep package contains programs for searching through files.
 
Approximate build time: 0.1 SBU
Required disk space: 7.3 MB
 
Unpack source :
 
cd /sources
rm -rf grep-2.5.4
tar -jxvf  grep-2.5.4.tar.bz2
cd grep-2.5.4
The current Grep package has many bugs, especially in the support of multibyte locales. The following consolidated patch from Debian fixes some of them, improves the number of individual tests which are passed, and much improves the speed in UTF-8 locales:
 
patch -Np1 -i ../grep-2.5.4-debian_fixes-1.patch
 
Build and install:
 
time {
./configure --prefix=/usr \
--bindir=/bin \
--without-included-regex &&
make &&
make install ;
}
 
real    1m39.310s
user    0m21.753s
sys     0m29.946s
 
 
The meaning of the configure switch:
--without-included-regex
The configure check for Glibc's regex library is broken when building against Glibc-2.10.1. This switch forces the use of Glibc's regex library.
To test the results, issue:
 
time make check || true
 
=================================
1 of 14 tests failed
Please report to bug-grep@gnu.org
=================================
real    0m18.520s
user    0m3.324s
sys     0m7.940s
 
 
There are known test failures in the fmbtest.sh tests. The "|| true" construct is used to avoid automated build scripts failing due to the test failures. A good run will show 1 failure from 14 tests, although the test failure will detail 2 failed sub-tests.
 
 
Readline-6.0
The Readline package is a set of libraries that offers command-line editing and history capabilities.
 
Approximate build time: 0.2 SBU
Required disk space: 13.8 MB
 
Unpack source :
 
cd /sources
tar -zxvf readline-6.0.tar.gz
cd readline-6.0
 
Reinstalling Readline will cause the old libraries to be moved to <libraryname>.old. While this is normally not a problem, in some cases it can trigger a linking bug in ldconfig. This can be avoided by issuing the following two seds:
 
sed -i '/MV.*old/d' Makefile.in
sed -i '/{OLDSUFF}/c:' support/shlib-install
 
Apply fixes for several bugs discovered since the initial release of Readline-6.0:
 
patch -Np1 -i ../readline-6.0-fixes-1.patch
 
Build and install :
 
time {
./configure --prefix=/usr --libdir=/lib &&
make SHLIB_LIBS=-lncurses &&
make install ;
}
 
real    1m42.210s
user    0m25.266s
sys     0m28.462s
 
The meaning of the make option:
SHLIB_LIBS=-lncurses
This option forces Readline to link against the libncurses (really, libncursesw) library.
Now move the static libraries to a more appropriate location:
mv -v /lib/lib{readline,history}.a /usr/lib
 
Next, remove the .so files in /lib and relink them into /usr/lib:
rm -v /lib/lib{readline,history}.so
ln -sfv ../../lib/libreadline.so.6 /usr/lib/libreadline.so
ln -sfv ../../lib/libhistory.so.6 /usr/lib/libhistory.so
 
If desired, install the documentation:
mkdir -v /usr/share/doc/readline-6.0
install -v -m644 doc/*.{ps,pdf,html,dvi} \
/usr/share/doc/readline-6.0
 
 
Bash-4.0
The Bash package contains the Bourne-Again SHell.
 
Approximate build time: 1.4 SBU
Required disk space: 35 MB
 
Unpack source :
 
cd /sources
rm -rf bash-4.0
tar -zxvf bash-4.0.tar.gz
cd bash-4.0
Apply fixes for several bugs discovered since the initial release of Bash-4.0:
 
patch -Np1 -i ../bash-4.0-fixes-3.patch
 
Build and install :
 
time {
./configure --prefix=/usr --bindir=/bin \
--htmldir=/usr/share/doc/bash-4.0 --without-bash-malloc \
--with-installed-readline &&
make &&
make install ;
}
 
real    5m13.068s
user    1m18.149s
sys     1m27.457s
 
 
The meaning of the configure options:
--htmldir
This option designates the directory into which HTML formatted documentation will be installed.
--with-installed-readline
This option tells Bash to use the readline library that is already installed on the system rather than using its own readline version.
 
To prepare the tests, ensure that the locale setting from our environment will be used and that the nobody user can read the standard input device and write to the sources tree:
 
sed -i 's/LANG/LC_ALL/' tests/intl.tests
sed -i 's@tests@& </dev/tty@' tests/run-test
chown -Rv nobody ./
 
Now, run the tests as the nobody user:
 
time su-tools nobody -s /bin/bash -c "make tests"
 
real    4m4.913s
user    0m20.165s
sys     0m48.511s
 
Run the newly compiled bash program (replacing the one that is currently being executed):
 
exec /bin/bash --login +h
 
 
Libtool-2.2.6a
The Libtool package contains the GNU generic library support script. It wraps the complexity of using shared libraries in a consistent, portable interface.

 
Approximate build time: 3.7 SBU testsuite included
Required disk space: 35 MB testsuite included
 
Unpack source :
 
cd /sources
tar -zxvf libtool-2.2.6a.tar.gz
cd libtool-2.2.6
Build and install :
 
time {
./configure --prefix=/usr &&
make &&
make install ;
}
 
real    1m32.271s
user    0m17.829s
sys     0m30.670s
 
 
To test the results (about 3.0 SBU), issue:
 
time make check
 
 
69 tests behaved as expected.
5 tests were skipped.
real    41m54.283s
user    11m5.410s
sys     18m45.186s
 
 
GDBM-1.8.3
The GDBM package contains the GNU Database Manager. This is a disk file format database which stores key/datapairs in single files. The actual data of any record being stored is indexed by a unique key, which can be retrieved in less time than if it was stored in a text file.
 
Approximate build time: 0.1 SBU
Required disk space: 2.7 MB
 
Unpack source :
 
cd /sources
tar -zxvf gdbm-1.8.3.tar.gz
cd gdbm-1.8.3
  
Build and install :
 
time {
./configure --prefix=/usr &&
make &&
make install &&
make install-compat ;
}
 
real    1m18.780s
user    0m16.637s
sys     0m26.502s
 
 
Inetutils-1.6
The Inetutils package contains programs for basic networking.
 
Approximate build time: 0.4 SBU
Required disk space: 17 MB
 
Unpack source :
 
cd /sources
tar -zxvf inetutils-1.6.tar.gz
cd inetutils-1.6
Not all programs that come with Inetutils will be installed. However, the Inetutils build system will insist on installing all the man pages anyway. The following patch will correct this situation:
 
patch -Np1 -i ../inetutils-1.6-no_server_man_pages-1.patch
 
Build and install :
 
time {
./configure --prefix=/usr --libexecdir=/usr/sbin \
--localstatedir=/var --disable-ifconfig \
--disable-logger --disable-syslogd --disable-whois \
--disable-servers &&
make &&
make install ;
}
 
real    4m15.119s
user    1m18.289s
sys     1m50.119s
 
 
The meaning of the configure options:
--disable-ifconfig
This option prevents Inetutils from installing the ifconfig program, which can be used to configure network interfaces. LFS uses ip from IPRoute2 to perform this task.
--disable-logger
This option prevents Inetutils from installing the logger program, which is used by scripts to pass messages to the System Log Daemon. Do not install it because Util-linux installs a better version later.
--disable-syslogd
This option prevents Inetutils from installing the System Log Daemon, which is installed with the Sysklogd package.
--disable-whois
This option disables the building of the Inetutils whois client, which is out of date. Instructions for a better whois client are in the BLFS book.
--disable-servers
This disables the installation of the various network servers included as part of the Inetutils package. These servers are deemed not appropriate in a basic LFS system. Some are insecure by nature and are only considered safe on trusted networks. More information can be found at http://www.linuxfromscratch.org/blfs/view/svn/basicnet/inetutils.html. Note that better replacements are available for many of these servers.
 
Move the ping program to its FHS-compliant place:
 
mv -v /usr/bin/ping /bin
 
 
Perl-5.10.0
The Perl package contains the Practical Extraction and Report Language.
 
Approximate build time: 5.5 SBU
Required disk space: 171 MB testsuite included
 
Unpack source :
 
cd /sources
rm -rf perl-5.10.0
tar -zxvf perl-5.10.0.tar.gz
cd perl-5.10.0
 
First create a basic /etc/hosts file to be referenced in one of Perl's configuration files as well as the optional testsuite:
 
echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
 
The following patch fixes known vulnerabilities and other issues identified by the developers:
 
patch -Np1 -i ../perl-5.10.0-consolidated-1.patch
 
This version of Perl now builds the Compress::Raw::Zlib module. By default Perl will use an internal copy of the Zlib source for the build. Issue the following command so that Perl will use the Zlib library installed on the system:
 
sed -i -e "s|BUILD_ZLIB\s*= True|BUILD_ZLIB = False|" \
-e "s|INCLUDE\s*= ./zlib-src|INCLUDE = /usr/include|" \
-e "s|LIB\s*= ./zlib-src|LIB = /usr/lib|" \
ext/Compress/Raw/Zlib/config.in
 
Build and install :
 
time {
sh Configure -des -Dprefix=/usr \
-Dvendorprefix=/usr \
-Dman1dir=/usr/share/man/man1 \
-Dman3dir=/usr/share/man/man3 \
-Dpager="/usr/bin/less -isR" &&
make &&
make install ;
}
 
real    10m17.288s
user    4m21.716s
sys     2m42.446s
 
 
The meaning of the configure options:
-Dvendorprefix=/usr
This ensures perl knows how to tell packages where they should install their perl modules.
-Dpager="/usr/bin/less -isR"
This corrects an error in the way that perldoc invokes the less program.
-Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3
Since Groff is not installed yet, Configure thinks that we do not want man pages for Perl. Issuing these parameters overrides this decision.
To test the results (approximately 2.5 SBU), issue:
 
time make test
 
 
All tests successful.
real    13m13.290s
user    3m27.493s
sys     1m54.055s
 
 
Autoconf-2.64
The Autoconf package contains programs for producing shell scripts that can automatically configure source code.
 
Approximate build time: 4.8 SBU testsuite included
Required disk space: 12.4 MB testsuite included
 
Unpack source :
 
cd /sources
tar -jxvf autoconf-2.64.tar.bz2
cd autoconf-2.64
Build and install :
 
time {
./configure --prefix=/usr &&
make &&
make install ;
}
 
real    0m19.354s
user    0m2.712s
sys     0m4.980s
 
 
To test the results, issue (about 4.7SBU, can be re-tested after Automake has been installed):
 
time make check
404 tests were successful.
22 tests were skipped.
real    40m4.994s
user    9m40.568s
sys     14m49.596s
 
 
 
Automake-1.11
The Automake package contains programs for generating Makefiles for use with Autoconf.
 
Approximate build time: 18.3 SBU testsuite included
Required disk space: 28.8 MB testsuite included
 
Unpack source :
 
cd /sources
tar -jxvf automake-1.11.tar.bz2
cd automake-1.11
Build and install :
 
time {
./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.11 &&
make &&
make install ;
}
 
real    0m17.142s
user    0m1.732s
sys     0m3.660s
 
 
To test the results, issue (10 SBUs):
 
time make check
 
 
=======================================================
All 667 tests behaved as expected (4 expected failures)
(62 tests were not run)
=======================================================
real    128m46.286s
user    25m37.144s
sys     35m48.878s
 
Bzip2-1.0.5
The Bzip2 package contains programs for compressing and decompressing files. Compressing text files with bzip2 yields a much better compression percentage than with the traditional gzip.
Approximate build time: less than 0.1 SBU
Required disk space: 6.4 MB
 
Unpack source :
 
cd /sources
rm -rf bzip2-1.0.5
tar -zxvf bzip2-1.0.5.tar.gz
cd bzip2-1.0.5
Apply a patch to install the documentation for this package:
 
patch -Np1 -i ../bzip2-1.0.5-install_docs-1.patch
 
The following command ensures installation of symbolic links are relative:
 
sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
 
Build and install:
 
time {
make -f Makefile-libbz2_so &&
make clean &&
make &&
make PREFIX=/usr install ;
}
 
real    0m22.041s
user    0m0.508s
sys     0m0.172s
  
 
The meaning of the make parameter:
-f Makefile-libbz2_so
This will cause Bzip2 to be built using a different Makefile file, in this case the Makefile-libbz2_so file, which creates a dynamic libbz2.so library and links the Bzip2 utilities against it.
 
Install the shared bzip2 binary into the /bin directory, make some necessary symbolic links, and clean up:
 
cp -v bzip2-shared /bin/bzip2
cp -av libbz2.so* /lib
ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so
rm -v /usr/bin/{bunzip2,bzcat,bzip2}
ln -sv bzip2 /bin/bunzip2
ln -sv bzip2 /bin/bzcat
 
 
 
Diffutils-2.8.1
The Diffutils package contains programs that show the differences between files or directories.
 
Approximate build time: 0.1 SBU
Required disk space: 6.3 MB
 
Unpack source :
 
cd /sources
rm -rf diffutils-2.8.1
tar -zxvf diffutils-2.8.1.tar.gz
cd diffutils-2.8.1
 
POSIX requires the diff command to treat whitespace characters according to the current locale. The following patch fixes the non-compliance issue:
 
patch -Np1 -i ../diffutils-2.8.1-i18n-1.patch
 
The above patch will cause the Diffutils build system to attempt to rebuild the diff.1 man page using the unavailable program help2man. The result is an unreadable man page for diff. We can avoid this by updating the timestamp on the file man/diff.1:
 
touch man/diff.1
 
Build and install :
 
time {
./configure --prefix=/usr &&
make &&
make install ;
}
 
 
real    1m3.027s
user    0m1.012s
sys     0m1.344s
 
 
File-5.03
The File package contains a utility for determining the type of a given file or files.
 
Approximate build time: 0.2 SBU
Required disk space: 9.5 MB
 
Unpack source :
 
cd /sources
tar -zxvf file-5.03.tar.gz
cd file-5.03
 
Build and install :
 
time {
./configure --prefix=/usr &&
make &&
make install ;
}
 
real    1m23.536s
user    0m1.236s
sys     0m1.840s
 
 
To test the results, issue:
 
time make check
 
real    0m1.606s
user    0m0.020s
sys     0m0.044s
 
 
Gawk-3.1.7
The Gawk package contains programs for manipulating text files.
 
Approximate build time: 0.2 SBU
Required disk space: 19 MB
 
Unpack source :
 
cd /sources
rm -rf gawk-3.1.7
tar -jxvf gawk-3.1.7.tar.bz2
cd gawk-3.1.7
 
Build and install :
 
time {
./configure --prefix=/usr --libexecdir=/usr/lib &&
make &&
make install ;
}
 
real    2m3.533s
user    0m2.088s
sys     0m2.656s
 
 
If desired, install the documentation:
 
mkdir -v /usr/share/doc/gawk-3.1.7
cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} \
/usr/share/doc/gawk-3.1.7
 
To test the results, issue:
 
time make check
 
ALL TESTS PASSED
real 0m17.625s
user 0m0.240s
sys 0m0.408s
 
 
Findutils-4.4.2
The Findutils package contains programs to find files. These programs are provided to recursively search through a directory tree and to create, maintain, and search a database (often faster than the recursive find, but unreliable if the database has not been recently updated).
 
Approximate build time: 0.5 SBU
Required disk space: 22 MB
 
Unpack source :
 
cd /sources
rm -rf findutils-4.4.2
tar -zxvf findutils-4.4.2.tar.gz
cd findutils-4.4.2
 
Build and install :
 
time {
./configure --prefix=/usr --libexecdir=/usr/lib/findutils \
--localstatedir=/var/lib/locate &&
make &&
make install ;
}
 
real    2m17.682s
user    0m2.084s
sys     0m3.120s
 
 
The meaning of the configure options:
--localstatedir
This option changes the location of the locate database to be in /var/lib/locate, which is FHS-compliant.
 
Some of the scripts in the LFS-Bootscripts package depend on find. As /usr may not be available during the early stages of booting, this program needs to be on the root partition. The updatedb script also needs to be modified to correct an explicit path:
 
mv -v /usr/bin/find /bin
sed -i 's/find:=${BINDIR}/find:=\/bin/' /usr/bin/updatedb

 

To test the results, issue:
 
time make check
 
 
real    1m31.920s
user    0m1.180s
sys     0m1.808s
 
 
Flex-2.5.35
The Flex package contains a utility for generating programs that recognize patterns in text.
Approximate build time: 0.7 SBU testsuite included
Required disk space: 28 MB testsuite included
Unpack source :
 
cd /sources
tar -jxvf flex-2.5.35.tar.bz2
cd flex-2.5.35
Apply a patch that fixes a bug in the C++ scanner generator, that causes scanner compilation to fail when using GCC-4.4.1:
 
patch -Np1 -i ../flex-2.5.35-gcc44-1.patch
Build and install :
 
time {
./configure --prefix=/usr &&
make &&
make install ;
}
 
real    1m8.048s
user    0m1.024s
sys     0m1.564s
 
There are some packages that expect to find the lex library in /usr/lib. Create a symlink to account for this:
 
ln -sv libfl.a /usr/lib/libl.a

A few programs do not know about flex yet and try to run its predecessor, lex. To support those programs, create a wrapper script named lex that calls flex in lex emulation mode:

 
cat > /usr/bin/lex << "EOF"
#!/bin/sh
# Begin /usr/bin/lex
exec /usr/bin/flex -l "$@"
# End /usr/bin/lex
EOF
chmod -v 755 /usr/bin/lex
If desired, install the flex.pdf documentation file:
 
mkdir -v /usr/share/doc/flex-2.5.35
cp -v doc/flex.pdf \
/usr/share/doc/flex-2.5.35
To test the results (about 0.5 SBU), issue:
 
time make check
 
 
Tests succeeded: 46
Tests FAILED: 0
real    1m50.287s
user    0m3.168s
sys     0m1.276s
 
 
Gettext-0.17
The Gettext package contains utilities for internationalization and localization. These allow programs to be compiled with NLS (Native Language Support), enabling them to output messages in the user's native language.
 
Approximate build time: 5.8 SBU
Required disk space: 125 MB
 
Unpack source :
 
cd /sources
rm -rf gettext-0.17
tar -zxvf gettext-0.17.tar.gz
cd gettext-0.17
 
Apply a patch that fixes file permissions and ownership and an internal bug:
 
patch -Np1 -i ../gettext-0.17-upstream_fixes-2.patch
 
Build and install :
 
time {
./configure --prefix=/usr \
--docdir=/usr/share/doc/gettext-0.17 &&
make &&
make install ;
}
 
real    20m8.514s
user    6m59.698s
sys     9m18.575s
 
 
To test the results (this takes a long time, around 3 SBUs), issue:
 
time make check
 
===================
All 30 tests passed
===================
real    44m35.887s
user    11m54.989s
sys     24m59.350s
 
 
Groff-1.20.1
The Groff package contains programs for processing and formatting text.
 
Approximate build time: 0.7 SBU
Required disk space: 66 MB
 
Unpack source :
 
cd /sources
tar -zxvf groff-1.20.1.tar.gz
cd groff-1.20.1
 
Build and install :
 
time {
PAGE=A4 ./configure --prefix=/usr &&
make &&
make docdir=/usr/share/doc/groff-1.20.1 install ;
}
 
real    4m2.153s
user    1m50.967s
sys     1m20.973s
  
 
Groff expects the environment variable PAGE to contain the default paper size. For users in the United States, PAGE=letter is appropriate. Elsewhere, PAGE=A4 may be more suitable. While the default paper size is configured during compilation, it can be overridden later by echoing either “A4” or “letter” to the /etc/papersize file.
 
Some documentation programs, such as xman, will not work properly without the following symlinks:
 
ln -sv eqn /usr/bin/geqn
ln -sv tbl /usr/bin/gtbl
 
 
Gzip-1.3.12
The Gzip package contains programs for compressing and decompressing files.
 
Approximate build time: less than 0.1 SBU
Required disk space: 3.3 MB
 
Unpack source :
 
cd /sources
rm -rf gzip-1.3.12
tar -zxvf gzip-1.3.12.tar.gz
cd gzip-1.3.12
The version of the function “futimens” used by Gzip is incompatible with the version that current Glibc provides, so we'll rename the function:
 
sed -i 's/futimens/gl_&/' gzip.c lib/utimens.{c,h}
 
There is also a bug in the zdiff script that needs to be fixed:
 
sed -i 's/5 -)/5 - >\&3)/' zdiff.in
 
Build and install :
 
time {
./configure --prefix=/usr --bindir=/bin &&
make &&
make install ;
}
 
real    0m47.236s
user    0m13.353s
sys     0m21.865s
 
 
Move some programs that do not need to be on the root filesystem:
 
mv -v /bin/{gzexe,uncompress,zcmp,zdiff,zegrep} /usr/bin
mv -v /bin/{zfgrep,zforce,zgrep,zless,zmore,znew} /usr/bin
 
To test the results, issue:
 
time make check
 
Test succeeded.
real    0m1.964s
user    0m0.428s
sys     0m0.780s
 
 
IPRoute2-2.6.29-1
The IPRoute2 package contains programs for basic and advanced IPV4-based networking.
 
Approximate build time: 0.2 SBU
Required disk space: 5.7 MB
 
Unpack source :
 
cd /sources
tar -jxvf iproute2-2.6.29-1.tar.bz2
cd iproute2-2.6.29-1
 
The arpd binary included in this package is dependent on Berkeley DB. Because arpd is not a very common requirement on a base Linux system, remove the dependency on Berkeley DB by applying the sed command below. If the arpd binary is needed, instructions for compiling Berkeley DB can be found in the BLFS Book at http://www.linuxfromscratch.org/blfs/view/svn/server/databases.html#db.
 
sed -i '/^TARGETS/s@arpd@@g' misc/Makefile
 
Build and install :
 
time {
make DESTDIR=&&
make DESTDIR= SBINDIR=/sbin MANDIR=/usr/share/man \
DOCDIR=/usr/share/doc/iproute2-2.6.29-1 install ;
}
 
real    0m52.000s
user    0m24.210s
sys     0m16.985s
 
 
The meaning of the make option:
DESTDIR=
This ensures that the IPRoute2 binaries will install into the correct directory. By default, DESTDIR is set to /usr.
 
This package comes with a testsuite, but due to assumptions it makes, it is not possible to reliably run these tests within the chroot environment. If you wish to run these tests after booting into your new LFS system, ensure you select /proc/config.gz CONFIG_IKCONFIG_PROC ("General setup" -> "Enable access to .config through /proc/config.gz") support into your kernel then run 'make alltests' from the testsuite/ subdirectory.
 
 
Kbd-1.15
The Kbd package contains key-table files and keyboard utilities.
 
Approximate build time: less than 0.1 SBU
Required disk space: 16.0 MB
 
Unpack sources :
 
cd /sources
tar -zxvf kbd-1.15.tar.gz
cd kbd-1.15
 
The behaviour of the Backspace and Delete keys is not consistent across the keymaps in the Kbd package. The following patch fixes this issue for i386 keymaps:
 
patch -Np1 -i ../kbd-1.15-backspace-1.patch
 
After patching, the Backspace key generates the character with code 127, and the Delete key generates a well-known escape sequence.
 
Build and install :
 
time {
./configure --prefix=/usr --datadir=/lib/kbd &&
make &&
make install ;
}
 
real    1m2.212s
user    0m20.297s
sys     0m27.770s
 
 
The meaning of the configure options:
--datadir=/lib/kbd
This option puts keyboard layout data in a directory that will always be on the root partition instead of the default /usr/share/kbd.
Some of the scripts in the LFS-Bootscripts package depend on kbd_mode, loadkeys, openvt, and setfont. As /usr may not be available during the early stages of booting, those binaries need to be on the root partition:
 
mv -v /usr/bin/{kbd_mode,loadkeys,openvt,setfont} /bin
If desired, install the documentation:
 
mkdir -v /usr/share/doc/kbd-1.15
cp -R -v doc/* \
/usr/share/doc/kbd-1.15
 
 
Less-429
The Less package contains a text file viewer.
 
Approximate build time: less than 0.1 SBU
Required disk space: 2.9 MB
 
 
Unpack source :
 
cd /sources
tar -zxvf less-429.tar.gz
cd less-429
 

Build and install :

 
time {
./configure --prefix=/usr --sysconfdir=/etc &&
make &&
make install ;
}
 
real    0m45.612s
user    0m16.633s
sys     0m20.917s
 
 
The meaning of the configure options:
--sysconfdir=/etc
This option tells the programs created by the package to look in /etc for the configuration files.
 
Make-3.81
The Make package contains a program for compiling packages.
 
Approximate build time: 0.3 SBU
Required disk space: 9.7 MB
 
Unpack source :
 
cd /sources
rm -rf make-3.81
tar -jxvf make-3.81.tar.bz2
cd make-3.81
Build and install :
 
time {
./configure --prefix=/usr &&
make &&
make install ;
}
 
real    1m13.213s
user    0m24.206s
sys     0m35.294s
 
 
To test the results, issue:
 
time make check
351 Tests in 96 Categories Complete ... No Failures :-)
real    0m45.720s
user    0m3.428s
sys     0m7.368s
 
 
Man-DB-2.5.5
The Man-DB package contains programs for finding and viewing man pages.
 
Approximate build time: 0.4 SBU
Required disk space: 22 MB
 
Unpack source :
 
cd /sources
tar -zxvf man-db-2.5.5.tar.gz
cd man-db-2.5.5
 
Apply a patch to fix a problem with the testsuite, which doesn't expect col to be UTF-8 aware, which Util-Linux-NG's version is:
 
patch -Np1 -i ../man-db-2.5.5-fix_testsuite-1.patch
 
Build and install :
time {
./configure --prefix=/usr --libexecdir=/usr/lib \
--sysconfdir=/etc --disable-setuid \
--with-browser=/usr/bin/lynx --with-vgrind=/usr/bin/vgrind \
--with-grap=/usr/bin/grap &&
make &&
make install ;
}
 
real    3m13.896s
user    1m4.004s
sys     1m29.774s
 
 
The meaning of the configure options:
--disable-setuid
This disables making the man program setuid to user man.
--with-...
These three parameters are used to set some default programs. lynx is a text-based web browser (see BLFS for installation instructions), vgrind converts program sources to Groff input, and grap is useful for typesetting graphs in Groff documents. The vgrind and grap programs are not normally needed for viewing manual pages.
They are not part of LFS or BLFS, but you should be able to install them yourself after finishing LFS if you wish to do so.
 
To test the results, issue:
time make check
 
All 11 tests passed
real    0m19.001s
user    0m6.564s
sys     0m8.997s
 
 
Module-Init-Tools-3.10
The Module-Init-Tools package contains programs for handling kernel modules in Linux kernels greater than or equal to version 2.5.47.
 
Approximate build time: 0.1 SBU
Required disk space: 8.7 MB
 
Unpack source :
 
cd /sources
tar -jxvf module-init-tools-3.10.tar.bz2
cd module-init-tools-3.10
 
The testsuite of this package is geared towards the needs of its Maintainer. The command make check builds a specially wrapped version of modprobe which is useless for normal operation. To run this (about 0.2 SBU), issue the following commands :
 
time {
./configure &&
make check &&
./tests/runtests &&
make clean ;
}
 
real    1m7.664s
user    0m21.937s
sys     0m33.162s
 
 
Build and install :
 
time {
./configure --prefix=/ --enable-zlib --mandir=/usr/share/man &&
make &&
make INSTALL=install install ;
}
 
The meaning of the make parameter:
INSTALL=install
Normally, make install will not install the binaries if they already exist. This option overrides that behavior by calling install instead of using the default wrapper script.
real    0m21.211s
user    0m8.413s
sys     0m8.625s
 
 
Patch-2.5.9
The Patch package contains a program for modifying or creating files by applying a “patch” file typically created by the diff program.
 
Approximate build time: less than 0.1 SBU
Required disk space: 1.9 MB
 
Unpack source :
 
cd /sources
rm -rf patch-2.5.9
tar -zxvf patch-2.5.9.tar.gz
cd patch-2.5.9
Apply a patch that fixes a bug whereby patch fails to apply patches whose lines contain trailing carriage return characters:
 
patch -Np1 -i ../patch-2.5.9-fixes-1.patch
Build and install :
 
time {
./configure --prefix=/usr &&
make &&
make install ;
}
 
real    0m43.853s
user    0m15.677s
sys     0m21.929s
  
 
Psmisc-22.8
The Psmisc package contains programs for displaying information about running processes.
 
Approximate build time: less than 0.1 SBU
Required disk space: 2.5 MB
 
Unpack source :
 
cd /sources
tar -zxvf psmisc-22.8.tar.gz
cd psmisc-22.8
Build and install:
 
time {
./configure --prefix=/usr --exec-prefix="" &&
make &&
make install ;
}
 
real    0m44.231s
user    0m13.317s
sys     0m22.065s
 
 
The meaning of the configure options:
--exec-prefix=""
This ensures that the Psmisc binaries will install into /bin instead of /usr/bin. This is the correct location according to the FHS, because some of the Psmisc binaries are used by the LFS-Bootscripts package.
 
There is no reason for the pstree and pstree.x11 programs to reside in /bin. Therefore, move them to /usr/bin:
 
mv -v /bin/pstree* /usr/bin
  
Shadow-4.1.4.2
The Shadow package contains programs for handling passwords in a secure way.
 
Approximate build time: 0.3 SBU
Required disk space: 30 MB
 
Unpack source :
 
cd /sources
tar -jxvf shadow-4.1.4.2.tar.bz2
cd shadow-4.1.4.2
 
Disable the installation of the groups program and its man pages, as Coreutils provides a better version:
 
sed -i 's/groups$(EXEEXT) //' src/Makefile.in
find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
 
Disable the installation of Chinese and Korean manual pages, since Man-DB cannot format them properly:
 
sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile.in
 
Instead of using the default crypt method, use the more secure MD5 method of password encryption, which also allows passwords longer than 8 characters. It is also necessary to change the obsolete /var/spool/mail location for user mailboxes that Shadow uses by default to the /var/mail location used currently:
 
sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD MD5@' \
-e 's@/var/spool/mail@/var/mail@' etc/login.defs
Build and install:
 
time {
./configure --sysconfdir=/etc &&
make &&
make install ;
}
 
real    3m26.660s
user    1m3.444s
sys     1m38.814s
 
 
Move a misplaced program to its proper location:
 
mv -v /usr/bin/passwd /bin
 
 
To enable shadowed passwords, run the following command:
 
pwconv
 
To enable shadowed group passwords, run:
 
grpconv
 
Default parameters in /etc/default/useradd
 
Choose a password for user root and set it by running:
 
passwd root
 
 
Sysklogd-1.5
The Sysklogd package contains programs for logging system messages, such as those given by the kernel when unusual things happen.
 
Approximate build time: less than 0.1 SBU
Required disk space: 0.5 MB
 
Unpack source :
 
cd /sources
tar -zxvf sysklogd-1.5.tar.gz
cd sysklogd-1.5
 
Build and install :
 
time {
make &&
make BINDIR=/sbin install ;
}
 
 
real    0m4.128s
user    0m1.948s
sys     0m1.068s
 
 
Create a new /etc/syslog.conf file by running the following:
 
cat > /etc/syslog.conf << "EOF"
# Begin /etc/syslog.conf
auth,authpriv.* -/var/log/auth.log
*.*;auth,authpriv.none -/var/log/sys.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
*.emerg *
# End /etc/syslog.conf
EOF
 
 
Sysvinit-2.86
The Sysvinit package contains programs for controlling the startup, running, and shutdown of the system.
 
Approximate build time: less than 0.1 SBU
Required disk space: 1 MB
 
Unpack source :
 
cd /sources
tar -zxvf sysvinit-2.86.tar.gz
cd sysvinit-2.86
 
When run-levels are changed (for example, when halting the system), init sends termination signals to those processes that init itself started and that should not be running in the new run-level. While doing this, init outputs messages like “Sending processes the TERM signal” which seem to imply that it is sending these signals to all currently running processes. To avoid this misinterpretation, modify the source so that these messages read like “Sending processes configured via /etc/inittab the TERM signal” instead:
 
sed -i 's@Sending processes@& configured via /etc/inittab@g' \
src/init.c
 
A maintained version of the wall program was installed earlier by Util-linux-ng. Suppress the installation of Sysvinit's version of this program and its man page:
 
sed -i -e 's/utmpdump wall/utmpdump/' \
-e 's/mountpoint.1 wall.1/mountpoint.1/' src/Makefile
 
Build and install :
 
time {
make -C src &&
make -C src install ;
}
 
 
real    0m9.137s
user    0m3.924s
sys     0m2.964s
 
 
Create a new file /etc/inittab by running the following:
 
cat > /etc/inittab << "EOF"
# Begin /etc/inittab
id:3:initdefault:
si::sysinit:/etc/rc.d/init.d/rc sysinit
l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
su:S016:once:/sbin/sulogin
1:2345:respawn:/sbin/agetty tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600
# End /etc/inittab
EOF
 
 
Tar-1.22
The Tar package contains an archiving program.
 
Approximate build time: 1.9 SBU testsuite included
Required disk space: 21.2 MB
 
Unpack source :
 
cd /sources
rm -rf tar-1.22
tar -jxvf tar-1.22.tar.bz2
cd tar-1.22
Build and install :
 
time {
./configure --prefix=/usr --bindir=/bin --libexecdir=/usr/sbin &&
make &&
make install ;
}
 
real    2m55.763s
user    0m59.928s
sys     1m22.941s
  
To test the results (about 1 SBU), issue:
 
time make check
 
69 tests were successful.
8 tests were skipped.
real    8m23.669s
user    1m21.229s
sys     2m12.532s
 
 
 
Texinfo-4.13a
The Texinfo package contains programs for reading, writing, and converting info pages.
 
Approximate build time: 0.3 SBU
Required disk space: 21 MB
 
Unpack source :
 
cd /sources
rm -rf texinfo-4.13
tar -zxvf texinfo-4.13a.tar.gz
cd texinfo-4.13
Build and install :
 
time {
./configure --prefix=/usr &&
make &&
make install ;
}
 
Optionally, install the components belonging in a TeX installation:
 
make TEXMF=/usr/share/texmf install-tex
 
real    2m3.716s
user    0m43.687s
sys     0m50.539s
 
 
The meaning of the make parameter:
TEXMF=/usr/share/texmf
The TEXMF makefile variable holds the location of the root of the TeX tree if, for example, a TeX package will be installed later.
 
The Info documentation system uses a plain text file to hold its list of menu entries. The file is located at /usr/share/info/dir. Unfortunately, due to occasional problems in the Makefiles of various packages, it can sometimes get out of sync with the info pages installed on the system. If the /usr/share/info/dir file ever needs to be recreated, the following optional commands will accomplish the task:
 
cd /usr/share/info
rm -v dir
for f in *
do install-info $f dir 2>/dev/null
done
 
To test the results, issue:
cd /sources/texinfo-4.13
time make check
 
real    0m11.277s
user    0m2.892s
sys     0m4.576s
 
 
Udev-145
The Udev package contains programs for dynamic creation of device nodes.
Approximate build time: 0.2 SBU
Required disk space: 11.6 MB
 
Unpack source :
 
cd /sources
tar -jxvf udev-145.tar.bz2
cd udev-145
The udev-config tarball contains LFS-specific files used to configure Udev. Unpack it into the Udev source directory:
 
tar -xvf ../udev-config-20090523.tar.bz2
 
Create some devices and directories that Udev cannot handle due to them being required very early in the boot process, or by Udev itself:
 
install -dv /lib/{firmware,udev/devices/{pts,shm}}
mknod -m0666 /lib/udev/devices/null c 1 3
mknod -m0600 /lib/udev/devices/kmsg c 1 11
ln -sv /proc/self/fd /lib/udev/devices/fd
ln -sv /proc/self/fd/0 /lib/udev/devices/stdin
ln -sv /proc/self/fd/1 /lib/udev/devices/stdout
ln -sv /proc/self/fd/2 /lib/udev/devices/stderr
ln -sv /proc/kcore /lib/udev/devices/core
 
Build and install :
 
time {
./configure --prefix=/usr \
--sysconfdir=/etc --sbindir=/sbin \
--with-rootlibdir=/lib --libexecdir=/lib/udev \
--docdir=/usr/share/doc/udev-145 \
--disable-extras &&
make &&
make install ;
}
 
real    1m32.483s
user    0m36.434s
sys     0m37.430s
 
The meaning of the new configure options
--with-rootlibdir=/lib

This controls where the libudev library is installed. The library needs to be in /lib because it's used by Udev at boot time, before /usr might be available, and the default --rootlibdir is /usr/lib.

--libexecdir=/lib/udev

This controls where Udev-internal rules and helper programs are installed.
--docdir=/usr/share/doc/udev-145
This option installs the Udev documentation in the proper location with the naming convention consistent with other packages.
--disable-extras
This option prevents Udev from installing helper programs and other extras which require more external libraries. These libraries are not part of the base LFS system. See the Udev README file for more information.
 
Udev default configuration does not cover all devices. First install two extra rules files from Udev to help support device-mapper and RAID setups:
install -m644 -v rules/packages/64-*.rules \
/lib/udev/rules.d/

Now install a file to create symlinks for certain hand-held devices:
install -m644 -v rules/packages/40-pilot-links.rules \
/lib/udev/rules.d/

Now install a file to handle ISDN devices:
install -m644 -v rules/packages/40-isdn.rules \
/lib/udev/rules.d/

Now install the LFS-specific custom rules files:
cd udev-config-20090523
make install

Install the documentation that explains the LFS-specific rules files:
make install-doc

Install the documentation that explains the commonly-used rules files provided by Udev:
make install-extra-doc
 
 
Vim-7.2
The Vim package contains a powerful text editor.
 
Approximate build time: 1.0 SBU
Required disk space: 79 MB
 
Unpack source :
cd /sources
tar -jxvf vim-7.2.tar.bz2
tar -zxvf vim-7.2-lang.tar.gz
cd vim72

Apply a patch which fixes various issues already found and fixed by the upstream maintainers since the inital release of Vim-7.2:
patch -Np1 -i ../vim-7.2-fixes-5.patch
 
Change the default location of the vimrc configuration file to /etc:
echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
 
Build and install :
time {
./configure --prefix=/usr --enable-multibyte &&
make &&
make install ;
}
 
real    3m42.582s
user    1m51.787s
sys     1m16.813s
 
The meaning of the configure options:
--enable-multibyte
This switch enables support for editing files in multibyte character encodings. This is needed if using a locale with a multibyte character set. This switch is also helpful to be able to edit text files initially created in Linux distributions like Fedora that use UTF-8 as a default character set.

Many users are used to using vi instead of vim. To allow execution of vim when users habitually enter vi, create a symlink for both the binary and the man page in the provided languages:
ln -sv vim /usr/bin/vi
for L in /usr/share/man/{,*/}man1/vim.1; do
ln -sv vim.1 $(dirname $L)/vi.1
done
 
By default, Vim's documentation is installed in /usr/share/vim. The following symlink allows the documentation to be accessed via /usr/share/doc/vim-7.2, making it consistent with the location of documentation for other packages:
ln -sv ../vim/vim72/doc /usr/share/doc/vim-7.2
 
Create a default vim configuration file by running the following:
cat > /etc/vimrc << "EOF"
" Begin /etc/vimrc
set nocompatible
set backspace=2
syntax on
if (&term == "iterm") || (&term == "putty")
set background=dark
endif
" End /etc/vimrc
EOF
 
 
Cleaning Up
From now on, when reentering the chroot environment after exiting, use the following modified chroot command:
(/tools are no longer needed)
chroot "$LFS" /usr/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login
 
Summary :
It toke me about 4 days to complete this page.
Started :2010-01-28
Finished : 2010-01-31
 
 

End

Comments