Installing basic system software

The installation of all the software is pretty straightforward and you'll think it's so much easier and shorter to give the generic installation instructions for each package and only explain how to install something if a certain package requires an alternate installation method. Although I agree with you on that, I, however, choose to give the full instructions for each and every package. This is simply to avoid any possible confusion and errors.

Entering the chroot'ed environment

It's time to enter our chroot'ed environment now in order to install the rest of the software we need.

Enter the following commands to setup the chroot'ed environment. From this point on there's no need to use the $LFS variable anymore, because everything you do will be restricted to the LFS partition (since / is actually /mnt/xxx but the shell doesn't know that).



root:~# cd $LFS/root
root:root# chroot $LFS bash --login

Now that we are inside a chroot'ed environment, we can continue to install all the basic system software. Make sure you execute all the following commands in this chapter from within the chroot'ed environment.

Installing Ed

Install Ed by running the following commands:



root:/usr/src/ed-0.2# ./configure --prefix=/usr
root:/usr/src/ed-0.2# make
root:/usr/src/ed-0.2# make install

Installing Patch

Install Patch by running the following commands:



root:patch-2.5.4# ./configure --prefix=/usr
root:patch-2.5.4# make
root:patch-2.5.4# make install

Installing GCC

After you unpacked the gcc-2.95.2 archive don't enter the newly created gcc-2.95.2 directory but stay in the /usr/src directory. Install GCC by running the following commands:



root:src# mkdir /usr/src/gcc-build
root:src# cd /usr/src/gcc-build
root:gcc-build# ../gcc-2.95.2/configure \
> --prefix=/usr --with-local-prefix=/usr \
> --with-gxx-include-dir=/usr/include/g++ \
> --enable-shared --enable-languages=c,c++
root:gcc-build# make bootstrap
root:gcc-build# make install

Installing Bison

Install Bison by running the following commands:



root:bison-1.28# ./configure --prefix=/usr --datadir=/usr/share/bison
root:bison-1.28# make
root:bison-1.28# make install

Installing Mawk

Install Mawk by running the following commands:



root:mawk-1.3.3# ./configure
root:mawk-1.3.3# make
root:mawk-1.3.3# make -e BINDIR=/usr/bin MANDIR=/usr/share/man/man1 install
root:mawk-1.3.3# cd /usr/bin
root:in# ln -s mawk awk

Installing Findutils

Install Findutils by running the following commands:



root:findutils-4.1# ./configure --prefix=/usr
root:findutils-4.1# make
root:findutils-4.1# make install

This package is known to cause compilation problem. If you're having trouble compiling this package as well, you can download a patch from http://www.linuxfromscratch.org/download/findutils-4.1.patch.gz

Install this patch by running the following command:



root:findutils-4.1# patch -Np1 -i ../findutils-4.1.patch.gz

Now recompile the package using the same commands as above.

Installing Termcap

Install Termcap by running the following commands:



root:termcap-1.3# ./configure --prefix=/usr
root:termcap-1.3# make
root:termcap-1.3# make install

Installing Ncurses

Install Ncurses by running the following commands:



root:ncurses-4.2# ./configure --prefix=/usr --with-shared
root:ncurses-4.2# make
root:ncurses-4.2# make install

Installing Less

Install Less by running the following commands:



root:less-340# ./configure --prefix=/usr
root:less-340# make
root:less-340# make install
root:less-340# mv /usr/bin/less /bin

Installing Perl

Install Perl by running the following commands:



root:perl-5.6.0# ./Configure
root:perl-5.6.0# make
root:perl-5.6.0# make test
root:perl-5.6.0# make install

Note that you have to change the installation path to /usr yourself. The Perl installation defaults to the /usr/local/subdir

Also note that a few tests during the make test phase will fail because we don't have network support installed yet.

Installing M4

Install M4 by running the following commands:



root:m4-1.4# ./configure --prefix=/usr
root:m4-1.4# make
root:m4-1.4# make install

Installing Texinfo

Install Texinfo by running the following commands:



root:texinfo-4.0# ./configure --prefix=/usr
root:texinfo-4.0# make
root:texinfo-4.0# make install

Installing Autoconf

Install Autoconf by running the following commands:



root:autoconf-2.13# ./configure --prefix=/usr
root:autoconf-2.13# make
root:autoconf-2.13# make install

Installing Automake

Install Automake by running the following commands:



root:automake-1.4# ./configure --prefix=/usr
root:automake-1.4# make install

Installing Bash

Install Bash by running the following commands:



root:bash-2.04# ./configure --prefix=/usr
root:bash-2.04# make
root:bash-2.04# make install
root:bash-2.04# logout
root:root# mv $LFS/usr/bin/bash $LFS/bin
root:root# chroot $LFS bash --login

Installing Flex

Install Flex by running the following commands:



root:flex-2.5.4a# ./configure --prefix=/usr
root:flex-2.5.4a# make
root:flex-2.5.4a# make install

Installing Binutils

Install Binutils by running the following commands:



root:binutils-2.9.5.0.37# ./configure --prefix=/usr
root:binutils-2.9.5.0.37# make
root:binutils-2.9.5.0.37# make install

Installing Bzip2

Install Bzip2 by running the following commands:



root:bzip2-0.9.5d# make
root:bzip2-0.9.5d# make PREFIX=/usr install
root:bzip2-0.9.5d# cd /usr/bin
root:bin# mv bunzip2 bzip2 /bin

Installing Diffutils

Install Diffutils by running the following commands:



root:diffutils-2.7# ./configure --prefix=/usr
root:diffutils-2.7# make
root:diffutils-2.7# make install

Installing Linux Kernel

We won't be compiling a new kernel image yet. We'll do that after we have finished the installation of the basic system software in this chapter. But because certain software need the kernel header files, we're going to unpack the kernel archive now and set it up so that we can compile package that need the kernel.

Create the kernel configuration file by running the following command:



root:linux# make menuconfig

You don't have to configure anything at this point yet. Exit the configuration program immediately and when asked whether you want to save the configuration file or not, choose yes.

Now run the following commands to set up all the dependencies correctly:



root:linux# make dep

Now that that's done, we need to create the $LFS/usr/include/linux and the $LFS/usr/include/asm symlinks. Create them by running the following commands:



root:~# cd $LFS/usr/include
root:include# ln -s ../src/linux/include/linux linux
root:include# ln -s ../src/linux/include/asm asm

Installing E2fsprogs

Install E2fsprogs by running the following commands:



root:e2fsprogs-1.18# ./configure --prefix=/usr --with-root-prefix=/
root:e2fsprogs-1.18# make
root:e2fsprogs-1.18# make install
root:e2fsprogs-1.18# cd /usr/sbin
root:sbin# mv *e2* *fs* mklost+found /sbin

Installing File

Install File by running the following commands:



root:file-3.26# ./configure --prefix=/usr
root:file-3.26# make
root:file-3.26# make install

Installing Fileutils

Install Fileutils by running the following commands:



root:fileutils-4.0# ./configure --prefix=/usr
root:fileutils-4.0# make
root:fileutils-4.0# make install
root:fileutils-4.0# cd /usr/bin
root:bin# mv chgrp chmod chown cp dd df ln /bin
root:bin# mv ls mkdir mknod mv rm rmdir sync /bin

Installing Grep

Install Grep by running the following commands:



root::grep-2.4.2# ./configure --prefix=/usr
root:grep-2.4.2# make
root:grep-2.4.2# make install

Installing Groff

Install Groff by running the following commands:



root:groff-1.15# ./configure --prefix=/usr
root:groff-1.15# make
root:groff-1.15# make install

Installing Gzip

Install Gzip by running the following commands:



root:gzip-1.2.4a# ./configure --prefix=/usr
root:gzip-1.2.4a# make
root:gzip-1.2.4a# make install
root:gzip-1.2.4a# cd /usr/bin
root:bin# mv gunzip gzip /bin

Installing Ld.so

Install Ld.so by running the following commands:



root:ld.so-1.9.10# cd util
root:util# make ldd ldconfig
root:util# cp ldd /bin
root:util# cp ldconfig /sbin
root:util# cd ../man
root:man# cp ldd.1 /usr/share/man/man1
root:man# cp *.8 /usr/share/man/man8
root:man# rm /usr/bin/ldd

Installing Libtool

Install Libtool by running the following commands:



root:libtool-1.3.4# ./configure --prefix=/usr
root:libtool-1.3.4# make
root:libtool-1.3.4# make install

Installing Linux86

Install Linux86 by running the following commands:



root:linux-86# cd as
root:as# make
root:as# make install
root:as# cd ../ld
root:ld# make ld86
root:ld# make install
root:ld# cd ../man
root:man# cp as86.1 ld86.1 /usr/share/man/man1

Installing Make

Install Make by running the following commands:



root:make-3.78.1# ./configure --prefix=/usr
root:make-3.78.1# make
root:make-3.78.1# make install

Installing Shell Utils

Install Shellutils by running the following commands:



root:sh-utils-2.0# ./configure --prefix=/usr
root:sh-utils-2.0# make
root:sh-utils-2.0# make install
root:sh-utils-2.0# cd /usr/bin
root:bin# mv date echo false pwd stty /bin
root:bin# mv su true uname hostname /bin

Installing Shadow Password Suite

Install the Shadow Password Suite by running the following commands:



root:shadow-19990827# ./configure --prefix=/usr
root:shadow-19990827# make
root:shadow-19990827# make install
root:shadow-19990827# cd etc
root:etc# cp limits login.access login.defs.linux shells suauth /etc
root:etc# mv /etc/login.defs.linux /etc/login.defs

Installing Man

Install Man by running the following commands:



root:man�1.5h1# ./configure -default
root:man�1.5h1# make
root:man�1.5h1# make install

Installing Modutils

Install Modutils by running the following commands:



root:modutils-2.3.9# ./configure
root:modutils-2.3.9# make
root:modutils-2.3.9# make install

Installing Procinfo

Install Procinfo by running the following commands:



root:procinfo-17# make
root:procinfo-17# make install

Installing Procps

Install Procps by running the following commands:



root:procps-2.0.6# gcc -c watch.c
root:procps-2.0.6# make
root:procps-2.0.6# make -e XSCPT="" install
root:procinfo-17# mv /usr/bin/kill /bin

Installing Psmisc

Install Psmisc by running the following commands:



root:psmisc-19# make
root:psmisc-19# make install

Installing Sed

Install Sed by running the following commands:



root:sed-3.02# ./configure --prefix=/usr
root:sed-3.02# make
root:sed-3.02# make install
root:sed-3.02# mv /usr/bin/sed /bin

Installing Start-stop-daemon

Install Start-stop-daemon by running the following commands:



root:ssd-0.4.1# make
root:ssd-0.4.1# make install

Installing Sysklogd

Install Sysklogd by running the following commands:



root:sysklogd-1.3-31# make
root:sysklogd-1.3-31# make install

Installing Sysvinit

Install Sysvinit by running the following commands:



root:sysvinit-2.78# cd src
root:sysvinit-2.78# make
root:sysvinit-2.78# make install

Installing Tar

Install Tar by running the following commands:



root:tar-1.13# ./configure --prefix=/usr
root:tar-1.13# make
root:tar-1.13# make install
root:tar-1.13# mv /usr/bin/tar /bin

Installing Textutils

Install Textutuils by running the following commands:



root:textutils-2.0# ./configure --prefix=/usr
root:textutils-2.0# make
root:textutils-2.0# make install
root:textutils-2.0# mv /usr/bin/cat /bin

Installing Vim

You need to unpack both the vim-rt and vim-src packages to install Vim. Install Vim by running the following commands:



root:vim-5.6# ./configure --prefix=/usr
root:vim-5.6# make
root:vim-5.6# make install
root:vim-5.6# cd /usr/bin
root:bin# ln -s vim vi

Installing Util-Linux

Before we can install the package we have to edit the MCONFIG file, find and modify the following variables as follows:



HAVE_PASSWD=yes
HAVE_SLN=yes
HAVE_TSORT=yes

Install Util-Linux by running the following commands:



root:util-linux-2.10h# groupadd -g 5 tty
root:util-linux-2.10h# ./configure
root:util-linux-2.10h# make
root:util-linux-2.10h# make install

Installing Pmac-utils

Install Pmac-utils by running the following commands:



root:pmac-utils-1.1.1# make clock
root:pmac-utils-1.1.1# cp clock /sbin
root:pmac-utils-1.1.1# rm /sbin/hwclock

Create a new file /sbin/hwclock containing the following:



        #!/bin/sh
        # Begin /sbin/hwclock

        /sbin/clock -s

        # End /sbin/hwclock

Set the right permissions by running the following command:



root:~# chmod 755 /sbin/hwclock