Linux_from_scratch.pdf

(932 KB) Pobierz
Linux From Scratch
Linux From Scratch
Version 5.0
Gerard Beekmans
Copyright © 1999−2003 Gerard Beekmans
This book describes the process of creating a Linux system from scratch, using nothing but the sources of the
required software.
Copyright (c) 1999−2003, Gerard Beekmans
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
·
Redistributions in any form must retain the above copyright notice, this list of conditions and the
following disclaimer.
·
Neither the name of "Linux From Scratch" nor the names of its contributors may be used to endorse
or promote products derived from this material without specific prior written permission.
·
Any material derived from Linux From Scratch must contain a reference to the "Linux From Scratch"
project.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Dedication
This book is dedicated to my loving and supportive wife Beverly Beekmans .
Linux From Scratch
Table of Contents
Preface. .................................................................................................................................................................1
1. Foreword. .............................................................................................................................................1
2. Audience. .............................................................................................................................................1
2.1. Who would want to read this book. ............................................................................................1
2.2. Who would not want to read this book. ......................................................................................2
3. Prerequisites. ........................................................................................................................................2
4. Structure. ..............................................................................................................................................3
4.1. Part I − Introduction. ..................................................................................................................3
4.2. Part II − Preparing for the build. ................................................................................................3
4.3. Part III − Building the LFS system. ...........................................................................................3
4.4. Part IV − Appendices. ................................................................................................................3
I. Part I − Introduction. ......................................................................................................................................4
Chapter 1. Introduction. .....................................................................................................................................5
1.1. How things are going to be done. .....................................................................................................5
1.2. Conventions used in this book. .........................................................................................................6
1.3. Book version. ....................................................................................................................................6
1.4. Changelog. ........................................................................................................................................7
1.5. Resources. .......................................................................................................................................16
1.5.1. FAQ. ......................................................................................................................................16
1.5.2. IRC. .......................................................................................................................................16
1.5.3. Mailing lists. ..........................................................................................................................16
1.5.4. News server. ..........................................................................................................................16
1.5.5. Mirror sites. ...........................................................................................................................17
1.5.6. Contact information. ..............................................................................................................17
1.6. Acknowledgments.. .........................................................................................................................17
1.6.1. Current Project Team Members. ...........................................................................................17
1.6.2. Translators. ............................................................................................................................18
1.6.3. Mirror Maintainers. ...............................................................................................................18
1.6.4. Donators. ...............................................................................................................................18
1.6.5. Former Team Members and Contributors. ............................................................................19
Chapter 2. Important information. .................................................................................................................20
2.1. About $LFS. ....................................................................................................................................20
2.2. About SBUs. ...................................................................................................................................20
2.3. About the test suites. .......................................................................................................................21
2.4. How to ask for help. ........................................................................................................................21
2.4.1. Things to mention. .................................................................................................................21
2.4.2. Configure problems. ..............................................................................................................21
2.4.3. Compile problems. ................................................................................................................22
2.4.4. Test suite problems. ...............................................................................................................22
II. Part II − Preparing for the build. ...............................................................................................................23
Chapter 3. Preparing a new partition. ............................................................................................................24
3.1. Introduction. ....................................................................................................................................24
3.2. Creating a new partition. .................................................................................................................24
i
74605198.001.png
Linux From Scratch
Table of Contents
3.3. Creating a file system on the new partition. ...................................................................................24
3.4. Mounting the new partition. ............................................................................................................25
Chapter 4. The materials: packages and patches. .........................................................................................26
4.1. Introduction. ....................................................................................................................................26
4.2. All the packages. .............................................................................................................................26
4.3. Needed patches. ..............................................................................................................................30
Chapter 5. Constructing a temporary system. ...............................................................................................33
5.1. Introduction. ....................................................................................................................................33
5.2. Toolchain technical notes ...............................................................................................................33
5.2.1. Notes on static linking. ..........................................................................................................35
5.3. Creating the $LFS/tools directory. ..................................................................................................36
5.4. Adding the user lfs. .........................................................................................................................37
5.5. Setting up the environment. ............................................................................................................37
5.6. Installing Binutils−2.14 − Pass 1. ...................................................................................................38
5.6.1. Contents of Binutils. ..............................................................................................................38
5.6.2.. ...............................................................................................................................................38
5.6.3. Binutils Installation Dependencies. .......................................................................................38
5.6.4.. ...............................................................................................................................................38
5.6.5. Installation of Binutils. ..........................................................................................................38
5.7. Installing GCC−3.3.1 − Pass 1. .......................................................................................................40
5.7.1. Contents of GCC. ..................................................................................................................40
5.7.2.. ...............................................................................................................................................40
5.7.3. GCC Installation Dependencies. ...........................................................................................40
5.7.4.. ...............................................................................................................................................40
5.7.5. Installation of GCC ...............................................................................................................40
5.8. Installing Linux−2.4.22 headers. ....................................................................................................41
5.8.1. Contents of Linux. .................................................................................................................42
5.8.2.. ...............................................................................................................................................42
5.8.3. Linux Installation Dependencies. ..........................................................................................42
5.8.4.. ...............................................................................................................................................42
5.8.5. Installation of the kernel headers.. .........................................................................................42
5.9. Installing Glibc−2.3.2. ....................................................................................................................43
5.9.1. Contents of Glibc.. .................................................................................................................43
5.9.2.. ...............................................................................................................................................43
5.9.3. Glibc Installation Dependencies. ...........................................................................................43
5.9.4.. ...............................................................................................................................................43
5.9.5. Glibc installation. ..................................................................................................................43
5.10. "Locking in" Glibc. .......................................................................................................................46
5.11. Installing Tcl−8.4.4. ......................................................................................................................47
5.11.1. Contents of Tcl. ...................................................................................................................47
5.11.2.. .............................................................................................................................................47
5.11.3. Tcl Installation Dependencies. ............................................................................................47
5.11.4.. .............................................................................................................................................47
5.11.5. Installation of Tcl. ...............................................................................................................48
5.12. Installing Expect−5.39.0. ..............................................................................................................48
ii
74605198.002.png
Linux From Scratch
Table of Contents
5.12.1. Contents of Expect. .............................................................................................................49
5.12.2.. .............................................................................................................................................49
5.12.3. Expect Installation Dependencies .......................................................................................49
5.12.4.. .............................................................................................................................................49
5.12.5. Installation of Expec.. .........................................................................................................49
5.13. Installing DejaGnu−1.4.3. .............................................................................................................50
5.13.1. Contents of DejaGnu. ..........................................................................................................50
5.13.2.. .............................................................................................................................................50
5.13.3. DejaGnu Installation Dependencies. ...................................................................................50
5.13.4.. .............................................................................................................................................50
5.13.5. Installation of DejaGnu. ......................................................................................................50
5.14. Installing GCC−3.3.1 − Pass 2. .....................................................................................................50
5.14.1.. .............................................................................................................................................50
5.14.2. Re−installation of GCC. ......................................................................................................51
5.15. Installing Binutils−2.14 − Pass 2. .................................................................................................53
5.15.1.. .............................................................................................................................................53
5.15.2. Re−installation of Binutils. .................................................................................................53
5.16. Installing Gawk−3.1.3.. .................................................................................................................54
5.16.1. Contents of Gawk. ...............................................................................................................54
5.16.2.. .............................................................................................................................................54
5.16.3. Gawk Installation Dependencies. ........................................................................................54
5.16.4.. .............................................................................................................................................55
5.16.5. Installation of Gawk. ...........................................................................................................55
5.17. Installing Coreutils−5.0 ................................................................................................................55
5.17.1. Contents of Coreutils. ..........................................................................................................55
5.17.2.. .............................................................................................................................................55
5.17.3. Coreutils Installation Dependencies. ...................................................................................55
5.17.4.. .............................................................................................................................................55
5.17.5. Installation of Coreutils. ......................................................................................................56
5.18. Installing Bzip2−1.0.2.. .................................................................................................................56
5.18.1. Contents of Bzip2. ...............................................................................................................56
5.18.2.. .............................................................................................................................................56
5.18.3. Bzip2 Installation Dependencies. ........................................................................................56
5.18.4.. .............................................................................................................................................57
5.18.5. Installation of Bzip2. ...........................................................................................................57
5.19. Installing Gzip−1.3.5. ...................................................................................................................57
5.19.1. Contents of Gzip. .................................................................................................................57
5.19.2.. .............................................................................................................................................57
5.19.3. Gzip Installation Dependencies. ..........................................................................................57
5.19.4.. .............................................................................................................................................57
5.19.5. Installation of Gzip. .............................................................................................................57
5.20. Installing Diffutils−2.8.1.. .............................................................................................................57
5.20.1. Contents of Diffutils. ...........................................................................................................58
5.20.2.. .............................................................................................................................................58
5.20.3. Diffutils Installation Dependencies. ....................................................................................58
5.20.4.. .............................................................................................................................................58
5.20.5. Installation of Diffutils. .......................................................................................................58
iii
74605198.003.png
Linux From Scratch
Table of Contents
5.21. Installing Findutils−4.1.20. ...........................................................................................................58
5.21.1. Contents of Findutils. ..........................................................................................................58
5.21.2.. .............................................................................................................................................58
5.21.3. Findutils Installation Dependencies. ...................................................................................59
5.21.4.. .............................................................................................................................................59
5.21.5. Installing Findutils. ..............................................................................................................59
5.22. Installing Make−3.80. ...................................................................................................................59
5.22.1. Contents of Make. ...............................................................................................................59
5.22.2.. .............................................................................................................................................59
5.22.3. Make Installation Dependencies. ........................................................................................59
5.22.4.. .............................................................................................................................................60
5.22.5. Installation of Make. ............................................................................................................60
5.23. Installing Grep−2.5.1. ...................................................................................................................60
5.23.1. Contents of Grep. ................................................................................................................60
5.23.2.. .............................................................................................................................................60
5.23.3. Grep Installation Dependencies.. .........................................................................................60
5.23.4.. .............................................................................................................................................60
5.23.5. Installation of Grep. .............................................................................................................60
5.24. Installing Sed−4.0.7. .....................................................................................................................61
5.24.1. Contents of Sed ...................................................................................................................61
5.24.2.. .............................................................................................................................................61
5.24.3. Sed Installation Dependencies. ............................................................................................61
5.24.4.. .............................................................................................................................................61
5.24.5. Installation of Sed. ...............................................................................................................61
5.25. Installing Gettext−0.12.1. .............................................................................................................62
5.25.1. Contents of Gettex. .............................................................................................................62
5.25.2.. .............................................................................................................................................62
5.25.3. Gettext Installation Dependencies. ......................................................................................62
5.25.4.. .............................................................................................................................................62
5.25.5. Installation of Gettext. .........................................................................................................62
5.26. Installing Ncurses−5.3. .................................................................................................................63
5.26.1. Contents of Ncurses. ............................................................................................................63
5.26.2.. .............................................................................................................................................63
5.26.3. Ncurses Installation Dependencies. .....................................................................................63
5.26.4.. .............................................................................................................................................63
5.26.5. Installation of Ncurses. ........................................................................................................63
5.27. Installing Patch−2.5.4. ..................................................................................................................64
5.27.1. Contents of Patch. ................................................................................................................64
5.27.2.. .............................................................................................................................................64
5.27.3. Patch Installation Dependencies. .........................................................................................64
5.27.4.. .............................................................................................................................................64
5.27.5. Installation of Patch. ............................................................................................................64
5.28. Installing Tar−1.13.25.. .................................................................................................................65
5.28.1. Contents of Tar. ...................................................................................................................65
5.28.2.. .............................................................................................................................................65
5.28.3. Tar Installation Dependencies. ............................................................................................65
5.28.4.. .............................................................................................................................................65
iv
74605198.004.png
Zgłoś jeśli naruszono regulamin