Linux From Scratch.pdf

(1453 KB) Pobierz
147355513 UNPDF
Linux From Scratch
Version 6.5
Gerard Beekmans
Linux From Scratch: Version 6.5
by Gerard Beekmans
Copyright © 1999-2009 Gerard Beekmans
Copyright © 1999-2009, Gerard Beekmans
All rights reserved.
This book is licensed under a Creative Commons License .
Computer instructions may be extracted from the book under the MIT License.
Linux® is a registered trademark of Linus Torvalds.
Linux From Scratch - Version 6.5
Table of Contents
Preface ..................................................................................................................................................................... viii
i. Foreword ........................................................................................................................................................ viii
ii. Audience ....................................................................................................................................................... viii
iii. Prerequisites ................................................................................................................................................... ix
iv. Host System Requirements ............................................................................................................................ x
v. Typography ................................................................................................................................................... xiii
vi. Structure ....................................................................................................................................................... xiv
vii. Errata .......................................................................................................................................................... xiv
I. Introduction ............................................................................................................................................................. 1
1. Introduction ...................................................................................................................................................... 2
1.1. How to Build an LFS System ................................................................................................................ 2
1.2. What's new since the last release ........................................................................................................... 3
1.3. Changelog ............................................................................................................................................... 5
1.4. Resources .............................................................................................................................................. 13
1.5. Help ....................................................................................................................................................... 13
II. Preparing for the Build ....................................................................................................................................... 16
2. Preparing a New Partition ............................................................................................................................. 17
2.1. Introduction ........................................................................................................................................... 17
2.2. Creating a New Partition ...................................................................................................................... 17
2.3. Creating a File System on the Partition ............................................................................................... 17
2.4. Mounting the New Partition ................................................................................................................. 18
3. Packages and Patches .................................................................................................................................... 20
3.1. Introduction ........................................................................................................................................... 20
3.2. All Packages ......................................................................................................................................... 20
3.3. Needed Patches ..................................................................................................................................... 26
4. Final Preparations .......................................................................................................................................... 29
4.1. About $LFS .......................................................................................................................................... 29
4.2. Creating the $LFS/tools Directory ....................................................................................................... 29
4.3. Adding the LFS User ........................................................................................................................... 30
4.4. Setting Up the Environment ................................................................................................................. 30
4.5. About SBUs .......................................................................................................................................... 32
4.6. About the Test Suites ........................................................................................................................... 32
5. Constructing a Temporary System ................................................................................................................ 33
5.1. Introduction ........................................................................................................................................... 33
5.2. Toolchain Technical Notes ................................................................................................................... 33
5.3. General Compilation Instructions ......................................................................................................... 35
5.4. Binutils-2.19.1 - Pass 1 ........................................................................................................................ 36
5.5. GCC-4.4.1 - Pass 1 ............................................................................................................................... 38
5.6. Linux-2.6.30.2 API Headers ................................................................................................................. 40
5.7. Glibc-2.10.1 .......................................................................................................................................... 41
5.8. Adjusting the Toolchain ....................................................................................................................... 43
5.9. Binutils-2.19.1 - Pass 2 ........................................................................................................................ 45
5.10. GCC-4.4.1 - Pass 2 ............................................................................................................................. 47
5.11. Tcl-8.5.7 .............................................................................................................................................. 51
5.12. Expect-5.43.0 ...................................................................................................................................... 53
iii
Linux From Scratch - Version 6.5
5.13. DejaGNU-1.4.4 ................................................................................................................................... 55
5.14. Ncurses-5.7 ......................................................................................................................................... 56
5.15. Bash-4.0 .............................................................................................................................................. 57
5.16. Bzip2-1.0.5 .......................................................................................................................................... 58
5.17. Coreutils-7.4 ........................................................................................................................................ 59
5.18. Diffutils-2.8.1 ...................................................................................................................................... 60
5.19. Findutils-4.4.2 ..................................................................................................................................... 61
5.20. Gawk-3.1.7 .......................................................................................................................................... 62
5.21. Gettext-0.17 ......................................................................................................................................... 63
5.22. Grep-2.5.4 ........................................................................................................................................... 64
5.23. Gzip-1.3.12 .......................................................................................................................................... 65
5.24. M4-1.4.13 ............................................................................................................................................ 66
5.25. Make-3.81 ........................................................................................................................................... 67
5.26. Patch-2.5.9 .......................................................................................................................................... 68
5.27. Perl-5.10.0 ........................................................................................................................................... 69
5.28. Sed-4.2.1 ............................................................................................................................................. 70
5.29. Tar-1.22 ............................................................................................................................................... 71
5.30. Texinfo-4.13a ...................................................................................................................................... 72
5.31. Stripping .............................................................................................................................................. 73
5.32. Changing Ownership .......................................................................................................................... 73
III. Building the LFS System .................................................................................................................................. 74
6. Installing Basic System Software .................................................................................................................. 75
6.1. Introduction ........................................................................................................................................... 75
6.2. Preparing Virtual Kernel File Systems ................................................................................................. 75
6.3. Package Management ........................................................................................................................... 76
6.4. Entering the Chroot Environment ........................................................................................................ 79
6.5. Creating Directories .............................................................................................................................. 80
6.6. Creating Essential Files and Symlinks ................................................................................................. 81
6.7. Linux-2.6.30.2 API Headers ................................................................................................................. 83
6.8. Man-pages-3.22 ..................................................................................................................................... 84
6.9. Glibc-2.10.1 .......................................................................................................................................... 85
6.10. Re-adjusting the Toolchain ................................................................................................................. 92
6.11. Zlib-1.2.3 ............................................................................................................................................. 94
6.12. Binutils-2.19.1 ..................................................................................................................................... 96
6.13. GMP-4.3.1 ........................................................................................................................................... 99
6.14. MPFR-2.4.1 ....................................................................................................................................... 101
6.15. GCC-4.4.1 ......................................................................................................................................... 102
6.16. Sed-4.2.1 ........................................................................................................................................... 106
6.17. Pkg-config-0.23 ................................................................................................................................. 107
6.18. Ncurses-5.7 ........................................................................................................................................ 108
6.19. Util-linux-ng-2.16 ............................................................................................................................. 111
6.20. E2fsprogs-1.41.8 ............................................................................................................................... 115
6.21. Coreutils-7.4 ...................................................................................................................................... 118
6.22. Iana-Etc-2.30 ..................................................................................................................................... 123
6.23. M4-1.4.13 .......................................................................................................................................... 124
6.24. Bison-2.4.1 ........................................................................................................................................ 125
6.25. Procps-3.2.8 ....................................................................................................................................... 126
iv
Linux From Scratch - Version 6.5
6.26. Grep-2.5.4 ......................................................................................................................................... 128
6.27. Readline-6.0 ...................................................................................................................................... 129
6.28. Bash-4.0 ............................................................................................................................................ 131
6.29. Libtool-2.2.6a .................................................................................................................................... 133
6.30. GDBM-1.8.3 ..................................................................................................................................... 134
6.31. Inetutils-1.6 ....................................................................................................................................... 135
6.32. Perl-5.10.0 ......................................................................................................................................... 137
6.33. Autoconf-2.64 ................................................................................................................................... 140
6.34. Automake-1.11 .................................................................................................................................. 141
6.35. Bzip2-1.0.5 ........................................................................................................................................ 143
6.36. Diffutils-2.8.1 .................................................................................................................................... 145
6.37. File-5.03 ............................................................................................................................................ 146
6.38. Gawk-3.1.7 ........................................................................................................................................ 147
6.39. Findutils-4.4.2 ................................................................................................................................... 148
6.40. Flex-2.5.35 ........................................................................................................................................ 150
6.41. Gettext-0.17 ....................................................................................................................................... 152
6.42. Groff-1.20.1 ....................................................................................................................................... 154
6.43. Gzip-1.3.12 ........................................................................................................................................ 157
6.44. IPRoute2-2.6.29-1 ............................................................................................................................. 159
6.45. Kbd-1.15 ........................................................................................................................................... 161
6.46. Less-429 ............................................................................................................................................ 163
6.47. Make-3.81 ......................................................................................................................................... 164
6.48. Man-DB-2.5.5 ................................................................................................................................... 165
6.49. Module-Init-Tools-3.10 ..................................................................................................................... 168
6.50. Patch-2.5.9 ........................................................................................................................................ 170
6.51. Psmisc-22.8 ....................................................................................................................................... 171
6.52. Shadow-4.1.4.2 .................................................................................................................................. 172
6.53. Sysklogd-1.5 ...................................................................................................................................... 175
6.54. Sysvinit-2.86 ..................................................................................................................................... 176
6.55. Tar-1.22 ............................................................................................................................................. 179
6.56. Texinfo-4.13a .................................................................................................................................... 180
6.57. Udev-145 ........................................................................................................................................... 182
6.58. Vim-7.2 ............................................................................................................................................. 185
6.59. About Debugging Symbols ............................................................................................................... 188
6.60. Stripping Again ................................................................................................................................. 188
6.61. Cleaning Up ...................................................................................................................................... 189
7. Setting Up System Bootscripts .................................................................................................................... 190
7.1. Introduction ......................................................................................................................................... 190
7.2. LFS-Bootscripts-20090812 ................................................................................................................. 191
7.3. How Do These Bootscripts Work? ..................................................................................................... 193
7.4. Configuring the setclock Script .......................................................................................................... 194
7.5. Configuring the Linux Console .......................................................................................................... 194
7.6. Configuring the sysklogd Script ......................................................................................................... 197
7.7. Creating the /etc/inputrc File .............................................................................................................. 197
7.8. The Bash Shell Startup Files .............................................................................................................. 200
7.9. Device and Module Handling on an LFS System .............................................................................. 201
7.10. Creating Custom Symlinks to Devices ............................................................................................. 205
v
Zgłoś jeśli naruszono regulamin