diff --git a/Makefile b/Makefile index 7fe98c4bb..a198af27b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -BASEDIR=~/lfs-book +BASEDIR=~/belfs-book lfs: xsltproc --xinclude --nonet -stringparam base.dir $(BASEDIR)/ \ diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index d152c2a3e..3bf2f6dd1 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -21,20 +21,23 @@ first a summary, then a detailed log. autoconf-2.59 automake-1.8.4 +binutils-2.15.90.0.3 +bison-1.875a coreutils-5.2.1 e2fsprogs-1.35 expect-5.41.0 file-4.09 +flex-2.5.31 gcc-3.3.3 gettext-0.14.1 +glibc-2.3.4-20040408 grub-0.94 kbd-1.12 less-382 lfs-bootscripts-2.0.4 libtool-2.5.6 -linux-2.4.26 +linux-2.6.5 man-pages-1.66 -modutils-2.4.27 ncurses-5.4 perl-5.8.4 procps-3.2.1 @@ -50,29 +53,45 @@ first a summary, then a detailed log. Added: +flex-2.5.31-debian-fixes-2.patch iana-etc-1.00 +inetutils-1.4.2-kernel-headers-1.patch inetutils-1.4.2-no_server_man_pages-1.patch -make_devices-1.2 -mktemp-1.5 + mktemp-1.5-add-tempfile.patch +linux-libc-headers-2.6.5.1 +mktemp-1.5 +mktemp-1.5-add-tempfile-1.patch +module-init-tools-3.0 +net-tools-1.60-kernel-headers-1.patch +sysklogd-1.4.1-kernel-headers-1.patch +udev-025 +udev-025-config-1.patch +util-linux-2.12a-kernel-headers-1.patch Removed: +bison-1.875-attribute.patch +ed-0.2 +gcc-2.95.3 gcc-3.3.1-suppress-libiberty.patch +kbd-1.12-more-programs-1.patch lfs-utils-0.5 MAKEDEV-1.7 man-1.5m2-manpath.patch man-1.5m2-pager.patch +modutils-2.4.25 ncurses-5.3-etip-2.patch ncurses-5.3-vsscanf.patch -perl-5.8.0-libc-3.patch +procinfo-18 procps-3.1.11-locale-fix.patch shadow-4.0.3-newgrp-fix.patch zlib-1.1.4-vsnprintf.patch +May 3rd, 2004 [winkie]: Merged BE-LFS content. + May 2nd, 2004 [matt]: Quoted chroot commands in chapter 6 (bug #818). May 2nd, 2004 [matt]: Removed description of the now diff --git a/chapter01/chapter01.xml b/chapter01/chapter01.xml index 0698615df..2090daa0e 100644 --- a/chapter01/chapter01.xml +++ b/chapter01/chapter01.xml @@ -9,13 +9,8 @@ - - - - - diff --git a/chapter02/chapter02.xml b/chapter02/chapter02.xml index 29d349029..8313de285 100644 --- a/chapter02/chapter02.xml +++ b/chapter02/chapter02.xml @@ -8,17 +8,9 @@ Preparing a new partition - - - - - - - - diff --git a/chapter03/chapter03.xml b/chapter03/chapter03.xml index 574d2db16..34896c8ea 100644 --- a/chapter03/chapter03.xml +++ b/chapter03/chapter03.xml @@ -8,13 +8,8 @@ The materials: packages and patches - - - - - diff --git a/chapter03/packages.xml b/chapter03/packages.xml index aa11f6fcb..e154944e3 100644 --- a/chapter03/packages.xml +++ b/chapter03/packages.xml @@ -20,10 +20,10 @@ Bash (&bash-version;) - 1,910 KB: Binutils (&binutils-version;) - 10,666 KB: - + Bison (&bison-version;) - 796 KB: - + Bzip2 (&bzip2-version;) - 650 KB: @@ -40,9 +40,6 @@ Diffutils (&diffutils-version;) - 762 KB: E2fsprogs (&e2fsprogs-version;) - 3,003 KB: -Ed (&ed-version;) - 182 KB: - - Expect (&expect-version;) - 510 KB: @@ -53,21 +50,12 @@ Findutils (&findutils-version;) - 760 KB: Flex (&flex-version;) - 372 KB: - + Gawk (&gawk-version;) - 1,596 KB: -GCC (&gcc-2953-version;) - 9,618 KB: - - -GCC-core (&gcc-version;) - 11,283KB: - - -GCC-g++ (&gcc-version;) - 2,026 KB: - - -GCC-testsuite (&gcc-version;) - 1,051 KB: +GCC (&gcc-version;) - ~27,000KB: Gettext (&gettext-version;) - 6,397 KB: @@ -101,7 +89,7 @@ Less (&less-version;) - 259 KB: LFS-Bootscripts (&bootscripts-version;) - 32 KB: - + Libtool (&libtool-version;) - 2,602 KB: @@ -109,15 +97,15 @@ Libtool (&libtool-version;) - 2,602 KB: Linux (&linux-version;) - 30,051 KB: +Linux-Libc-Headers (&linux-libc-headers-version;) - 2,381 KB: + + M4 (&m4-version;) - 310 KB: Make (&make-version;) - 899 KB: -Make_devices (&makedev-version;) - 20 KB: - - Man (&man-version;) - 196 KB: @@ -127,8 +115,8 @@ Man-pages (&man-pages-version;) - 1,582 KB: Mktemp (&mktemp-version;) - 69 KB: -Modutils (&modutils-version;) - 229 KB: - +Module-Init-Tools (&module-init-tools-version;) - 118 KB: + Ncurses (&ncurses-version;) - 2,019 KB: @@ -142,9 +130,6 @@ Patch (&patch-version;) - 182 KB: Perl (&perl-version;) - 9,373 KB: -Procinfo (&procinfo-version;) - 24 KB: - - Procps (&procps-version;) - 260 KB: @@ -172,6 +157,9 @@ Tcl (&tcl-version;) - 3,363 KB: Texinfo (&texinfo-version;) - 1,385 KB: +Udev (&udev-version;) - 327 KB: + + Util-linux (&util-linux-version;) - 1,814 KB: @@ -190,27 +178,19 @@ remove old versions when new ones are released. An alternative download location that may have older versions available is . -2) As of this writing, the Glibc maintainers have decided in their -wisdom not to make available new release tarballs for download. The only way to -obtain the current Glibc release from pristine upstream sources is to pull it -from the Glibc CVS (Concurrent Versioning System) repository. The following commands will download the current -release and make a tarball from it: +2) Released packages of Glibc are not new enough for our purposes, +so create a tarball of some known-good CVS with the following commands: -cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/glibc \ - export -d glibc-2.3.3-20031202 -D "2003-12-02 UTC" libc -tar jcvf glibc-2.3.3-20031202.tar.bz2 glibc-2.3.3-20031202 +cvs -z 3 -d :pserver:anoncvs@sources.redhat.com:/cvs/glibc \ + export -d glibc-2.3.4-20040408 -D "18:00:00 2004-04-08 UTC" libc +sed -i -e "s/stable/2004-04-08/" -e "s/2\.3\.3/2.3.4/" \ + glibc-2.3.4-20040408/version.h +tar jcvf glibc-2.3.4-20040408.tar.bz2 glibc-2.3.4-20040408 -Alternatively, we've made our own tarball available which you can -download courtesy of the generous LFS mirror sites. - - - - - - - - - +Alternatively, we've made our own tarball available which you can download +from the following location: + + diff --git a/chapter03/patches.xml b/chapter03/patches.xml index 2c72ca029..7c5e7ee0c 100644 --- a/chapter03/patches.xml +++ b/chapter03/patches.xml @@ -16,42 +16,30 @@ following: Bash Patch - 7 KB: -Bison Attribute Patch - 2 KB: - - Coreutils Hostname Patch - 1 KB: Coreutils Uname Patch - 1 KB: -Ed Mkstemp Patch - 1 KB: - - Expect Spawn Patch - 6 KB: +Flex Brokenness Patch - 8 KB: + + GCC No-Fixincludes Patch - 1 KB: GCC Specs Patch - 11 KB: -GCC-2 Patch - 16 KB: - - -GCC-2 No-Fixincludes Patch - 1 KB: - - -GCC-2 Return-Type Patch - 1 KB: - +Inetutils Kernel Headers Patch - 1 KB: + Inetutils No-Server-Man-Pages Patch - 4 KB: -Kbd More-Programs Patch - 1 KB: - - Man 80-Columns Patch - 1 KB: @@ -61,8 +49,20 @@ Mktemp Tempfile Patch - 3 KB: Net-tools Mii-Tool-Gcc33 Patch - 2 KB: +Net-tools Kernel Headers Patch - 1 KB: + + Perl Libc Patch - 1 KB: + +Sysklogd Kernel Headers Patch - 3 KB: + + +Udev Configuration Patch - 6 KB: + + +Util-Linux Kernel Headers Patch - 3 KB: + In addition to the above required patches, there exist a number of diff --git a/chapter04/chapter04.xml b/chapter04/chapter04.xml index e676549b7..25c188020 100644 --- a/chapter04/chapter04.xml +++ b/chapter04/chapter04.xml @@ -8,7 +8,6 @@ Final Preparations - diff --git a/chapter05/bash.xml b/chapter05/bash.xml index a2ec5683e..d5d5ee747 100644 --- a/chapter05/bash.xml +++ b/chapter05/bash.xml @@ -29,7 +29,7 @@ patch: Now prepare Bash for compilation: -./configure --prefix=/tools +./configure --prefix=/tools --without-bash-malloc Compile the program: diff --git a/chapter05/binutils-pass2.xml b/chapter05/binutils-pass2.xml index 32c749b77..78436e1b0 100644 --- a/chapter05/binutils-pass2.xml +++ b/chapter05/binutils-pass2.xml @@ -50,7 +50,16 @@ running the test suites for the temporary tools here in this chapter. If nevertheless you want to run the Binutils test suite, the following command will do so: -make check +make -k check + +Except for a few known failures, the binutils tests should all pass. The +exceptions to this rule are as follows: + +* 5 FAIL (unexpected failure) for visibility +* 1 FAIL for selective4 +* 1 FAIL for selective5 + + + And install the package: make install diff --git a/chapter05/bison.xml b/chapter05/bison.xml new file mode 100644 index 000000000..8be0bc2b9 --- /dev/null +++ b/chapter05/bison.xml @@ -0,0 +1,46 @@ + + + %general-entities; +]> + +Bison-&bison-version; + + + +Bison +tools + + + +&buildtime; 0.6 SBU +&diskspace; 10.6 MB + + + + + +Installation of Bison + +Prepare Bison for compilation: + +./configure --prefix=/tools + +Compile the package: + +make + +To test the results, issue: +make check. + +Now install the package: + +make install + + + + +The details on this package are found in . + + + diff --git a/chapter05/bzip2.xml b/chapter05/bzip2.xml index 11b45b599..0671fcc16 100644 --- a/chapter05/bzip2.xml +++ b/chapter05/bzip2.xml @@ -23,7 +23,11 @@ Installation of Bzip2 The Bzip2 package doesn't contain a configure -script. Compile and install it with a straightforward: +script. Compile it with a straightforward: + +make + +And install it: make PREFIX=/tools install diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml index 9a939e00e..bf810d2fb 100644 --- a/chapter05/chapter05.xml +++ b/chapter05/chapter05.xml @@ -9,9 +9,11 @@ + + @@ -35,8 +37,12 @@ + + + + diff --git a/chapter05/flex.xml b/chapter05/flex.xml new file mode 100644 index 000000000..b158c5f5a --- /dev/null +++ b/chapter05/flex.xml @@ -0,0 +1,57 @@ + + + %general-entities; +]> + +Flex-&flex-version; + + + +Flex +tools + + + +&buildtime; 0.6 SBU +&diskspace; 10.6 MB + + + + + +Installation of Bison + +Flex contains several known bugs. Fix these with the following patch: + +patch -Np1 -i ../flex-&flex-version;-debian-fixes-2.patch + +The GNU autotools detects that the Flex source code has been modified by +the patch, and tries to update the man pages to include those changes, but this +breaks on many systems, and the default pages are fine, so make sure they don't +get renegerated: + +touch doc/*.1 + +Now prepare Flex for compilation: + +./configure --prefix=/tools + +Compile the package: + +make + +To test the results, issue: +make check. + +Now install the package: + +make install + + + + +The details on this package are found in . + + + diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 68c429fb0..d5b2a3fa0 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -40,9 +40,8 @@ cd ../gcc-build Prepare GCC for compilation: ../gcc-&gcc-version;/configure --prefix=/tools \ - --with-local-prefix=/tools \ - --disable-nls --enable-shared \ - --enable-languages=c + --libexecdir=/tools/lib --with-local-prefix=/tools \ + --disable-nls --enable-shared --enable-languages=c The meaning of the configure options: diff --git a/chapter05/gcc-pass2.xml b/chapter05/gcc-pass2.xml index d89d82e82..fbf321af4 100644 --- a/chapter05/gcc-pass2.xml +++ b/chapter05/gcc-pass2.xml @@ -83,10 +83,9 @@ variables that override the default optimization flags. Now prepare GCC for compilation: ../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++ + --libexecdir=/tools/lib --with-local-prefix=/tools \ + --enable-clocale=gnu --enable-shared --enable-threads=posix \ + --enable-__cxa_atexit --enable-languages=c,c++ The meaning of the new configure options: @@ -141,34 +140,12 @@ a summary of the test suite results, run this: You can compare your results to those posted to the gcc-testresults mailing list for similar configurations to your own. For an example of how current GCC-&gcc-version; should look on i686-pc-linux-gnu, see -. - -Note that the results contain: - -* 1 XPASS (unexpected pass) for g++ -* 1 FAIL (unexpected failure) for gcc -* 24 XPASS's for libstdc++ - -The unexpected pass for g++ is due to the use of ---enable-__cxa_atexit. Apparently not all platforms -supported by GCC have support for __cxa_atexit in their C -libraries, so this test is not always expected to pass. - -The 24 unexpected passes for libstdc++ are due to the use of ---enable-clocale=gnu. This option, which is the correct -choice on Glibc-based systems of versions 2.2.5 and above, enables in the GNU C -library a locale support that is superior to the otherwise selected -generic model (which may be applicable if for instance you -were using Newlibc, Sun-libc or whatever other libc). The libstdc++ test suite -is apparently expecting the generic model, hence those -tests are not always expected to pass. +. Having a few unexpected failures often cannot be avoided. The GCC developers are usually aware of these, but haven't yet gotten around to fixing -them. One particular case in point is the filebuf_members test in the C++ -standard library testsuite. This test has been observed to fail in some -situations, but succeeed in others. In short, unless your results are vastly -different from those at the above URL, it is safe to continue. +them. In short, unless your results are vastly different from those at the above +URL, it is safe to continue. And finally install the package: diff --git a/chapter05/gettext.xml b/chapter05/gettext.xml index cebff68f1..836b3c3ef 100644 --- a/chapter05/gettext.xml +++ b/chapter05/gettext.xml @@ -24,7 +24,20 @@ Prepare Gettext for compilation: -./configure --prefix=/tools +./configure --prefix=/tools --disable-libasprintf \ + --disable-csharp + + +--disable-libasprintf: This flag tells +Gettext that we don't want its asprintf library. Nothing in Chapter 5 or 6 +requires this, and gettext gets rebuilt later, so we exclude it to save +time/space. + +--disable-csharp: Gettext has a nasty +habit of searching for a C# compiler on the host, and building bindings for it. +We've already locked ourselves into the temporary tools though, +which doesn't have a C# compiler. + Compile the programs: diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index 92d2f3ad8..48c22ea07 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -39,38 +39,44 @@ cd ../glibc-build Next, prepare Glibc for compilation: -../glibc-&glibc-version;-20031202/configure --prefix=/tools \ - --disable-profile --enable-add-ons=linuxthreads \ - --with-binutils=/tools/bin --with-headers=/tools/include \ - --without-gd --without-cvs +../glibc-&glibc-version;/configure --prefix=/tools \ + --disable-profile --enable-add-ons=nptl --with-tls \ + --with-binutils=/tools/bin --without-gd --without-cvs \ + --with-headers=/tools/glibc-kernheaders The meaning of the configure options: ---disable-profile: This -builds the libraries without profiling information. Omit this option if you -plan to do profiling on the temporary tools. +--disable-profile: This builds the +libraries without profiling information. Omit this option if you plan to do +profiling on the temporary tools. ---enable-add-ons=linuxthreads: This -tells Glibc to use the Linuxthreads add-on as its threading -library. +--enable-add-ons=nptl: This +tells Glibc to use the NPTL add-on as its threading library. ---with-binutils=/tools/bin and ---with-headers=/tools/include: 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. +--with-tls: This tells Glibc to include +support for TLS (thread-local storage). This is required for NPTL to work. + ---without-gd: This prevents -the build of the memusagestat program, which -strangely enough insists on linking against the host's libraries (libgd, -libpng, libz, and so forth). +--with-binutils=/tools/bin: Strictly +speaking this switch is not required. But it does ensure nothing can go wrong +with regard to what Binutils programs get used during the Glibc build. + +--without-gd: This prevents the build +of the memusagestat program, which strangely enough insists +on linking against the host's libraries (libgd, libpng, libz, and so forth). + --without-cvs: This is meant to prevent the Makefiles from attempting automatic CVS checkouts when using a CVS snapshot. But it's not actually needed these days. We use it because it suppresses an annoying but harmless warning about a missing autoconf program. + +--with-headers=/tools/glibc-kernheaders: +This tells Glibc to compile against the raw kernel headers, so +that it knows exactly what features the kernel has, and can optimize itself +accordingly. Not strictly necessary, but nice to have. During this stage you might see the following warning: diff --git a/chapter05/hostreqs.xml b/chapter05/hostreqs.xml new file mode 100644 index 000000000..c2d2ef4fb --- /dev/null +++ b/chapter05/hostreqs.xml @@ -0,0 +1,26 @@ + + + %general-entities; +]> + +Host system requirements + + +Due to the experimental nature of BE-LFS, the host must be running at +least a 2.6.2 kernel. The reasons for this high requirement +is the use of NPTL, but more importantly the use of udev. Udev creates devices +dynamically by reading from the sysfs file system. Only very recently has +support for this file system been implemented in most of the kernel drivers, +however. We must be sure that all the critical system devices get created +properly. + +As for obtaining such a kernel, let's hope you distributor has provided +a 2.6 kernel package for you. If so, install it. If not, you'll have to compile +it yourself. If you're forced into a situation where you need to compile it +yourself, it is highly recommended that you compile your kernel in a monolithic +manner, as you probably don't want to go fiddling with your hosts module +utilities. Supposing you don't want to listen, open up the module-init-tools +tarball and check out the README on how to get module support for 2.6. + + diff --git a/chapter05/kernel-headers.xml b/chapter05/kernel-headers.xml index e825fe66d..d4a4e0742 100644 --- a/chapter05/kernel-headers.xml +++ b/chapter05/kernel-headers.xml @@ -38,17 +38,17 @@ un-tarring. Create the platform-specific include/asm symlink: -make symlinks +make include/asm Install the platform-specific header files: -mkdir /tools/include/asm -cp include/asm/* /tools/include/asm -cp -R include/asm-generic /tools/include +mkdir /tools/glibc-kernheaders +cp -HR include/asm /tools/glibc-kernheaders +cp -R include/asm-generic /tools/glibc-kernheaders Finally, install the cross-platform kernel header files: -cp -R include/linux /tools/include +cp -R include/linux /tools/glibc-kernheaders diff --git a/chapter05/linux-libc-headers.xml b/chapter05/linux-libc-headers.xml new file mode 100644 index 000000000..5f7fdec1a --- /dev/null +++ b/chapter05/linux-libc-headers.xml @@ -0,0 +1,34 @@ + + + %general-entities; +]> + +Linux-Libc-Headers-&linux-libc-headers-version; + + + +Linux-Libc-Headers +tools, headers + +&buildtime; 0.1 SBU +&diskspace; 22 MB + + + +Installation of Linux-Libc-Headers + +For years it has been common practice to use so-called raw +kernel headers (straight from a kernel tarball) in /usr/include, but over the +last few years, the kernel developers have taken a strong stance that such +things should not be done. Thus was born the linux-libc-headers project, +designed to maintain an API stable version of the Linux headers. + +Install the header files: + +cp -R include/asm-i386 /tools/include/asm +cp -R include/linux /tools/include + + + + diff --git a/chapter05/m4.xml b/chapter05/m4.xml new file mode 100644 index 000000000..c07576003 --- /dev/null +++ b/chapter05/m4.xml @@ -0,0 +1,46 @@ + + + %general-entities; +]> + +M4-&m4-version; + + + +M4 +tools + + + +&buildtime; 0.1 SBU +&diskspace; 3.0 MB + + + + + +Installation of M4 + +Prepare M4 for compilation: + +./configure --prefix=/tools + +Compile the package: + +make + +To test the results, issue: +make check. + +Now install the package: + +make install + + + + +The details on this package are found in . + + + diff --git a/chapter05/perl.xml b/chapter05/perl.xml index 556bb66ea..2216d7154 100644 --- a/chapter05/perl.xml +++ b/chapter05/perl.xml @@ -26,12 +26,6 @@ patch -Np1 -i ../perl-&perl-version;-libc-1.patch -Perl insists on using the arch program to find out -the machine type. Create a little script to mimic this command: - -echo "uname -m" > /tools/bin/arch -chmod 755 /tools/bin/arch - Now prepare Perl for compilation (make sure you get the 'IO Fcntl POSIX' right, they are all letters): diff --git a/chapter05/udev.xml b/chapter05/udev.xml new file mode 100644 index 000000000..af957e2c0 --- /dev/null +++ b/chapter05/udev.xml @@ -0,0 +1,65 @@ + + + %general-entities; +]> + +Udev-&udev-version; + + + +Udev +tools + + + +&buildtime; 0.2 SBU +&diskspace; 5.2 MB + + + + +Installation of Udev + +By default, the permissions udev assigns to nodes are all uniform, +being owned by user root, group root, and only accessible to root. As you +can easily imagine, this isn't ideal. Give it a much better configuration +by applying the following patch: + +patch -Np1 -i ../udev-&udev-version;-config-1.patch + + +The udevstart program hardcodes the path to the udev program in itself, +which is bad since we install udev in a non-standard location. Fix this by +running the following: + +sed -i 's:\/sbin\/udev:/tools&:' udevstart.c + +Also assure that udev knows the correct location to look for its +configuration files: + +sed -i 's:\/etc:/tools&:' etc/udev/udev.conf.in + +Now compile Udev: + +make prefix=/tools etcdir=/tools/etc + +Generate Udev's main configuration file: + +make udevdir=/dev etc/udev/udev.conf + +And install finally install it: + +make DESTDIR=/tools install + + + + +The details on this package are found in . + + + diff --git a/chapter05/util-linux.xml b/chapter05/util-linux.xml index d5007d79a..7954b0f83 100644 --- a/chapter05/util-linux.xml +++ b/chapter05/util-linux.xml @@ -22,12 +22,16 @@ Installation of Util-linux +Util-linux has issues with the Linux 2.6 kernel series - fix these issues +by applying the following patch: + +patch -Np1 -i ../util-linux-&util-linux-version;-kernel-dj-2.6-1.patch + Util-linux doesn't use the freshly installed headers and libraries from the /tools directory. This is fixed by altering the configure script: -cp configure configure.backup -sed "s@/usr/include@/tools/include@g" configure.backup > configure +sed -i "s@/usr/include@/tools/include@g" configure Prepare Util-linux for compilation: diff --git a/chapter06/bash.xml b/chapter06/bash.xml index af2acf4b5..8ce43a01e 100644 --- a/chapter06/bash.xml +++ b/chapter06/bash.xml @@ -18,7 +18,6 @@ Required disk space: 27 MB GCC, Glibc, Grep, Make, Ncurses, Sed. - Installation of Bash @@ -30,7 +29,8 @@ patch: Now prepare Bash for compilation: -./configure --prefix=/usr --bindir=/bin +./configure --prefix=/usr --bindir=/bin \ + --without-bash-malloc Compile the package: diff --git a/chapter06/binutils.xml b/chapter06/binutils.xml index 589f61f29..9edbb24f2 100644 --- a/chapter06/binutils.xml +++ b/chapter06/binutils.xml @@ -34,9 +34,7 @@ everything is set up correctly by performing a simple test: Your chroot environment is not set up for proper PTY operation. In this case there is no point in running the test suites for Binutils and GCC until you -are able to resolve the issue. Please refer back to -and the section and perform the recommended steps -to fix the problem. +are able to resolve the issue. This package is known to behave badly when you have changed its default optimization flags (including the -march and -mcpu options). @@ -72,7 +70,7 @@ circumstances. Test the results: -make check +make -k check The test suite notes from are still very much appropriate here. Be sure to refer back there should you have any diff --git a/chapter06/bison.xml b/chapter06/bison.xml index 4202899d1..64ed98ec5 100644 --- a/chapter06/bison.xml +++ b/chapter06/bison.xml @@ -22,12 +22,7 @@ GCC, Gettext, Glibc, Grep, M4, Make, Sed. Installation of Bison -First fix a minor compilation problem that Bison has with some packages, -the patch is back-ported from CVS: - -patch -Np1 -i ../bison-&bison-version;-attribute.patch - -Now prepare Bison for compilation: +Prepare Bison for compilation: ./configure --prefix=/usr diff --git a/chapter06/bzip2.xml b/chapter06/bzip2.xml index e6034e228..d52cde737 100644 --- a/chapter06/bzip2.xml +++ b/chapter06/bzip2.xml @@ -55,7 +55,6 @@ necessary symbolic links, and clean up: cp -a libbz2.so* /lib ln -s ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so rm /usr/bin/{bunzip2,bzcat,bzip2} -mv /usr/bin/{bzip2recover,bzless,bzmore} /bin ln -s bzip2 /bin/bunzip2 ln -s bzip2 /bin/bzcat diff --git a/chapter06/chapter06.xml b/chapter06/chapter06.xml index 0de12cb7a..e6425e402 100644 --- a/chapter06/chapter06.xml +++ b/chapter06/chapter06.xml @@ -8,192 +8,65 @@ Installing basic system software - - - - - - + - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - - - Stripping again @@ -239,7 +112,6 @@ destroyed. - diff --git a/chapter06/coreutils.xml b/chapter06/coreutils.xml index 8ac6c756e..7adb4ee60 100644 --- a/chapter06/coreutils.xml +++ b/chapter06/coreutils.xml @@ -57,11 +57,7 @@ so do it now: make install-root -Create a 'table of mounted filesystems' file with: - -touch /etc/mtab - -And create two dummy groups and a dummy user name: +Create two dummy groups and a dummy user name: echo "dummy1:x:1000" >> /etc/group echo "dummy2:x:1001:dummy" >> /etc/group @@ -70,7 +66,7 @@ echo "dummy:x:1000:1000:::/bin/bash" >> /etc/passwd Now you're all set to run the test suite. First run the few tests that are meant to be run as root: -export NON_ROOT_USERNAME=dummy; make check-root +make NON_ROOT_USERNAME=dummy make check-root Then run the remainder of the tests as the dummy user: @@ -79,7 +75,7 @@ user: When you're done testing, remove the dummy user and groups: -sed -i.bak '/dummy/d' /etc/passwd /etc/group +sed -i '/dummy/d' /etc/passwd /etc/group Install the package: @@ -87,7 +83,7 @@ user: And move some programs to their proper locations: -mv /usr/bin/{basename,cat,chgrp,chmod,chown,cp,dd,df} /bin +mv /usr/bin/{[,basename,cat,chgrp,chmod,chown,cp,dd,df} /bin mv /usr/bin/{date,echo,false,head,install,ln,ls} /bin mv /usr/bin/{mkdir,mknod,mv,pwd,rm,rmdir,sync} /bin mv /usr/bin/{sleep,stty,su,test,touch,true,uname} /bin @@ -99,10 +95,9 @@ Remove the one installed by Coreutils: rm /usr/bin/kill -Finally, create two symlinks to be FHS-compliant: +Finally, create a symlink to be FHS-compliant: -ln -s test /bin/[ -ln -s ../../bin/install /usr/bin +ln -s ../../bin/install /usr/bin diff --git a/chapter06/creatingdirs.xml b/chapter06/creatingdirs.xml index 4faf42e66..b85264a47 100644 --- a/chapter06/creatingdirs.xml +++ b/chapter06/creatingdirs.xml @@ -11,7 +11,7 @@ a directory tree. Issuing the following commands will create a more or less standard tree: -mkdir -p /{bin,boot,dev/{pts,shm},etc/opt,home,lib,mnt,proc} +mkdir -p /{bin,boot,dev,etc/opt,home,lib,mnt} mkdir -p /{root,sbin,srv,tmp,usr/local,var,opt} mkdir -p /media/{floppy,cdrom} mkdir /usr/{bin,include,lib,sbin,share,src} @@ -25,7 +25,7 @@ mkdir /usr/local/share/{doc,info,locale,man} mkdir /usr/local/share/{misc,terminfo,zoneinfo} mkdir /usr/local/share/man/man{1,2,3,4,5,6,7,8} mkdir /var/{lock,log,mail,run,spool} -mkdir -p /var/{tmp,opt,cache,lib/misc,local} +mkdir -p /var/{tmp,opt,cache,lib/{misc,locate},local} mkdir /opt/{bin,doc,include,info} mkdir -p /opt/{lib,man/man{1,2,3,4,5,6,7,8}} diff --git a/chapter06/devices.xml b/chapter06/devices.xml new file mode 100644 index 000000000..e6b1a8c57 --- /dev/null +++ b/chapter06/devices.xml @@ -0,0 +1,56 @@ + + + %general-entities; +]> + +Populating /dev with device nodes + + +Devices + + +Creating initial device nodes + +When the kernel boots the system, it requires the presence of a few device +nodes, in particular the console and null devices: + +mknod -m 600 /dev/console c 5 1 +mknod -m 666 /dev/null c 1 3 + + + +Mounting ramfs and populating /dev + +The ideal way to populate /dev is to mount a ramfs onto /dev (like tmpfs, but it +cannot be swapped) and create the devices on there during each bootup. Since we haven't +booted the system, we have to do what the bootscripts would otherwise do for us, and +populate /dev ourselves. Begin by mounting /dev: + +mount -n -t ramfs none /dev + +Now use the provided udevstart utility to create the initial devices based on +all the information in /sys: + +/tools/sbin/udevstart + +There are some symlinks and directories required by LFS that are not created by +Udev, so we create those ourselves here: + +ln -s /proc/self/fd /dev/fd +ln -s /proc/self/fd/0 /dev/stdin +ln -s /proc/self/fd/1 /dev/stdout +ln -s /proc/self/fd/2 /dev/stderr +ln -s /proc/kcore /dev/core +mkdir /dev/pts +mkdir /dev/shm + +Finally, mount the proper virtual (kernel) file systems on the directories we just +created: + +mount -t devpts -o gid=4,mode=620 none /dev/pts +mount -t tmpfs none /dev/shm + + + + diff --git a/chapter06/e2fsprogs.xml b/chapter06/e2fsprogs.xml index 4ca8f4b50..56828e140 100644 --- a/chapter06/e2fsprogs.xml +++ b/chapter06/e2fsprogs.xml @@ -23,16 +23,10 @@ Diffutils, Gawk, GCC, Gettext, Glibc, Grep, Make, Sed, Texinfo. Installation of E2fsprogs -It is recommended to build E2fsprogs outside of the -source tree: - -mkdir ../e2fsprogs-build -cd ../e2fsprogs-build - Prepare E2fsprogs for compilation: -../e2fsprogs-&e2fsprogs-version;/configure --prefix=/usr --with-root-prefix="" \ - --enable-elf-shlibs +./configure --prefix=/usr --with-root-prefix="" \ + --enable-elf-shlibs --disable-evms The meaning of the configure options: @@ -55,11 +49,8 @@ the shared libraries which some programs in this package use. make -If you to test the results, first make sure an mtab file -exists with touch /etc/mtab to prevent some sixty tests -from failing, and (if it doesn't already exist) fake the presence of an old -pager with ln -s /tools/bin/cat /bin/more to prevent one -test from failing, then issue: make check. +To test the results, issue: +make check. Install most of the package: diff --git a/chapter06/ed.xml b/chapter06/ed.xml deleted file mode 100644 index 7858144c9..000000000 --- a/chapter06/ed.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - %general-entities; -]> - -Ed-&ed-version; - - -Ed - -The Ed package contains a spartan line editor. - -&buildtime; 0.1 SBU -&diskspace; 3.1 MB - -Ed installation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, -Glibc, Grep, Make, Sed. - - - - -Installation of Ed - -Ed isn't something which many people use. It's installed here -because it can be used by the patch program if you encounter an ed-based patch -file. This happens rarely because diff-based patches are preferred these -days. - -Ed normally uses the mktemp function to create -temporary files in /tmp, but this -function contains a vulnerability (see the section on Temporary Files in ). Apply -the following patch to make Ed use mkstemp instead, a -secure way to create temporary files: - -patch -Np1 -i ../ed-&ed-version;-mkstemp.patch - -Now prepare Ed for compilation: - -./configure --prefix=/usr --exec-prefix="" - -The meaning of the configure option: - - ---exec-prefix="": This forces the -programs to be installed into the /bin directory. Having -the programs available there is useful in the event of the -/usr partition being unavailable. - - -Compile the package: - -make - -To test the results, issue: -make check. - -Install the package: - -make install - - - - -Contents of Ed - -Installed programs: ed and red (link to ed) - - - - -Short descriptions - -ed -ed is a line-oriented text editor. It can be used -to create, display, modify and otherwise manipulate text files. - -red -red is a restricted ed -- it can only edit files -in the current directory and cannot execute shell commands. - - - - - - diff --git a/chapter06/findutils.xml b/chapter06/findutils.xml index a6f2aa3d5..82000777c 100644 --- a/chapter06/findutils.xml +++ b/chapter06/findutils.xml @@ -28,10 +28,10 @@ Diffutils, GCC, Gettext, Glibc, Grep, Make, Sed. Prepare Findutils for compilation: ./configure --prefix=/usr --libexecdir=/usr/lib/locate \ - --localstatedir=/var/lib/misc + --localstatedir=/var/lib/locate The localstatedir directive above changes the location of the locate -database to be in /var/lib/misc, which is FHS-compliant. +database to be in /var/lib/locate, which is FHS-compliant. Compile the package: diff --git a/chapter06/flex.xml b/chapter06/flex.xml index 4210a6fc8..34f0fbc1e 100644 --- a/chapter06/flex.xml +++ b/chapter06/flex.xml @@ -23,7 +23,17 @@ GCC, Gettext, Glibc, Grep, M4, Make, Sed. Installation of Flex -Prepare Flex for compilation: +Flex contains several known bugs. Fix these with the following patch: + +patch -Np1 -i ../flex-&flex-version;-debian-fixes-2.patch + +The GNU autotools detects that the Flex source code has been modified by the patch, +and tries to update the man pages to include those changes, but this breaks on many +systems, and the default pages are fine, so make sure they don't get renegerated: + +touch doc/*.1 + +Now prepare Flex for compilation: ./configure --prefix=/usr @@ -32,7 +42,7 @@ GCC, Gettext, Glibc, Grep, M4, Make, Sed. make To test the results, issue: -make bigcheck. +make check. Now install the package: diff --git a/chapter06/gcc-2953.xml b/chapter06/gcc-2953.xml deleted file mode 100644 index b337d127e..000000000 --- a/chapter06/gcc-2953.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - %general-entities; -]> - -GCC-&gcc-2953-version; - - -GCC-2953 - -&buildtime; 1.5 SBU -&buildtime; 130 MB - - -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 un-setting -or modifying them when building GCC. - -This is an older release of GCC which we are going to install for the -purpose of compiling the Linux kernel in . -This version is recommended by the kernel developers when you need absolute -stability. Later versions of GCC have not received as much testing for Linux -kernel compilation. Using a later version is likely to work, however, we -recommend adhering to the kernel developer's advice and using the version here -to compile your kernel. - -We don't install the C++ compiler or libraries here. However, there -may be reasons why you would want to install them. More information can be found -at . - -We'll install this older release of GCC into the non-standard prefix of -/opt so as to avoid interfering with -the system GCC already installed in /usr - . - -Apply the patches and make a small adjustment: - -patch -Np1 -i ../gcc-&gcc-2953-version;-2.patch -patch -Np1 -i ../gcc-&gcc-2953-version;-no-fixinc.patch -patch -Np1 -i ../gcc-&gcc-2953-version;-returntype-fix.patch -echo timestamp > gcc/cstamp-h.in - -The GCC documentation recommends building GCC outside of the source -directory in a dedicated build directory: - -mkdir ../gcc-2-build -cd ../gcc-2-build - -Compile and install the compiler: - -../gcc-&gcc-2953-version;/configure --prefix=/opt/gcc-&gcc-2953-version; \ - --enable-shared --enable-languages=c \ - --enable-threads=posix -make bootstrap -make install - - - - diff --git a/chapter06/gcc.xml b/chapter06/gcc.xml index cc6b5d79e..eb168cb61 100644 --- a/chapter06/gcc.xml +++ b/chapter06/gcc.xml @@ -55,9 +55,9 @@ cd ../gcc-build Now prepare GCC for compilation: ../gcc-&gcc-version;/configure --prefix=/usr \ - --enable-shared --enable-threads=posix \ - --enable-__cxa_atexit --enable-clocale=gnu \ - --enable-languages=c,c++ + --libexecdir=/usr/lib --enable-shared --enable-threads=posix \ + --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ + Compile the package: diff --git a/chapter06/glibc.xml b/chapter06/glibc.xml index 59ecff6f9..9296458e5 100644 --- a/chapter06/glibc.xml +++ b/chapter06/glibc.xml @@ -42,28 +42,20 @@ cd ../glibc-build Now prepare Glibc for compilation: -../glibc-&glibc-version;-20031202/configure --prefix=/usr \ - --disable-profile --enable-add-ons=linuxthreads \ - --libexecdir=/usr/lib --with-headers=/usr/include \ - --without-cvs +../glibc-&glibc-version;/configure --prefix=/usr \ + --disable-profile --enable-add-ons=nptl --with-tls \ + --libexecdir=/tmp/pt_chown --without-cvs \ + --with-headers=/tools/glibc-kernheaders The meaning of the new configure options: ---libexecdir=/usr/lib: This changes the -location of the pt_chown program from its default of +--libexecdir=/tmp/pt_chown: This changes +the location of the pt_chown program from its default of /usr/libexec to -/usr/lib. The use of -libexec is considered not to be FHS-compliant because the -FHS doesn't even mention it. - ---with-headers=/usr/include: This -ensures that the kernel headers in /usr/include are used -for this build. If you don't pass this switch then the headers from -/tools/include are used which of course is not ideal -(although they should be identical). Using this switch has the advantage -that you will be informed immediately should you have forgotten to install the -kernel headers into /usr/include. +/tmp/pt_chown. This program isn't required +on modern systems, so we install it in a place from which we will delete it +later. Compile the package: @@ -119,13 +111,14 @@ localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro localedef -i it_IT -f ISO-8859-1 it_IT localedef -i ja_JP -f EUC-JP ja_JP -Finally, build the linuxthreads man pages: +Finally, build the linuxthreads man pages, which are a great reference +on the threading API (applicable to NPTL as well): -make -C ../glibc-&glibc-version;-20031202/linuxthreads/man +make -C ../glibc-&glibc-version;/linuxthreads/man And install these pages: -make -C ../glibc-&glibc-version;-20031202/linuxthreads/man install +make -C ../glibc-&glibc-version;/linuxthreads/man install diff --git a/chapter06/grub.xml b/chapter06/grub.xml index a7c7ff1bc..3abecc041 100644 --- a/chapter06/grub.xml +++ b/chapter06/grub.xml @@ -32,10 +32,19 @@ Grub. ./configure --prefix=/usr -Compile the package: +A few of the files comprising Grub have issues with optimizations done +by GCC 3.4. Compile these few files with known-good optimizations: + +make -C stage2 STAGE2_CFLAGS=-O2 \ + pre_stage2_exec-builtins.o pre_stage2_exec-serial.o + +Now compile the rest of the package: make +To test the results, issue: +make check. + Now install it: make install diff --git a/chapter06/inetutils.xml b/chapter06/inetutils.xml index 9d944d340..6ef16b16f 100644 --- a/chapter06/inetutils.xml +++ b/chapter06/inetutils.xml @@ -22,6 +22,11 @@ Diffutils, GCC, Glibc, Grep, Make, Ncurses, Sed. Installation of Inetutils +Inetutils has issues with the Linux 2.6 kernel series - fix these isues +by applying the following patch: + +patch -Np1 -i ../inetutils-&inetutils-version;-kernel-2.6-1.patch + We are not going to install all the programs that come with Inetutils. However, the Inetutils build system will insist on installing all the man pages anyway. The following patch will correct this situation: diff --git a/chapter06/kbd.xml b/chapter06/kbd.xml index 4c37aade6..0f644bfb5 100644 --- a/chapter06/kbd.xml +++ b/chapter06/kbd.xml @@ -22,13 +22,7 @@ Diffutils, Flex, GCC, Gettext, Glibc, Grep, Gzip, M4, Make, Sed. Installation of Kbd -By default some of Kbd's utilities (setlogcons, -setvesablank and getunimap) are -not installed. First enable the compilation of these utilities: - -patch -Np1 -i ../kbd-&kbd-version;-more-programs-1.patch - -Now prepare Kbd for compilation: +Prepare Kbd for compilation: ./configure @@ -73,7 +67,7 @@ source (you will have to repeat this command whenever you unpack a new kernel): loadkeys -m /usr/share/kbd/keymaps/defkeymap.map.gz > \ - /usr/src/linux-2.4.25/drivers/char/defkeymap.c + /usr/src/linux-&linux-version;/drivers/char/defkeymap.c diff --git a/chapter06/kernel-headers.xml b/chapter06/kernel-headers.xml deleted file mode 100644 index 1a51b1a31..000000000 --- a/chapter06/kernel-headers.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - %general-entities; -]> - -Linux-&linux-version; headers - - - -Linux -system, headers - -&buildtime; 0.1 SBU -&diskspace; 186 MB - - - -Installation of the kernel headers - -We won't be compiling a new kernel yet -- we'll do that when we have -finished the installation of all the packages. But the libraries installed in -the next section need to refer to the kernel header files in order to know how -to interface with the kernel. Instead of unpacking the kernel sources again, -making the version file and the symlinks and so on, we will simply copy the -headers from the temporary tools directory in one swoop: - -cp -a /tools/include/{asm,asm-generic,linux} /usr/include - -A few kernel header files refer to the autoconf.h -header file. Since we have not yet configured the kernel, we need to create -this file ourselves in order to avoid a compilation failure of Sysklogd. -Create an empty autoconf.h file with: - -touch /usr/include/linux/autoconf.h - - - - - -Why we copy the kernel headers - -In the past it was common practice to symlink the -/usr/include/{linux,asm} directories -to /usr/src/linux/include/{linux,asm}. -This was a bad practice, as the following extract from a -post by Linus Torvalds to the Linux Kernel Mailing List points out: - -I would suggest that people who compile new kernels should: - - - not have a single symbolic link in sight (except the one that the - kernel build itself sets up, namely the linux/include/asm - symlink that is only used for the internal kernel compile itself) - -And yes, this is what I do. My /usr/src/linux still has the old 2.2.13 -header files, even though I haven't run a 2.2.13 kernel in a _loong_ -time. But those headers were what Glibc was compiled against, so those -headers are what matches the library object files. - -And this is actually what has been the suggested environment for at -least the last five years. I don't know why the symlink business keeps -on living on, like a bad zombie. Pretty much every distribution still -has that broken symlink, and people still remember that the linux -sources should go into /usr/src/linux even though that hasn't -been true in a _loong_ time. - -The essential part is where Linus states that the header files should be -the ones which Glibc was compiled against. These are -the headers that should be used when you later compile other packages, as they -are the ones that match the object-code library files. By copying the headers, -we ensure that they remain available if later you upgrade your kernel. - -Note, by the way, that it is perfectly all right to have the kernel sources -in /usr/src/linux, as long as you don't -have the /usr/include/{linux,asm} -symlinks. - - - - diff --git a/chapter06/kernfs.xml b/chapter06/kernfs.xml new file mode 100644 index 000000000..9b3473303 --- /dev/null +++ b/chapter06/kernfs.xml @@ -0,0 +1,31 @@ + + + +Mounting virtual kernel file systems + + +Various file systems exported by the kernel don't exist at all on your +hard drive, but are used to communicate things to and from the kernel itself. + +Begin by creating directories onto which the file systems will be mounted: + +mkdir -p $LFS/{proc,sys} + +Now mount the file systems: + +mount -t proc proc $LFS/proc +mount -t sysfs sysfs $LFS/sys + +Remember that if for any reason you stop working on your BE-LFS, and start +again later, it's important to check that these file systems are mounted again +before entering the chroot environment, otherwise problems could occur. + +Shortly, we'll be mounting a few more file systems from within the chroot +environment. To keep the host up-to-date, we'll do a fake mount +for each of these now: + +mount -f -t ramfs ramfs $LFS/dev +mount -f -t tmpfs tmpfs $LFS/dev/shm +mount -f -t devpts -o gid=4,mode=620 devpts $LFS/dev/pts + + diff --git a/chapter06/linux-libc-headers.xml b/chapter06/linux-libc-headers.xml new file mode 100644 index 000000000..03cf0ecaa --- /dev/null +++ b/chapter06/linux-libc-headers.xml @@ -0,0 +1,43 @@ + + + %general-entities; +]> + +Linux-Libc-Headers-&linux-libc-headers-version; + + + +Linux-Libc-Headers +system, headers + +&buildtime; 0.1 SBU +&diskspace; 22 MB + + + +Installation of Linux-Libc-Headers + +For years it has been common practice to use so-called raw +kernel headers (straight from a kernel tarball) in /usr/include, but over the +last few years, the kernel developers have taken a strong stance that such +things should not be done. Thus was born the linux-libc-headers project, +designed to maintain an API stable version of the Linux headers. + +Install the header files: + +cp -R include/asm-i386 /usr/include/asm +cp -R include/linux /usr/include + +Assure that all the headers are owned by root: + +chown -R root:root /usr/include/{asm,linux} + +And make sure all the users can read the headers: + +find /usr/include/{asm,linux} -type d -exec chmod 755 {} \; +find /usr/include/{asm,linux} -type f -exec chmod 644 {} \; + + + + diff --git a/chapter06/makedev.xml b/chapter06/makedev.xml deleted file mode 100644 index 6d6e08edb..000000000 --- a/chapter06/makedev.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - %general-entities; -]> - -Creating devices with Make_devices-&makedev-version; - - -Make_devices - -The Make_devices package contains a script for creating device -nodes. - -&buildtime; 1 SBU -&diskspace; 160 KB - -For its installation Make_devices depends on: Bash, Bzip2, -Coreutils. - - - - -Making devices - -Note that unpacking the -make_devices-&makedev-version;.bz2 file doesn't -create a directory for you to cd into, as the file -contains only a shell script. - -Install the make_devices script: - -bzcat make_devices-&makedev-version;.bz2 > /dev/make_devices -chmod 754 /dev/make_devices - -Device nodes are special files: things that can generate or receive data. -They usually correspond to physical pieces of hardware. Device nodes can be -created by issuing commands of the form: mknod -m mode name type major -minor. In such a command, mode is the usual -octal read/write/execute permissions triplet, and name is -the name of the device file to be created. It may seem surprising, but the -device name is actually arbitrary, except that most programs rely on devices -such as /dev/null having their usual names. The remaining -three parameters tell the kernel what device the node -actually refers to. The type is a letter, either b or c, -indicating whether the device is accessed in blocks (such as a hard disk) or -character by character (such as the console). And major -and minor are numbers, together forming a code that -identifies the device to the kernel. A list of the currently assigned device -numbers for Linux can be found in the file devices.txt in -the Documentation subdirectory of the -kernel sources. - -Note that the same major/minor combination is usually assigned to both a -block and a character device. These are, however, completely unrelated devices -that cannot be interchanged. A device is identified by the type/major/minor -triple, not just the major/minor pair, so when creating a device node it is -important to choose the correct type of device. - -Because looking up the type/major/minor triples and using -mknod manually is tedious and error-prone, the -make_devices script has been created. It contains a whole -series of mknod commands, one for each device, complete with -recommended name, permissions and group assignment. It has been set up so that -only a minimal set of commonly used devices is enabled and the other lines are -commented out. You should open make_devices in an editor -and customize it to your needs. This takes some time, but is very simple. When -you are satisfied, run the script to create the device files: - -cd /dev -./make_devices - -If you had success with mounting the devpts file system earlier in -, you can continue with the next section. If you were -unable to mount devpts, you will have to create a few static ptyXX and ttyXX -device nodes instead. To do this, open make_devices in -your editor, go to the section Pseudo-TTY masters and enable a -few ptyXX devices -- a handful are enough to enable the test suites to run, but -if you plan to run a kernel without devpts support you will probably need many -more (every xterm, ssh connection, telnet connection, and the like, uses one of -these pseudo terminals). In the immediately following section Pseudo-TTY -slaves, enable the corresponding ttyXX devices. When you are done, rerun -./make_devices from inside /dev to -have it create the new devices. - - - - -Contents of Make_devices - -Installed script: make_devices - - - -Short description - -make_devices -make_devices is a script for creating a basic set of -static device nodes, usually residing in the /dev directory. - - - - - - diff --git a/chapter06/module-init-tools.xml b/chapter06/module-init-tools.xml new file mode 100644 index 000000000..a98fe2773 --- /dev/null +++ b/chapter06/module-init-tools.xml @@ -0,0 +1,98 @@ + + + %general-entities; +]> + +Module-Init-Tools-&module-init-tools-version; + + +Module-Init-Tools + +The Module-Init-Tools package contains programs for handling kernel +modules in Linux kernels greater than or equal to version 2.5.47. + +&buildtime; 0.1 SBU +&buildtime; 650 KB + +Module-Init-Tools installation depends on: Bash, Binutils, Bison, +Coreutils, Diffutils, Flex, GCC, Glibc, Grep, M4, Make, Sed. + + + +Installation of Module-Init-Tools + +Prepare Module-Init-Tools for compilation: + +./configure --prefix="" --enable-zlib + +Compile the package: + +make + +To test the results, issue: +make check. + +Install it: + +make install + + + + +Contents of Module-Init-Tools + +Installed programs: depmod, genksyms, insmod, +insmod_ksymoops_clean, kallsyms (link to insmod), kernelversion, ksyms +(link to insmod), lsmod (link to insmod), modinfo, modprobe (link to insmod) +and rmmod (link to insmod) + + + + +Short descriptions + +depmod +depmod creates a dependency file, based on the +symbols it finds in the existing set of modules. This dependency file is used +by modprobe to automatically load the required modules. + +genksyms +genksyms generates symbol version information. + +insmod +insmod installs a loadable module in the running kernel. + +insmod_ksymoops_clean +insmod_ksymoops_clean deletes saved ksyms and +modules not accessed for two days. + +kallsyms +kallsyms extracts all kernel symbols for debugging. + +kernelversion +kernelversion reports the major version of the +running kernel. + +ksyms +ksyms displays exported kernel symbols. + +lsmod +lsmod shows which modules are loaded. + +modinfo +modinfo examines an object file associated with +a kernel module and displays any information that it can glean. + +modprobe +modprobe uses a dependency file, created by +depmod, to automatically load the relevant modules. + +rmmod +rmmod unloads modules from the running kernel. + + + + + + diff --git a/chapter06/modutils.xml b/chapter06/modutils.xml deleted file mode 100644 index 829dc4739..000000000 --- a/chapter06/modutils.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - %general-entities; -]> - -Modutils-&modutils-version; - - -Modutils - -The Modutils package contains programs for handling kernel modules. - -&buildtime; 0.1 SBU -&buildtime; 2.9 MB - -Modutils installation depends on: Bash, Binutils, Bison, Coreutils, -Diffutils, Flex, GCC, Glibc, Grep, M4, Make, Sed. - - - - -Installation of Modutils - -Prepare Modutils for compilation: - -./configure - -Compile the package: - -make - -Install it: - -make install - - - - -Contents of Modutils - -Installed programs: depmod, genksyms, insmod, -insmod_ksymoops_clean, kallsyms (link to insmod), kernelversion, ksyms -(link to insmod), lsmod (link to insmod), modinfo, modprobe (link to insmod) -and rmmod (link to insmod) - - - - -Short descriptions - -depmod -depmod creates a dependency file, based on the -symbols it finds in the existing set of modules. This dependency file is used -by modprobe to automatically load the required modules. - -genksyms -genksyms generates symbol version information. - -insmod -insmod installs a loadable module in the running kernel. - -insmod_ksymoops_clean -insmod_ksymoops_clean deletes saved ksyms and -modules not accessed for two days. - -kallsyms -kallsyms extracts all kernel symbols for debugging. - -kernelversion -kernelversion reports the major version of the -running kernel. - -ksyms -ksyms displays exported kernel symbols. - -lsmod -lsmod shows which modules are loaded. - -modinfo -modinfo examines an object file associated with -a kernel module and displays any information that it can glean. - -modprobe -modprobe uses a dependency file, created by -depmod, to automatically load the relevant modules. - -rmmod -rmmod unloads modules from the running kernel. - - - - - - diff --git a/chapter06/net-tools.xml b/chapter06/net-tools.xml index 9eaa24b3c..d63b2f4b4 100644 --- a/chapter06/net-tools.xml +++ b/chapter06/net-tools.xml @@ -37,6 +37,11 @@ but it's up to the kernel to make the protocols available. patch -Np1 -i ../net-tools-&net-tools-version;-miitool-gcc33-1.patch +Net-tools has issues with the Linux 2.6 kernel series - fix these issues +by applying the following patch: + +patch -Np1 -i ../net-tools-&net-tools-version;-kernel-2.6-1.patch + Now prepare Net-tools for compilation (if you intend to accept the defaults, you can skip all the questions by running yes "" | make config instead): diff --git a/chapter06/proc.xml b/chapter06/proc.xml deleted file mode 100644 index 919abf6a8..000000000 --- a/chapter06/proc.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - -Mounting the proc and devpts file systems - - -In order for certain programs to function properly, the -proc and devpts file systems must be -available within the chroot environment. The proc file system is the process -information pseudo file system through which the kernel provides information -about the status of the system. And the devpts file system is nowadays the most -common way pseudo terminals (PTYs) are implemented. Since kernel version 2.4, a -file system can be mounted as many times and in as many places as you like, -thus it's not a problem that these file systems are already mounted on your -host system, especially so because they are virtual file systems. - -First become root, as only root -can mount file systems in unusual places. Then check again that the LFS -environment variable is set correctly by running echo -$LFS and making sure it shows the path to your LFS partition's -mount point, which is /mnt/lfs if you -followed our example. - -Now make the mount points for these filesystems: - -mkdir -p $LFS/{proc,dev/pts} - -Mount the proc file system with: - -mount proc $LFS/proc -t proc - -And mount the devpts file system with: - -mount devpts $LFS/dev/pts -t devpts - -This last command might fail with an error like: - -
filesystem devpts not supported by kernel
- -The most likely cause for this is that your host system's kernel was -compiled without support for the devpts file system (you can check which file -systems your kernel supports with cat /proc/filesystems, -for example). A few PTYs are needed to be able to run the suites for Binutils -and GCC later on. If your kernel does not support devpts, do not worry, there -is another way to get them working inside the chroot environment. We'll cover -this shortly in the section. - -Remember that if for any reason you stop working on your LFS, and start -again later, it's important to check that these file systems are mounted again -before entering the chroot environment, otherwise problems could occur. - -
diff --git a/chapter06/procinfo.xml b/chapter06/procinfo.xml deleted file mode 100644 index 41249115b..000000000 --- a/chapter06/procinfo.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - %general-entities; -]> - -Procinfo-&procinfo-version; - - -Procinfo - -The Procinfo package contains programs for displaying system information. - -&buildtime; 0.1 SBU -&diskspace; 0.2 MB - -Procinfo installation depends on: Binutils, GCC, Glibc, Make, Ncurses. - - - - -Installation of Procinfo - -Compile Procinfo: - -make LDLIBS=-lncurses - -The meaning of the make parameter: - -LDLIBS=-lncurses: This tells Procinfo -to use the libncurses library instead of the -long-obsolete libtermcap. - - -Install the package: - -make install - - - - -Contents of Procinfo - -Installed programs: lsdev, procinfo and -socklist - - - - -Short descriptions - -lsdev -lsdev lists the devices present in your system, -and which IRQs (Interrupt ReQuest) and IO ports they use. - -procinfo -procinfo displays an overview of some of the information -present in the virtual proc file system. - -socklist -socklist lists the open sockets, reporting their -type, port number, and other specifics. - - - - - - diff --git a/chapter06/psmisc.xml b/chapter06/psmisc.xml index 2378d60ff..b69f91ea1 100644 --- a/chapter06/psmisc.xml +++ b/chapter06/psmisc.xml @@ -25,12 +25,12 @@ GCC, Gettext, Glibc, Grep, Make, Ncurses, Sed. Prepare Psmisc for compilation: -./configure --prefix=/usr --exec-prefix=/ +./configure --prefix=/usr --exec-prefix="" The meaning of the configure option: ---exec-prefix=/: This causes the +--exec-prefix="": This causes the binaries to be installed in /bin instead of /usr/bin. As the Psmisc programs are often used in bootscripts, they should be available also when the /usr diff --git a/chapter06/pwdgroup.xml b/chapter06/pwdgroup.xml index a515de425..83c3bd283 100644 --- a/chapter06/pwdgroup.xml +++ b/chapter06/pwdgroup.xml @@ -45,10 +45,11 @@ disk:x:8: lp:x:9: dialout:x:10: audio:x:11: +video:x:12: EOF The created groups aren't part of any standard -- they are some of the -groups that the make_devices script in the next section +groups that the Udev configuration we will be using in the next section uses. The LSB (Linux Standard Base) recommends only that, beside the group root with a GID of 0, a group bin with a GID of 1 be present. All other group diff --git a/chapter06/shadow.xml b/chapter06/shadow.xml index 76ea1f075..cba368d08 100644 --- a/chapter06/shadow.xml +++ b/chapter06/shadow.xml @@ -43,6 +43,11 @@ working: echo '#define HAVE_SETLOCALE 1' >> config.h +Shadow incorrectly declares the malloc() function, causing compilation +failure. Fix this: + +sed -i '/extern char/d' libmisc/xmalloc.c + Compile the package: make diff --git a/chapter06/sysklogd.xml b/chapter06/sysklogd.xml index 1d85acec1..c9eac3bdf 100644 --- a/chapter06/sysklogd.xml +++ b/chapter06/sysklogd.xml @@ -18,10 +18,14 @@ as those given by the kernel when unusual things happen. Sysklogd installation depends on: Binutils, Coreutils, GCC, Glibc, Make. - Installation of Sysklogd +Sysklogd has issues with the Linux 2.6 kernel series - fix these isues +by applying the following patch: + +patch -Np1 -i ../sysklogd-&sysklogd-version;-kernel_header.patch + Compile Sysklogd: make diff --git a/chapter06/udev.xml b/chapter06/udev.xml new file mode 100644 index 000000000..aba37b85f --- /dev/null +++ b/chapter06/udev.xml @@ -0,0 +1,50 @@ + + + %general-entities; +]> + +Udev-&udev-version; + + + +Udev +system + +&buildtime; 0.2 SBU +&diskspace; 5.2 MB + + + +Installation of Udev + +By default, the permissions udev assigns to nodes are all uniform, +being owned by user root, group root, and only accessible to root. As you +can easily imagine, this isn't ideal. Give it a much better configuration +by applying the following patch: + +patch -Np1 -i ../udev-&udev-version;-config-1.patch + + +Now compile Udev: + +make udevdir=/dev + +And install finally install it: + +make udevdir=/dev install + +And since we aren't going to be using the udev daemon, but instead the +udev binary itself, we correct it's hotplug configuration: + +ln -sf /sbin/udev /etc/hotplug.d/default/udev.hotplug + + + + +Contents of Udev +Who knows? + + + + diff --git a/chapter06/util-linux.xml b/chapter06/util-linux.xml index 38aa75a84..b0d5ca805 100644 --- a/chapter06/util-linux.xml +++ b/chapter06/util-linux.xml @@ -39,6 +39,11 @@ mkdir -p /var/lib/hwclock Installation of Util-linux +Util-linux has issues with the Linux 2.6 kernel series - fix these isues +by applying the following patch: + +patch -Np1 -i ../util-linux-&util-linux-version;-kernel-dj-2.6-1.patch + Prepare Util-linux for compilation: ./configure diff --git a/chapter06/vim.xml b/chapter06/vim.xml index a11a4dca9..366716f0d 100644 --- a/chapter06/vim.xml +++ b/chapter06/vim.xml @@ -45,7 +45,7 @@ echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' >> src/feature.h< make To test the results, you can issue: -make check. However, this test suite outputs a lot of +make test. However, this test suite outputs a lot of seemingly garbage characters to the screen, and this can wreak havoc with the settings of the current terminal. Therefore the running of the test suite here is strictly optional. diff --git a/chapter07/bootscripts.xml b/chapter07/bootscripts.xml index 9ee79f203..de6e35128 100644 --- a/chapter07/bootscripts.xml +++ b/chapter07/bootscripts.xml @@ -25,6 +25,10 @@ make install +Since we're using Udev, install the support script for it: + +make install-udev + diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml index 6482e26a8..64dfc7eb8 100644 --- a/chapter07/chapter07.xml +++ b/chapter07/chapter07.xml @@ -8,33 +8,14 @@ Setting up system boot scripts - - - - - - - - - - - - - - - - - - - diff --git a/chapter08/chapter08.xml b/chapter08/chapter08.xml index 01fec81e3..7fcdfa749 100644 --- a/chapter08/chapter08.xml +++ b/chapter08/chapter08.xml @@ -9,15 +9,8 @@ - - - - - - - diff --git a/chapter08/fstab.xml b/chapter08/fstab.xml index 83b32fbd1..6c8738cc8 100644 --- a/chapter08/fstab.xml +++ b/chapter08/fstab.xml @@ -22,6 +22,7 @@ this: /dev/xxx / fff defaults 1 1 /dev/yyy swap swap pri=1 0 0 proc /proc proc defaults 0 0 +sysfs /sys sysfs defaults 0 0 devpts /dev/pts devpts gid=4,mode=620 0 0 shm /dev/shm tmpfs defaults 0 0 diff --git a/chapter08/grub.xml b/chapter08/grub.xml index aca02cada..add9baaba 100644 --- a/chapter08/grub.xml +++ b/chapter08/grub.xml @@ -92,9 +92,9 @@ timeout 30 color green/black light-green/black # The first entry is for LFS. -title LFS &milestone; +title LFS &milestone; (Linux &linux-version;) root (hd0,3) -kernel --no-mem-option /boot/lfskernel root=/dev/hda4 +kernel --no-mem-option /boot/lfskernel-&linux-version; root=/dev/hda4 EOF By default, Grub will automatically pass a mem=xxx diff --git a/chapter08/kernel.xml b/chapter08/kernel.xml index 5ad76a1a4..84f772804 100644 --- a/chapter08/kernel.xml +++ b/chapter08/kernel.xml @@ -56,45 +56,33 @@ scratch. Virtual memory file system support is enabled. It resides within the File systems menu and is normally enabled by default. -Verify dependencies and create dependency information files: +NPTL requires the kernel to be compiled with GCC 3.x, in this case +&gcc-version;. Compiling with 2.95.x is known to cause failures in the glibc +testsuite, so do not compile the kernel with gcc 2.95.x +unless you know what you're getting yourself into. -make CC=/opt/gcc-2.95.3/bin/gcc dep +Compile the kernel image and modules: -Compile the kernel image: - -make CC=/opt/gcc-2.95.3/bin/gcc bzImage - -Compile the drivers which have been configured as modules: - -make CC=/opt/gcc-2.95.3/bin/gcc modules +make If you intend to use kernel modules, you will need an -/etc/modules.conf file. Information pertaining +/etc/modprobe.conf file. Information pertaining to modules and to kernel configuration in general may be found in the kernel documentation, which is found in the -linux-2.4.25/Documentation directory. The +linux-&linux-version;/Documentation directory. The modules.conf man page and the kernel HOWTO at may also be of interest to you. Install the modules: -make CC=/opt/gcc-2.95.3/bin/gcc modules_install +make modules_install If you have a lot of modules and very little space, you may want to consider stripping and compressing the modules. For most people such compression isn't worth the trouble, but if you're really pressed for space, then have a look at . -As nothing is complete without documentation, build the manual pages -that come with the kernel: - -make mandocs - -And install these pages: - -cp -a Documentation/man /usr/share/man/man9 - Kernel compilation has finished but more steps are required to complete the installation. Some files need to be copied to the /boot directory. @@ -102,21 +90,21 @@ directory. The path to the kernel image may vary depending on the platform you're using. Issue the following command to install the kernel: -cp arch/i386/boot/bzImage /boot/lfskernel +cp arch/i386/boot/bzImage /boot/lfskernel-&linux-version; System.map is a symbol file for the kernel. It maps the function entry points of every function in the kernel API (Application Programming Interface), as well as the addresses of the kernel data structures for the running kernel. Issue the following command to install the map file: -cp System.map /boot +cp System.map /boot/System.map-&linux-version; .config is the kernel configuration file that was produced by the make menuconfig step above. It contains all the config selections for the kernel that was just compiled. It's a good idea to keep this file for future reference: -cp .config /boot/config-lfskernel +cp .config /boot/config-&linux-version; It is important to note that the files in the kernel source directory are not owned by root. Whenever you unpack a package as user diff --git a/chapter09/chapter09.xml b/chapter09/chapter09.xml index 0469ef29e..c5738cad4 100644 --- a/chapter09/chapter09.xml +++ b/chapter09/chapter09.xml @@ -9,14 +9,8 @@ - - - - - - diff --git a/chapter09/reboot.xml b/chapter09/reboot.xml index 6607a71e3..96969a9d4 100644 --- a/chapter09/reboot.xml +++ b/chapter09/reboot.xml @@ -15,7 +15,10 @@ your computer. First exit from the chroot environment: Then unmount the virtual files systems: umount $LFS/dev/pts -umount $LFS/proc +umount $LFS/dev/shm +umount $LFS/dev +umount $LFS/proc +umount $LFS/sys And unmount the LFS file system: diff --git a/general.ent b/general.ent index 50c87240d..454b9de3c 100644 --- a/general.ent +++ b/general.ent @@ -1,7 +1,7 @@ - + @@ -19,24 +19,22 @@ - - + + - - + - - + @@ -46,19 +44,18 @@ - + + - - + - @@ -69,5 +66,6 @@ + diff --git a/index.xml b/index.xml index c63dbc3d3..c97453be3 100644 --- a/index.xml +++ b/index.xml @@ -6,10 +6,7 @@ - - - @@ -17,38 +14,24 @@ Introduction - - Preparing for the build - - - - - Building the LFS system - - - - - - -