In this chapter we will install all the software that belongs to a basic Linux system. After you're done with this chapter you have a fully working Linux system. The remaining chapters deal with optional issues such as setting up networking, Internet servers + clients (telnet, ftp, http, email), setting up Internet itself and the X Window System. You can skip chapters at your own discretion. If you don't plan on going online with the LFS system there's little use to setup Internet for example.
This chapter is devided in two chunks. The first part installs a few necessary programs on the LFS system. These programs are needed to install the rest of the programs that belong to a basic system. When the first part is done, we will enter a chroot'ed environment. This means that we start a shell with $LFS as the root directory (instead of the usual / directory as the root directory). This has the same effect as rebooting the computer into the LFS system, but this way we don't have to reboot. If something goes wrong, you don't need to reboot back in the normal Linux system to fix whatever you need to fix. You just open a new shell on a virtual console, or start a new xterm and you can do what you need to do.
The software in the first part will be linked statically. These programs will be re-installed in the second part and linked dynamically. The reason for the static version first is that there is a chance that our normal Linux system and our LFS system-to-be don't use the same C Library versions. If the programs in the first part are linked against an older C library version, those program might not work too well on the LFS system.
Every program and library is by default compiled with debugging symbols. This means you can run a program or library through a debugger and the debugger's output will be more user friendly. These debugging symbols also enlarge the program or library significantly. This document will not install software without debugging symbols (as I don't know if the majority of readers do or do not debug software). In stead, you can remove those symbols manually if you want with the strip program.
To remove debugging symbols from a binary (must be an a.out or ELF binary) run strip --strip-debug filename You can use wild cards if you need to strip debugging symbols from multiple files (use something like strip --strip-debug $LFS/usr/bin/*).
Before you wonder if these debugging symbols would make a big difference, here are some statistics:
A static Bash binary with debugging symbols: 2.3MB
A static Bash binary without debugging symbols: 645KB
A dynamic Bash binary with debugging symbols: 1.2MB
A dynamic Bash binary without debugging symbols: 478KB
$LFS/lib and $LFS/usr/lib (glibc and gcc files) with debugging symbols: 87MB
$LFS/lib and $LFS/usr/lib (glibc and gcc files) without debugging symbols: 16MB
Sizes may vary depending on which compiler was used and which C library version was used to link dynamic programs against, but your results will be similar if you compare programs with and without debugging symbols. After I was done with this chapter and stripped all debugging symbols from all LFS binaries and libraries I regained a little over 102 MB of disk space. Quite the difference. The difference would be even greater when I would do this at the end of this book when everything is installed.