linux from scratch.pdf

(1746 KB) Pobierz
Linux From Scratch
Version 9.0
Published September 1st, 2019
Created by Gerard Beekmans
Managing Editor: Bruce Dubbs
Linux From Scratch: Version 9.0 : Published September 1st, 2019
by Created by Gerard Beekmans and Managing Editor: Bruce Dubbs
Copyright © 1999-2019 Gerard Beekmans
Copyright © 1999-2019, 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 9.0
Table of Contents
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. Typography .................................................................................................................................................... xvii
viii. Structure ...................................................................................................................................................... xviii
ix. Errata ............................................................................................................................................................. xviii
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 .................................................................................................................................................... 7
1.5. Help ............................................................................................................................................................. 8
II. Preparing for the Build ........................................................................................................................................... 10
2. Preparing the Host System ................................................................................................................................ 11
2.1. Introduction ............................................................................................................................................... 11
2.2. Host System Requirements ....................................................................................................................... 11
2.3. Building LFS in Stages ............................................................................................................................ 14
2.4. Creating a New Partition .......................................................................................................................... 14
2.5. Creating a File System on the Partition ................................................................................................... 16
2.6. Setting The $LFS Variable ....................................................................................................................... 17
2.7. Mounting the New Partition ..................................................................................................................... 18
3. Packages and Patches ........................................................................................................................................ 19
3.1. Introduction ............................................................................................................................................... 19
3.2. All Packages ............................................................................................................................................. 19
3.3. Needed Patches ......................................................................................................................................... 27
4. Final Preparations .............................................................................................................................................. 28
4.1. Introduction ............................................................................................................................................... 28
4.2. Creating the $LFS/tools Directory ........................................................................................................... 28
4.3. Adding the LFS User ............................................................................................................................... 28
4.4. Setting Up the Environment ..................................................................................................................... 29
4.5. About SBUs .............................................................................................................................................. 30
4.6. About the Test Suites ............................................................................................................................... 31
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.32 - Pass 1 ............................................................................................................................... 36
5.5. GCC-9.2.0 - Pass 1 ................................................................................................................................... 38
5.6. Linux-5.2.8 API Headers .......................................................................................................................... 41
5.7. Glibc-2.30 ................................................................................................................................................. 42
iii
Linux From Scratch - Version 9.0
5.8. Libstdc++ from GCC-9.2.0 ...................................................................................................................... 44
5.9. Binutils-2.32 - Pass 2 ............................................................................................................................... 46
5.10. GCC-9.2.0 - Pass 2 ................................................................................................................................. 48
5.11. Tcl-8.6.9 .................................................................................................................................................. 51
5.12. Expect-5.45.4 .......................................................................................................................................... 53
5.13. DejaGNU-1.6.2 ....................................................................................................................................... 55
5.14. M4-1.4.18 ................................................................................................................................................ 56
5.15. Ncurses-6.1 .............................................................................................................................................. 57
5.16. Bash-5.0 .................................................................................................................................................. 58
5.17. Bison-3.4.1 .............................................................................................................................................. 59
5.18. Bzip2-1.0.8 .............................................................................................................................................. 60
5.19. Coreutils-8.31 .......................................................................................................................................... 61
5.20. Diffutils-3.7 ............................................................................................................................................. 62
5.21. File-5.37 .................................................................................................................................................. 63
5.22. Findutils-4.6.0 ......................................................................................................................................... 64
5.23. Gawk-5.0.1 .............................................................................................................................................. 65
5.24. Gettext-0.20.1 .......................................................................................................................................... 66
5.25. Grep-3.3 .................................................................................................................................................. 67
5.26. Gzip-1.10 ................................................................................................................................................. 68
5.27. Make-4.2.1 .............................................................................................................................................. 69
5.28. Patch-2.7.6 ............................................................................................................................................... 70
5.29. Perl-5.30.0 ............................................................................................................................................... 71
5.30. Python-3.7.4 ............................................................................................................................................ 72
5.31. Sed-4.7 .................................................................................................................................................... 73
5.32. Tar-1.32 ................................................................................................................................................... 74
5.33. Texinfo-6.6 .............................................................................................................................................. 75
5.34. Xz-5.2.4 ................................................................................................................................................... 76
5.35. Stripping .................................................................................................................................................. 77
5.36. Changing Ownership .............................................................................................................................. 77
III. Building the LFS System ...................................................................................................................................... 78
6. Installing Basic System Software ...................................................................................................................... 79
6.1. Introduction ............................................................................................................................................... 79
6.2. Preparing Virtual Kernel File Systems .................................................................................................... 80
6.3. Package Management ............................................................................................................................... 81
6.4. Entering the Chroot Environment ............................................................................................................ 84
6.5. Creating Directories .................................................................................................................................. 85
6.6. Creating Essential Files and Symlinks ..................................................................................................... 86
6.7. Linux-5.2.8 API Headers .......................................................................................................................... 89
6.8. Man-pages-5.02 ......................................................................................................................................... 90
6.9. Glibc-2.30 ................................................................................................................................................. 91
6.10. Adjusting the Toolchain ......................................................................................................................... 99
6.11. Zlib-1.2.11 ............................................................................................................................................. 101
6.12. File-5.37 ................................................................................................................................................ 102
6.13. Readline-8.0 .......................................................................................................................................... 103
6.14. M4-1.4.18 .............................................................................................................................................. 105
6.15. Bc-2.1.3 ................................................................................................................................................. 106
6.16. Binutils-2.32 .......................................................................................................................................... 107
iv
Linux From Scratch - Version 9.0
6.17.
6.18.
6.19.
6.20.
6.21.
6.22.
6.23.
6.24.
6.25.
6.26.
6.27.
6.28.
6.29.
6.30.
6.31.
6.32.
6.33.
6.34.
6.35.
6.36.
6.37.
6.38.
6.39.
6.40.
6.41.
6.42.
6.43.
6.44.
6.45.
6.46.
6.47.
6.48.
6.49.
6.50.
6.51.
6.52.
6.53.
6.54.
6.55.
6.56.
6.57.
6.58.
6.59.
6.60.
6.61.
6.62.
6.63.
GMP-6.1.2 .............................................................................................................................................
MPFR-4.0.2 ...........................................................................................................................................
MPC-1.1.0 .............................................................................................................................................
Shadow-4.7 ............................................................................................................................................
GCC-9.2.0 .............................................................................................................................................
Bzip2-1.0.8 ............................................................................................................................................
Pkg-config-0.29.2 ..................................................................................................................................
Ncurses-6.1 ............................................................................................................................................
Attr-2.4.48 .............................................................................................................................................
Acl-2.2.53 ..............................................................................................................................................
Libcap-2.27 ...........................................................................................................................................
Sed-4.7 ..................................................................................................................................................
Psmisc-23.2 ...........................................................................................................................................
Iana-Etc-2.30 .........................................................................................................................................
Bison-3.4.1 ............................................................................................................................................
Flex-2.6.4 ..............................................................................................................................................
Grep-3.3 ................................................................................................................................................
Bash-5.0 ................................................................................................................................................
Libtool-2.4.6 ..........................................................................................................................................
GDBM-1.18.1 .......................................................................................................................................
Gperf-3.1 ...............................................................................................................................................
Expat-2.2.7 ............................................................................................................................................
Inetutils-1.9.4 ........................................................................................................................................
Perl-5.30.0 .............................................................................................................................................
XML::Parser-2.44 .................................................................................................................................
Intltool-0.51.0 ........................................................................................................................................
Autoconf-2.69 .......................................................................................................................................
Automake-1.16.1 ...................................................................................................................................
Xz-5.2.4 .................................................................................................................................................
Kmod-26 ...............................................................................................................................................
Gettext-0.20.1 ........................................................................................................................................
Libelf from Elfutils-0.177 ....................................................................................................................
Libffi-3.2.1 ............................................................................................................................................
OpenSSL-1.1.1c ....................................................................................................................................
Python-3.7.4 ..........................................................................................................................................
Ninja-1.9.0 .............................................................................................................................................
Meson-0.51.1 .........................................................................................................................................
Coreutils-8.31 ........................................................................................................................................
Check-0.12.0 .........................................................................................................................................
Diffutils-3.7 ...........................................................................................................................................
Gawk-5.0.1 ............................................................................................................................................
Findutils-4.6.0 .......................................................................................................................................
Groff-1.22.4 ...........................................................................................................................................
GRUB-2.04 ...........................................................................................................................................
Less-551 ................................................................................................................................................
Gzip-1.10 ...............................................................................................................................................
IPRoute2-5.2.0 ......................................................................................................................................
v
110
112
113
114
118
123
125
126
129
130
131
132
133
134
135
136
137
138
140
141
142
143
144
146
149
150
151
153
154
156
158
160
161
163
165
167
169
170
176
177
178
179
181
184
186
187
189
Zgłoś jeśli naruszono regulamin