From bc82645e958948a6aefd3147a0d7f712de9eaf6b Mon Sep 17 00:00:00 2001 From: Gerard Beekmans Date: Fri, 2 May 2003 18:20:20 +0000 Subject: Integrated Pure LFS - Phase 1 git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@2490 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter06/aboutdebug.xml | 2 +- chapter06/adjustingtoolchain.xml | 14 +++++++++ chapter06/binutils-inst.xml | 20 ++++++------ chapter06/changingowner.xml | 14 ++++----- chapter06/chapter06.xml | 11 ++++--- chapter06/chroot.xml | 9 ++++-- chapter06/coreutils-inst.xml | 20 ++++++++++++ chapter06/coreutils.xml | 8 +++++ chapter06/createfiles.xml | 32 ++++++++++++++----- chapter06/dejagnu-inst.xml | 12 ++++++++ chapter06/dejagnu.xml | 11 +++++++ chapter06/expect-inst.xml | 15 +++++++++ chapter06/expect.xml | 11 +++++++ chapter06/gcc-2953-inst.xml | 22 ++++++++++++++ chapter06/gcc-2953.xml | 8 +++++ chapter06/gcc-inst.xml | 25 +++++++++------ chapter06/glibc-inst.xml | 66 +++++----------------------------------- chapter06/groff-inst.xml | 2 +- chapter06/ncurses-inst.xml | 2 ++ chapter06/pwdgroup.xml | 2 ++ chapter06/revisedchroot.xml | 3 ++ chapter06/tcl-inst.xml | 14 +++++++++ chapter06/tcl.xml | 11 +++++++ 23 files changed, 231 insertions(+), 103 deletions(-) create mode 100644 chapter06/adjustingtoolchain.xml create mode 100644 chapter06/coreutils-inst.xml create mode 100644 chapter06/coreutils.xml create mode 100644 chapter06/dejagnu-inst.xml create mode 100644 chapter06/dejagnu.xml create mode 100644 chapter06/expect-inst.xml create mode 100644 chapter06/expect.xml create mode 100644 chapter06/gcc-2953-inst.xml create mode 100644 chapter06/gcc-2953.xml create mode 100644 chapter06/tcl-inst.xml create mode 100644 chapter06/tcl.xml (limited to 'chapter06') diff --git a/chapter06/aboutdebug.xml b/chapter06/aboutdebug.xml index 3e3a82dc9..d92e0abf9 100644 --- a/chapter06/aboutdebug.xml +++ b/chapter06/aboutdebug.xml @@ -39,7 +39,7 @@ software, a lot of disk space can be regained by removing these symbols . To remove debugging symbols from a binary (which must be an a.out or ELF binary), run strip --strip-debug filename. Wildcards can be used to treat multiple files (use something like -strip --strip-debug $LFS/static/bin/*). +strip --strip-debug $LFS/stage1/bin/*). For your convenience, Chapter 9 includes one simple command to strip all debugging symbols from all programs and libraries on your system. diff --git a/chapter06/adjustingtoolchain.xml b/chapter06/adjustingtoolchain.xml new file mode 100644 index 000000000..c269e57ff --- /dev/null +++ b/chapter06/adjustingtoolchain.xml @@ -0,0 +1,14 @@ + +Adjusting toolchain + + +cd binutils-build +make -C ld INSTALL=/stage1/bin/install install-data-local +SPECFILE=/stage1/lib/gcc-lib/i686-pc-linux-gnu/*/specs && +cp ${SPECFILE} ./XX && +sed 's@/stage1/lib/ld-linux.so.2@/lib/ld-linux.so.2@g' ./XX > ${SPECFILE} && +unset SPECFILE && +rm -f ./XX + + + diff --git a/chapter06/binutils-inst.xml b/chapter06/binutils-inst.xml index 8adbe9dbd..f9c329061 100644 --- a/chapter06/binutils-inst.xml +++ b/chapter06/binutils-inst.xml @@ -16,11 +16,16 @@ cd ../binutils-build Next, prepare Binutils to be compiled: -../binutils-&binutils-version;/configure --prefix=/usr --enable-shared +CFLAGS="-O2 -pipe" \ +    ../binutils-&binutils-version;/configure \ +    --prefix=/usr --mandir=/usr/share/man \ +    --infodir=/usr/share/info --enable-shared Continue with compiling the package: -make tooldir=/usr +make LDFLAGS="-s" + +make -k check Normally, the tooldir (the directory where the executables end up) is set to $(exec_prefix)/$(target_alias) which expands @@ -32,16 +37,9 @@ executed on Apple PowerPC machines). Install the package: -make tooldir=/usr install - -Install the info pages: - -make tooldir=/usr install-info - -Some packages require the libiberty header -in order to build. To honor those packages, install the file: +make install -cp ../binutils-&binutils-version;/include/libiberty.h /usr/include +rm /usr/lib/libiberty.a diff --git a/chapter06/changingowner.xml b/chapter06/changingowner.xml index f984f47d6..2b24fecd3 100644 --- a/chapter06/changingowner.xml +++ b/chapter06/changingowner.xml @@ -2,17 +2,17 @@ Changing ownership -Right now the /static directory is owned by the lfs user. However, +Right now the /stage1 directory is owned by the lfs user. However, this user account exists only on the host system. Although you may delete -the /static directory once you have +the /stage1 directory once you have finished your LFS system, you might want to keep it around, e.g. for building more LFS systems. But if you keep the -/static directory you will end up +/stage1 directory you will end up with files owned by a user id without a corresponding account. This is dangerous because a user account created later could get this user id and -would suddenly own the /static +would suddenly own the /stage1 directory and all of the files therein. This could open the -/static directory to manipulation by +/stage1 directory to manipulation by an untrusted user. To avoid this issue, you can add the @@ -20,10 +20,10 @@ an untrusted user. the /etc/passwd file, taking care to assign it the same user and group id. Alternatively, you can (and the book will assume you do) run the following command now, to assign the contents of the -/static directory to user +/stage1 directory to user root by running the following command: -chown -R 0:0 /static +chown -R 0:0 /stage1 The command uses "0:0" instead of "root:root", because chown is unable to resolve the name "root" until glibc has been installed. diff --git a/chapter06/chapter06.xml b/chapter06/chapter06.xml index 060cd4fe9..f1963a4e9 100644 --- a/chapter06/chapter06.xml +++ b/chapter06/chapter06.xml @@ -15,7 +15,10 @@ &c6-kernel; &c6-manpages; &c6-glibc; +&c6-adjustingtoolchain; +&c6-binutils; &c6-gcc; +&c6-coreutils; &c6-zlib; &c6-findutils; &c6-gawk; @@ -25,12 +28,8 @@ &c6-bison; &c6-less; &c6-groff; -&c6-textutils; &c6-sed; &c6-flex; -&c6-binutils; -&c6-fileutils; -&c6-shellutils; &c6-gettext; &c6-nettools; &c6-perl; @@ -62,6 +61,10 @@ &c6-sysvinit; &c6-tar; &c6-utillinux; +&c6-tcl; +&c6-expect; +&c6-dejagnu; +&c6-gcc-2953; &c6-kernel-manpages; &c6-glibc-pass2; &c6-revisedchroot; diff --git a/chapter06/chroot.xml b/chapter06/chroot.xml index f6880b4a5..2cfaa21de 100644 --- a/chapter06/chroot.xml +++ b/chapter06/chroot.xml @@ -10,12 +10,15 @@ can execute the chroot command. Become root and run the following command to enter the chroot environment: -chroot $LFS /static/bin/env -i \ +chroot $LFS /stage1/bin/env -i \     HOME=/root TERM=$TERM PS1='\u:\w\$ ' \ -    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/static/bin \ -    /static/bin/bash --login +    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/stage1/bin \ +    LDFLAGS="-s" \ +    /stage1/bin/bash --login +set +h + The -i option given to the env command will clear all variables of the chroot environment. After that, only the HOME, TERM, PS1 and PATH variables are diff --git a/chapter06/coreutils-inst.xml b/chapter06/coreutils-inst.xml new file mode 100644 index 000000000..14df0ec19 --- /dev/null +++ b/chapter06/coreutils-inst.xml @@ -0,0 +1,20 @@ +   + + +Installation of Coreutils + +/configure --prefix=/usr +make +make install +mv /usr/bin/{basename,cat,chgrp,chmod,chown,cp,dd,df} /bin && +mv /usr/bin/{dir,dircolors,du,date,echo,false,head} /bin && +mv /usr/bin/{install,ln,ls,mkdir,mkfifo,mknod,mv,pwd} /bin && +mv /usr/bin/{rm,rmdir,shred,sync,sleep,stty,su,test} /bin && +mv /usr/bin/{touch,true,uname,vdir} /bin +mv /usr/bin/chroot /usr/sbin +ln -s test /bin/[ +ln -s ../../bin/install /usr/bin + + + + diff --git a/chapter06/coreutils.xml b/chapter06/coreutils.xml new file mode 100644 index 000000000..612a7643c --- /dev/null +++ b/chapter06/coreutils.xml @@ -0,0 +1,8 @@ + +Installing Coreutils-&coreutils-version; + + +&c6-coreutils-inst; + + + diff --git a/chapter06/createfiles.xml b/chapter06/createfiles.xml index 47ccefb90..1be2246a8 100644 --- a/chapter06/createfiles.xml +++ b/chapter06/createfiles.xml @@ -1,17 +1,33 @@ -Creating the bash and sh symlinks +Creating essential symlinks Some programs hard-wire paths to programs which don't exist yet. In -order to satisfy these programs, we create the symbolic links -/bin/bash and /bin/sh, both -pointing to the static bash program. +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. -Create the /bin/bash and /bin/sh -symlinks by running the following commands: +ln -sf /stage1/bin/bash /bin +ln -sf bash /bin/sh +ln -sf /stage1/bin/pwd /bin +ln -sf /stage1/bin/perl /usr/bin +ln -sf /stage1/bin/cat /bin +ln -sf /stage1/bin/stty /bin +ln -sf /stage1/bin/msgfmt /usr/bin +ln -sf /stage1/bin/xgettext /usr/bin +ln -sf /stage1/bin/msgmerge /usr/bin +ln -sf /stage1/bin/install /usr/bin +ln -sf /usr/bin/install /bin +ln -sf /stage1/bin/echo /bin +ln -sf /stage1/bin/sed /bin +ln -sf /stage1/bin/awk /bin +ln -sf /stage1/bin/rm /bin +ln -sf /stage1/bin/mv /bin +ln -sf /stage1/bin/chmod /bin +ln -sf /stage1/bin/chgrp /bin +ln -sf /stage1/bin/sort /usr/bin +ln -sf /stage1/bin/cmp /usr/bin -ln -s /static/bin/bash /bin/bash && -ln -s bash /bin/sh diff --git a/chapter06/dejagnu-inst.xml b/chapter06/dejagnu-inst.xml new file mode 100644 index 000000000..4b7adff56 --- /dev/null +++ b/chapter06/dejagnu-inst.xml @@ -0,0 +1,12 @@ +   + + +Installation of DejaGNU + +./configure --prefix=/usr +make +make install + + + + diff --git a/chapter06/dejagnu.xml b/chapter06/dejagnu.xml new file mode 100644 index 000000000..2105add41 --- /dev/null +++ b/chapter06/dejagnu.xml @@ -0,0 +1,11 @@ + +Installing DejaGNU-&dejagnu-version; + + +Estimated build time: &dejagnu-time-static; +Estimated required disk space: &dejagnu-compsize-static; + +&c6-dejagnu-inst; + + + diff --git a/chapter06/expect-inst.xml b/chapter06/expect-inst.xml new file mode 100644 index 000000000..cd5882a0b --- /dev/null +++ b/chapter06/expect-inst.xml @@ -0,0 +1,15 @@ +   + + +Installation of Expect + +patch -Np1 -i ../expect-&expect-version;.patch +./configure --prefix=/usr --with-tcl=/stage1/lib \ +    --with-x=no --disable-symbols --cache-file=/dev/null +make +make test +make install + + + + diff --git a/chapter06/expect.xml b/chapter06/expect.xml new file mode 100644 index 000000000..6d46ec33e --- /dev/null +++ b/chapter06/expect.xml @@ -0,0 +1,11 @@ + +Installing Expect-&expect-version; + + +Estimated build time: &expect-time-static; +Estimated required disk space: &expect-compsize-static; + +&c6-expect-inst; + + + diff --git a/chapter06/gcc-2953-inst.xml b/chapter06/gcc-2953-inst.xml new file mode 100644 index 000000000..2a45a5908 --- /dev/null +++ b/chapter06/gcc-2953-inst.xml @@ -0,0 +1,22 @@ +   + + +Installation of GCC + +This package is known to behave badly when you have changed its +default optimization flags (including the -march and -mcpu options). +Therefore, if you have defined any environment variables that override +default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting +or modifying them when building GCC. + +patch -Np1 -i ../gcc-2.95.3-2.patch +echo timestamp > gcc/cstamp-h.in +mkdir ../gcc-2-build +cd ../gcc-2-build +../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 \ +    --enable-shared --enable-languages=c +make bootstrap +make install + + + diff --git a/chapter06/gcc-2953.xml b/chapter06/gcc-2953.xml new file mode 100644 index 000000000..c65b09684 --- /dev/null +++ b/chapter06/gcc-2953.xml @@ -0,0 +1,8 @@ + +Installing GCC-2.95.3 + + +&c6-gcc-2953-inst; + + + diff --git a/chapter06/gcc-inst.xml b/chapter06/gcc-inst.xml index 1ec2c780f..6f16a3b3e 100644 --- a/chapter06/gcc-inst.xml +++ b/chapter06/gcc-inst.xml @@ -14,6 +14,9 @@ need to unpack both the gcc-core and gcc-g++ tarballs. Other compilers are available in the full gcc package; instructions for building them may be found at . +patch -Np1 -i ../gcc-&gcc-version;-no_fixedincludes.patch +patch -Np1 -i ../gcc-&gcc-version;-mmap_test.patch + It is recommended by the GCC installation documentation to build GCC in a dedicated directory outside of the source tree. Create the build directory: @@ -23,9 +26,13 @@ cd ../gcc-build Prepare GCC to be compiled: -../gcc-&gcc-version;/configure --prefix=/usr --enable-shared \ -    --enable-threads=posix --with-slibdir=/lib \ -    --enable-__cxa_atexit --enable-clocale=gnu +CFLAGS="-O2 -pipe" CXXFLAGS="-O2 -pipe" \ +    ../gcc-&gcc-version;/configure --prefix=/usr \ +    --enable-shared --enable-threads=posix \ +    --enable-__cxa_atexit --enable-clocale=gnu \ +    --enable-version-specific-runtime-libs \ +    --mandir=/usr/share/man \ +    --infodir=/usr/share/info The meanings of the configure options are: @@ -48,16 +55,14 @@ is implemented. Continue with compiling the package: -make bootstrap +make BOOT_LDFLAGS="-s" BOOT_CFLAGS="-O2 -pipe" \ +    STAGE1_CFLAGS="-pipe" bootstrap -The bootstrap target doesn't just compile GCC, but -it compiles GCC multiple times. It uses the first compiled programs to -compile itself a second and third time to make sure the compiler was compiled -properly. +make -k check Finish installing the package: -make install-no-fixedincludes +make install Some packages expect the C PreProcessor to be installed in the /lib and /usr/lib directories. @@ -72,4 +77,6 @@ symlink: ln -s gcc /usr/bin/cc +rm /usr/lib/libiberty.a + diff --git a/chapter06/glibc-inst.xml b/chapter06/glibc-inst.xml index d9c7bbc93..8f1924dc7 100644 --- a/chapter06/glibc-inst.xml +++ b/chapter06/glibc-inst.xml @@ -3,63 +3,6 @@ Glibc installation -Before starting to install Glibc, you must cd -into the glibc-&glibc-version; directory and unpack -Glibc-linuxthreads in that directory, not in /usr/src as -you would normally do. - -This package is known to behave badly when you have changed its -default optimization flags (including the -march and -mcpu options). -Therefore, if you have defined any environment variables that override -default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting -them when building Glibc. - -Basically, compiling Glibc in any other way than the book suggests -is putting your system at a very high risk. - -We'll start by applying a patch that does the following: - - -It converts all occurrences of $(PERL) -to /usr/bin/perl in the -malloc/Makefile file. This is done because Glibc -can't autodetect the location of perl because the Perl -package hasn't been installed yet. And if Glibc thinks Perl isn't installed, the -perl program mtrace won't be installed -either. - -It replaces all occurrences of root -with 0 in the login/Makefile -file. This is done because Glibc itself isn't installed yet and therefore -username-to-userid resolving isn't working yet, so a -chown root file would fail. Using numeric IDs (as in -chown 0 file) works fine. - - - -patch -Np1 -i ../glibc-&glibc-rootperl-patch-version;-root-perl.patch - -There is a potential problem that causes statically linked binaries -to crash that were linked against Glibc-2.2 or older libraries. Even though -static binaries have all the necessary parts of Glibc built-in, they still -rely on one external library set: Glibc's NSS libraries. These libraries, -among other things, tell programs where the system's password database is -(in /etc/password, NIS, or whatever other scheme has -been configured). - -Glibc has undergone some changes since version 2.2.x and the new NSS -code is incompatible with the old one. So when Glibc is installed it will -install its new NSS libraries, and static programs will load these new NSS -libraries and will abort with a segmentation fault -error. This patch undoes some of the changes to overcome the problem. - -If you started chapter 5 with a host system that uses Glibc-2.2.x -or older, you must apply the following patch. We will install Glibc again at -the end of this chapter to remove this patch so you'll have a pristine Glibc -as the developers intended it. - -patch -Np1 -i ../glibc-&glibc-libnss-patch-version;-libnss.patch - Glibc will check for the /etc/ld.so.conf file and abort with an error if the file is missing, so we must create it: @@ -73,9 +16,12 @@ cd ../glibc-build Next, prepare Glibc to be compiled: -../glibc-&glibc-version;/configure --prefix=/usr \ +CFLAGS="-O2 -pipe" \ +    ../glibc-&glibc-version;/configure --prefix=/usr \     --disable-profile --enable-add-ons \ -    --libexecdir=/usr/bin +    --libexecdir=/usr/bin \ +    --with-headers=/usr/include \ +    --mandir=/usr/share/man --infodir=/usr/share/info The meaning of the configure options are: @@ -130,6 +76,8 @@ working Perl installation. We'll install Perl later on in this chapter, and the man pages will be installed when Glibc is installed for the second time at the end of this chapter. +make check + make install The locales (used by Glibc to make your Linux system talk in a different diff --git a/chapter06/groff-inst.xml b/chapter06/groff-inst.xml index 4c2e6d4ef..6c95604d7 100644 --- a/chapter06/groff-inst.xml +++ b/chapter06/groff-inst.xml @@ -5,7 +5,7 @@ Prepare Groff to be compiled: -./configure --prefix=/usr +PAGE=letter ./configure --prefix=/usr Continue with compiling the package: diff --git a/chapter06/ncurses-inst.xml b/chapter06/ncurses-inst.xml index c264776dc..0bac4e69b 100644 --- a/chapter06/ncurses-inst.xml +++ b/chapter06/ncurses-inst.xml @@ -3,6 +3,8 @@ Installation of Ncurses +patch -Np1 -i ../ncurses-&ncurses-version;-etip.patch + Prepare Ncurses to be compiled: ./configure --prefix=/usr --with-shared diff --git a/chapter06/pwdgroup.xml b/chapter06/pwdgroup.xml index caa57280f..103ba579a 100644 --- a/chapter06/pwdgroup.xml +++ b/chapter06/pwdgroup.xml @@ -40,5 +40,7 @@ the LSB () 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. +exec /stage1/bin/bash --login + diff --git a/chapter06/revisedchroot.xml b/chapter06/revisedchroot.xml index 9ec574a91..696c441cf 100644 --- a/chapter06/revisedchroot.xml +++ b/chapter06/revisedchroot.xml @@ -17,7 +17,10 @@ class="directory">/static directory anymore. chroot $LFS /usr/bin/env -i \     HOME=/root TERM=$TERM PS1='\u:\w\$ ' \     PATH=/bin:/usr/bin:/sbin:/usr/sbin \ +    LDFLAGS="-s" \     /bin/bash --login +set +h + diff --git a/chapter06/tcl-inst.xml b/chapter06/tcl-inst.xml new file mode 100644 index 000000000..30534a8f2 --- /dev/null +++ b/chapter06/tcl-inst.xml @@ -0,0 +1,14 @@ +   + + +Installation of TCL + +cd unix +./configure --prefix=/usr +MAKE +make test +make install +ln -s tclsh8.4 /usr/bin/tclsh + + + diff --git a/chapter06/tcl.xml b/chapter06/tcl.xml new file mode 100644 index 000000000..d37c3094e --- /dev/null +++ b/chapter06/tcl.xml @@ -0,0 +1,11 @@ + +Installing TCL-&tcl-version; + + +Estimated build time: &tcl-time-static; +Estimated required disk space: &tcl-compsize-static; + +&c6-tcl-inst; + + + -- cgit v1.2.3-54-g00ecf