From 3c928f1c576bdc82b3dab964a575ba5bd56b15bf Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Sun, 13 Jun 2004 12:58:23 +0000 Subject: [PATCH] Added a separate file for the strippingagain section. Tags correcitions. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3780 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter06/aboutdebug.xml | 5 ++-- chapter06/automake.xml | 2 +- chapter06/bash.xml | 14 ++++++----- chapter06/binutils.xml | 12 ++++----- chapter06/bison.xml | 7 +++--- chapter06/bzip2.xml | 16 ++++++------ chapter06/changingowner.xml | 2 +- chapter06/chapter06.xml | 47 +----------------------------------- chapter06/chroot.xml | 12 +++++---- chapter06/coreutils.xml | 16 ++++++------ chapter06/devices.xml | 13 ++++++---- chapter06/strippingagain.xml | 47 ++++++++++++++++++++++++++++++++++++ 12 files changed, 102 insertions(+), 91 deletions(-) create mode 100644 chapter06/strippingagain.xml diff --git a/chapter06/aboutdebug.xml b/chapter06/aboutdebug.xml index 32798c78b..4939bb704 100644 --- a/chapter06/aboutdebug.xml +++ b/chapter06/aboutdebug.xml @@ -8,7 +8,7 @@ Most programs and libraries are, by default, compiled with debugging -symbols included (with gcc's -g +symbols included (with gcc's -g option). This means that, when debugging a program or library that was compiled with debugging information included, the debugger can give you not only memory addresses but also the names of the routines and variables. @@ -25,7 +25,8 @@ with debugging symbols: 1200 KB a bash binary without debugging symbols: 480 KB -Glibc and GCC files (/lib and /usr/lib) +Glibc and GCC files (/lib +and /usr/lib) with debugging symbols: 87 MB Glibc and GCC files diff --git a/chapter06/automake.xml b/chapter06/automake.xml index 84043649a..e668b27b9 100644 --- a/chapter06/automake.xml +++ b/chapter06/automake.xml @@ -184,7 +184,7 @@ missing GNU programs during an installation. ylwrap ylwrap -is a wrapper for lex and yacc. +is a wrapper for lex and yacc. diff --git a/chapter06/bash.xml b/chapter06/bash.xml index 002a043ff..286038439 100644 --- a/chapter06/bash.xml +++ b/chapter06/bash.xml @@ -54,11 +54,12 @@ patch: exec /bin/bash --login +h -Note that the parameters used make it an interactive login instance -(so /etc/profile is read, if it exists, and the first found -~/.bash_profile, ~/.bash_login or and ~/.profile) and continue to +The parameters used make it an interactive login instance +(so /etc/profile is read, if it exists, and the first found +~/.bash_profile, ~/.bash_login or +and ~/.profile) and continue to disable hashing so that new programs are found as they become -available. +available. @@ -87,7 +88,7 @@ before executing it, thus making this interpreter a powerful tool. bashbug is a shell script to help the user -compose and mail bug reports concerning bash in a standard format. +compose and mail bug reports concerning bash in a standard format. @@ -96,7 +97,8 @@ compose and mail bug reports concerning bash in a standard format. sh is a symlink to the bash program. When invoked -as sh, bash tries to mimic the startup behavior of historical versions of sh as +as sh, bash tries to mimic the +startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well. diff --git a/chapter06/binutils.xml b/chapter06/binutils.xml index b05d0416e..75421eb41 100644 --- a/chapter06/binutils.xml +++ b/chapter06/binutils.xml @@ -37,14 +37,14 @@ everything is set up correctly by performing a simple test: If you receive the message: -
The system has no more ptys. Ask your system administrator to create more.
+The system has no more ptys. Ask your system administrator to create more. 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. This package is known to behave badly when you have changed its -default optimization flags (including the -march and -mcpu options). +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 Binutils. @@ -65,9 +65,9 @@ cd ../binutils-build Normally, the tooldir (the directory where the executables end up) is set to $(exec_prefix)/$(target_alias), which expands -into, for example, /usr/i686-pc-linux-gnu. Since we only +into, for example, /usr/i686-pc-linux-gnu. Since we only build for our own system, we don't need this target specific directory in -/usr. That setup would be used if the system was used to +/usr. That setup would be used if the system was used to cross-compile (for example compiling a package on an Intel machine that generates code that can be executed on PowerPC machines). @@ -87,7 +87,7 @@ doubts. make tooldir=/usr install -Install the libiberty header file that is needed by +Install the libiberty header file that is needed by some packages: cp ../binutils-&binutils-version;/include/libiberty.h /usr/include @@ -133,7 +133,7 @@ the archive). as as -is an assembler. It assembles the output of gcc into object files. +is an assembler. It assembles the output of gcc into object files. diff --git a/chapter06/bison.xml b/chapter06/bison.xml index f6247bb94..438485e1a 100644 --- a/chapter06/bison.xml +++ b/chapter06/bison.xml @@ -61,7 +61,7 @@ GCC, Gettext, Glibc, Grep, M4, Make, Sed bison generates, from a series of rules, a program -for analyzing the structure of text files. Bison is a replacement for yacc +for analyzing the structure of text files. bison is a replacement for yacc (Yet Another Compiler Compiler). @@ -70,8 +70,9 @@ for analyzing the structure of text files. Bison is a replacement for yacc yacc yacc -is a wrapper for bison, meant for programs -that still call yacc instead of bison. It calls bison with the -y option. +is a wrapper for bison, meant for programs +that still call yacc instead of bison. +It calls bison with the -y option. diff --git a/chapter06/bzip2.xml b/chapter06/bzip2.xml index 62271ad57..def1398d8 100644 --- a/chapter06/bzip2.xml +++ b/chapter06/bzip2.xml @@ -35,10 +35,10 @@ GCC, Glibc, Make make -f Makefile-libbz2_so make clean -The -f flag will cause Bzip2 to be built +The -f flag will cause Bzip2 to be built using a different Makefile file, in this case the Makefile-libbz2_so file, which creates a dynamic -libbz2.so library and links the Bzip2 utilities +libbz2.so library and links the Bzip2 utilities against it. Compile the package: @@ -100,7 +100,7 @@ libbz2.so.&bzip2-version;) and libbz2.so.&bzip2-version; bzcmp bzcmp -runs cmp on bzipped files. +runs cmp on bzipped files. @@ -108,7 +108,7 @@ libbz2.so.&bzip2-version;) and libbz2.so.&bzip2-version; bzdiff bzdiff -runs diff on bzipped files. +runs diff on bzipped files. @@ -116,7 +116,7 @@ libbz2.so.&bzip2-version;) and libbz2.so.&bzip2-version; bzgrep bzgrep -and friends run grep on bzipped files. +and friends run grep on bzipped files. @@ -135,7 +135,7 @@ compressors using LZ77/LZ78, like gzip. bzip2recover bzip2recover -tries to recover data from damaged bzip2 files. +tries to recover data from damaged bzipped files. @@ -143,7 +143,7 @@ compressors using LZ77/LZ78, like gzip. bzless bzless -runs less on bzipped files. +runs less on bzipped files. @@ -151,7 +151,7 @@ compressors using LZ77/LZ78, like gzip. bzmore bzmore -runs more on bzipped files. +runs more on bzipped files. diff --git a/chapter06/changingowner.xml b/chapter06/changingowner.xml index cef15f8ba..1de747a01 100644 --- a/chapter06/changingowner.xml +++ b/chapter06/changingowner.xml @@ -29,7 +29,7 @@ user root by running the following command: chown -R 0:0 /tools -The command uses 0:0 instead of root:root, +The command uses 0:0 instead of root:root, because chown is unable to resolve the name root until the password file has been created. diff --git a/chapter06/chapter06.xml b/chapter06/chapter06.xml index a99b76af8..603568982 100644 --- a/chapter06/chapter06.xml +++ b/chapter06/chapter06.xml @@ -68,52 +68,7 @@ - - -Stripping again - - -If you are not a programmer and don't plan to do any debugging on your -system software, you can shrink your system by about 200 MB by removing the -debugging symbols from binaries and libraries. This causes no inconvenience -other than not being able to debug the software fully any more. - -Most people who use the command mentioned below don't experience any -problems. But it is easy to make a typo and render your new system unusable, so -before running the strip command it is probably a good idea to make a backup of -the current situation. - -If you are going to perform the stripping, special care is needed to -ensure you're not running any of the binaries that are about to be stripped. -If you're not sure whether you entered chroot with the command given in -, then first exit from chroot: - -logout - -Then reenter it with: - -chroot $LFS /tools/bin/env -i \ - HOME=/root TERM=$TERM PS1='\u:\w\$ ' \ - PATH=/bin:/usr/bin:/sbin:/usr/sbin \ - /tools/bin/bash --login - -Now you can safely strip the binaries and libraries: - -/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \ - -exec /tools/bin/strip --strip-debug '{}' ';' - -A large number of files will be reported as having their file format not -recognized. These warnings can be safely ignored, they just mean that those -files are scripts instead of binaries, no harm is done. - -If you are really tight on disk space, you may want to use ---strip-all on the binaries in -/{,usr/}{bin,sbin} to gain several more megabytes. But do -not use this option on libraries: they would be -destroyed. - - - + diff --git a/chapter06/chroot.xml b/chapter06/chroot.xml index 08d74ea53..238dc5381 100644 --- a/chapter06/chroot.xml +++ b/chapter06/chroot.xml @@ -17,10 +17,10 @@ populated with only the temporary tools: PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/bin/bash --login +h -The -i option given to the +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 -set again. The TERM=$TERM construct will set the TERM variable inside chroot +set again. The TERM=$TERM construct will set the TERM variable inside chroot to the same value as outside chroot; this variable is needed for programs like vim and less to operate properly. If you need other variables present, such as CFLAGS or CXXFLAGS, @@ -36,17 +36,19 @@ the chroot command. last in the PATH. This means that a temporary tool will not be used any more as soon as its final version is installed. Well, at least when the shell doesn't remember the locations of executed binaries -- for this reason hashing -is switched off by passing the +h option to +is switched off by passing the +h option to bash. You have to make sure all the commands in the rest of this chapter and in the following chapters are run from within the chroot environment. If you ever leave this environment for any reason (rebooting for example), -you must remember to first mount the proc and devpts file systems (discussed +you must remember to first mount the proc +and devpts file systems (discussed in the previous section) and enter chroot again before continuing with the installations. -Note that the bash prompt will say I have no name! This is +Note that the bash prompt will say +I have no name! This is normal, as the /etc/passwd file has not been created yet. diff --git a/chapter06/coreutils.xml b/chapter06/coreutils.xml index af5251262..984981273 100644 --- a/chapter06/coreutils.xml +++ b/chapter06/coreutils.xml @@ -30,8 +30,8 @@ Gettext, Glibc, Grep, Make, Perl, Sed Installation of Coreutils Normally the functionality of uname is somewhat -broken, in that the -p switch always returns -unknown. The following patch fixes this behavior for Intel +broken, in that the -p switch always returns +unknown. The following patch fixes this behavior for Intel architectures: patch -Np1 -i ../coreutils-&coreutils-version;-uname-2.patch @@ -160,7 +160,7 @@ each given file to the given user:group pair. chroot runs a given command with the specified directory as the -/ directory. The given command can be an interactive shell. +/ directory. The given command can be an interactive shell. On most systems only root can do this. @@ -241,7 +241,7 @@ given files. dir dir -is the same as ls. +is the same as ls. @@ -250,7 +250,7 @@ given files. dircolors outputs commands to set the LS_COLOR -environment variable, to change the color scheme used by ls. +environment variable, to change the color scheme used by ls. @@ -448,7 +448,7 @@ By default it orders the files and subdirectories alphabetically. mkfifo mkfifo -creates FIFOs (First-In, First-Out, a "named pipe" in UNIX parlance) with +creates FIFOs (First-In, First-Out, a named pipe in UNIX parlance) with the given names. @@ -808,7 +808,7 @@ running, how many users are logged on, and the system load averages. vdir vdir -is the same as ls -l. +is the same as ls -l. @@ -841,7 +841,7 @@ for each given file, and a total line when more than one file is given. yes yes -outputs 'y' or a given string repeatedly, until killed. +outputs y or a given string repeatedly, until killed. diff --git a/chapter06/devices.xml b/chapter06/devices.xml index e6b1a8c57..b14789fa0 100644 --- a/chapter06/devices.xml +++ b/chapter06/devices.xml @@ -7,13 +7,14 @@ Populating /dev with device nodes -Devices +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: +nodes, in particular the console and +null devices: mknod -m 600 /dev/console c 5 1 mknod -m 666 /dev/null c 1 3 @@ -22,15 +23,17 @@ 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 +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: +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: +all the information in /sys: /tools/sbin/udevstart diff --git a/chapter06/strippingagain.xml b/chapter06/strippingagain.xml new file mode 100644 index 000000000..1630cd2af --- /dev/null +++ b/chapter06/strippingagain.xml @@ -0,0 +1,47 @@ + + + +Stripping again + + +If you are not a programmer and don't plan to do any debugging on your +system software, you can shrink your system by about 200 MB by removing the +debugging symbols from binaries and libraries. This causes no inconvenience +other than not being able to debug the software fully any more. + +Most people who use the command mentioned below don't experience any +problems. But it is easy to make a typo and render your new system unusable, so +before running the strip command it is probably a good idea to make a backup of +the current situation. + +If you are going to perform the stripping, special care is needed to +ensure you're not running any of the binaries that are about to be stripped. +If you're not sure whether you entered chroot with the command given in +, then first exit from chroot: + +logout + +Then reenter it with: + +chroot $LFS /tools/bin/env -i \ + HOME=/root TERM=$TERM PS1='\u:\w\$ ' \ + PATH=/bin:/usr/bin:/sbin:/usr/sbin \ + /tools/bin/bash --login + +Now you can safely strip the binaries and libraries: + +/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \ + -exec /tools/bin/strip --strip-debug '{}' ';' + +A large number of files will be reported as having their file format not +recognized. These warnings can be safely ignored, they just mean that those +files are scripts instead of binaries, no harm is done. + +If you are really tight on disk space, you may want to use +--strip-all on the binaries in +/{,usr/}{bin,sbin} to gain several more megabytes. But do +not use this option on libraries: they would be +destroyed. + + +