- Timestamp:
- 09/02/2003 10:03:51 PM (21 years ago)
- Branches:
- 10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 6.0, 6.1, 6.1.1, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, v5_0, v5_1, v5_1_1, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
- Children:
- cd8e54e
- Parents:
- 40add94
- Location:
- chapter05
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter05/adding-user.xml
r40add94 r148bb04 15 15 16 16 <para>Now grant this new user <emphasis>lfs</emphasis> full access to 17 <filename class="directory">$LFS/ stage1</filename> by giving it ownership17 <filename class="directory">$LFS/tools</filename> by giving it ownership 18 18 of the directory:</para> 19 19 20 <para><screen><userinput>chown lfs $LFS/ stage1</userinput></screen></para>20 <para><screen><userinput>chown lfs $LFS/tools</userinput></screen></para> 21 21 22 22 <para>Next, login as user <emphasis>lfs</emphasis>. This can be done via a -
chapter05/bash-inst.xml
r40add94 r148bb04 11 11 <para>Now prepare Bash for compilation:</para> 12 12 13 <para><screen><userinput>./configure --prefix=/ stage1--with-curses</userinput></screen></para>13 <para><screen><userinput>./configure --prefix=/tools --with-curses</userinput></screen></para> 14 14 15 15 <para>Compile the program:</para> … … 28 28 for a shell:</para> 29 29 30 <para><screen><userinput>ln -s bash / stage1/bin/sh</userinput></screen></para>30 <para><screen><userinput>ln -s bash /tools/bin/sh</userinput></screen></para> 31 31 32 32 </sect2> -
chapter05/binutils-pass1-inst.xml
r40add94 r148bb04 23 23 24 24 <para><screen><userinput>../binutils-&binutils-version;/configure \ 25 --prefix=/ stage1--disable-nls</userinput></screen></para>25 --prefix=/tools --disable-nls</userinput></screen></para> 26 26 27 27 <para>The meaning of the configure switches:</para> 28 28 29 29 <itemizedlist> 30 <listitem><para><userinput>--prefix=/ stage1</userinput>: This tells the30 <listitem><para><userinput>--prefix=/tools</userinput>: This tells the 31 31 configure script to prepare to install the Binutils programs in the 32 <filename>/ stage1</filename> directory.</para></listitem>32 <filename>/tools</filename> directory.</para></listitem> 33 33 <listitem><para><userinput>--disable-nls</userinput>: This disables 34 34 internationalization (a word often shortened to i18n). We don't need this … … 58 58 59 59 <para><screen><userinput>make -C ld clean 60 make -C ld LIB_PATH=/ stage1/lib</userinput></screen></para>60 make -C ld LIB_PATH=/tools/lib</userinput></screen></para> 61 61 62 62 <para><emphasis>Do not yet remove</emphasis> the Binutils build and source -
chapter05/binutils-pass2-inst.xml
r40add94 r148bb04 11 11 <para>Now prepare Binutils to be compiled:</para> 12 12 13 <para><screen><userinput>../binutils-&binutils-version;/configure --prefix=/ stage1\14 --enable-shared --with-lib-path=/ stage1/lib</userinput></screen></para>13 <para><screen><userinput>../binutils-&binutils-version;/configure --prefix=/tools \ 14 --enable-shared --with-lib-path=/tools/lib</userinput></screen></para> 15 15 16 16 <para>Before starting to build Binutils, remember to unset any environment -
chapter05/bzip2-inst.xml
r40add94 r148bb04 7 7 script. Compile and install it with a straightforward:</para> 8 8 9 <para><screen><userinput>make PREFIX=/ stage1install</userinput></screen></para>9 <para><screen><userinput>make PREFIX=/tools install</userinput></screen></para> 10 10 11 11 </sect2> -
chapter05/chapter05.xml
r40add94 r148bb04 5 5 &c5-introduction; 6 6 &c5-whystatic; 7 &c5-creating stage1dir;7 &c5-creatingtoolsdir; 8 8 &c5-addinguser; 9 9 &c5-settingenviron; … … 46 46 symbols like this:</para> 47 47 48 <para><screen><userinput>strip --strip-unneeded / stage1/{,s}bin/*49 strip --strip-debug / stage1/lib/*</userinput></screen></para>48 <para><screen><userinput>strip --strip-unneeded /tools/{,s}bin/* 49 strip --strip-debug /tools/lib/*</userinput></screen></para> 50 50 51 51 <para>The first of the above commands will skip some twenty files, reporting … … 60 60 and some of the bigger unneeded programs:</para> 61 61 62 <para><screen><userinput>rm -r / stage1/share/{doc,info,man}63 rm / stage1/bin/{addr2line,gprof,nm,size,strings,strip}</userinput></screen></para>62 <para><screen><userinput>rm -r /tools/share/{doc,info,man} 63 rm /tools/bin/{addr2line,gprof,nm,size,strings,strip}</userinput></screen></para> 64 64 65 65 <para>You will now need to have at least 700 MB of free space on your LFS -
chapter05/coreutils-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Coreutils to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Compile the package:</para> -
chapter05/creatingstage1dir.xml
r40add94 r148bb04 1 <sect1 id="ch05-creating stage1dir">2 <title>Creating the $LFS/ stage1directory</title>3 <?dbhtml filename="creating stage1dir.html" dir="chapter05"?>1 <sect1 id="ch05-creatingtoolsdir"> 2 <title>Creating the $LFS/tools directory</title> 3 <?dbhtml filename="creatingtoolsdir.html" dir="chapter05"?> 4 4 5 5 <para>All programs compiled in this chapter will be installed under <filename 6 class="directory">$LFS/ stage1</filename> to keep them separate from the6 class="directory">$LFS/tools</filename> to keep them separate from the 7 7 programs compiled in the next chapter. The programs compiled here are only 8 8 temporary tools and won't be a part of the final LFS system and by keeping them 9 in a separate directory, we can later easily throw them away. Create the 10 required directory by running the following:</para> 9 in a separate directory, we can later easily throw them away.</para> 11 10 12 <para><screen><userinput>mkdir $LFS/stage1</userinput></screen></para> 11 <para>If later you wish to search through the binaries of your system to see 12 what files they make use of or link against, then to make this searching easier 13 you may want to choose a unique name. Instead of the simple "tools" you could 14 use something like "tools-for-lfs".</para> 13 15 14 <para>The next step is to create a <filename>/stage1</filename> symlink on 16 <para>Create the required directory by running the following:</para> 17 18 <para><screen><userinput>mkdir $LFS/tools</userinput></screen></para> 19 20 <para>The next step is to create a <filename>/tools</filename> symlink on 15 21 your host system. It will point to the directory we just created on the LFS 16 22 partition:</para> 17 23 18 <para><screen><userinput>ln -s $LFS/ stage1/</userinput></screen></para>24 <para><screen><userinput>ln -s $LFS/tools /</userinput></screen></para> 19 25 20 26 <para>This symlink enables us to compile our toolchain so that it always 21 refers to <filename>/ stage1</filename>, meaning that the compiler, assembler27 refers to <filename>/tools</filename>, meaning that the compiler, assembler 22 28 and linker will work both in this chapter (when we are still using some tools 23 29 from the host) <emphasis>and</emphasis> in the next (when we are chrooted to -
chapter05/dejagnu-inst.xml
r40add94 r148bb04 6 6 <para>Prepare DejaGNU to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Build and install the package:</para> -
chapter05/diffutils-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Diffutils to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Compile the package:</para> -
chapter05/expect-inst.xml
r40add94 r148bb04 13 13 <para>Now prepare Expect to be compiled:</para> 14 14 15 <para><screen><userinput>./configure --prefix=/ stage1 --with-tcl=/stage1/lib --with-x=no</userinput></screen></para>15 <para><screen><userinput>./configure --prefix=/tools --with-tcl=/tools/lib --with-x=no</userinput></screen></para> 16 16 17 17 <para>Build, test, and install the package:</para> -
chapter05/findutils-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Findutils to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Compile the package:</para> -
chapter05/gawk-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Gawk to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Compile the package:</para> -
chapter05/gcc-pass1-inst.xml
r40add94 r148bb04 21 21 <para>Prepare GCC to be compiled:</para> 22 22 23 <para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/ stage1\24 --with-local-prefix=/ stage1\23 <para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/tools \ 24 --with-local-prefix=/tools \ 25 25 --disable-nls --enable-shared \ 26 26 --enable-languages=c</userinput></screen></para> … … 29 29 30 30 <itemizedlist> 31 <listitem><para><userinput>--with-local-prefix=/ stage1</userinput>: The31 <listitem><para><userinput>--with-local-prefix=/tools</userinput>: The 32 32 purpose of this switch is to remove <filename>/usr/local/include</filename> 33 33 from <userinput>gcc</userinput>'s include search path. This is not absolutely … … 72 72 73 73 <para>As a finishing touch we'll create the <filename 74 class="symlink">/ stage1/bin/cc</filename> symlink. Many programs and74 class="symlink">/tools/bin/cc</filename> symlink. Many programs and 75 75 scripts run <userinput>cc</userinput> instead of <userinput>gcc</userinput>, 76 76 a thing meant to keep programs generic and therefore usable on all kinds of … … 79 79 C compiler to install, as long as there's a symlink pointing to it:</para> 80 80 81 <para><screen><userinput>ln -sf gcc / stage1/bin/cc</userinput></screen></para>81 <para><screen><userinput>ln -sf gcc /tools/bin/cc</userinput></screen></para> 82 82 83 83 </sect2> -
chapter05/gcc-pass2-inst.xml
r40add94 r148bb04 25 25 26 26 <para>The last patch changes GCC's default location of the dynamic linker, 27 a simple substitution of "/lib/ld-linux.so.2" with "/ stage1/lib/ld-linux.so.2"27 a simple substitution of "/lib/ld-linux.so.2" with "/tools/lib/ld-linux.so.2" 28 28 in <filename>config/i386/linux.h</filename>. Patching now rather than adjusting 29 29 the specs file after installation ensures that our new dynamic linker gets … … 41 41 <para>Now prepare GCC to be compiled:</para> 42 42 43 <para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/ stage1\44 --with-local-prefix=/ stage1\43 <para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/tools \ 44 --with-local-prefix=/tools \ 45 45 --enable-clocale=gnu --enable-shared \ 46 46 --enable-threads=posix --enable-__cxa_atexit \ -
chapter05/gettext-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Gettext to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Compile the programs:</para> -
chapter05/glibc-inst.xml
r40add94 r148bb04 22 22 Fix this annoying little error with:</para> 23 23 24 <para><screen><userinput>mkdir / stage1/etc25 touch / stage1/etc/ld.so.conf</userinput></screen></para>24 <para><screen><userinput>mkdir /tools/etc 25 touch /tools/etc/ld.so.conf</userinput></screen></para> 26 26 27 27 <para>Also, Glibc has a subtle problem when compiled with GCC 3.3.1. … … 39 39 <para>Next, prepare Glibc to be compiled:</para> 40 40 41 <para><screen><userinput>../glibc-&glibc-version;/configure --prefix=/ stage1\41 <para><screen><userinput>../glibc-&glibc-version;/configure --prefix=/tools \ 42 42 --disable-profile --enable-add-ons \ 43 --with-headers=/ stage1/include \44 --with-binutils=/ stage1/bin \43 --with-headers=/tools/include \ 44 --with-binutils=/tools/bin \ 45 45 --without-gd</userinput></screen></para> 46 46 … … 55 55 add-ons that were installed with Glibc, in our case Linuxthreads.</para></listitem> 56 56 57 <listitem><para><userinput>--with-binutils=/ stage1/bin</userinput> and58 <userinput>--with-headers=/ stage1/include</userinput>: Strictly speaking57 <listitem><para><userinput>--with-binutils=/tools/bin</userinput> and 58 <userinput>--with-headers=/tools/include</userinput>: Strictly speaking 59 59 these switches are not required. But they ensure nothing can go wrong with 60 60 regard to what kernel headers and Binutils programs get used during the -
chapter05/grep-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Grep to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1\8 <para><screen><userinput>./configure --prefix=/tools \ 9 9 --disable-perl-regexp --with-included-regex</userinput></screen></para> 10 10 -
chapter05/gzip-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Gzip to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Compile the package:</para> -
chapter05/introduction.xml
r40add94 r148bb04 13 13 14 14 <para>The files compiled in this chapter will be installed under the 15 <filename class="directory">$LFS/ stage1</filename> directory,15 <filename class="directory">$LFS/tools</filename> directory, 16 16 to keep them separate from the files installed in the next chapter. 17 17 Since the packages compiled here are merely temporary, we don't want -
chapter05/kernelheaders-inst.xml
r40add94 r148bb04 28 28 <para>Install the platform-specific header files:</para> 29 29 30 <para><screen><userinput>mkdir / stage1/include/asm31 cp include/asm/* / stage1/include/asm32 cp -R include/asm-generic / stage1/include</userinput></screen></para>30 <para><screen><userinput>mkdir /tools/include/asm 31 cp include/asm/* /tools/include/asm 32 cp -R include/asm-generic /tools/include</userinput></screen></para> 33 33 34 34 <para>Install the cross-platform kernel header files:</para> 35 35 36 <para><screen><userinput>cp -R include/linux / stage1/include</userinput></screen></para>36 <para><screen><userinput>cp -R include/linux /tools/include</userinput></screen></para> 37 37 38 38 <para>There are a few kernel header files which make use of the … … 41 41 failures. Create an empty <filename>autoconf.h</filename> file:</para> 42 42 43 <para><screen><userinput>touch / stage1/include/linux/autoconf.h</userinput></screen></para>43 <para><screen><userinput>touch /tools/include/linux/autoconf.h</userinput></screen></para> 44 44 45 45 </sect2> -
chapter05/lockingglibc.xml
r40add94 r148bb04 18 18 <filename>/usr/lib</filename> or <filename>/usr/local/lib</filename>. 19 19 From this point onwards everything will link <emphasis>only</emphasis> 20 against the libraries in <filename>/ stage1/lib</filename>.</para>20 against the libraries in <filename>/tools/lib</filename>.</para> 21 21 22 22 <para>You can now remove Binutils' build and source directories.</para> … … 25 25 to the new dynamic linker. A simple sed will accomplish this:</para> 26 26 27 <para><screen><userinput>SPECFILE=/ stage1/lib/gcc-lib/*/*/specs28 sed -e 's@/lib/ld.so.1@/ stage1/lib/ld.so.1@g' \29 -e 's@/lib/ld-linux.so.2@/ stage1/lib/ld-linux.so.2@g' \27 <para><screen><userinput>SPECFILE=/tools/lib/gcc-lib/*/*/specs 28 sed -e 's@/lib/ld.so.1@/tools/lib/ld.so.1@g' \ 29 -e 's@/lib/ld-linux.so.2@/tools/lib/ld-linux.so.2@g' \ 30 30 $SPECFILE > tempspecfile 31 31 mv tempspecfile $SPECFILE … … 34 34 <para>We recommend that you cut-and-paste the above rather than try and type 35 35 it all in. Or you can edit the specs file by hand if you want to: just replace 36 "/lib/ld-linux.so.2" with "/ stage1/lib/ld-linux.so.2".</para>36 "/lib/ld-linux.so.2" with "/tools/lib/ld-linux.so.2".</para> 37 37 38 38 <para>Lastly, there is a possibility that some include files from the host … … 42 42 following commands to eliminate this possibility.</para> 43 43 44 <para><screen><userinput>rm -f / stage1/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen></para>44 <para><screen><userinput>rm -f /tools/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen></para> 45 45 46 46 <para>This completes the installation of the self-contained toolchain, which -
chapter05/make-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Make to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Compile the program:</para> -
chapter05/ncurses-inst.xml
r40add94 r148bb04 15 15 <para>Now prepare Ncurses to be compiled:</para> 16 16 17 <para><screen><userinput>./configure --prefix=/ stage1--with-shared \17 <para><screen><userinput>./configure --prefix=/tools --with-shared \ 18 18 --without-debug --without-ada</userinput></screen></para> 19 19 -
chapter05/patch-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Patch to be compiled:</para> 7 7 8 <para><screen><userinput>CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>The preprocessor flag <userinput>-D_GNU_SOURCE</userinput> is only needed -
chapter05/perl-inst.xml
r40add94 r148bb04 14 14 <para>Now prepare Perl for compilation:</para> 15 15 16 <para><screen><userinput>./configure.gnu --prefix=/ stage1</userinput></screen></para>16 <para><screen><userinput>./configure.gnu --prefix=/tools</userinput></screen></para> 17 17 18 18 <para>Compile only the required tools:</para> … … 22 22 <para>Then copy these tools and their libraries:</para> 23 23 24 <para><screen><userinput>cp perl pod/pod2man / stage1/bin25 mkdir -p / stage1/lib/perl5/5.8.026 cp -R lib/* / stage1/lib/perl5/5.8.0</userinput></screen></para>24 <para><screen><userinput>cp perl pod/pod2man /tools/bin 25 mkdir -p /tools/lib/perl5/5.8.0 26 cp -R lib/* /tools/lib/perl5/5.8.0</userinput></screen></para> 27 27 28 28 </sect2> -
chapter05/sed-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Sed to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Compile the program:</para> -
chapter05/setting-environment.xml
r40add94 r148bb04 11 11 LFS=/mnt/lfs 12 12 LC_ALL=POSIX 13 PATH=/ stage1/bin:$PATH13 PATH=/tools/bin:$PATH 14 14 export LFS LC_ALL PATH 15 15 EOF … … 43 43 everything will work as expected in the chroot environment.</para> 44 44 45 <para>We prepend <filename>/ stage1/bin</filename> to the standard PATH so45 <para>We prepend <filename>/tools/bin</filename> to the standard PATH so 46 46 that, as we move along through this chapter, the tools we build will get used 47 47 during the rest of the building process.</para> -
chapter05/tar-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Tar to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Compile the programs:</para> -
chapter05/tcl-inst.xml
r40add94 r148bb04 12 12 13 13 <para><screen><userinput>cd unix 14 ./configure --prefix=/ stage1</userinput></screen></para>14 ./configure --prefix=/tools</userinput></screen></para> 15 15 16 16 <para>Build, test, and install the package:</para> … … 25 25 26 26 <para>Make a link:</para> 27 <para><screen><userinput>ln -s tclsh8.4 / stage1/bin/tclsh</userinput></screen></para>27 <para><screen><userinput>ln -s tclsh8.4 /tools/bin/tclsh</userinput></screen></para> 28 28 29 29 <caution><para><emphasis>Do not remove</emphasis> the -
chapter05/texinfo-inst.xml
r40add94 r148bb04 6 6 <para>Prepare Texinfo to be compiled:</para> 7 7 8 <para><screen><userinput>./configure --prefix=/ stage1</userinput></screen></para>8 <para><screen><userinput>./configure --prefix=/tools</userinput></screen></para> 9 9 10 10 <para>Compile the programs:</para> -
chapter05/utillinux-inst.xml
r40add94 r148bb04 20 20 <para>Now copy these programs to the temporary tools directory:</para> 21 21 22 <para><screen><userinput>cp mount/{,u}mount text-utils/more / stage1/bin</userinput></screen></para>22 <para><screen><userinput>cp mount/{,u}mount text-utils/more /tools/bin</userinput></screen></para> 23 23 24 24 </sect2>
Note:
See TracChangeset
for help on using the changeset viewer.