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 command to enter 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:~# 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:ed-0.2# ./configure --prefix=/usr
root:ed-0.2# make -e
root:ed-0.2# make install
root:ed-0.2# cd /usr/bin
root:bin# mv ed red /bin

Installing Patch

Install Patch by running the following commands:



root:patch-2.5.4# ./configure --prefix=/usr
root:patch-2.5.4# make -e
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-gxx-include-dir=/usr/include/g++ \
> --enable-shared --enable-languages=c,c++
root:gcc-build# make -e 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 -e
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 -e
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

Now recompile the package using the same commands as above.

Installing Ncurses

Install Ncurses by running the following commands:



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

Installing Less

Install Less by running the following commands:



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

Installing Groff

Install Groff by running the following commands:



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

Installing Man

Install Man by running the following commands:



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

Installing Perl

Install Perl by running the following commands:



root:perl-5.6.0# ./Configure
root:perl-5.6.0# make -e
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/ subdirectory.

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 -e
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 -e
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 -e
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 -e
root:flex-2.5.4a# make install

Installing File

Install File by running the following commands:



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

Installing Binutils

Install Binutils by running the following commands:



root:binutils-2.9.5.0.46# ./configure --prefix=/usr
root:binutils-2.9.5.0.46# make -e tooldir=/usr
root:binutils-2.9.5.0.46# make -e tooldir=/usr install

Installing Bzip2

Install Bzip2 by running the following commands:



root:bzip2-1.0.0# make -e -f Makefile-libbz2_so
root:bzip2-1.0.0# make -e bzip2recover libbz2.a
root:bzip2-1.0.0# cp bzip2-shared /bin/bzip2
root:bzip2-1.0.0# cp bzip2recover /bin
root:bzip2-1.0.0# cp bzip2.1 /usr/share/man/man1
root:bzip2-1.0.0# cp bzlib.h /usr/include
root:bzip2-1.0.0# cp libbz2.so* libbz2.a /lib
root:bzip2-1.0.0# cd /bin
root:bin# rm bunzip2; ln -s bzip2 bunzip2
root:bin# rm bzcat; ln -s bzip2 bzcat

Installing Diffutils

Install Diffutils by running the following commands:



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

Installing E2fsprogs

Install E2fsprogs by running the following commands:



root:e2fsprogs-1.18# ./configure --prefix=/usr --with-root-prefix=/
root:e2fsprogs-1.18# make -e
root:e2fsprogs-1.18# make install

Installing Fileutils

Install Fileutils by running the following commands:



root:fileutils-4.0# ./configure --prefix=/usr
root:fileutils-4.0# make -e
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 rmdir sync /bin
root:bin# cp mv /bin; rm mv

Installing Grep

Install Grep by running the following commands:



root:grep-2.4.2# ./configure --prefix=/usr
root:grep-2.4.2# make -e
root:grep-2.4.2# 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 -e
root:gzip-1.2.4a# make install
root:gzip-1.2.4a# cd /usr/bin
root:bin# cp gunzip gzip /bin
root:bin# rm gunzip gzip

Installing Ld.so

Install Ld.so by running the following commands:



root:ld.so-1.9.9# 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
root:man# hash -r

The "hash -r" command is to make bash forget about the locations of previously executed commands. If you have executed ldd before, bash expects it to be found in /usr/bin. Since we moved it to /bin, the cache needs to be purged so bash can find it in /bin when you want to execute it again.

You might have noticed that we don't use the compiler optimizations for this package. The reason is that overriding the CFLAGS variable causes compilation problems. You would have to edit the Config.mk file and add the proper values to the CFLAGS variable and then compile the package. If you want to do that it's up to you. I don't think it's worth the trouble though. The ld and ldd programs usually are only rarely used.

Installing Libtool

Install Libtool by running the following commands:



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

Installing Bin86

Install Bin86 by running the following commands:



root:bin86-0.4# make -e
root:bin86-0.4# make install

Installing Lilo

Install Lilo by running the following commands:



root:lilo-21.4.3# make -e
root:lilo-21.4.3# make install

Installing Make

Install Make by running the following commands:



root:make-3.79# ./configure --prefix=/usr
root:make-3.79# make -e
root:make-3.79# 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 -e
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 -e
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 Modutils

Install Modutils by running the following commands:



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

Installing Procinfo

Install Procinfo by running the following commands:



root:procinfo-17# make -e
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:procps-2.0.6# mv /usr/bin/kill /bin

You might have noticed that we don't use the compiler optimizations for this package. The reason is that overriding the CFLAGS variable causes compilation problems. You would have to edit the Makefile file and add the proper values to the CFLAGS variable and then compile the package. If you want to do that it's up to you. I don't think it's worth the trouble though. The programs in this package aren't that big that optimization would have any noticable effect on the performance.

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 -e
root:vim-5.6# make install
root:vim-5.6# cd /usr/bin
root:bin# ln -s vim vi

If you are planning on installing the X Window system on your LFS system, you might want to re-compile Vim after you have installed X. Vim comes with a nice GUI version of the editor which requires X and a few other libraries to be installed. For more information read the Vim documentation.

Installing Psmisc

Before Psmisc can be compiled, the Makefile file needs to be modified. Open the Makefile file in a text editor (like Vim that was installed just before) and find -ltermcap. Change this into -lncurses

Install Psmisc by running the following commands:



root:psmisc# make
root:psmisc# make install

You might have noticed that we don't use the compiler optimizations for this package. The reason is that overriding the CFLAGS variable causes compilation problems. You would have to edit the Makefile file and add the proper values to the CFLAGS variable and then compile the package. If you want to do that it's up to you. I don't think it's worth the trouble though. The programs in this package aren't that big that optimization would have any noticable effect on the performance.

Installing Sed

Install Sed by running the following commands:



root:sed-3.02# ./configure --prefix=/usr
root:sed-3.02# make -e
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 -e
root:ssd-0.4.1# make install

Installing Sysklogd

Before we are going to install Sysklogd we have to modify the Makefile file. This is only necessary if you want to compile sysklogd with the optimization options. If not, then just continue without modifying the Makefile file.

Edit the Makefile file and find this line: CFLAGS= $(RPM_OPT_FLAGS) -O3 -DSYSV -fomit-frame-pointer -Wall -fno-strength-reduce. Add the proper -mcpu= and -march= option to this variable and save the file.

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 -e
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 -e
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 -e
root:textutils-2.0# make install
root:textutils-2.0# mv /usr/bin/cat /bin

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

Now find the following lines in the MCONFIG file:



ifeq "$(CPU)" "intel"
  OPT=          -pipe -O2 -m486 -fomit-frame-pointer
else
  ifeq "$(CPU)" "arm"
    OPT=        -pipe -O2 -fsigned-char -fomit-frame-pointer
  else
    OPT=        -O2 -fomit-frame-pointer
  endif
endif

Modify the proper OPT variable to include the -mcpu= and -march= options. If you modify the first OPT variable, replace -m486 by the -mcpu variable.

Install Util-Linux by running the following commands:



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

Installing Console-tools

Install Console-tools by running the following commands:



root:console-tools-0.2.3# ./configure --prefix=/usr
root:console-tools-0.2.3# make -e
root:console-tools-0.2.3# make install

Ignore the error at the end of the compilation. We don't have an SGML parser and related utilities installed so console-tools can't format the SGML files into html files.

Installing Console-data

Install Console-data by running the following commands:



root:console-data-1999.08.29# ./configure --prefix=/usr
root:console-data-1999.08.29# make
root:console-data-1999.08.29# make install