Linux from scratch

Linux From Scratch Free Book Download

Download Book NOw

Preface ……………….. viii
i. Foreword ……. viii
ii. Audience …… viii
iii. LFS Target Architectures ………….. ix
iv. LFS and Standards ……………………. x
v. Rationale for Packages in the Book ………… xi
vi. Prerequisites ….. xvi
vii. Host System Requirements …….. xvi
viii. Typography ………………………….. xix
ix. Structure ……. xx
x. Errata …………. xx
I. Introduction ………… 1
1. Introduction ….. 2
1.1. How to Build an LFS System 2
1.2. What’s new since the last release …….. 2
1.3. Changelog …………………………. 4
1.4. Resources ………………………….. 9
1.5. Help …… 10
II. Preparing for the Build ………………….. 12
2. Preparing a New Partition …………. 13
2.1. Introduction ……………………… 13
2.2. Creating a New Partition …… 13
2.3. Creating a File System on the Partition ……………………….. 14
2.4. Mounting the New Partition . 15
3. Packages and Patches ……………….. 16
3.1. Introduction ……………………… 16
3.2. All Packages ……………………. 16
3.3. Needed Patches ………………… 23
4. Final Preparations …………………….. 25
4.1. About $LFS …………………….. 25
4.2. Creating the $LFS/tools Directory …. 25
4.3. Adding the LFS User ……….. 26
4.4. Setting Up the Environment . 26
4.5. About SBUs …………………….. 28
4.6. About the Test Suites ……….. 28
5. Constructing a Temporary System 30
5.1. Introduction ……………………… 30
5.2. Toolchain Technical Notes … 30
5.3. General Compilation Instructions …… 32
5.4. Binutils-2.23.2 – Pass 1 …….. 34
5.5. GCC-4.8.1 – Pass 1 …………… 36
5.6. Linux-3.10.10 API Headers .. 39
5.7. Glibc-2.18 ……………………….. 40
5.8. Libstdc++-4.8.1 ………………… 43
5.9. Binutils-2.23.2 – Pass 2 …….. 45
5.10. GCC-4.8.1 – Pass 2 …………. 47
5.11. Tcl-8.6.0 ………………………… 51
5.12. Expect-5.45 ……………………. 53
5.13. DejaGNU-1.5.1 ………………. 55
5.14. Check-0.9.10 ………………….. 56
5.15. Ncurses-5.9 ……………………. 57
5.16. Bash-4.2 ………………………… 58
5.17. Bzip2-1.0.6 …………………….. 59
5.18. Coreutils-8.21 …………………. 60
5.19. Diffutils-3.3 ……………………. 61
5.20. File-5.14 ………………………… 62
5.21. Findutils-4.4.2 ………………… 63
5.22. Gawk-4.1.0 …………………….. 64
5.23. Gettext-0.18.3 …………………. 65
5.24. Grep-2.14 ………………………. 66
5.25. Gzip-1.6 …………………………. 67
5.26. M4-1.4.16 ………………………. 68
5.27. Make-3.82 ……………………… 69
5.28. Patch-2.7.1 …………………….. 70
5.29. Perl-5.18.1 ……………………… 71
5.30. Sed-4.2.2 ……………………….. 72
5.31. Tar-1.26 …………………………. 73
5.32. Texinfo-5.1 …………………….. 74
5.33. Xz-5.0.5 …………………………. 75
5.34. Stripping ………………………… 76
5.35. Changing Ownership ………. 76
III. Building the LFS System ……………… 77
6. Installing Basic System Software .. 78
6.1. Introduction ……………………… 78
6.2. Preparing Virtual Kernel File Systems …………………………. 78
6.3. Package Management ……….. 80
6.4. Entering the Chroot Environment ….. 83
6.5. Creating Directories ………….. 84
6.6. Creating Essential Files and Symlinks …………………………. 85
6.7. Linux-3.10.10 API Headers .. 88
6.8. Man-pages-3.53 ………………… 89
6.9. Glibc-2.18 ……………………….. 90
6.10. Adjusting the Toolchain ….. 98
6.11. Zlib-1.2.8 ……………………… 100
6.12. File-5.14 ………………………. 101
6.13. Binutils-2.23.2 ………………. 102
6.14. GMP-5.1.2 ……………………. 105
6.15. MPFR-3.1.2 ………………….. 107
6.16. MPC-1.0.1 ……………………. 108
6.17. GCC-4.8.1 ……………………. 109
6.18. Sed-4.2.2 ……………………… 114
6.19. Bzip2-1.0.6 …………………… 115
6.20. Pkg-config-0.28 …………….. 117
6.21. Ncurses-5.9 …………………… 118
6.22. Shadow-4.1.5.1 ……………… 121
6.23. Util-linux-2.23.2 ……………. 124
6.24. Psmisc-22.20 ………………… 129
6.25. Procps-ng-3.3.8 …………….. 130
6.26. E2fsprogs-1.42.8 …………… 132
6.27. Coreutils-8.21 ……………….. 135
6.28. Iana-Etc-2.30 ………………… 140
6.29. M4-1.4.16 …………………….. 141
6.30. Flex-2.5.37 …………………… 142
6.31. Bison-3.0 ……………………… 144
6.32. Grep-2.14 …………………….. 145
6.33. Readline-6.2 …………………. 146
6.34. Bash-4.2 ………………………. 148
6.35. Bc-1.06.95 ……………………. 150
6.36. Libtool-2.4.2 …………………. 151
6.37. GDBM-1.10 …………………. 152
6.38. Inetutils-1.9.1 ……………….. 153
6.39. Perl-5.18.1 ……………………. 155
6.40. Autoconf-2.69 ………………. 158
6.41. Automake-1.14 ……………… 159
6.42. Diffutils-3.3 ………………….. 161
6.43. Gawk-4.1.0 …………………… 162
6.44. Findutils-4.4.2 ………………. 163
6.45. Gettext-0.18.3 ……………….. 165
6.46. Groff-1.22.2 ………………….. 167
6.47. Xz-5.0.5 ……………………….. 170
6.48. GRUB-2.00 ………………….. 172
6.49. Less-458 ………………………. 174
6.50. Gzip-1.6 ……………………….. 175
6.51. IPRoute2-3.10.0 ……………. 177
6.52. Kbd-1.15.5 …………………… 179
6.53. Kmod-14 ……………………… 182
6.54. Libpipeline-1.2.4 …………… 184
6.55. Make-3.82 ……………………. 185
6.56. Man-DB-2.6.5 ………………. 186
6.57. Patch-2.7.1 …………………… 189
6.58. Sysklogd-1.5 …………………. 190
6.59. Sysvinit-2.88dsf ……………. 191
6.60. Tar-1.26 ……………………….. 193
6.61. Texinfo-5.1 …………………… 195
6.62. Udev-206 (Extracted from systemd-206) ………………….. 197
6.63. Vim-7.4 ……………………….. 199
6.64. About Debugging Symbols ………… 202
6.65. Stripping Again …………….. 202
6.66. Cleaning Up …………………. 203
7. Setting Up System Bootscripts …. 204
7.1. Introduction ……………………. 204
7.2. General Network Configuration …… 204
7.3. Customizing the /etc/hosts File …….. 207
7.4. Device and Module Handling on an LFS System ………… 208
7.5. Creating Custom Symlinks to Devices ……………………….. 212
7.6. LFS-Bootscripts-20130821 . 214
7.7. How Do These Bootscripts Work? .. 216
7.8. Configuring the system hostname … 218
7.9. Configuring the setclock Script ……. 219
7.10. Configuring the Linux Console ….. 219
7.11. Configuring the sysklogd Script …. 222
7.12. The rc.site File ……………… 222
7.13. The Bash Shell Startup Files ……… 225
7.14. Creating the /etc/inputrc File ……… 227
8. Making the LFS System Bootable ……….. 229
8.1. Introduction ……………………. 229
8.2. Creating the /etc/fstab File .. 229
8.3. Linux-3.10.10 …………………. 231
8.4. Using GRUB to Set Up the Boot Process …………………… 234
9. The End ……. 236
9.1. The End …………………………. 236
9.2. Get Counted …………………… 236
9.3. Rebooting the System ……… 236
9.4. What Now? ……………………. 238
IV. Appendices …… 239
A. Acronyms and Terms ……………… 240
B. Acknowledgments ………………….. 243
C. Dependencies …………………………. 246
D. Boot and sysconfig scripts version-20130821 …………………….. 256
D.1. /etc/rc.d/init.d/rc ……………… 256
D.2. /lib/lsb/init-functions ……….. 260
D.3. /etc/rc.d/init.d/functions …… 274
D.4. /etc/rc.d/init.d/mountvirtfs .. 288
D.5. /etc/rc.d/init.d/modules ……. 289
D.6. /etc/rc.d/init.d/udev …………. 291
D.7. /etc/rc.d/init.d/swap …………. 292
D.8. /etc/rc.d/init.d/setclock …….. 293
D.9. /etc/rc.d/init.d/checkfs ……… 294
D.10. /etc/rc.d/init.d/mountfs …… 297
D.11. /etc/rc.d/init.d/udev_retry . 298
D.12. /etc/rc.d/init.d/cleanfs ……. 300
D.13. /etc/rc.d/init.d/console ……. 302
D.14. /etc/rc.d/init.d/localnet …… 304
D.15. /etc/rc.d/init.d/sysctl ………. 305
D.16. /etc/rc.d/init.d/sysklogd ….. 306
D.17. /etc/rc.d/init.d/network …… 308
D.18. /etc/rc.d/init.d/sendsignals 309
D.19. /etc/rc.d/init.d/reboot ……… 311
D.20. /etc/rc.d/init.d/halt …………. 311
D.21. /etc/rc.d/init.d/template ….. 312
D.22. /etc/sysconfig/modules ….. 313
D.23. /etc/sysconfig/createfiles … 314
D.24. /etc/sysconfig/udev-retry .. 314
D.25. /sbin/ifup ……………………… 315
D.26. /sbin/ifdown …………………. 317
D.27. /lib/services/ipv4-static ….. 319
D.28. /lib/services/ipv4-static-route ……… 320
E. Udev configuration rules …………. 323
E.1. 55-lfs.rules …………………….. 323
F. LFS Licenses …………………………. 324
F.1. Creative Commons License 324
F.2. The MIT License ……………. 328
Index …………………. 329

Host System Requirements

Your host system should have the following software with the minimum versions indicated. This should not be an issue for most modern Linux distributions. Also note that many distributions will place software headers into separate packages, often in the form of “<package-name>-devel” or “<package-name>-dev”. Be sure to install those if your distribution provides them.

Earlier versions of the listed software packages may work, but has not been tested.

• Bash-3.2 (/bin/sh should be a symbolic or hard link to bash)
• Binutils-2.17 (Versions greater than 2.23.2 are not recommended as they have not been tested)
• Bison-2.3 (/usr/bin/yacc should be a link to bison or small script that executes bison)
• Bzip2-1.0.4
• Coreutils-6.9
• Diffutils-2.8.1
• Findutils-4.2.31
• Gawk-4.0.1 (/usr/bin/awk should be a link to gawk)
GCC-4.1.2 including the C++ compiler, g++ (Versions greater than 4.8.1 are not recommended as they have not been tested)
• Glibc-2.5.1 (Versions greater than 2.18 are not recommended as they have not been tested)
• Grep-2.5.1a
• Gzip-1.3.12
• Linux Kernel-2.6.32

The reason for the kernel version requirement is that we specify that version when building glibc in Chapter 6 at the recommendation of the developers. It is also required by udev.

If the host kernel is earlier than 2.6.32 you will need to replace the kernel with a more up to date version. There are two ways you can go about this. First, see if your Linux vendor provides a 2.6.32 or later kernel package. If so, you may wish to install it. If your vendor doesn’t offer an acceptable kernel package, or you would prefer not to install it, you can compile a kernel yourself. Instructions for compiling the kernel and configuring the boot loader (assuming the host uses GRUB) are located in Chapter 8.

• M4-1.4.10
• Make-3.81
• Patch-2.5.4
• Perl-5.8.8
• Sed-4.1.5
• Tar-1.18
• Texinfo-4.9
• Xz-5.0.0

Note that the symlinks mentioned above are required to build an LFS system using the instructions contained within this book. Symlinks that point to other software (such as dash, mawk, etc.) may work, but are not tested or supported by the LFS development team, and may require either deviation from the instructions or additional patches to some packages.

Download Book NOw

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s