mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-03-06 06:14:47 +00:00
Renaming /stage1 to /tools.
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@2725 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
40add94459
commit
148bb04f80
@ -14,10 +14,10 @@ issue the following commands to add the new user:</para>
|
||||
passwd lfs</userinput></screen></para>
|
||||
|
||||
<para>Now grant this new user <emphasis>lfs</emphasis> full access to
|
||||
<filename class="directory">$LFS/stage1</filename> by giving it ownership
|
||||
<filename class="directory">$LFS/tools</filename> by giving it ownership
|
||||
of the directory:</para>
|
||||
|
||||
<para><screen><userinput>chown lfs $LFS/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>chown lfs $LFS/tools</userinput></screen></para>
|
||||
|
||||
<para>Next, login as user <emphasis>lfs</emphasis>. This can be done via a
|
||||
virtual console, through a display manager, or with the following substitute
|
||||
|
@ -10,7 +10,7 @@ patch:</para>
|
||||
|
||||
<para>Now prepare Bash for compilation:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1 --with-curses</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools --with-curses</userinput></screen></para>
|
||||
|
||||
<para>Compile the program:</para>
|
||||
|
||||
@ -27,7 +27,7 @@ patch:</para>
|
||||
<para>And make a link for the programs that use <userinput>sh</userinput>
|
||||
for a shell:</para>
|
||||
|
||||
<para><screen><userinput>ln -s bash /stage1/bin/sh</userinput></screen></para>
|
||||
<para><screen><userinput>ln -s bash /tools/bin/sh</userinput></screen></para>
|
||||
|
||||
</sect2>
|
||||
|
||||
|
@ -22,14 +22,14 @@ cd ../binutils-build</userinput></screen></para>
|
||||
<para>Next, prepare Binutils to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>../binutils-&binutils-version;/configure \
|
||||
--prefix=/stage1 --disable-nls</userinput></screen></para>
|
||||
--prefix=/tools --disable-nls</userinput></screen></para>
|
||||
|
||||
<para>The meaning of the configure switches:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para><userinput>--prefix=/stage1</userinput>: This tells the
|
||||
<listitem><para><userinput>--prefix=/tools</userinput>: This tells the
|
||||
configure script to prepare to install the Binutils programs in the
|
||||
<filename>/stage1</filename> directory.</para></listitem>
|
||||
<filename>/tools</filename> directory.</para></listitem>
|
||||
<listitem><para><userinput>--disable-nls</userinput>: This disables
|
||||
internationalization (a word often shortened to i18n). We don't need this
|
||||
for our static programs and <emphasis>nls</emphasis> often causes problems
|
||||
@ -57,7 +57,7 @@ statically.</para></listitem>
|
||||
on:</para>
|
||||
|
||||
<para><screen><userinput>make -C ld clean
|
||||
make -C ld LIB_PATH=/stage1/lib</userinput></screen></para>
|
||||
make -C ld LIB_PATH=/tools/lib</userinput></screen></para>
|
||||
|
||||
<para><emphasis>Do not yet remove</emphasis> the Binutils build and source
|
||||
directories. You will need them again in their current state a bit further on
|
||||
|
@ -10,8 +10,8 @@ cd ../binutils-build</userinput></screen></para>
|
||||
|
||||
<para>Now prepare Binutils to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>../binutils-&binutils-version;/configure --prefix=/stage1 \
|
||||
--enable-shared --with-lib-path=/stage1/lib</userinput></screen></para>
|
||||
<para><screen><userinput>../binutils-&binutils-version;/configure --prefix=/tools \
|
||||
--enable-shared --with-lib-path=/tools/lib</userinput></screen></para>
|
||||
|
||||
<para>Before starting to build Binutils, remember to unset any environment
|
||||
variables that override the default optimization flags.</para>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<para>The Bzip2 package doesn't contain a <userinput>configure</userinput>
|
||||
script. Compile and install it with a straightforward:</para>
|
||||
|
||||
<para><screen><userinput>make PREFIX=/stage1 install</userinput></screen></para>
|
||||
<para><screen><userinput>make PREFIX=/tools install</userinput></screen></para>
|
||||
|
||||
</sect2>
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
&c5-introduction;
|
||||
&c5-whystatic;
|
||||
&c5-creatingstage1dir;
|
||||
&c5-creatingtoolsdir;
|
||||
&c5-addinguser;
|
||||
&c5-settingenviron;
|
||||
&c5-binutils-pass1;
|
||||
@ -45,8 +45,8 @@ can throw away some unnecessary things. The executables and libraries you have
|
||||
built so far contain about 130 MB of unneeded debugging symbols. Remove those
|
||||
symbols like this:</para>
|
||||
|
||||
<para><screen><userinput>strip --strip-unneeded /stage1/{,s}bin/*
|
||||
strip --strip-debug /stage1/lib/*</userinput></screen></para>
|
||||
<para><screen><userinput>strip --strip-unneeded /tools/{,s}bin/*
|
||||
strip --strip-debug /tools/lib/*</userinput></screen></para>
|
||||
|
||||
<para>The first of the above commands will skip some twenty files, reporting
|
||||
that it doesn't recognize their file format. Most of them are scripts instead
|
||||
@ -59,8 +59,8 @@ destroyed and you would have to build Glibc all over again.</para>
|
||||
<para>To save another couple of megabytes, you can throw away the documentation
|
||||
and some of the bigger unneeded programs:</para>
|
||||
|
||||
<para><screen><userinput>rm -r /stage1/share/{doc,info,man}
|
||||
rm /stage1/bin/{addr2line,gprof,nm,size,strings,strip}</userinput></screen></para>
|
||||
<para><screen><userinput>rm -r /tools/share/{doc,info,man}
|
||||
rm /tools/bin/{addr2line,gprof,nm,size,strings,strip}</userinput></screen></para>
|
||||
|
||||
<para>You will now need to have at least 700 MB of free space on your LFS
|
||||
filesystem to be able to build and install Glibc in the next phase.</para>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Coreutils to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile the package:</para>
|
||||
|
||||
|
@ -1,24 +1,30 @@
|
||||
<sect1 id="ch05-creatingstage1dir">
|
||||
<title>Creating the $LFS/stage1 directory</title>
|
||||
<?dbhtml filename="creatingstage1dir.html" dir="chapter05"?>
|
||||
<sect1 id="ch05-creatingtoolsdir">
|
||||
<title>Creating the $LFS/tools directory</title>
|
||||
<?dbhtml filename="creatingtoolsdir.html" dir="chapter05"?>
|
||||
|
||||
<para>All programs compiled in this chapter will be installed under <filename
|
||||
class="directory">$LFS/stage1</filename> to keep them separate from the
|
||||
class="directory">$LFS/tools</filename> to keep them separate from the
|
||||
programs compiled in the next chapter. The programs compiled here are only
|
||||
temporary tools and won't be a part of the final LFS system and by keeping them
|
||||
in a separate directory, we can later easily throw them away. Create the
|
||||
required directory by running the following:</para>
|
||||
in a separate directory, we can later easily throw them away.</para>
|
||||
|
||||
<para><screen><userinput>mkdir $LFS/stage1</userinput></screen></para>
|
||||
<para>If later you wish to search through the binaries of your system to see
|
||||
what files they make use of or link against, then to make this searching easier
|
||||
you may want to choose a unique name. Instead of the simple "tools" you could
|
||||
use something like "tools-for-lfs".</para>
|
||||
|
||||
<para>The next step is to create a <filename>/stage1</filename> symlink on
|
||||
<para>Create the required directory by running the following:</para>
|
||||
|
||||
<para><screen><userinput>mkdir $LFS/tools</userinput></screen></para>
|
||||
|
||||
<para>The next step is to create a <filename>/tools</filename> symlink on
|
||||
your host system. It will point to the directory we just created on the LFS
|
||||
partition:</para>
|
||||
|
||||
<para><screen><userinput>ln -s $LFS/stage1 /</userinput></screen></para>
|
||||
<para><screen><userinput>ln -s $LFS/tools /</userinput></screen></para>
|
||||
|
||||
<para>This symlink enables us to compile our toolchain so that it always
|
||||
refers to <filename>/stage1</filename>, meaning that the compiler, assembler
|
||||
refers to <filename>/tools</filename>, meaning that the compiler, assembler
|
||||
and linker will work both in this chapter (when we are still using some tools
|
||||
from the host) <emphasis>and</emphasis> in the next (when we are chrooted to
|
||||
the LFS partition).</para>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare DejaGNU to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Build and install the package:</para>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Diffutils to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile the package:</para>
|
||||
|
||||
|
@ -12,7 +12,7 @@ GCC test suite run.</para>
|
||||
|
||||
<para>Now prepare Expect to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1 --with-tcl=/stage1/lib --with-x=no</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools --with-tcl=/tools/lib --with-x=no</userinput></screen></para>
|
||||
|
||||
<para>Build, test, and install the package:</para>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Findutils to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile the package:</para>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Gawk to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile the package:</para>
|
||||
|
||||
|
@ -20,15 +20,15 @@ cd ../gcc-build</userinput></screen></para>
|
||||
|
||||
<para>Prepare GCC to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/stage1 \
|
||||
--with-local-prefix=/stage1 \
|
||||
<para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/tools \
|
||||
--with-local-prefix=/tools \
|
||||
--disable-nls --enable-shared \
|
||||
--enable-languages=c</userinput></screen></para>
|
||||
|
||||
<para>The meaning of the new configure options:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para><userinput>--with-local-prefix=/stage1</userinput>: The
|
||||
<listitem><para><userinput>--with-local-prefix=/tools</userinput>: The
|
||||
purpose of this switch is to remove <filename>/usr/local/include</filename>
|
||||
from <userinput>gcc</userinput>'s include search path. This is not absolutely
|
||||
essential, but we want to try and minimize the influence from the host system,
|
||||
@ -71,14 +71,14 @@ compiled correctly.</para></listitem>
|
||||
<para><screen><userinput>make install</userinput></screen></para>
|
||||
|
||||
<para>As a finishing touch we'll create the <filename
|
||||
class="symlink">/stage1/bin/cc</filename> symlink. Many programs and
|
||||
class="symlink">/tools/bin/cc</filename> symlink. Many programs and
|
||||
scripts run <userinput>cc</userinput> instead of <userinput>gcc</userinput>,
|
||||
a thing meant to keep programs generic and therefore usable on all kinds of
|
||||
Unix systems. Not everybody has the GNU C compiler installed. Simply running
|
||||
<userinput>cc</userinput> leaves the system administrator free to decide what
|
||||
C compiler to install, as long as there's a symlink pointing to it:</para>
|
||||
|
||||
<para><screen><userinput>ln -sf gcc /stage1/bin/cc</userinput></screen></para>
|
||||
<para><screen><userinput>ln -sf gcc /tools/bin/cc</userinput></screen></para>
|
||||
|
||||
</sect2>
|
||||
|
||||
|
@ -24,7 +24,7 @@ fixed headers from the host system, which would most likely not match the Glibc
|
||||
version actually used for the LFS system.</para>
|
||||
|
||||
<para>The last patch changes GCC's default location of the dynamic linker,
|
||||
a simple substitution of "/lib/ld-linux.so.2" with "/stage1/lib/ld-linux.so.2"
|
||||
a simple substitution of "/lib/ld-linux.so.2" with "/tools/lib/ld-linux.so.2"
|
||||
in <filename>config/i386/linux.h</filename>. Patching now rather than adjusting
|
||||
the specs file after installation ensures that our new dynamic linker gets
|
||||
used during the actual build of GCC. That is, all the final (and temporary)
|
||||
@ -40,8 +40,8 @@ variables that override the default optimization flags.</para>
|
||||
|
||||
<para>Now prepare GCC to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/stage1 \
|
||||
--with-local-prefix=/stage1 \
|
||||
<para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/tools \
|
||||
--with-local-prefix=/tools \
|
||||
--enable-clocale=gnu --enable-shared \
|
||||
--enable-threads=posix --enable-__cxa_atexit \
|
||||
--enable-languages=c,c++</userinput></screen></para>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Gettext to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile the programs:</para>
|
||||
|
||||
|
@ -21,8 +21,8 @@ is putting the stability of your system at risk.</para>
|
||||
complain about the absence of <filename>/etc/ld.so.conf</filename>.
|
||||
Fix this annoying little error with:</para>
|
||||
|
||||
<para><screen><userinput>mkdir /stage1/etc
|
||||
touch /stage1/etc/ld.so.conf</userinput></screen></para>
|
||||
<para><screen><userinput>mkdir /tools/etc
|
||||
touch /tools/etc/ld.so.conf</userinput></screen></para>
|
||||
|
||||
<para>Also, Glibc has a subtle problem when compiled with GCC 3.3.1.
|
||||
Apply the following patch to fix this:</para>
|
||||
@ -38,10 +38,10 @@ cd ../glibc-build</userinput></screen></para>
|
||||
|
||||
<para>Next, prepare Glibc to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>../glibc-&glibc-version;/configure --prefix=/stage1 \
|
||||
<para><screen><userinput>../glibc-&glibc-version;/configure --prefix=/tools \
|
||||
--disable-profile --enable-add-ons \
|
||||
--with-headers=/stage1/include \
|
||||
--with-binutils=/stage1/bin \
|
||||
--with-headers=/tools/include \
|
||||
--with-binutils=/tools/bin \
|
||||
--without-gd</userinput></screen></para>
|
||||
|
||||
<para>The meaning of the new configure options:</para>
|
||||
@ -54,8 +54,8 @@ plan to do profiling.</para></listitem>
|
||||
<listitem><para><userinput>--enable-add-ons</userinput>: This enables any
|
||||
add-ons that were installed with Glibc, in our case Linuxthreads.</para></listitem>
|
||||
|
||||
<listitem><para><userinput>--with-binutils=/stage1/bin</userinput> and
|
||||
<userinput>--with-headers=/stage1/include</userinput>: Strictly speaking
|
||||
<listitem><para><userinput>--with-binutils=/tools/bin</userinput> and
|
||||
<userinput>--with-headers=/tools/include</userinput>: Strictly speaking
|
||||
these switches are not required. But they ensure nothing can go wrong with
|
||||
regard to what kernel headers and Binutils programs get used during the
|
||||
Glibc build.</para></listitem>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Grep to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1 \
|
||||
<para><screen><userinput>./configure --prefix=/tools \
|
||||
--disable-perl-regexp --with-included-regex</userinput></screen></para>
|
||||
|
||||
<para>Compile the programs:</para>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Gzip to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile the package:</para>
|
||||
|
||||
|
@ -12,7 +12,7 @@ linker and libraries), and then use this to build all the other essential
|
||||
tools.</para>
|
||||
|
||||
<para>The files compiled in this chapter will be installed under the
|
||||
<filename class="directory">$LFS/stage1</filename> directory,
|
||||
<filename class="directory">$LFS/tools</filename> directory,
|
||||
to keep them separate from the files installed in the next chapter.
|
||||
Since the packages compiled here are merely temporary, we don't want
|
||||
them to pollute the soon-to-be LFS system.</para>
|
||||
|
@ -27,20 +27,20 @@ symlink:</para>
|
||||
|
||||
<para>Install the platform-specific header files:</para>
|
||||
|
||||
<para><screen><userinput>mkdir /stage1/include/asm
|
||||
cp include/asm/* /stage1/include/asm
|
||||
cp -R include/asm-generic /stage1/include</userinput></screen></para>
|
||||
<para><screen><userinput>mkdir /tools/include/asm
|
||||
cp include/asm/* /tools/include/asm
|
||||
cp -R include/asm-generic /tools/include</userinput></screen></para>
|
||||
|
||||
<para>Install the cross-platform kernel header files:</para>
|
||||
|
||||
<para><screen><userinput>cp -R include/linux /stage1/include</userinput></screen></para>
|
||||
<para><screen><userinput>cp -R include/linux /tools/include</userinput></screen></para>
|
||||
|
||||
<para>There are a few kernel header files which make use of the
|
||||
<filename>autoconf.h</filename> header file. Since we do not yet configure the
|
||||
kernel, we need to create this file ourselves in order to avoid compilation
|
||||
failures. Create an empty <filename>autoconf.h</filename> file:</para>
|
||||
|
||||
<para><screen><userinput>touch /stage1/include/linux/autoconf.h</userinput></screen></para>
|
||||
<para><screen><userinput>touch /tools/include/linux/autoconf.h</userinput></screen></para>
|
||||
|
||||
</sect2>
|
||||
|
||||
|
@ -17,23 +17,23 @@ directory:</para>
|
||||
pass of Binutils, and contain no mention of <filename>/lib</filename>,
|
||||
<filename>/usr/lib</filename> or <filename>/usr/local/lib</filename>.
|
||||
From this point onwards everything will link <emphasis>only</emphasis>
|
||||
against the libraries in <filename>/stage1/lib</filename>.</para>
|
||||
against the libraries in <filename>/tools/lib</filename>.</para>
|
||||
|
||||
<para>You can now remove Binutils' build and source directories.</para>
|
||||
|
||||
<para>The other thing to do is to amend our GCC specs file so that it points
|
||||
to the new dynamic linker. A simple sed will accomplish this:</para>
|
||||
|
||||
<para><screen><userinput>SPECFILE=/stage1/lib/gcc-lib/*/*/specs
|
||||
sed -e 's@/lib/ld.so.1@/stage1/lib/ld.so.1@g' \
|
||||
-e 's@/lib/ld-linux.so.2@/stage1/lib/ld-linux.so.2@g' \
|
||||
<para><screen><userinput>SPECFILE=/tools/lib/gcc-lib/*/*/specs
|
||||
sed -e 's@/lib/ld.so.1@/tools/lib/ld.so.1@g' \
|
||||
-e 's@/lib/ld-linux.so.2@/tools/lib/ld-linux.so.2@g' \
|
||||
$SPECFILE > tempspecfile
|
||||
mv tempspecfile $SPECFILE
|
||||
unset SPECFILE</userinput></screen></para>
|
||||
|
||||
<para>We recommend that you cut-and-paste the above rather than try and type
|
||||
it all in. Or you can edit the specs file by hand if you want to: just replace
|
||||
"/lib/ld-linux.so.2" with "/stage1/lib/ld-linux.so.2".</para>
|
||||
"/lib/ld-linux.so.2" with "/tools/lib/ld-linux.so.2".</para>
|
||||
|
||||
<para>Lastly, there is a possibility that some include files from the host
|
||||
system have found their way into gcc's private include dir. This can happen
|
||||
@ -41,7 +41,7 @@ because of GCC's "fixincludes" process which part of the GCC build. We'll
|
||||
explain more about this further on in this chapter. For now, run the
|
||||
following commands to eliminate this possibility.</para>
|
||||
|
||||
<para><screen><userinput>rm -f /stage1/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen></para>
|
||||
<para><screen><userinput>rm -f /tools/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen></para>
|
||||
|
||||
<para>This completes the installation of the self-contained toolchain, which
|
||||
can now be used to build the rest of the temporary tools.</para>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Make to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile the program:</para>
|
||||
|
||||
|
@ -14,7 +14,7 @@ deprecated headers.</para>
|
||||
|
||||
<para>Now prepare Ncurses to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1 --with-shared \
|
||||
<para><screen><userinput>./configure --prefix=/tools --with-shared \
|
||||
--without-debug --without-ada</userinput></screen></para>
|
||||
|
||||
<para>Compile the programs and libraries:</para>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Patch to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>The preprocessor flag <userinput>-D_GNU_SOURCE</userinput> is only needed
|
||||
on the PowerPC platform. On other architectures you can leave it out.</para>
|
||||
|
@ -13,7 +13,7 @@ echo 'static_ext="IO re Fcntl"' >> hints/linux.sh</userinput></screen></para>
|
||||
|
||||
<para>Now prepare Perl for compilation:</para>
|
||||
|
||||
<para><screen><userinput>./configure.gnu --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure.gnu --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile only the required tools:</para>
|
||||
|
||||
@ -21,9 +21,9 @@ echo 'static_ext="IO re Fcntl"' >> hints/linux.sh</userinput></screen></para>
|
||||
|
||||
<para>Then copy these tools and their libraries:</para>
|
||||
|
||||
<para><screen><userinput>cp perl pod/pod2man /stage1/bin
|
||||
mkdir -p /stage1/lib/perl5/5.8.0
|
||||
cp -R lib/* /stage1/lib/perl5/5.8.0</userinput></screen></para>
|
||||
<para><screen><userinput>cp perl pod/pod2man /tools/bin
|
||||
mkdir -p /tools/lib/perl5/5.8.0
|
||||
cp -R lib/* /tools/lib/perl5/5.8.0</userinput></screen></para>
|
||||
|
||||
</sect2>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Sed to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile the program:</para>
|
||||
|
||||
|
@ -10,7 +10,7 @@ set +h
|
||||
umask 022
|
||||
LFS=/mnt/lfs
|
||||
LC_ALL=POSIX
|
||||
PATH=/stage1/bin:$PATH
|
||||
PATH=/tools/bin:$PATH
|
||||
export LFS LC_ALL PATH
|
||||
EOF
|
||||
|
||||
@ -42,7 +42,7 @@ may cause trouble if you exit the chroot environment and wish to return later.
|
||||
By setting LC_ALL to "POSIX" (or "C", the two are equivalent) we ensure that
|
||||
everything will work as expected in the chroot environment.</para>
|
||||
|
||||
<para>We prepend <filename>/stage1/bin</filename> to the standard PATH so
|
||||
<para>We prepend <filename>/tools/bin</filename> to the standard PATH so
|
||||
that, as we move along through this chapter, the tools we build will get used
|
||||
during the rest of the building process.</para>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Tar to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile the programs:</para>
|
||||
|
||||
|
@ -11,7 +11,7 @@ essential, to know that our most important tools are working properly.</para>
|
||||
<para>Prepare Tcl to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>cd unix
|
||||
./configure --prefix=/stage1</userinput></screen></para>
|
||||
./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Build, test, and install the package:</para>
|
||||
|
||||
@ -24,7 +24,7 @@ This is, however, not a problem: the program will work well enough to be able
|
||||
to run the GCC and Binutils test suites.</para>
|
||||
|
||||
<para>Make a link:</para>
|
||||
<para><screen><userinput>ln -s tclsh8.4 /stage1/bin/tclsh</userinput></screen></para>
|
||||
<para><screen><userinput>ln -s tclsh8.4 /tools/bin/tclsh</userinput></screen></para>
|
||||
|
||||
<caution><para><emphasis>Do not remove</emphasis> the
|
||||
<filename>tcl&tcl-version;</filename> source directory yet, as the next package
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>Prepare Texinfo to be compiled:</para>
|
||||
|
||||
<para><screen><userinput>./configure --prefix=/stage1</userinput></screen></para>
|
||||
<para><screen><userinput>./configure --prefix=/tools</userinput></screen></para>
|
||||
|
||||
<para>Compile the programs:</para>
|
||||
|
||||
|
@ -19,7 +19,7 @@ make -C text-utils more</userinput></screen></para>
|
||||
|
||||
<para>Now copy these programs to the temporary tools directory:</para>
|
||||
|
||||
<para><screen><userinput>cp mount/{,u}mount text-utils/more /stage1/bin</userinput></screen></para>
|
||||
<para><screen><userinput>cp mount/{,u}mount text-utils/more /tools/bin</userinput></screen></para>
|
||||
|
||||
</sect2>
|
||||
|
||||
|
@ -39,7 +39,7 @@ software, a lot of disk space can be regained by removing these symbols .</para>
|
||||
<para>To remove debugging symbols from a binary (which must be an a.out
|
||||
or ELF binary), run <userinput>strip --strip-debug filename</userinput>.
|
||||
Wildcards can be used to treat multiple files (use something like
|
||||
<userinput>strip --strip-debug $LFS/stage1/bin/*</userinput>).</para>
|
||||
<userinput>strip --strip-debug $LFS/tools/bin/*</userinput>).</para>
|
||||
|
||||
<para>For your convenience, Chapter 9 includes one simple command to strip
|
||||
all debugging symbols from all programs and libraries on your system.
|
||||
|
@ -12,14 +12,14 @@ retained the source and build directories from the second pass over Binutils.
|
||||
Install the adjusted linker scripts by running the following from within the
|
||||
<filename class="directory">binutils-build</filename> directory:</para>
|
||||
|
||||
<para><screen><userinput>make -C ld INSTALL=/stage1/bin/install install-data-local</userinput></screen></para>
|
||||
<para><screen><userinput>make -C ld INSTALL=/tools/bin/install install-data-local</userinput></screen></para>
|
||||
|
||||
<para>The linker scripts now contain
|
||||
no mention of <filename class="directory">/stage1/lib</filename> anymore.
|
||||
no mention of <filename class="directory">/tools/lib</filename> anymore.
|
||||
From now on every compiled program will link <emphasis>only</emphasis>
|
||||
against the libraries in <filename>/usr/lib</filename> and
|
||||
<filename>/lib</filename>. The extra
|
||||
<userinput>INSTALL=/stage1/bin/install</userinput> is needed because the
|
||||
<userinput>INSTALL=/tools/bin/install</userinput> is needed because the
|
||||
Makefile created during the second pass still contains the reference to
|
||||
<filename>/usr/bin/install</filename>, which we obviously haven't installed
|
||||
yet.</para>
|
||||
@ -30,9 +30,9 @@ yet.</para>
|
||||
to the new dynamic linker. Just like earlier on, we use a sed to accomplish
|
||||
this:</para>
|
||||
|
||||
<para><screen><userinput>SPECFILE=/stage1/lib/gcc-lib/*/*/specs
|
||||
sed -e 's@/stage1/lib/ld.so.1@/lib/ld.so.1@g' \
|
||||
-e 's@/stage1/lib/ld-linux.so.2@/lib/ld-linux.so.2@g' \
|
||||
<para><screen><userinput>SPECFILE=/tools/lib/gcc-lib/*/*/specs
|
||||
sed -e 's@/tools/lib/ld.so.1@/lib/ld.so.1@g' \
|
||||
-e 's@/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g' \
|
||||
$SPECFILE > newspecfile
|
||||
mv newspecfile $SPECFILE
|
||||
unset SPECFILE</userinput></screen></para>
|
||||
@ -42,10 +42,10 @@ before, it is a good idea to check the linker scripts and the specs file to
|
||||
ensure the intended changes were actually made.</para>
|
||||
|
||||
<para>Note that the linker scripts will still contain a reference to
|
||||
<filename class="directory">/stage1/i686-pc-linux-gnu/lib</filename>. This
|
||||
<filename class="directory">/tools/i686-pc-linux-gnu/lib</filename>. This
|
||||
is unavoidable, but luckily does not present a problem. There are no
|
||||
libraries in that location as all the temporary stage1 libraries are
|
||||
located in <filename class="directory">/stage1/lib</filename>.</para>
|
||||
libraries in that location as all the temporary tools libraries are
|
||||
located in <filename class="directory">/tools/lib</filename>.</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
|
@ -2,16 +2,16 @@
|
||||
<title>Changing ownership</title>
|
||||
<?dbhtml filename="changingowner.html" dir="chapter06"?>
|
||||
|
||||
<para>Right now the <filename class="directory">/stage1</filename> directory
|
||||
<para>Right now the <filename class="directory">/tools</filename> directory
|
||||
is owned by the user <emphasis>lfs</emphasis>, a user that exists only on your
|
||||
host system. Although you will probably want to delete the
|
||||
<filename class="directory">/stage1</filename> directory once you have
|
||||
<filename class="directory">/tools</filename> directory once you have
|
||||
finished your LFS system, you may want to keep it around, for example to
|
||||
build more LFS systems. But if you keep the
|
||||
<filename class="directory">/stage1</filename> directory as it is, you end up
|
||||
<filename class="directory">/tools</filename> directory as it is, you end up
|
||||
with files owned by a user ID without a corresponding account. This is
|
||||
dangerous because a user account created later on could get this same user ID
|
||||
and would suddenly own the <filename class="directory">/stage1</filename>
|
||||
and would suddenly own the <filename class="directory">/tools</filename>
|
||||
directory and all the files therein, thus exposing these files to possible
|
||||
malicious manipulation.</para>
|
||||
|
||||
@ -19,10 +19,10 @@ malicious manipulation.</para>
|
||||
your new LFS system later on when creating the <filename>/etc/passwd</filename>
|
||||
file, taking care to assign it the same user and group IDs as on your host
|
||||
system. Alternatively, you can (and the book assumes you do) assign the
|
||||
contents of the <filename class="directory">/stage1</filename> directory to
|
||||
contents of the <filename class="directory">/tools</filename> directory to
|
||||
user <emphasis>root</emphasis> by running the following command:</para>
|
||||
|
||||
<para><screen><userinput>chown -R 0:0 /stage1</userinput></screen></para>
|
||||
<para><screen><userinput>chown -R 0:0 /tools</userinput></screen></para>
|
||||
|
||||
<para>The command uses "0:0" instead of "root:root", because chown is unable
|
||||
to resolve the name "root" until glibc has been installed.</para>
|
||||
|
@ -10,10 +10,10 @@ can execute the <userinput>chroot</userinput> command.</para>
|
||||
<para>Become <emphasis>root</emphasis> and run the following command
|
||||
to enter the chroot environment:</para>
|
||||
|
||||
<para><screen><userinput>chroot $LFS /stage1/bin/env -i \
|
||||
<para><screen><userinput>chroot $LFS /tools/bin/env -i \
|
||||
HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/stage1/bin \
|
||||
/stage1/bin/bash --login</userinput></screen>
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
|
||||
/tools/bin/bash --login</userinput></screen>
|
||||
</para>
|
||||
|
||||
<para><screen><userinput>set +h</userinput></screen></para>
|
||||
|
@ -7,10 +7,10 @@ order to satisfy these programs, we create a number of symbolic links which
|
||||
will be replaced by real files throughout the course of this chapter when
|
||||
we're installing all the software.</para>
|
||||
|
||||
<para><screen><userinput>ln -s /stage1/bin/{bash,pwd,cat,stty,echo,sed} /bin
|
||||
ln -s /stage1/bin/{rm,mv,chmod,chgrp} /bin
|
||||
ln -s /stage1/bin/{perl,msgfmt,xgettext,msgmerge,install} /usr/bin
|
||||
ln -s /stage1/bin/{sort,gawk,cmp} /usr/bin
|
||||
<para><screen><userinput>ln -s /tools/bin/{bash,pwd,cat,stty,echo,sed} /bin
|
||||
ln -s /tools/bin/{rm,mv,chmod,chgrp} /bin
|
||||
ln -s /tools/bin/{perl,msgfmt,xgettext,msgmerge,install} /usr/bin
|
||||
ln -s /tools/bin/{sort,gawk,cmp} /usr/bin
|
||||
ln -s bash /bin/sh
|
||||
ln -s ../usr/bin/install /bin</userinput></screen></para>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
<para>The Glibc build system is very well self-contained and will install
|
||||
perfectly, even though our compiler specs file and linker scripts are still
|
||||
pointing at <filename>/stage1</filename>. We cannot adjust the specs and
|
||||
pointing at <filename>/tools</filename>. We cannot adjust the specs and
|
||||
ldscripts before the Glibc install, because the Glibc autoconf tests would then
|
||||
give bogus results and thus defeat our goal of achieving a clean build.</para>
|
||||
|
||||
@ -48,7 +48,7 @@ cause the <filename>pt_chown</filename> program to be installed in the
|
||||
<listitem><para><userinput>--with-headers=/usr/include</userinput>: This
|
||||
ensures that the kernel headers in <filename>/usr/include</filename> are used
|
||||
for this build. If you don't pass this switch then the headers from
|
||||
<filename>/stage1/include</filename> are used which of course is not ideal
|
||||
<filename>/tools/include</filename> are used which of course is not ideal
|
||||
(although they should be identical). Using the switch has the advantage
|
||||
that you will be informed immediately should you have forgotten to install the
|
||||
kernel headers into <filename>/usr/include</filename>.</para></listitem>
|
||||
|
@ -25,11 +25,11 @@ optimization and see if the problem goes away.</para>
|
||||
|
||||
<para>The order in which packages are installed in this chapter has
|
||||
to be strictly followed, to ensure that no program gets a path referring
|
||||
to <filename class="directory">/stage1</filename> hard-wired into it.
|
||||
to <filename class="directory">/tools</filename> hard-wired into it.
|
||||
For the same reason, <emphasis>do not </emphasis> compile packages
|
||||
in parallel. Compiling in parallel may save you some time (especially on
|
||||
dual-CPU machines), but it could result in a program containing a
|
||||
hard-wired path to <filename class="directory">/stage1</filename>,
|
||||
hard-wired path to <filename class="directory">/tools</filename>,
|
||||
which will cause the program to stop working when the static directory
|
||||
is removed.</para>
|
||||
|
||||
|
@ -28,7 +28,7 @@ Unfortunately, the configuration script picks the last location in PATH
|
||||
rather than the first place a program is found. By appending
|
||||
<emphasis>/usr/bin:/bin</emphasis> to PATH for the
|
||||
<userinput>./configure</userinput> command, we ensure that Man doesn't
|
||||
use the programs in the <filename class="directory">/stage1</filename>
|
||||
use the programs in the <filename class="directory">/tools</filename>
|
||||
directory.</para>
|
||||
|
||||
<para>Now prepare Man for compilation:</para>
|
||||
|
@ -46,7 +46,7 @@ the LSB (<ulink url="http://www.linuxbase.org"/>) recommends only a group
|
||||
chosen freely by the user, as well-written packages don't depend on GID
|
||||
numbers but use the group's name.</para>
|
||||
|
||||
<para><screen><userinput>exec /stage1/bin/bash --login
|
||||
<para><screen><userinput>exec /tools/bin/bash --login
|
||||
set +h</userinput></screen></para>
|
||||
|
||||
</sect1>
|
||||
|
@ -6,13 +6,13 @@
|
||||
it, you need to run the following modified chroot command. The one at the
|
||||
beginning of this chapter might not work anymore (if your host distribution
|
||||
was based on Glibc-2.2.x or older, the programs in <filename
|
||||
class="directory">/stage1/bin</filename>, such as <filename>bash</filename>,
|
||||
class="directory">/tools/bin</filename>, such as <filename>bash</filename>,
|
||||
will not work anymore). The following chroot command will work regardless
|
||||
of your host distribution's Glibc version.</para>
|
||||
|
||||
<para>Additionally, now that all software has been installed there is no
|
||||
need to use anything from the <filename
|
||||
class="directory">/stage1</filename> directory anymore.</para>
|
||||
class="directory">/tools</filename> directory anymore.</para>
|
||||
|
||||
<para><screen><userinput>chroot $LFS /usr/bin/env -i \
|
||||
HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
|
||||
|
@ -39,11 +39,11 @@ on LFS active:</para>
|
||||
|
||||
<para><screen><userinput>/sbin/lilo</userinput></screen></para>
|
||||
|
||||
<para>You may now remove the stage1 directory. If you think you may
|
||||
need to redo Chapter 5, then you may wish to backup the directory before
|
||||
removing it. To remove the stage1 directory, type the following
|
||||
command:</para>
|
||||
<para>You may now remove the <filename>tools</filename> directory. If you
|
||||
think you may need to redo Chapter 5, then you may wish to backup the directory
|
||||
before removing it. To remove the <filename>tools</filename> directory, type
|
||||
the following command, carefully:</para>
|
||||
|
||||
<para><screen><userinput>rm -rf /stage1</userinput></screen></para>
|
||||
<para><screen><userinput>rm -rf /tools</userinput></screen></para>
|
||||
|
||||
</sect1>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!ENTITY chapter05 SYSTEM "../chapter05/chapter05.xml">
|
||||
<!ENTITY c5-introduction SYSTEM "../chapter05/introduction.xml">
|
||||
<!ENTITY c5-whystatic SYSTEM "../chapter05/whystatic.xml">
|
||||
<!ENTITY c5-creatingstage1dir SYSTEM "../chapter05/creatingstage1dir.xml">
|
||||
<!ENTITY c5-creatingtoolsdir SYSTEM "../chapter05/creatingstage1dir.xml">
|
||||
<!ENTITY c5-addinguser SYSTEM "../chapter05/adding-user.xml">
|
||||
<!ENTITY c5-settingenviron SYSTEM "../chapter05/setting-environment.xml">
|
||||
|
Loading…
Reference in New Issue
Block a user