Please consider a donation to the Higher Intellect project. See https://preterhuman.net/donate.php or the Donate to Higher Intellect page for more info.

Linux From Scratch

From Higher Intellect Vintage Wiki
Jump to navigation Jump to search
Linux From Scratch

Gerard Beekmans

Copyright © 1999, 2000, 2001 by Gerard Beekmans


This book describes the process of creating your own Linux system from
scratch from an already installed Linux distribution, using nothing but the
sources of software that are needed.

Copyright (c) 1999-2001, Gerard Beekmans

All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer.
   
  * Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions and the following disclaimer in the documentation
    and/or other materials provided with the distribution.
   
  * Neither the name of LinuxFromScratch nor the names of its contributors
    may be used to endorse or promote products derived from this software
    without specific prior written permission.
   

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Dedication

 This book is dedicated to my loving and supportive wife Beverly Beekmans. 

Table of Contents
Preface
    1. Who would want to read this book
    2. Who would not want to read this book
    3. Organization
   
   
I. Part I - Introduction
    1. Introduction
    2. Important information
   
   
II. Part II - Installing the LFS system
    3. Packages you need to download
    4. Preparing a new partition
    5. Preparing the LFS system
    6. Installing basic system software
    7. Creating system boot scripts
    8. Making the LFS system bootable
    9. Setting up basic networking
   
   
III. Part III - Appendixes
    A. Package descriptions
    B. Resources
    C. Official download locations
   
   

-----------------------------------------------------------------------------
Preface

1. Who would want to read this book

This book is intended for Linux users who want to learn more about the inner
workings of Linux and how the various pieces of the Operating System fit
together. This book will guide you step-by-step in creating your own custom
build Linux system from scratch, using the source code of the software that
we need.

This book is also intended for Linux users who want to get away from the
existing commercial and free distributions that are often too bloated. Using
existing distributions also forces you to use the file system structure, boot
script structure, etc. that they choose to use. With this book you can create
your own structures and methods in exactly the way you like them (which can
be based on the ones this book provides)

Also, if you have security concerns, you don't want to rely on pre-compiled
packages. So instead, you want to compile all programs from scratch and
install them yourself. That could be another reason why you would want to
build a custom made Linux system.

Those are just a few out of many reasons why people want to build their own
Linux system. If you're one of those people, this book is meant for you.
-----------------------------------------------------------------------------

2. Who would not want to read this book

Users who don't want to build an entire Linux system from scratch probably
don't want to read this book. If you, however, do want to learn more about
what happens behind the scenes, in particular what happens between turning on
your computer and seeing the command prompt, you want to read the "From Power
Up To Bash Prompt" (P2B) HOWTO. This HOWTO builds a bare system, in a similar
way as this book does, but it focusses more on just installing a bootable
system instead of a complete system.

To decide whether you want to read this book or the P2B HOWTO, you could ask
yourself this question: Is my main objective to get a working Linux system
that I'm going to build myself and along the way learn and learn what every
component of a system is for, or is just the learning part your main
objective. If you want to build and learn, read this book. If you just want
to learn, then the P2B HOWTO is probably better material to read.

The "From Power Up To Bash Prompt" HOWTO can be downloaded from [http://
www.netspace.net.au/~gok/power2bash/] http://www.netspace.net.au/~gok/
power2bash/
-----------------------------------------------------------------------------

3. Organization

This book is divided into the following parts. Although there is a lot of
duplicate information in certain parts, it's the easiest way to read it and
not to mention the easiest way for me to maintain the book.
-----------------------------------------------------------------------------

3.1. Part I - Introduction

Part One gives you general information about this book (versions, where to
get it, changelog, mailinglists and how to get in touch with me). It also
explains a few important aspects you really want and need to read before you
start building an LFS system.
-----------------------------------------------------------------------------

3.2. Part II - Installation of the LFS system

Part Two guides you through the installation of the LFS system which will be
the foundation for the rest of the system. Whatever you choose to do with
your brand new LFS system, it will be built on the foundation that's
installed in this part.
-----------------------------------------------------------------------------

3.3. Part III - Appendixes

Part Three contains various Appendixes.

I. Part I - Introduction

Table of Contents
1. Introduction
    1.1. Introduction
    1.2. How things are going to be done
    1.3. Book versions
    1.4. Acknowledgements
    1.5. Changelog
    1.6. Mailinglists and archives
    1.7. Contact information
   
   
2. Important information
    2.1. About $LFS
    2.2. How to download the software
    2.3. How to install the software
    2.4. Download the bootscripts
    2.5. Download the LFS Commands
   
   

-----------------------------------------------------------------------------
Chapter 1. Introduction

1.1. Introduction

Having used a number of different Linux distributions, I was never fully
satisfied with any of those. I didn't like the way the bootscripts were
arranged, or I didn't like the way certain programs were configured by
default and more of those things. I came to realize that when I want to be
totally satisfied with a Linux system, I have to build my own Linux system
from scratch, ideally only using the source code. Not using pre-compiled
packages of any kind. No help from some sort of cdrom or bootdisk that would
install some basic utilities. You would use your current Linux system and use
that one to build your own.

This, at one time, wild idea seemed very difficult and at times almost
impossible. The reason for most problems were due to my lack of knowledge
about certain programs and procedures. After sorting out all kinds of
dependency problems, compilation problems, etcetera, a custom built Linux
system was created and fully operational. I called this system an LFS system,
which stands for LinuxFromScratch.
-----------------------------------------------------------------------------

1.2. How things are going to be done

We are going to build the LFS system by using an already installed Linux
distribution such as Debian, SuSe, Slackware, Mandrake, RedHat, etc. You
don't need to have any kind of bootdisk. We will use an existing Linux system
as the base (since we need a compiler, linker, text editor and other tools).

If you don't have Linux installed yet, you won't be able to put this book to
use right away. I suggest you first install a Linux distribution. It really
doesn't matter which one you install. It also doesn't need to be the latest
version, though it shouldn't be a too old one. If it is about a year old or
newer it should do just fine. You will save yourself a lot of trouble if your
normal system uses glibc-2.1 or newer. Libc5 isn't supported by this book,
though it isn't impossible to use a libc5 system if you have no choice.
-----------------------------------------------------------------------------

1.3. Book versions

This is LFS-BOOK-INTEL version 2.4.4 version dated January 23rd, 2001. If
this version is older than a month you definitely want to take a look at our
website and check if there is a newer version available for download.

Below you will find a list of our current HTTP and FTP mirror sites as of
December 19th, 2000. This list might not be accurate anymore. For the latest
info check our website at [http://www.linuxfromscratch.org] http://
www.linuxfromscratch.org
-----------------------------------------------------------------------------

1.3.1. HTTP Mirrors

  * Columbus, Ohio, United States - [http://www.linuxfromscratch.org/intro/]
    http://www.linuxfromscratch.org/intro/
   
  * United States - [http://lfs.sourceforge.net/intro/] http://
    lfs.sourceforge.net/intro/
   
  * Canmore, Alberta, Canada - [http://www.ca.linuxfromscratch.org/intro/]
    http://www.ca.linuxfromscratch.org/intro/
   
  * Braunschweig, Niedersachsen, Germany - [http://
    www.de.linuxfromscratch.org/intro/] http://www.de.linuxfromscratch.org/
    intro/
   
  * Mainz, Germany, Europe - [http://lfs.linux-provider.net/intro/] http://
    lfs.linux-provider.net/intro/
   
  * Australia (accessible from within AU/NZ only) - [http://
    lfs.mirror.aarnet.edu.au/intro/] http://lfs.mirror.aarnet.edu.au/intro/
   

-----------------------------------------------------------------------------
1.3.2. FTP Mirrors

  * Columbus, Ohio, USA - [ftp://packages.linuxfromscratch.org] ftp://
    packages.linuxfromscratch.org
   
  * Canmore, Alberta, Canada [FTP interface to FTP archive] - [ftp://
    ftp.ca.linuxfromscratch.org] ftp://ftp.ca.linuxfromscratch.org
   
  * Canmore, Alberta, Canada [HTTP inteface to FTP archive] - [http://
    ftp.ca.linuxfromscratch.org] http://ftp.ca.linuxfromscratch.org
   
  * Mainz, Germany, Europe [FTP interface to FTP archive] - [ftp://
    ftp.linux-provider.net/pub/lfs/] ftp://ftp.linux-provider.net/pub/lfs/
   
  * Mainz, Germany, Europe [HTTP interface to FTP archive] - [http://
    ftp.linux-provider.net/lfs/] http://ftp.linux-provider.net/lfs/
   
  * Australia (accessible from within AU/NZ only) - [ftp://
    mirror.aarnet.edu.au/pub/pub/lfs/] ftp://mirror.aarnet.edu.au/pub/lfs/
   

-----------------------------------------------------------------------------
1.4. Acknowledgements

I would like to thank the following people and organizations for their
contributions towards the LinuxFromScratch project:

  * [mailto:[email protected]] Bryan Dumm for providing the hardware to
    run linuxfromscratch.org and for providing [http://www.bcpub.com] http://
    www.bcpub.com as the lfs.bcpub.com mirror
   
  * [http://www.dreamwvr.com/services] DREAMWVR.COM for their ongoing
    sponsorhip by donating various resources to the LFS and related sub
    projects.
   
  * [mailto:[email protected]] Jan Niemann for providing [http://
    helga.lk.etc.tu-bs.de] http://helga.lk.etc.tu-bs.de as the
    134.169.139.209 mirror
   
  * [mailto:[email protected]] Johan Lenglet for running the
    French translation project at [http://www.fr.linuxfromscratch.org] http:/
    /www.fr.linuxfromscratch.org
   
  * [mailto:[email protected]] Michael Peters for contributing the Apple
    PowerPC modifications
   
  * [http://www.valinux.com] VA Linux Systems who, on behalf of [http://
    www.linux.com] Linux.com, donated a VA Linux 420 (formerly StartX SP2)
    workstation towards this project
   
  * [mailto:[email protected]] Jesse Tie Ten Quee who donated a Yamaha CDRW
    8824E CD-RW.
   
  * [mailto:[email protected]] Jesse Tie Ten Quee for providing
    quasar.highos.com as the www.ca.linuxfromscratch.org mirror.
   
  * [http://www.oreilly.com] O'Reilly for donating books on SQL and PHP.
   
  * Robert Briggs for donating the linuxfromscratch.org and
    linuxfromscratch.com domain names.
   
  * Torsten Westermann for running the lfs.linux-provider.net http and ftp
    mirror sites.
   
  * Countless other people from the various LFS mailinglists who are making
    this book happen by making suggestions, testing and submitting bug
    reports.
   

-----------------------------------------------------------------------------
1.5. Changelog

If, for example, a change is listed for chapter 5 it (usually) means the same
change has been made in the chapters for the other architectures.

2.4.4 - January 23rd, 2001

  * Chapter 1: Added the lfs-security list to the list of available
    mailinglists.
   
  * Chapter 1: Updated the mirror sites list.
   
  * Chapter 5: Bash still had the --with-ncurses option which is a bogus
    option (it may as well have said --with-foo-bar). It has been changed
    into --with-curses (like it was already done in chapter 6)
   
  * Chapter 5: Instead of CPPFLAGS=-Dvar=value ./configure during the
    installation of diffutils, grep and sed, we now use export CPPFLAGS=-Dvar
    =value && ./configure && unset CPPFLAGS. This was done to get things
    working on some systems that don't work well with that construction.
   
  * Chapter 5 + 6: Added the --libexecdir parameter to fileutile's configure
    command. This was done to avoid the creation of the $LFS/usr/libexec
    directory.
   
  * Chapter 5 + 6: Added the --libexecdir parameter to tar's configure
    command. This was done to avoid the creation of the $LFS/usr/libexec
    directory.
   
  * Chapter 6: Moved the installation of the man-pages packages as the very
    first package. This way we don't have to worry about files being
    overwritten by this package's make install. It will install all the man
    pages it has and as we install packages in chapter 6 those packages will
    install their own man pages replacing the files from man-pages.
   
  * Chapter 6: Added the copying of the man pages after console-tools has
    been installed.
   
  * Chapter 6: Provided a patch to sysvinit. Read the installation notes what
    the patch is for.
   
  * Chapter 6: Removed compiler optimization from the book. Thomas "Balu"
    Walter has transformed it into an LFS-Hint.
   
  * Chapter 6: Removed running of localedef. This apparently isn't needed.
   
  * Chapter 6: Added the compress and uncompress symlinks to the installation
    of gzip.
   
  * Chapter 6: When entering chroot environment use absolute paths to the env
    and bash programs instead of relying on $PATH to be set properly.
   
  * Chapter 6: Override libexecdir's variable during the installation of
    findutils. As findutils' configure script doesn't recognize the
    libexecdir parameter, we'll override the variable during the make install
    phase.
   
  * Chapter 6: Instead of sed'ing the Makefile file during the installations
    of procinfo, procps and psmisc, we pipe the output of sed to make and
    build the packages that way. This is more effecient.
   
  * Chapter 6: Use sed to modify the MCONFIG file.
   
  * Chapter 6: Instead of using cp -avi to copy the files from the man-pages
    package, we use cp -dRiv now. This is almost the same as -avi, it just
    won't preserve the file attributes. The files from the packages would
    otherwise be installed not owned by user root but with userid 1000 which
    wasn't a good thing.
   
  * Chapter 6: Mentioned the LFS-Hints' editor's section containing
    alternatives to vim in case you don't want vim installed on your system.
   
  * Chapter 6: Added the sysklogd-1.4 patch. Sysklogd out of the box comes
    with a broken klogd - it's not able to intercept kernel messages. This
    patch fixes this.
   
  * Chapter 6: Instead of having two seperate fallthrough lines in the
    inittab file (f1:0:... and f2:6:....) these are merged into one line (ft:
    06:respawn:/sbin/sulogin).
   
  * Chapter 7: Added comments to the boot scripts.
   
  * Chapter 7: Modified the startup function in the rc script. No need to
    distinguish between files that have an .sh extension or not. Also removed
    the stty onlcr command. This one doesn't seem to be needed anymore
    either.
   
  * Chapter 7: When something is killed using the killproc function in the
    functions script, sleep for 2 seconds before continuing to allow the kill
    to be completed (sometimes it takes a little while before all processes
    are terminated).
   
  * Chapter 7: When the print_status function in the functions script is
    called without a parameter don't abort the entire calling script, just
    return an error value of 1. This function is non-essential so it won't
    really affect anything when it doesn't run properly.
   
  * Chapter 7: Merged the umountfs script with the mountfs script.
   
  * Chapter 7: Fixed minor bug in the statusproc function in the functions
    script. It read "$i is not running" - should be "$1 is not running".
   
  * Chapter 7: The print_error_msg function in the rc script now asks the
    user to press a key before continueing. This way the user is able to
    write down certain information before it's potentially all lost.
   
  * Chapter 7 + 9: Moved the boot script symlinks from including two digits
    to three digits. This makes it easier to add scripts before and after
    other scripts.
   
  * Chapter 9: Split up the network boot scripts page over multiple pages
    like the way the boot scripts are arranged in chapter 7.
   
  * Chapter 9: Added a GATEWAY check to the ethnet script. If the GATEWAY
    variable is set, the default gateway will be setup.
   
  * Chapter 9: Added the restart option to the localnet and ethnet scripts.
   
  * Chapter 9: Removed the ethnet K script when rebooting or halting. The
    halt and reboot programs are called with the -i parameter which shut down
    all network interfaces just before halt or reboot.
   
  * Chapter 9: Removed --prefix=/usr from netkit-base. It doesn't do anything
    useful.
   
  * Appendix A: Added a description for blockdev from the util-linux package.
   
  * Appendix C: Updated the util-linux official download site link.
   
  * Appendix C: Updated the man-pages official download site link.
   

2.4.3 - November 21st, 2000

  * The LFS FTP archive has been moved to a new server which is reachable
    under the name packages.linuxfromscratch.org. The reason for the move is
    that this new server sits on a link with a lot more bandwidth to spare.
   
  * Instead of having the reader create files by running vim or some editor,
    the reader can now simply copy and paste a command that creates the file
    in the form of "cat > outputfile << EOF" followed by the text to put in
    the file and when a single line containing EOF is read by cat, it stops
    reading and writes the file (not including the EOF). This will be handy
    to put in scripts so you can make LFS installations fully automatic.
   
  * Added explanations on the commands being executed to make it clearer why
    and what is being done to install the packages.
   
  * Chapter 1: Updated the HTTP mirror list and added the FTP mirror list.
    This list is up-to-date as of November 14th, 2000.
   
  * Chapter 5: In the Bash installation changed the --with-curses configure
    option to --with-ncurses. This seems to fix bash compilations on
    distribution that don't have ncurses properly installed.
   
  * Chapter 5: Instead of having the user replace <host> in the gcc
    installation by whatever appears in $LFS/usr/lib/gcc-lib you can use a *.
    This won't be a problem because the * will expand in only one directory
    so the 'ln' command won't complain about it. This makes it easier to
    automate as well.
   
  * Chapter 6: Mentioned the -e parameter to perl's Configure script that
    makes the script not ask you anything after it has created the config.sh
    script.
   
  * Chapter 6: Removed the creation of the /usr/bin/install symlink - this
    symlink was already created earier in chapter 5
   
  * Chapter 6: Added the creation of /var/log/lastlog where utmp, btmp and
    wtmp are created.
   
  * Chapter 6: When the yacc script is created in the Bison section, execute
    a chmod 755 on it so we can execute the script.
   
  * Chapter 6: Cosmetic change to the inittab file. Instead of using /dev/tty
    [1-6] as parameters to agetty we now use just 'dev[1-6]'. This generates
    a nicer output from commands like 'w'.
   
  * Chapter 7: Modified all scripts to use absolute paths instead of relying
    on $PATH to be set.
   
  * Chapter 7: In fstab changed "none /proc proc defaults 0 0" to "proc /proc
    proc defaults 0 0". Upon mount problems you could get "none: device or
    resource busy" instead of "proc: device or resourced busy".
   
  * Appendix C: Fixed a couple of broken links.
   

2.4.2 - October 11th, 2000

  * Chapter 3: Newer verions were mentioned, but the links were still
    pointing to the older versions. Besides that I forgot to put the newer
    package versions in the ftp archive. Both have been fixed now.
   
  * Chapter 5: Instead of looking at the filename of the C library files to
    determine which C library your starting Linux system uses we'll obtain it
    by running "strings /lib/libc* | grep "release version"" instead.
   
  * Chapter 5+6: The proc file system must be mounted in chapter 5 before we
    enter the chroot'ed environment since after chroot the mount program will
    not be available yet.
   
  * Chapter 6: Fixed a HTML bug in the GCC installation which caused a CR
    character to appear in certain browser.
   

2.4.1 - October 10th, 2000

  * Removed the bash prompts from the commands. This will make it much easier
    to copy & paste the commands from the book onto the command line. Typing
    them all out is great for the first few times, but it tends to get
    tedious after a while. You can of course use scripts to do this all, but
    that's not the goal of this book. That's part of a different project
    (alfs.linuxfromscratch.org).
   
  * Swapped chapters 8 and 9. Now we first reboot and then setup networking.
    If done the other way around, networking programs won't work unless both
    the normal system and the LFS system are going to run the same kernel
    version, which often is not the case. Swapping the chapters eliminates
    that possible problem.
   
  * Chapter 3: All packages have been moved to download.linuxfromscratch.org
    and the links are updated accordingly. The official download sites for
    all the packages are listed in Appendix C.
   
  * Chapter 5+6: Moved the execution of localedef after Glibc in chapter 5 to
    after you entered chroot in chapter 6. It was a mistake (the only real
    bug in 2.4) to put it in chapter 5.
   
  * Chapter 6: Installing Vim as the first program. In case you need to edit
    something you an editor available right away. This also caused a couple
    of other packages to be moved to satisfy depencies.
   
  * Chapter 6: When we use sed to modify a Makefile file we now run make as 
    "make -f Makefile2" instead of "mv Makefile2 Makefile && make".
   
  * Chapter 6: Added the "publickey: files" line to the nsswitch.conf file.
    This is needed when you run a 2.4 kernel to login properly.
   
  * Chapter 6: Added the /usr/bin/yacc script that runs bison with the -y
    switch to emulate yacc's output file name conventions. This is done
    because there are a few packages out there that rely on yacc and can't
    work with bison (yet).
   
  * Chapter 6: Modified the /usr/sbin/makewhatis script after the
    installation of the man package. The /usr/sbin/makewhatis script needs
    the AWK= variable defined to /usr/bin/mawk.
   
  * Chapter 7: Added the template script. This way you can easily add new
    bootscripts without having to write them from scratch.
   

2.4 - August 28th, 2000

  * Split the book up into two differnet books for Intel and PPC.
   
  * Chapter 4: Added the mail and dev/pts directories to the "Creating
    directories" section.
   
  * Chapter 5: Everything from chroot and after has been put in a new
    chapter.
   
  * Chapter 6: Moved the optimization part to the point just before you enter
    the chroot'ed environment. It's a waste to use compiler optimizations for
    the static packages since they will be replaced anyways.
   
  * Chapter 6: To enter chroot we first cd to the $LFS/root directory. Some
    older chroot programs have problems when you enter chroot when your
    starting directory isn't inside the chroot environment. Also we don't
    execute bash directly in the chroot'ed environment, but we start the 
    "env" program so we can enter with a clean environment that only has
    CFLAGS and CXXFLAGS set.
   
  * Chapter 6: A few people have had problems compiling M4 in the chroot'ed
    enviroment. Instructions are provided how to install this package
    statically for the affected users.
   
  * Chapter 6: We can't move the 'mv' program during the dynamic installation
    of the fileutils package with the mv program. So we copy it to /bin
    first, then remove the /usr/bin/mv one.
   
  * Chapter 5: Added 'make localedata/install-locales' to the Glibc
    installation. This installs the locale files that various applications
    use (most notable GDK applications) if you have an NLS capable system
    (which LFS is, but with missing locales it's almost useless)
   
  * Chapter 6: Moved vim's installation before Lilo since you might want to
    edit Lilo's Makefile file to add compiler optimization.
   
  * Chapter 6: Moved the installatin of shadow password suit after sh-utils.
    Else sh-utils replaces the "su" version from shadow password with it's
    own version which shouldn't happen.
   
  * Chapter 6: Changed the way we enter the chroot'ed environment. We use the
    "env" to create an empty enviroment so that enviroment variables from the
    normal Linux system won't interfer in the chroot enviroment. The only
    variable set when entering the chroot'ed environment is the HOME
    variable.
   
  * Chapter 6: Because of the new way we enter chroot, the $LFS/root
    /.bash_profile file has been created that sets a few variables like TERM,
    CFLAGS, CXXFLAGS and whatever you deem necesarry.
   

2.3.7 - August 3rd, 2000

  * All chapters: Removed the <blockquote> SGML tags so that the contents of
    files isn't indented anymore. This improves the easy of copy and pasting
    from the book into your files without needing to manually reformat the
    files to get rid of the indentations.
   
  * Chapter 4: Added var/tmp to the "chmod 1777 tmp usr/tmp" command.
   
  * Chapter 4: Made mkdir commands less repetitive by putting the creation of
    the directories in $LFS/usr and $LFS/usr/local in a for-loop.
   
  * Chapter 5: Moved the chmod 754 command for MAKEDEV after the sed
    operation.
   
  * Chapter 5: Changed the order in which packages are installed to conform
    more to a alphabetically ordering.
   
  * Chapter 5: After console-tools has been installed the /usr/share/
    defkeymap.kmap.gz file is created which will be used by the loadkeys
    script.
   
  * Chapter 5: Removed "gcc -c watch.c" from "Installing Procps". Please let
    us know if this is still needed on certain hardware.
   
  * Chapter 5: Added the /usr/bin/install symbolic link as it seems that at
    least one package (sysklogd) has the install location hard coded in it's
    Makefile file.
   
  * Chapter 5: After gettext has been installed, we have a file /po-mode.el.
    This file will be moved to /usr/share/gettext where it probably belongs.
   
  * Chapter 5: Instead of passing --with-root-prefix=/ to e2fsprogs'
    configure script, we now pass --with-root-prefix=
   
  * Chapter 5: When gzip is installed and the files moved to /bin the hard
    link between the files is removed. So we just move gzip to /bin and
    create a symlink between gzip and gunzip.
   
  * Chapter 5: In the chroot environment: changed the installation order of a
    few packages who's dependencies have changed over time.
   
  * Chapter 5: inittab file has been slightly updated to better support the
    single user run level. When you change to run level S, s or 1 it will do
    it's job properly now.
   
  * Chapter 6: Fixed typo in the rc script (! -f sysinit_start -> ! -f
    $sysinit_start).
   
  * Chapter 6: Changed the loadkeys command in the loadkeys script. New
    command is: loadkeys -d which loads the /usr/share/keymaps/
    defkeymap.kmap.gz file.
   
  * Chapter 6: Changed ". /etc/init.d/functions" into "source /etc/init.d/
    functions".
   
  * Chapter 6: Removed the "rm /fastboot" command from the checkfs script.
   

2.3.6 - July 19th, 2000

  * Chapter 3: Re-ordered the software download list so it once again matches
    the order in which packages are used (the first package listed in the
    list is the first package that we will be using in the book, the second
    listed package will be the second package used in the book, etc).
   
  * Chapter 3: Added the file sizes of the packages you have to download.
   
  * Chapter 3: Removed the start-stop-daemon package.
   
  * Chapter 3: Added the findutils and glibc patches to the package list.
   
  * Chapter 3: Added the man-pages package to the package list.
   
  * Chapter 4: Moved the creation of the $LFS/dev/ files to chapter 5 after
    we have entered the chroot environment. This is done because GID's on
    normal system and LFS system might differ and the MAKEDEV script depends
    on the GID's.
   
  * Chapter 5: Added the installation of the man-pages package.
   
  * Chapter 5: Added a few commonly used groups to the /etc/group file when
    it is created (these are the groups needed by the MAKEDEV script).
   
  * Chapter 5: The /proc/devices file is copied to $LFS/proc for the benefit
    of the MAKEDEV script. The presence of this file ensures the proper
    creation of the device files.
   
  * Chapter 5: Layout changes. Every package installation has it's own page
    now. Also the text from appendixa for every package is included with the
    installation instructions so you can read what a package is about during
    (or after or before) the installation of it.
   
  * Chapter 5: Removed the patches for diffutils, grep, gzip and sed that
    used to fix static link problems. The problems can be fixed by passing
    compile arguments to the C pre-processor (cpp) instead.
   
  * Chapter 5: Added the --disable-termcap option to configure to disable
    termcap backward compatibility (if you want to know why termcap isn't
    used anymore, please read the INSTALL file that comes with the Ncurses
    package).
   
  * Chapter 5: Added a few missing files from the fileutils package to the 
    "mv" commands.
   
  * Chapter 5: Removed the installation of the start-stop-daemon package.
   
  * Chapter 5: Removed the -e parameters from the make command lines.
   
  * Chapter 5: Instead of editing the procinfo, procps and psmisc Makefile
    files with a text editor, the sed command it used.
   
  * Chapter 6: Added the setclock script in case your hardware clock isn't
    set to GMT.
   
  * Chapter 6: Removed the use of the start-stop-daemon program and replaced
    them with custom functions that use programs like pidof and kill to
    accomplish the same tasks but with more control over what happens.
   
  * Chapter 6: Added the loadproc and killproc functions to the /etc/init.d/
    functions file that take over the functions the start-stop-daemon program
    used to perform.
   
  * Chapter 6: When the checkfs script runs without errors it now prints a
    green OK.
   
  * Chapter 6: When /fastboot or /forcefsck exist, they won't be deleted from
    within the checkfs script but from within the mountfs script as soon as
    the root partition has been remounted in read-write mode.
   
  * Chapter 6 & 7: Instead of sourcing a file with ". /etc/init.d/functions",
    "source /etc/init.d/functions" is now used. This makes it easier to read
    and is clearer for persons who don't know much about scripting.
   
  * Appendix A: removed start-stop-daemon.
   
  * Appendix B: Removed a few unrelated items from the book and howto
    sections (the references to Sendmail and ISP-Hookup-HOWTO).
   

2.3.5 - June 19th, 2000

  * Chapter 3: Updated LILO download location
   
  * Chapter 3: Updated Shadow Password Suite download location
   
  * Chapter 3: Updated the Flex download location
   
  * Chapter 3: Updated the File download location
   
  * Chapter 3: Added netkit-base and net-tools to the mandatory packages
    section
   
  * Chapter 5: A glibc-2.1.3 patch is available if you have problems
    compiling glibc on a bash-2.04 machine.
   
  * Chapter 5: Added compiler optimization
   
  * Chapter 5: Added the creation of the root password to "Configuring
    essential software"
   
  * Chapter 5: The Linux86 package has been replaced by the Bin86 package.
   
  * Chapter 5: Included information on how to optimize compilations.
   
  * Chapter 5: Moved installation of Groff and Man before Perl. This way Perl
    known how to install man pages and where to install them.
   
  * Chapter 5: Changed GCC's local-prefix option to /usr/local instead of /
    usr (this was still a residue from the time where /usr/local was a
    symbolic link to /usr)
   
  * Chaper 5: Fixed the commands when a patch is used and the patch filename
    contained the .gz suffix.
   
  * Chapter 5: Added --disable-nls to every configure command in the 
    "Perparing the LFS system..." section which didn't have it yet.
   
  * Chapter 5: Added the installation of bash-2.03 so you have a shell that
    can be used to compile packages that violate POSIX standards regarding
    valid characters in variable names
   
  * Chapter 5: Added the installation of console-tools and console-data for
    people who have non-US keyboards
   
  * Chapter 5: Moved the ed program to the /bin directory conforming the FHS
    standard
   
  * Chapter 6 & 7: Implemented LSB recommended run level scheme.
   
  * Chapter 6 & 7: Implemented "fancy bootscripts". When something fails in a
    bootscript it still says FAILED but the text red. When something
    succeeded it still will print OK but the text is green.
   
  * Chater 6: Added the loadkeys scripts for people with non-US keyboards
   
  * Chapter 6: Added the /etc/sysconfig directory to "Creating directories"
   
  * Chapter 6: Renamed the checkroot boot script into checkfs. The script
    also checks other file systems now.
   
  * Chapter 6: Updated the mountfs boot script to mount all file systems that
    are mentioned in the /etc/fstab file and don't have the noauto option
    set.
   
  * Chapter 6: After checkfs evaluated the existence of /fastboot or /
    forcecheck it will remove those files.
   
  * Chapter 6 & 7: Changed the mode of the boot scripts from 755 to 754
   
  * Chapter 7: Moved system specific information for hostname and ethernet
    configuration to the /etc/sysconfig/network file
   
  * Chapter 7: Removed the default gateway command
   
  * Chapter 7: Fixed the typo in the ethnet script (NETMAKSK -> NETMASK)
   
  * Chapter 7: A net-tools patch is available to fix a minor bug in the
    package (illegal variable names that bash-2.04 will complain about)
   

2.3.4 - June 5th, 2000

  * Chapter 5: Fixed the kernel header files configuration
   
  * Chapter 5: Fixed the lilo configuration
   

2.3.3 - May 15th, 2000

  * Changed the default mount point from /mnt/xxx to /mnt/lfs (where xxx used
    to be the partition's designation like hda5, sda5 and others). The reason
    for the change is to make cross-platform instructions easier.
   
  * Chapter 4: Changed the default modes for the $LFS/root and $LFS/tmp
    directory to respectively 0750 and 1777.
   
  * Chapter 5: Removed the encoded password from the passwd file. Instead a
    file with no set password is created. The root password can be set by the
    user when the system is rebooted into the LFS system (after chapter 8).
   
  * Chapter 5: Fixed the procps compile command for watch.c. It should
    compile properly now.
   
  * Chapter 5: Fixed gzip patch installation (used the wrong filename in the
    patch command
   
  * Chapter 5: Changed 'entering the chroot'ed environment' to make bash a
    login shell.
   
  * Chapter 5: Configuring the kernel has been moved to this chapter because
    it needs to be done before programs like e2fsprogs and lilo are compiled.
   
  * Chapter 6: Fixed the rc script. It now checks to see if the previous run
    level starts a service before attempting to stop it in the new run level.
    Also, if a service is already started in the previous run level it won't
    attempt to start the service in the new run level again. Thanks to Jason
    Pearce for providing this fixed script.
   
  * Chapter 7: Fixed the ethnet script - removed paratheses from the
    environment variables and removed the command to add a route. The
    ifconfig command used to bring the eth device up already sets this route.
   

2.3.2 - April 18th, 2000

  * Chapter 4.7: Change only the owner of the $LFS/dev/* files
   
  * Fixed a large amount of typo's that occured during the transistion from
    the LinuxDoc DTD (2.2 and lower) to the DocBook DTD (2.3.1 and higher).
   
  * Moved chapters around quite a bit and applied a new structure in the
    book. Installations for Intel, Apple PowerPC and future systems will be
    put in their own dedicated part of the book.
   
  * After the system is prepared to install the basic system software, we no
    longer reboot the system but instead we setup a chroot'ed environment.
    This will have the same effect without having to reboot.
   
  * Apple PowerPC has it's own dedicated chapters now. This should increase
    readability a lot
   
  * All optional chapters have been removed. LFS follows a "we provide the
    foundation, it's up to you to build the rest of the house" philosophy.
   
  * Replaced the fixed packages by patch files. This way you can see what
    needs to be changed in a package in order to get it to compile properly.
   

2.3.1 - April 12th, 2000

  * Chapter 4.4: Added the $LFS/usr/info symlink which points to $LFS/usr/
    share/info
   
  * Chapter 7.3.1: Added a second variation to a 'swap-line' in a fstab file.
   
  * Chapter 7.3.2: Removed $LFS from the commands.
   
  * Chapter 7.4.43: Added the vi symlink
   
  * Chapter 9.2.5: Improved ethnet script to include routing information
   
  * Chapter 10.1.2: Fixed missing subdirectory 'mqueue' in mkdir /var/spool -
    > /mkdir /var/spool/mqueue
   
  * Chapter 10.1.4: Updated the sendmail configuration file with a few
    necessary options
   
  * Chapter 10.1.7: Fixed wrong directory path /etc/init.d/rc2.d -> /etc/
    rc2.d
   

-----------------------------------------------------------------------------
1.6. Mailinglists and archives

The linuxfromscratch.org server is hosting the following public accessible
mailinglists:

  * lfs-discuss
   
  * lfs-apps
   
  * lfs-announce
   
  * lfs-security
   
  * alfs-discuss
   
  * alfs-docs
   
  * alfs-ipc
   
  * alfs-profile
   

-----------------------------------------------------------------------------
1.6.1. lfs-discuss

The lfs-discuss mailinglist discusses matters strictly related to the
LFS-BOOK. If you have problems with the book, want to report a bug or two or
have suggestions to improve the book, use this mailinglist.

Any other mail is to be posted on the lfs-apps list.
-----------------------------------------------------------------------------

1.6.2. lfs-apps

The lfs-apps list deals with everything that does not fit on the lfs-discuss
list.
-----------------------------------------------------------------------------

1.6.3. lfs-announce

The lfs-announce list is a moderated list. You can subscribe to it, but you
can't post any messages to this list. This list is used to announce new
stable releases. If you want to be informed about development releases as
well then you'll have to join the lfs-discuss list. If you're already on the
lfs-discuss list there's little use subscribing to this list as well because
everything that is posted to the lfs-announce list will be posted to the
lfs-discuss list as well.
-----------------------------------------------------------------------------

1.6.4. lfs-security

The lfs-security mailinglist discusses security related matters. If you have
security concerns or have heard about a package used by LFS that has known
security problems, you can address that on this list.
-----------------------------------------------------------------------------

1.6.5. alfs-discuss

The alfs-discuss list discusses the development of ALFS which stands for
Automated LinuxFromScratch. The goal of this project is to develop an
installation tool that can install an LFS system automatically for you. It's
main goal is to speed up compilation by taking away your need to manually
enter the commands to configure, compile and install packages.
-----------------------------------------------------------------------------

1.6.6. alfs-docs

ALFS-docs is the ALFS documentation project which creates and maintains all
of the ALFS documentation.
-----------------------------------------------------------------------------

1.6.7. alfs-ipc

The alfs-ipc list discusses the ALFS InterProcess Communication issues.
-----------------------------------------------------------------------------

1.6.8. alfs-profile

The alfs-profile list discusses the development of the ALFS XML profile and
DTD.
-----------------------------------------------------------------------------

1.6.9. How to subscribe?

You can subscribe to any of the above mentioned mailinglists by sending an
email to [mailto:[email protected]] [email protected] and
write subscribe listname in the subject line of the message.

You can, if you want, subscribe to multiple lists at the same time using one
email. If you want to do so, write some junk in the subject line, something
that isn't a valid command like "hello". Then write the subscribe commands in
the body of the message. The email will look like:
   
   
   
    To: [email protected]
    Subject: hello 
   
    subscribe lfs-discuss
    subscribe lfs-apps
    subscribe alfs-discuss 
     
   
After you have sent the email, the Listar program will send you an email back
requesting a confirmation of your subscription request. After you have sent
back this confirmation email, Majordomo will send you an email again with the
message that you have been subscribed to the list(s) along with an
introduction message for that particulair list.
-----------------------------------------------------------------------------

1.6.10. How to unsubscribe?

To unsubscribe from a list, send an email to [mailto:
[email protected]] [email protected] and write 
unsubscribe listname in the subject line of the message.

 You can, if you want, unsubscribe from multiple lists at the same time using
one email. If you want to do so, write some junk in the subject line,
something that isn't a valid command like "hello". Then write the unsubscribe
commands in the body of the message. The email will look like:
   
   
   
    To: [email protected]
    Subject: hello 
   
    unsubscribe lfs-discuss
    unsubscribe lfs-apps
    unsubscribe alfs-discuss 
   
After you have sent the email, the Listar program will send you an email back
requesting a confirmation of your unsubscription request. After you have sent
back this confirmation email, Listar will send you an email again with the
message that you have been unsubscribed from the list(s).
-----------------------------------------------------------------------------

1.6.11. Mail archives

Every publically available mailinglist has a mailinglist archive you can
access to find information on subjects already posted to this list. You can
find them at [http://archive.linuxfromscratch.org/mail-archives] http://
archive.linuxfromscratch.org/mail-archives
-----------------------------------------------------------------------------

1.7. Contact information

Direct all your emails to the [mailto:[email protected]]
lfs-discuss mailinglist preferably.

If you need to reach Gerard Beekmans personally, send an email to [mailto:
[email protected]] [email protected]
-----------------------------------------------------------------------------

Chapter 2. Important information

2.1. About $LFS

Please read the following carefully: throughout this book you will frequently
see the variable name $LFS. $LFS must at all times be replaced by the
directory where the partition that contains the LFS system is mounted. How to
create and where to mount the partition will be explaind in full detail later
on in chapter 4. In my case the LFS partition is mounted on /mnt/lfs. If I
read this book myself and I see $LFS somewhere, I will pretend that I read /
mnt/lfs. If I read that I have to run this command: cp inittab $LFS/etc I
actually will run this: cp inittab /mnt/lfs/etc

It's important that you do this no matter where you read it; be it in
commands you enter on the prompt, or in a file you edit or create.

If you want, you can set the environment variable LFS. This way you can
literally enter $LFS instead of replacing it by something like /mnt/lfs. This
is accomplished by running: export LFS=/mnt/lfs

If I read cp inittab $LFS/etc, I literally can type cp inittab $LFS/etc and
the shell will replace this command by cp inittab /mnt/lfs/etc automatically.

Do not forget to set the $LFS variable at all times. If you haven't set the
variable and you use it in a command, $LFS will be ignored and whatever is
left will be executed. The command cp inittab $LFS/etc without the $LFS
variable set, will result in copying the inittab file to the /etc directory
which will overwrite your system's inittab. A file like inittab isn't that
big a problem as it can easily be restored, but if you would make this
mistake during the installation of the C Library, you can damage things.

One way to make sure that $LFS is set at all times you could add it to your /
root/.bash_profile and/or /root/.bashrc file(s) so everytime you 'su' to user
too as to install LFS, the $LFS variable is set for you.
-----------------------------------------------------------------------------

2.2. How to download the software

Throughout this document I will assume that you have stored all the packages
you have downloaded somewhere in $LFS/usr/src.

I use the convention of having a $LFS/usr/src/sources directory. Under
sources you'll find the directory 0-9 and the directories a through z. A
package as sysvinit-2.78.tar.gz is stored under $LFS/usr/src/sources/s/ A
package as bash-2.04.tar.gz is stored under $LFS/usr/src/sources/b/ and so
forth. You don't have to follow this convention of course, I was just giving
an example. It's better to keep the packages out of $LFS/usr/src and move
them to a subdirectory, so we'll have a clean $LFS/usr/src directory in which
we will unpack the packages and work with them.

The next chapter contains the list of all the packages you need to download,
but the partition that is going to contain our LFS system isn't created yet.
Therefore store the files temporarily somewhere where you want and remember
to copy them to $LFS/usr/src/ when you have finished the chapter in which you
prepare a new partition (chapter 4).
-----------------------------------------------------------------------------

2.3. How to install the software

Before you can actually start doing something with a package, you need to
unpack it first. Often you will find the package files being tar'ed and
gzip'ed (you can determind this by looking at the extension of the file.
tar'ed and gzip'ed archives have a .tar.gz or .tgz extension for example)).
I'm not going to write down every time how to ungzip and how to untar an
archive. I will tell you how to do that once, in this paragraph. There is
also the possibility that you have the ability of downloading a .tar.bz2
file. Such a file is tar'ed and compressed with the bzip2 program. Bzip2
achieves a better compression than the commonly used gzip does. In order to
use bz2 archives you need to have the bzip2 program installed. Most if not
every distribution comes with this program so chances are high it is already
installed on your system. If not, install it using your distribution's
installation tool.

To start with, change to the $LFS/usr/src directory by running:
   
   
   
            cd $LFS/usr/src
     
   
When you have a file that is tar'ed and gzip'ed, you unpack it by running
either one of the following two commands, depending on the filename format:
   
   
   
            tar xvzf filename.tar.gz
            tar xvzf filename.tgz
     
   
When you have a file that is tar'ed and bzip'ed, you unpack it by running:
   
   
   
            bzcat filename.tar.bz2 | tar xv
     
   
Some tar programs (most of them nowadays but not all of them) are slightly
modified to be able to use bzip2 files directly using either the I or the y
tar parameter which works the same as the z tar parameter to handle gzip
archives.

When you have a file that is tar'ed, you unpack it by running:
   
   
   
            tar xvf filename.tar
     
   
When the archive is unpacked a new directory will be created under the
current directory (and this document assumes that you unpack the archives
under the $LFS/usr/src directory). You have to enter that new directory
before you continue with the installation instructions. So everytime the book
is going to install a program, it's up to you to unpack the source archive.

After you have installed a package you can do two things with it. You can
either delete the directory that contains the sources or you can keep it. If
you decide to keep it, that's fine by me. But if you need the same package
again in a later chapter you need to delete the directory first before using
it again. If you don't do this, you might end up in trouble because old
settings will be used (settings that apply to your normal Linux system but
which don't always apply to your LFS system). Doing a simple make clean or
make distclean does not always guarantee a totally clean source tree. The
configure script can also have files lying around in various subdirectories
which aren't always removed by a make clean process.

There is on exception to that rule: don't remove the linux kernel source
tree. A lot of programs need the kernel headers, so that's the only directory
you don't want to remove, unless you are not going to compile any software
anymore.
-----------------------------------------------------------------------------

2.4. Download the bootscripts

Typing out all the bootscripts in chapters 7 and 9 can be a long tedious
process, not to mention very error prone.

To save you guys and girls some time, you can download the bootscripts from
[http://download.linuxfromscratch.org/bootscripts/] http://
download.linuxfromscratch.org/bootscripts/ or [ftp://
download.linuxfromscratch.org/bootscripts/] ftp://
download.linuxfromscratch.org/bootscripts/
-----------------------------------------------------------------------------

2.5. Download the LFS Commands

LFS Commands is a tarball containing files which list the installation
commands for the packages installed in this book. These files can be used to
dump to your shell and install the packages, though some files need to be
modified (for example when you install the console-tools package you need to
select your keyboard layout file which can't be guessed).

These files can be used to quickly find out which commands have been changed
between the different LFS versions as well. You can download the lfs-commands
tarball for this book version and the previous book version and run a diff on
the files. That way you can see which package have updated installation
instructions so you can modify your own scripts, or reinstall a package if
you deem necessary.

The lfscommands can be downloaded from [http://download.linuxfromscratch.org/
lfs-commands/] http://download.linuxfromscratch.org/lfs-commands/ or [ftp://
download.linuxfromscratch.org/lfs-commands/] ftp://
download.linuxfromscratch.org/lfs-commands/

II. Part II - Installing the LFS system

Table of Contents
3. Packages you need to download
4. Preparing a new partition
    4.1. Introduction
    4.2. Creating a new partition
    4.3. Creating a ext2 file system on the new partition
    4.4. Mounting the new partition
    4.5. Creating directories
   
   
5. Preparing the LFS system
    5.1. Introduction
    5.2. Installing Bash
    5.3. Installing Binutils
    5.4. Installing Bzip2
    5.5. Installing Diffutils
    5.6. Installing Fileutils
    5.7. Installing GCC on the normal system if necessary
    5.8. Installing GCC on the LFS system
    5.9. Installing Linux Kernel
    5.10. Installing Glibc
    5.11. Installing Grep
    5.12. Installing Gzip
    5.13. Installing Make
    5.14. Installing Sed
    5.15. Installing Shellutils
    5.16. Installing Tar
    5.17. Installing Textutils
    5.18. Creating passwd and group files
    5.19. Mounting $LFS/proc file system
   
   
6. Installing basic system software
    6.1. Introduction
    6.2. About debugging symbols
    6.3. Creating $LFS/root/.bash_profile
    6.4. Entering the chroot'ed environment
    6.5. Creating device files
    6.6. Installing Man-pages
    6.7. Installing Ed
    6.8. Installing Patch
    6.9. Installing Findutils
    6.10. Installing Mawk
    6.11. Installing Ncurses
    6.12. Installing Vim
    6.13. Installing GCC
    6.14. Installing Bison
    6.15. Installing Less
    6.16. Installing Groff
    6.17. Installing Man
    6.18. Installing Perl
    6.19. Installing M4
    6.20. Installing Texinfo
    6.21. Installing Autoconf
    6.22. Installing Automake
    6.23. Installing Bash
    6.24. Installing Flex
    6.25. Installing File
    6.26. Installing Libtool
    6.27. Installing Bin86
    6.28. Installing Binutils
    6.29. Installing Bzip2
    6.30. Installing Gettext
    6.31. Installing Consoletools
    6.32. Installing Consoledata
    6.33. Installing Diffutils
    6.34. Installing E2fsprogs
    6.35. Installing Fileutils
    6.36. Installing Grep
    6.37. Installing Gzip
    6.38. Installing Ldso
    6.39. Installing Lilo
    6.40. Installing Make
    6.41. Installing Modutils
    6.42. Installing Procinfo
    6.43. Installing Procps
    6.44. Installing Psmisc
    6.45. Installing Sed
    6.46. Installing Shellutils
    6.47. Installing Shadowpwd
    6.48. Installing Sysklogd
    6.49. Installing Sysvinit
    6.50. Installing Tar
    6.51. Installing Textutils
    6.52. Installing Utillinux
    6.53. Removing old NSS library files
    6.54. Configuring essential software
   
   
7. Creating system boot scripts
    7.1. Introduction
    7.2. Creating directories
    7.3. Creating the rc script
    7.4. Creating the rcS script
    7.5. Creating the functions script
    7.6. Creating the checkfs script
    7.7. Creating the halt script
    7.8. Creating the loadkeys script
    7.9. Creating the mountfs script
    7.10. Creating the reboot script
    7.11. Creating the sendsignals script
    7.12. Creating the setclock script
    7.13. Creating the sysklogd script
    7.14. Creating the template script
    7.15. Setting up symlinks and permissions
    7.16. Creating the /etc/fstab file
   
   
8. Making the LFS system bootable
    8.1. Introduction
    8.2. Installing a kernel
    8.3. Adding an entry to LILO
    8.4. Rebooting the system
   
   
9. Setting up basic networking
    9.1. Introduction
    9.2. Installing network software
    9.3. Creating the /etc/init.d/localnet bootscript
    9.4. Creating the /etc/sysconfig/network file
    9.5. Creating the /etc/hosts file
    9.6. Creating the /etc/init.d/ethnet script
   
   

-----------------------------------------------------------------------------
Chapter 3. Packages you need to download

Below is a list of all the packages you need to download for building the
basic system. The version numbers printed correspond to versions of the
software that is known to work and which this book is based on. If you
experience problems which you can't solve yourself, download the version that
is assumed in this book (in case you downloaded a newer version).

If the packages.linuxfromscratch.org server isn't allowing connections
anymore try one of our mirror sites. The addresses of the mirror sites can be
found in Chapter 1 - Book Versions

We have provided a list of official download sites of the packages below in
[appendixc.html] Appendix C - Official download locations. The LFS FTP
archive only contains the versions of packages that are recommended for use
in this book. If you're looking for newer versions than the ones listed here
you can have a look in Appendix C.

Please note that all files downloaded from the LFS FTP archive are files
compressed with bzip2 instead of gz. If you don't know how to handle bz2
files, please read Chapter 2 - How to install the software.

The list below is current as of January 5th, 2001

  *  Browse FTP: [ftp://packages.linuxfromscratch.org/] ftp://
    packages.linuxfromscratch.org 
   
  *  Bash (2.04) - 1,307 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/bash-2.04.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/bash-2.04.tar.bz2 
   
  *  Binutils (2.10.1) 5,523 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/binutils-2.10.1.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/binutils-2.10.1.tar.bz2
   
  *  Bzip2 (1.0.1) 454 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/bzip2-1.0.1.tar.gz] ftp://packages.linuxfromscratch.org/
    pub/common-packages/bzip2-1.0.1.tar.gz 
   
  *  Diff Utils (2.7) 247 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/diffutils-2.7.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/diffutils-2.7.tar.bz2 
   
  *  File Utils (4.0) 801 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/fileutils-4.0.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/fileutils-4.0.tar.bz2 
   
  *  GCC (2.95.2) 9,555 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/gcc-2.95.2.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/gcc-2.95.2.tar.bz2 
   
  *  Linux Kernel (2.2.18) 14,921 KB: [ftp://packages.linuxfromscratch.org/
    pub/common-packages/linux-2.2.18.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/linux-2.2.18.tar.bz2 
   
  *  Glibc (2.1.3) 6,308 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/glibc-2.1.3.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/glibc-2.1.3.tar.bz2 
   
  *  Glibc-crypt (2.1) 36 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/glibc-crypt-2.1.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/glibc-crypt-2.1.tar.bz2
   
  *  Glibc-linuxthreads (2.1.3) 112 KB: [ftp://packages.linuxfromscratch.org/
    pub/common-packages/glibc-linuxthreads-2.1.3.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/
    glibc-linuxthreads-2.1.3.tar.bz2 
   
  *  Glibc Patch (2.1.3) - 1 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/glibc-2.1.3.patch.gz] ftp://packages.linuxfromscratch.org
    /pub/common-packages/glibc-2.1.3.patch.gz 
   
  *  Grep (2.4.2) 382 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/grep-2.4.2.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/grep-2.4.2.tar.bz2 
   
  *  Gzip (1.2.4a) 178 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/gzip-1.2.4a.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/gzip-1.2.4a.tar.bz2 
   
  *  Gzip Patch (1.2.4a) 1 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/gzip-1.2.4a.patch.gz] ftp://packages.linuxfromscratch.org
    /pub/common-packages/gzip-1.2.4a.patch.gz 
   
  *  Make (3.79.1) 749 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/make-3.79.1.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/make-3.79.1.tar.bz2 
   
  *  Sed (3.02) 221 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/sed-3.02.tar.bz2] ftp://packages.linuxfromscratch.org/pub
    /common-packages/sed-3.02.tar.bz2 
   
  *  Sh-utils (2.0) 824 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/sh-utils-2.0.tar.bz2] ftp://packages.linuxfromscratch.org
    /pub/common-packages/sh-utils-2.0.tar.bz2 
   
  *  Tar (1.13) 730 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/tar-1.13.tar.bz2] ftp://packages.linuxfromscratch.org/pub
    /common-packages/tar-1.13.tar.bz2 
   
  *  Tar Patch (1.13) 2 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/gnutarpatch.txt] ftp://packages.linuxfromscratch.org/pub/
    common-packages/gnutarpatch.txt 
   
  *  Text Utils (2.0) 1,040 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/textutils-2.0.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/textutils-2.0.tar.bz2 
   
  *  MAKEDEV (2.5) - 11 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/MAKEDEV-2.5.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/MAKEDEV-2.5.tar.bz2 
   
  *  Bison (1.28) 321 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/bison-1.28.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/bison-1.28.tar.bz2 
   
  *  Mawk (1.3.3) 168 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/mawk1.3.3.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/mawk1.3.3.tar.bz2 
   
  *  Patch (2.5.4) 149 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/patch-2.5.4.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/patch-2.5.4.tar.bz2 
   
  *  Find Utils (4.1) 226 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/findutils-4.1.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/findutils-4.1.tar.bz2 
   
  *  Find Utils Patch (4.1) 1 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/findutils-4.1.patch.gz] ftp://
    packages.linuxfromscratch.org/pub/common-packages/findutils-4.1.patch.gz 
   
  *  Ncurses (5.2) 1,307 KB: [ftp://packages.linuxfromscratch.org/pub/
    intel-packages/ncurses-5.2.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/intel-packages/ncurses-5.2.tar.bz2 
   
  *  Less (358) 178 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/less-358.tar.bz2] ftp://packages.linuxfromscratch.org/pub
    /common-packages/less-358.tar.bz2 
   
  *  Groff (1.16.1) 1,173 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/groff-1.16.1.tar.bz2] ftp://packages.linuxfromscratch.org
    /pub/common-packages/groff-1.16.1.tar.bz2 
   
  *  Man (1.5h1) 156 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/man-1.5h1.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/man-1.5h1.tar.bz2 
   
  *  Perl (5.6.0) 4,327 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/perl-5.6.0.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/perl-5.6.0.tar.bz2 
   
  *  M4 (1.4) 249 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/m4-1.4.tar.bz2] ftp://packages.linuxfromscratch.org/pub/
    common-packages/m4-1.4.tar.bz2 
   
  *  Texinfo (4.0) 812 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/texinfo-4.0.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/texinfo-4.0.tar.bz2 
   
  *  Autoconf (2.13) 333 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/autoconf-2.13.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/autoconf-2.13.tar.bz2 
   
  *  Automake (1.4) 277 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/automake-1.4.tar.bz2] ftp://packages.linuxfromscratch.org
    /pub/common-packages/automake-1.4.tar.bz2 
   
  *  Flex (2.5.4a) 278 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/flex-2.5.4a.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/flex-2.5.4a.tar.bz2 
   
  *  File (3.33) 126 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/file-3.33.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/file-3.33.tar.bz2 
   
  *  Libtool (1.3.5) 361 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/libtool-1.3.5.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/libtool-1.3.5.tar.bz2 
   
  *  Bin86 (0.15.4) 111 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/bin86-0.15.4.tar.bz2] ftp://packages.linuxfromscratch.org
    /pub/common-packages/bin86-0.15.4.tar.bz2 
   
  *  Gettext (0.10.35) 525 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/gettext-0.10.35.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/gettext-0.10.35.tar.bz2
   
  *  Console-tools (0.2.3) 490 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/console-tools-0.2.3.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/
    console-tools-0.2.3.tar.bz2 
   
  *  Console-tools (0.2.3) Patch: 4 KB: [ftp://packages.linuxfromscratch.org/
    pub/common-packages/console-tools-0.2.3.patch.gz] ftp://
    packages.linuxfromscratch.org/pub/common-packages/
    console-tools-0.2.3.patch.gz 
   
  *  Console-data (1999.08.29) 418 KB: [ftp://packages.linuxfromscratch.org/
    pub/common-packages/console-data-1999.08.29.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/
    console-data-1999.08.29.tar.bz2 
   
  *  E2fsprogs (1.19) 808 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/e2fsprogs-1.19.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/e2fsprogs-1.19.tar.bz2 
   
  *  Ed (0.2) 158 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/ed-0.2.tar.bz2] ftp://packages.linuxfromscratch.org/pub/
    common-packages/ed-0.2.tar.bz2 
   
  *  Ld.so (1.9.9) 280 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/ld.so-1.9.9.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/ld.so-1.9.9.tar.bz2 
   
  * Lilo (21.6) 172 KB: [ftp://packages.linuxfromscratch.org/pub/
    intel-packages/lilo-21.6.tar.bz2] ftp://packages.linuxfromscratch.org/pub
    /intel-packages/lilo-21.6.tar.bz2 
   
  *  Modutils (2.4.0) 195 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/modutils-2.4.0.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/modutils-2.4.0.tar.bz2 
   
  *  Vim-rt (5.7) 905 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/vim-5.7-rt.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/vim-5.7-rt.tar.bz2 
   
  *  Vim-src (5.7) 963 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/vim-5.7-src.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/vim-5.7-src.tar.bz2 
   
  *  Procinfo (17) 21 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/procinfo-17.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/procinfo-17.tar.bz2 
   
  *  Procps (2.0.7) 153 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/procps-2.0.7.tar.bz2] ftp://packages.linuxfromscratch.org
    /pub/common-packages/procps-2.0.7.tar.bz2 
   
  *  Psmisc (19) 20 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/psmisc-19.tar.bz2] ftp://packages.linuxfromscratch.org/
    pub/common-packages/psmisc-19.tar.bz2 
   
  *  Shadow Password Suite (20000902) 557 KB: [ftp://
    packages.linuxfromscratch.org/pub/common-packages/
    shadow-20000902.tar.bz2] ftp://packages.linuxfromscratch.org/pub/
    common-packages/shadow-20000902.tar.bz2 
   
  *  Sysklogd (1.4) 67 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/sysklogd-1.4.tar.bz2] ftp://packages.linuxfromscratch.org
    /pub/common-packages/sysklogd-1.4.tar.bz2 
   
  *  Sysklogd Patch (1.4) 0.5 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/sysklogd-1.4.patch] ftp://packages.linuxfromscratch.org/
    pub/common-packages/sysklogd-1.4.patch 
   
  *  Sysvinit (2.78) 90 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/sysvinit-2.78.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/sysvinit-2.78.tar.bz2 
   
  *  Sysvinit Patch (2.78) 1 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/sysvinit-2.78.patch] ftp://packages.linuxfromscratch.org/
    pub/common-packages/sysvinit-2.78.patch 
   
  *  Util Linux (2.10r) 883 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/util-linux-2.10r.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/
    util-linux-2.10r.tar.bz2 
   
  *  Man-pages (1.33) 475 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/man-pages-1.33.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/man-pages-1.33.tar.bz2 
   
  *  Netkit-base (0.17) 49 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/netkit-base-0.17.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/
    netkit-base-0.17.tar.bz2 
   
  *  Net-tools (1.57) 187 KB: [ftp://packages.linuxfromscratch.org/pub/
    common-packages/net-tools-1.57.tar.bz2] ftp://
    packages.linuxfromscratch.org/pub/common-packages/net-tools-1.57.tar.bz2 
   
  * Total size of all intel-packages: 61,377 KB (59,94 MB)
   

-----------------------------------------------------------------------------
Chapter 4. Preparing a new partition

4.1. Introduction

In this chapter the partition that is going to host the LFS system is going
to be prepared. A new partition will be created, an ext2 file system will be
created on it and the directory structure will be created. When this is done,
we can move on to the next chapter and start building a new Linux system from
scratch.
-----------------------------------------------------------------------------

4.2. Creating a new partition

Before we can build our new Linux system, we need to have an empty Linux
partition on which we can build our new system. I recommend a partition size
of around 750 MB. This gives you enough space to store all the tarballs and
to compile all packages without worrying running out of the necessary
temporary disk space. If you already have a Linux Native partition available,
you can skip this subsection.

Start the fdisk program (or another fdisk program you prefer) with the
appropriate hard disk as the option (like /dev/hda if you want to create a
new partition on the primary master IDE disk). Create a Linux Native
partition, write the partition table and exit the fdisk program. If you get
the message that you need to reboot your system to ensure that the partition
table is updated, then please reboot your system now before continuing.
Remember what your new partition's designation is. It could be something like
hda11 (as it is in my case). This newly created partition will be referred to
as the LFS partition in this book.
-----------------------------------------------------------------------------

4.3. Creating a ext2 file system on the new partition

Once the partition is created, we have to create a new ext2 file system on
that partition. To create a new ext2 file system we use the mke2fs command.
Enter the new partition as the only option and the file system will be
created. If your partition is hda11, you would run:
   
   
   
    mke2fs /dev/hda11
     
   
-----------------------------------------------------------------------------
4.4. Mounting the new partition

Now that we have created the ext2 file system, it is ready for use. All we
have to do to be able to access it (as in reading from and writing date to
it) is mounting it. If you mount it under /mnt/lfs, you can access this
partition by going to the /mnt/lfs directory and then do whatever you need to
do. This book will assume that you have mounted the partition on a
subdirectory under /mnt. It doesn't matter which directory you choose, just
make sure you remember what you chose.

Create the /mnt/lfs directory by runnning:
   
   
   
    mkdir -p /mnt/lfs
     
   
Now mount the LFS partition by running:
   
   
   
    mount /dev/xxx /mnt/lfs
     
   
Replace "xxx" by your partition's designation.

This directory (/mnt/lfs) is the $LFS variable you have read about earlier.
So if you read somewhere to "cp inittab $LFS/etc" you actually will type "cp
inittab /mnt/lfs/etc". Or if you want to use the $LFS environment variable,
execute export LFS=/mnt/lfs now.
-----------------------------------------------------------------------------

4.5. Creating directories

Let's create the directory tree on the LFS partition according to the FHS
standard which can be found at [http://www.pathname.com/fhs/] http://
www.pathname.com/fhs/. Issuing the following commands will create the
necessary directories:
   
   
   
    cd $LFS
    mkdir bin boot dev dev/pts etc home lib mnt proc root sbin tmp var
    for dirname in $LFS/usr $LFS/usr/local
       do
       mkdir $dirname
       cd $dirname
       mkdir bin etc include lib sbin share src tmp var
       ln -s share/man man
       ln -s share/doc doc
       ln -s share/info info
       cd $dirname/share
       mkdir dict doc info locale man nls misc terminfo zoneinfo
       cd $dirname/share/man
       mkdir man1 man2 man3 man4 man5 man6 man7 man8
    done
    cd $LFS/var
    mkdir lock log mail run spool tmp
     
   
Normally directories are created with permission mode 755, which isn't
desired for all directories. I haven't checked the FHS if they suggest
default modes for certain directories, so I'll just change the modes for a
few directories that make sense to change. The first change is a mode 0750
for the $LFS/root directory. This is to make sure that not just everybody can
enter the /root directory (the same you would do with /home/username
directories). The second change is a mode 1777 for the tmp directories. This
way every user can write stuff to the /tmp directory if they need to. The
sticky (1) bit makes sure users can't delete other user's file which they
normally can do because the directory is set in such a way that every body
(owner, group, world) can write to that directory.
   
   
   
    cd $LFS &&
    chmod 0750 root &&
    chmod 1777 tmp usr/tmp var/tmp
     
   
Now that the directories are created, copy the source files you have
downloaded in chapter 3 to some subdirectory under $LFS/usr/src (you will
need to create this subdirectory yourself).
-----------------------------------------------------------------------------

Chapter 5. Preparing the LFS system

5.1. Introduction

In the following chapters we will install all the software that belongs to a
basic Linux system. After you're done with this chapter you have a fully
working Linux system. The remaining chapters deal with setting up networking,
creating the boot scripts and adding an entry to lilo.conf so that you can
boot your LFS system.

The software in this chapter will be linked statically. These programs will
be re-installed in the next chapter and linked dynamically. The reason for
the static version first is that there is a chance that our normal Linux
system and your LFS system aren't using the same C Library versions. If the
programs in the first part are linked against an older C library version,
those programs might not work well on the LFS system.

The key to learn what makes Linux tick is to know exactly what packages are
used for and why you or the system needs them. Descriptions of the package
content are provided after the Installation subsection of each package and in
Appendix A as well.

We're about to start with installing the first set of packages. These
packages will be, as previously explained, linked statically.

During the installation of various packages you will most likely see compiler
warnings scrolling by on your screen. These are normal and can be safely
ignored. They are just that, warnings (mostly about improper use of the C or
C++ syntax, but not illegal use. It's just that often C standards changed and
packages still use the old standard which is not a problem).

Before we start, make sure you have the LFS environment variable setup if you
plan on using it, by running the following command:
   
   
   
    echo $LFS
     
   
-----------------------------------------------------------------------------
5.2. Installing Bash

5.2.1. Installation of Bash

Install Bash by running the following commands:
   
   
   
    ./configure --enable-static-link --prefix=$LFS/usr \
       --bindir=$LFS/bin --disable-nls --with-curses &&
    make &&
    make install &&
    cd $LFS/bin &&
    ln -s bash sh
     
   
If you get errors when compiling bash that tell you about not being able to
find "-lcurses" run these two commands to create the missing symlink (so far
we have not enountered one distribution that has this libncurses symlink
setup properly, except for LFS systems where it is setup properly):
   
   
   
    cd /usr/lib &&
    ln -s libncurses.a libcurses.a
     
   
Note: Normally the libncurses.a file resides in the /usr/lib directory but it
might reside in /lib (like it does on LFS systems). So check to make sure
whether you should run the ln command in /usr/lib or in /lib
-----------------------------------------------------------------------------

5.2.2. Command explanations

--enable-static-link: This configure option causes Bash to be linked
statically

--prefix=$LFS/usr: This configure option installs all of Bash's files under
the $LFS/usr directory, which becomes the /usr directory after you chroot
into $LFS or when you reboot the system into LFS.

--bindir=$LFS/bin: This installs the executable files in $LFS/bin. We do this
because we want bash to be in /bin, not in /usr/bin. One reason being: your /
usr partition might be on a seperate partition which has to be mounted at
some point. Before that partition is mounted you need and will want to have
bash available (it will be hard to execute the boot scripts without a shell
for instance).

--disable-nls: This disables the build of NLS (National Language Support).
It's only a waste of time for now as Bash will be reinstalled in the next
chapter.

--with-curses: This causes Bash to be linked against the curses library
instead of the default termcap library which is becoming obsolete.

ln -s bash sh: This command creates the sh symlink that points to bash. Most
scripts run themselves via 'sh'; sh being a symlink to the default system
shell. Because programs and scripts don't know what shell you use by default
(could be bash, ksh, korn, tch, csh and others) they use the common symlink
sh which, if the system is properly setup, always points to the system's
default shell.

The &&'s at the end of every line cause the next command only to be executed
when the previous command exists with a return value of 0 indicating success.
In case you copy&paste all of these commands on the shell you want to be
ensured that if ./configure fails, make isn't being executed and likewise if
make fails that make install isn't being executed, and so forth.
-----------------------------------------------------------------------------

5.2.3. Contents

The Bash package contains the bash program
-----------------------------------------------------------------------------

5.2.4. Description

Bash is the Bourne-Again SHell, which is a widely used command interpreter on
Unix systems. Bash is a program that reads from standard input, the keyboard.
You type something and the program will evaluate what you have typed and do
something with it, like running a program.
-----------------------------------------------------------------------------

5.3. Installing Binutils

5.3.1. Installation of Binutils

Install Binutils by running the following commands:
   
   
   
    ./configure --prefix=$LFS/usr --disable-nls &&
    make -e LDFLAGS=-all-static tooldir=$LFS/usr &&
    make -e tooldir=$LFS/usr install
     
   
-----------------------------------------------------------------------------
5.3.2. Command explanations

make -e: The -e paramater tells make that environment variables take
precedence over variables defined in the Makefile file(s). This is needed in
order to successfully link binutils statically.

LDFLAGS=-all-static: Setting the variable LDFLAGS to the value -all-static
causes binutils to be linked statically.

tooldir=$LFS/usr: Normally the tooldir (the directory where the executables
from binutils end up in) is set to $(exec_prefix)/$(target_alias) which
expands 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 $LFS/usr. You
would use that setup if you use your system to cross-compile (for example you
would compile a package on your Intel machine that generates code that can be
executed on Apple PowerPC machines).
-----------------------------------------------------------------------------

5.3.3. Description

The Binutils package contains the ld, as, ar, nm, objcopy, objdump, ranlib,
size, strings, strip, c++filt, addr2line and nlmconv programs
-----------------------------------------------------------------------------

5.3.4. Description

5.3.4.1. ld

ld combines a number of object and archive files, relocates their data and
ties up symbol references. Often the last step in building a new compiled
program to run is a call to ld.
-----------------------------------------------------------------------------

5.3.4.2. as

as is primarily intended to assemble the output of the GNU C compiler gcc for
use by the linker ld.
-----------------------------------------------------------------------------

5.3.4.3. ar

The ar program creates, modifies, and extracts from archives. An archive is a
single file holding a collection of other files in a structure that makes it
possible to retrieve the original individual files (called members of the
archive).
-----------------------------------------------------------------------------

5.3.4.4. nm

nm lists the symbols from object files.
-----------------------------------------------------------------------------

5.3.4.5. objcopy

objcopy utility copies the contents of an object file to another. objcopy
uses the GNU BFD Library to read and write the object files. It can write the
destination object file in a format different from that of the source object
file.
-----------------------------------------------------------------------------

5.3.4.6. objdump

objdump displays information about one or more object files. The options
control what particular information to display. This information is mostly
useful to programmers who are working on the compilation tools, as opposed to
programmers who just want their program to compile and work.
-----------------------------------------------------------------------------

5.3.4.7. ranlib

ranlib generates an index to the contents of an archive, and stores it in the
archive. The index lists each symbol defined by a member of an archive that
is a relocatable object file.
-----------------------------------------------------------------------------

5.3.4.8. size

size lists the section sizes --and the total size-- for each of the object
files objfile in its argument list. By default, one line of output is
generated for each object file or each module in an archive.
-----------------------------------------------------------------------------

5.3.4.9. strings

For each file given, strings prints the printable character sequences that
are at least 4 characters long (or the number specified with an option to the
program) and are followed by an unprintable character. By default, it only
prints the strings from the initialized and loaded sections of object files;
for other types of files, it prints the strings from the whole file.

strings is mainly useful for determining the contents of non-text files.
-----------------------------------------------------------------------------

5.3.4.10. strip

strip discards all or specific symbols from object files. The list of object
files may include archives. At least one object file must be given. strip
modifies the files named in its argument, rather than writing modified copies
under different names.
-----------------------------------------------------------------------------

5.3.4.11. c++filt

The C++ language provides function overloading, which means that you can
write many functions with the same name (providing each takes parameters of
different types). All C++ function names are encoded into a low-level
assembly label (this process is known as mangling). The c++filt program does
the inverse mapping: it decodes (demangles) low-level names into user-level
names so that the linker can keep these overloaded functions from clashing.
-----------------------------------------------------------------------------

5.3.4.12. addr2line

addr2line translates program addresses into file names and line numbers.
Given an address and an executable, it uses the debugging information in the
executable to figure out which file name and line number are associated with
a given address.
-----------------------------------------------------------------------------

5.3.4.13. nlmconv

nlmconv converts relocatable object files into the NetWare Loadable Module
files, optionally reading header files for NLM header information.
-----------------------------------------------------------------------------

5.4. Installing Bzip2

5.4.1. Installation of Bzip2

Install Bzip2 by running the following commands:
   
   
   
    sed \
       s/"\$(CC) \$(CFLAGS) -o"/"\$(CC) \$(CFLAGS) \$(LDFLAGS) -o"/ \
       Makefile | make -f - LDFLAGS=-static &&
    make PREFIX=$LFS/usr install &&
    cd $LFS/usr/bin &&
    mv bzcat bunzip2 bzip2 bzip2recover $LFS/bin
     
   
-----------------------------------------------------------------------------
5.4.2. Command explanations

sed: The sed command here searches for the string "$(CC) $(CFLAGS) -o" and
replaced it by "$(CC) $(CFLAGS) $(LDFLAGS) -o" in the Makefile file. We make
that modification so it will be easier to link bzip2 statically.

...Makefile | make -f -: Makefile is the last parameter of the sed command
which indicates the file to search and replace in. sed normally sends the
modified file to stdout (standard output) which will be your console. With
the construction we use, sed's output will be piped to the make program.
Normally when make is started it tries to find a number of files like
Makefile. But we have modified the Makefile file so we don't want make to use
it. The "-f -" parameter tells make to read it's input from another file, or
from stdin (standard input) which the dash (-) implies. This is one way to do
it. Another way would be to have sed write the output to a different file and
tell make with the -f parameter to read that alternate file.

LDFLAGS=-static: This is the second way we use to link a package statically.
This is also the most common way. As you'll notice, the -all-static value is
only used with the binutils package and won't be used throughout the rest of
this book.
-----------------------------------------------------------------------------

5.4.3. Contents

The Bzip2 packages contains the bzip2, bunzip2, bzcat and bzip2recover
programs.
-----------------------------------------------------------------------------

5.4.4. Description

5.4.4.1. Bzip2

bzip2 compresses files using the Burrows-Wheeler block sorting text
compression algorithm, and Huffman coding. Compression is generally
considerably better than that achieved by more conventional LZ77/LZ78-based
compressors, and approaches the performance of the PPM family of statistical
compressors.
-----------------------------------------------------------------------------

5.4.4.2. Bunzip2

Bunzip2 decompresses files that are compressed with bzip2.
-----------------------------------------------------------------------------

5.4.4.3. bzcat

bzcat (or bzip2 -dc) decompresses all specified files to the standard output.
-----------------------------------------------------------------------------

5.4.4.4. bzip2recover

bzip2recover recovers data from damaged bzip2 files.
-----------------------------------------------------------------------------

5.5. Installing Diffutils

5.5.1. Installation of Diffutils

Install Diffutils by running the following commands:
   
   
   
    export CPPFLAGS=-Dre_max_failures=re_max_failures2 &&
    ./configure --prefix=$LFS/usr --disable-nls &&
    unset CPPFLAGS &&
    make LDFLAGS=-static &&
    make install
     
   
-----------------------------------------------------------------------------
5.5.2. Command explanations

CPPFLAGS=-Dre_max_failures=re_max_failures2: The CPPFLAGS variable is a
variable that's read by the cpp program (C PreProcessor). The value of this
variable tells the preprocessor to replace every instance of re_max_failures
it finds by re_max_failures2 before handing the souce file to the compiler
itself for compilation. This package has problems linking statically on
certain platforms (depending on the Glibc version used on that system) and
this construction fixes that problem.
-----------------------------------------------------------------------------

5.5.3. Contents

The Diffutils package contains the cmp, diff, diff3 and sdiff programs.
-----------------------------------------------------------------------------

5.5.4. Description

5.5.4.1. cmp and diff

cmp and diff both compare two files and report their differences. Both
programs have extra options which compare files in different situations.
-----------------------------------------------------------------------------

5.5.4.2. diff3

The difference between diff and diff3 is that diff comprares 2 files, diff3
compares 3 files.
-----------------------------------------------------------------------------

5.5.4.3. sdiff

sdiff merges two two files and interactively outputs the results.
-----------------------------------------------------------------------------

5.6. Installing Fileutils

5.6.1. Installation of Fileutils

Install Fileutils by running the following commands:
   
   
   
    ./configure --disable-nls \
    --prefix=$LFS/usr --libexecdir=$LFS/bin --bindir=$LFS/bin &&
    make LDFLAGS=-static &&
    make install &&
    cd $LFS/usr/bin &&
    ln -s ../../bin/install install
     
   
-----------------------------------------------------------------------------
5.6.2. Command explanations

--libexecdir=$LFS/bin: This configure option will set the program executable
directory to $LFS/bin. This is normally set to /usr/libexec, but nothing is
placed in it. Changing it just prevents that directory from being created.
-----------------------------------------------------------------------------

5.6.3. Contents

The Fileutils package contains the chgrp, chmod, chown, cp, dd, df, dir,
dircolors, du, install, ln, ls, mkdir, mkfifo, mknod, mv, rm, rmdir, sync,
touch and vdir programs.
-----------------------------------------------------------------------------

5.6.4. Description

5.6.4.1. chgrp

chgrp changes the group ownership of each given file to the named group,
which can be either a group name or a numeric group ID.
-----------------------------------------------------------------------------

5.6.4.2. chmod

chmod changes the permissions of each given file according to mode, which can
be either a symbolic representation of changes to make, or an octal number
representing the bit pattern for the new permissions.
-----------------------------------------------------------------------------

5.6.4.3. chown

chown changes the user and/or group ownership of each given file.
-----------------------------------------------------------------------------

5.6.4.4. cp

cp copies files from one place to another.
-----------------------------------------------------------------------------

5.6.4.5. dd

dd copies a file (from the standard input to the standard output, by default)
with a user-selectable blocksize, while optionally performing conversions on
it.
-----------------------------------------------------------------------------

5.6.4.6. df

df displays the amount of disk space available on the filesystem containing
each file name argument. If no file name is given, the space available on all
currently mounted filesystems is shown.
-----------------------------------------------------------------------------

5.6.4.7. ls, dir and vdir

dir and vdir are versions of ls with different default output formats. These
programs list each given file or directory name. Directory contents are
sorted alphabetically. For ls, files are by default listed in columns, sorted
vertically, if the standard output is a terminal; otherwise they are listed
one per line. For dir, files are by default listed in columns, sorted
vertically. For vdir, files are by default listed in long format.
-----------------------------------------------------------------------------

5.6.4.8. dircolors

dircolors outputs commands to set the LS_COLOR environment variable. The
LS_COLOR variable is use to change the default color scheme used by ls and
related utilities.
-----------------------------------------------------------------------------

5.6.4.9. du

du displays the amount of disk space used by each argument and for each
subdirectory of directory arguments.
-----------------------------------------------------------------------------

5.6.4.10. install

install copies files and sets their permission modes and, if possible, their
owner and group.
-----------------------------------------------------------------------------

5.6.4.11. ln

ln makes hard or soft (symbolic) links between files.
-----------------------------------------------------------------------------

5.6.4.12. mkdir

mkdir creates directories with a given name.
-----------------------------------------------------------------------------

5.6.4.13. mkfifo

mkfifo creates a FIFO with each given name.
-----------------------------------------------------------------------------

5.6.4.14. mknod

mknod creates a FIFO, character special file, or block special file with the
given file name.
-----------------------------------------------------------------------------

5.6.4.15. mv

mv moves files from one directory to another or renames files, depending on
the arguments given to mv.
-----------------------------------------------------------------------------

5.6.4.16. rm

rm removes files or directories.
-----------------------------------------------------------------------------

5.6.4.17. rmdir

rmdir removes directories, if they are empty.
-----------------------------------------------------------------------------

5.6.4.18. sync

sync forces changed blocks to disk and updates the super block.
-----------------------------------------------------------------------------

5.6.4.19. touch

touch changes the access and modification times of each given file to the
current time. Files that do not exist are created empty.
-----------------------------------------------------------------------------

5.7. Installing GCC on the normal system if necessary

5.7.1. Installation of GCC on the normal system if necessary

In order to compile Glibc-2.1.3 later on you need to have gcc-2.95.2
installed. Although any GCC version above 2.8 would do, 2.95.2 is the highly
recommended version to use. egcs-2.91.x is also known to work. If you don't
have gcc-2.95.x or egcs-2.91.x you need to install gcc-2.95.2 on your normal
sytem before you can compile Glibc later in this chapter.

To find out which compiler version your systems has, run the following
command:
   
   
   
    gcc --version
     
   
If you normal Linux system does not have gcc-2.95.x or egcs-2.91.x installed
you need to install it now. We won't replace the current compiler on your
system, but instead we will install gcc in a separate directory (/usr/local/
gcc2952). This way no binaries or header files will be replaced.

After you unpacked the gcc-2.95.2 archive don't enter the newly created
gcc-2.95.2 directory but stay in the $LFS/usr/src directory. Install GCC by
running the following commands:
   
   
   
    mkdir $LFS/usr/src/gcc-build &&
    cd $LFS/usr/src/gcc-build &&
    ../gcc-2.95.2/configure \
       --prefix=/usr/local/gcc2952 \
       --with-local-prefix=/usr/local/gcc2952 \
       --with-gxx-include-dir=/usr/local/gcc2952/include/g++ \
       --enable-shared --enable-languages=c,c++ &&
    make bootstrap &&
    make install
     
   
-----------------------------------------------------------------------------
5.7.2. Command explanations

--with-local-prefix: GCC installs a number of files in /usr/local even when
--prefix is set to something else. We don't want that to happen in this case
so that's why we use the --with-local-prefix option to change that path.

--with-gxx-include-dir: GCC installs the C++ header files in /usr/include/g++
by default. Again, in this case we don't want that to happen, we want this
GCC version to be installed completely under /usr/local/gcc2952.

make bootstrap: Compile GCC by bootstrapping it. Here that means the compiler
will be built three times in total. First it is compiled with your system's
default compiler (which will usually be a gcc or egcs compiler). This is
stage 1 compiler. Then GCC will re-compile itself but instead of using your
system's compiler it will use itself to compile itself again. This is the
stage 2 compiler. Then it will compile itself a second time with the stage 2
compiler and compares the second and the third build to see if they are
identical. If so, the compilation was a success.
-----------------------------------------------------------------------------

5.7.3. Contents

The GCC package contains compilers, preprocessors and the GNU C++ Library.
-----------------------------------------------------------------------------

5.7.4. Description

5.7.4.1. Compiler

A compiler translates source code in text format to a format that a computer
understands. After a source code file is compiled into an object file, a
linker will create an executable file from one or more of these compiler
generated object files.
-----------------------------------------------------------------------------

5.7.4.2. Pre-processor

A pre-processor pre-processes a source file, such as including the contents
of header files into the source file. You generally don't do this yourself to
save yourself a lot of time. You just insert a line like #include <filename>.
The pre-processor file insert the contents of that file into the source file.
That's one of the things a pre-processor does.
-----------------------------------------------------------------------------

5.7.4.3. C++ Library

The C++ library is used by C++ programs. The C++ library contains functions
that are frequently used in C++ programs. This way the programmer doesn't
have to write certain functions (such as writing a string of text to the
screen) from scratch every time he creates a program.
-----------------------------------------------------------------------------

5.8. Installing GCC on the LFS system

5.8.1. Installation of GCC on the LFS system

After you unpacked the gcc-2.95.2 archive don't enter the newly created
gcc-2.95.2 directory but stay in the $LFS/usr/src directory. Install GCC by
running the following commands:
   
   
   
    mkdir $LFS/usr/src/gcc-build &&
    cd $LFS/usr/src/gcc-build &&
    ../gcc-2.95.2/configure --prefix=/usr \
       --with-gxx-include-dir=/usr/include/g++ \
       --enable-languages=c,c++ --disable-nls &&
    make -e LDFLAGS=-static bootstrap &&
    make prefix=$LFS/usr local_prefix=$LFS/usr/local \
       gxx_include_dir=$LFS/usr/include/g++ install &&
    cd $LFS/lib &&
    ln -s ../usr/lib/gcc-lib/*/2.95.2/cpp cpp &&
    cd $LFS/usr/lib &&
    ln -s gcc-lib/*/2.95.2/cpp cpp &&
    cd $LFS/usr/bin &&
    ln -s gcc cc
     
   
-----------------------------------------------------------------------------
5.8.2. Command explanations

--enable-languages=c,c++: This only builds the C and C++ compilers and not
the other available compilers as they are, on the average, not often used. If
you do need those other compilers don't use the --enable-languages parameter.

ln -s ../usr/lib/gcc-lib/*/2.95.2/cpp cpp: This creates the $LFS/lib/cpp
symlink. Some packages explicitely try to find cpp in /lib.

ln -s ../usr/lib/gcc-lib/*/2.95.2/cpp cpp: This creates the $LFS/usr/lib/cpp
symlink as there are packages that expect cpp to be in /usr/lib.
-----------------------------------------------------------------------------

5.8.3. Contents

The GCC package contains compilers, preprocessors and the GNU C++ Library.
-----------------------------------------------------------------------------

5.8.4. Description

5.8.4.1. Compiler

A compiler translates source code in text format to a format that a computer
understands. After a source code file is compiled into an object file, a
linker will create an executable file from one or more of these compiler
generated object files.
-----------------------------------------------------------------------------

5.8.4.2. Pre-processor

A pre-processor pre-processes a source file, such as including the contents
of header files into the source file. You generally don't do this yourself to
save yourself a lot of time. You just insert a line like #include <filename>.
The pre-processor file insert the contents of that file into the source file.
That's one of the things a pre-processor does.
-----------------------------------------------------------------------------

5.8.4.3. C++ Library

The C++ library is used by C++ programs. The C++ library contains functions
that are frequently used in C++ programs. This way the programmer doesn't
have to write certain functions (such as writing a string of text to the
screen) from scratch every time he creates a program.
-----------------------------------------------------------------------------

5.9. Installing Linux Kernel

5.9.1. Installation of Linux Kernel

We won't be compiling a new kernel image yet. We'll do that after we have
finished the installation of the basic system software in this chapter. But
because certain software need the kernel header files, we're going to unpack
the kernel archive now and set it up so that we can compile package that need
the kernel.

Create the kernel configuration file by running the following command:
   
   
   
    yes "" | make config
     
   
Ignore the warning Broken pipe you might see at the end. Now run the
following commands to set up all the dependencies correctly:
   
   
   
    make dep
     
   
Now that that's done, we need to create the $LFS/usr/include/linux and the
$LFS/usr/include/asm symlinks. Create them by running the following commands:
   
   
   
    cd $LFS/usr/include &&
    ln -s ../src/linux/include/linux linux &&
    ln -s ../src/linux/include/asm asm
     
   
-----------------------------------------------------------------------------
5.9.2. Command explanations

yes "" | make config: This runs make config and answers "Y" to every question
the config script asks the user. We're not configuring the real kernel here,
we just need to have some sort of configure file created so that we can run
make dep next that will create a few files in $LFS/usr/src/linux/include/
linux like version.h among others that we will need to compilg Glibc and
other packages later in chroot.

make dep: make dep checks dependencies and sets up the dependencies file. We
don't really care about the dependency checks, but what we do care about is
that make dep creates those aforementioned files in $LFS/usr/src/linux/
include/linux we will be needing later on.

ln -s ../src/linux/include/linux linux and ln -s ../src/linux/include/asm
asm: These commands create the linux and asm symlinks in the $LFS/usr/include
directory that point to the proper directories in the Linux source tree.
Packages that need kernel headers include them with lines like #include <
linux/errno.h>. These paths are relative to the /usr/include directory so the
/usr/include/linux link points to the directory containing the Linux kernel
header files. The same goes for the asm symlink.
-----------------------------------------------------------------------------

5.9.3. Contents

The Linux kernel package contains the Linux kernel.
-----------------------------------------------------------------------------

5.9.4. Description

The Linux kernel is at the core of every Linux system. It's what makes Linux
tick. When you turn on your computer and boot a Linux system, the very first
piece of Linux software that gets loaded is the kernel. The kernel
initializes the system's hardware components such as serial ports, parallel
ports, sound cards, network cards, IDE controllers, SCSI controllers and a
lot more. In a nutshell the kernel makes the hardware available so that the
software can run.
-----------------------------------------------------------------------------

5.10. Installing Glibc

5.10.1. Installation of Glibc

Unpack the glibc-crypt and glibc-linuxthreads in the glibc-2.1.3 directory,
not in $LFS/usr/src. Don't enter the created directories. Just unpack them
and leave it with that.

A few default parameters of Glibc need to be changed, such as the directory
where the shared libraries are supposed to be installed in and the directory
that contains the system configuration files. For this purpose you need to
create the $LFS/usr/src/glibc-build directory and cd into that directory
with:
   
   
   
    mkdir $LFS/usr/src/glibc-build &&
    cd $LFS/usr/src/glibc-build
     
   
In that directory you create a new file configparms by running the following:


cat > configparms << "EOF"
# Begin configparms

slibdir=/lib
sysconfdir=/etc

# End configparms
EOF
 

Before we actually install Glibc you need to unpack the Glibc patch file.

Please note that the configure script of Glibc may complain about certain
files in the /usr/include directory being too old and will be replaced, or
that some symlink is not supposed to be there anymore (like the /usr/include/
scsi symlink that's present on older Linux systems). If it asks you to move a
symlink like scsi out of the way, please do so. If it says it will replace
old files by the newer Glibc files you can ignore that. Glibc does not know
that it will end up on $LFS when the configure script is run.

If your system had already a suitable GCC version installed, change to the
$LFS/usr/src/glibc-build directory and install Glibc by running the following
commands:
   
   
   
    cd ../glibc-2.1.3 &&
    patch -Np1 -i ../glibc-2.1.3.patch &&
    cd $LFS/usr/src/glibc-build &&
    ../glibc-2.1.3/configure \
       --prefix=/usr --enable-add-ons \
       --with-headers=$LFS/usr/include \
       --libexecdir=/usr/bin &&
    make &&
    make install_root=$LFS install &&
    make install_root=$LFS localedata/install-locales
     
   
If your system didn't have a suitable GCC version installed, change to the
$LFS/usr/src/glibc-build directory and install Glibc using the gcc-2.95.2 you
just installed by running the following commands:
   
   
   
    cd ../glibc-2.1.3 &&
    patch -Np1 -i ../glibc-2.1.3.patch &&
    cd $LFS/usr/src/glibc-build &&
    CC=/usr/local/gcc2952/bin/gcc \
       ../glibc-2.1.3/configure --prefix=/usr --enable-add-ons \
       --with-headers=$LFS/usr/include \
       --libexecdir=/usr/bin &&
    make &&
    make install_root=$LFS install &&
    make install_root=$LFS localedata/install-locales
     
   
-----------------------------------------------------------------------------
5.10.2. Copying old NSS library files

If your normal Linux system runs glibc-2.0, you need to copy the NSS library
files to the LFS partition. Certain statically linked programs still depend
on the NSS library, especially programs that need to lookup
usernames,userid's and groupid's. You can check which C library version your
normal Linux system uses by running:
   
   
   
    strings /lib/libc* | grep "release version"
     
   
The output of that command should tell you something like this:
   
   
    GNU C Library stable release version 2.1.3, by Roland McGrath et al.
   
If you have Glibc-2.0.x installed on your starting distribution, copy the NSS
library files by running:
   
   
   
    cp -av /lib/libnss* $LFS/lib
     
   
-----------------------------------------------------------------------------
5.10.3. Command explanations

patch -Np1 -i ../glibc-2.1.3.patch: This applies a patch that fixes a minor
bug in Glibc. Glibc defines a few variables names with illegal characters in
the name. Bash-2.03 and older don't complain about that but Bash-2.04 does
and won't compile Glibc properly.

--enable-add-ons: This enabled the add-ons that we install with Glibc:
linuxthreads and crypt.

--with-headers=$LFS/usr/include: This makes Glibc use the kernel header files
on our LFS system and not the kernel header files from your starting
distribution which may be out-of-date or modified.

make install_root=$LFS: This is the Glibc way to specify the equivalent of
--prefix=.
-----------------------------------------------------------------------------

5.10.4. Contents

The Glibc package contains the GNU C Library.
-----------------------------------------------------------------------------

5.10.5. Description

The C Library is a collection of commonly used functions in programs. This
way a programmer doens't need to create his own functions for every single
task. The most common things like writing a string to your screen are already
present and at the disposal of the programmer.

The C library (actually almost every library) come in two flavours: dynamic
ones and static ones. In short when a program uses a static C library, the
code from the C library will be copied into the executable file. When a
program uses a dynamic library, that executable will not contain the code
from the C library, but instead a routine that loads the functions from the
library at the time the program is run. This means a significant decrease in
the file size of a program. If you don't understand this concept, you better
read the documentation that comes with the C Library as it is too complicated
to explain here in one or two lines.
-----------------------------------------------------------------------------

5.11. Installing Grep

5.11.1. Installation of Grep

Install Grep by running the following commands:
   
   
   
    export CPPFLAGS=-Dre_max_failures=re_max_failures2 &&
    ./configure --prefix=$LFS/usr --disable-nls &&
    unset CPPFLAGS &&
    make LDFLAGS=-static &&
    make install
     
   
-----------------------------------------------------------------------------
5.11.2. Contents

The grep package contains the egrep, fgrep and grep programs.
-----------------------------------------------------------------------------

5.11.3. Description

5.11.3.1. egrep

egrep prints lines from files matching an extended regular expression
pattern.
-----------------------------------------------------------------------------

5.11.3.2. fgrep

fgrep prints lines from files matching a list of fixed strings, separated by
newlines, any of which is to be matched.
-----------------------------------------------------------------------------

5.11.3.3. grep

grep prints lines from files matching a basic regular expression pattern.
-----------------------------------------------------------------------------

5.12. Installing Gzip

5.12.1. Installation of Gzip

Before you install Gzip you have to unpack the gzip patch file.
   
   
   
    patch -Np1 -i ../gzip-1.2.4a.patch &&
    ./configure --prefix=$LFS/usr --disable-nls &&
    make LDFLAGS=-static &&
    make install &&
    cp $LFS/usr/bin/gunzip $LFS/usr/bin/gzip $LFS/bin &&
    rm $LFS/usr/bin/gunzip $LFS/usr/bin/gzip
     
   
-----------------------------------------------------------------------------
5.12.2. Contents

The Gzip package contains the compress, gunzip, gzexe, gzip, uncompress,
zcat, zcmp, zdiff, zforece, zgrep, zmore and znew programs.
-----------------------------------------------------------------------------

5.12.3. Description

5.12.3.1. gunzip

gunzip decompresses files that are compressed with gzip.
-----------------------------------------------------------------------------

5.12.3.2. gzexe

gzexe allows you to compress executables in place and have them automatically
uncompress and execute when you run them (at a penalty in performance).
-----------------------------------------------------------------------------

5.12.3.3. gzip

gzip reduces the size of the named files using Lempel-Ziv coding (LZ77).
-----------------------------------------------------------------------------

5.12.3.4. zcat

zcat uncompresses either a list of files on the command line or its standard
input and writes the uncompressed data on standard output
-----------------------------------------------------------------------------

5.12.3.5. zcmp

zcmp invokes the cmp program on compressed files.
-----------------------------------------------------------------------------

5.12.3.6. zdiff

zdiff invokes the diff program on compressed files.
-----------------------------------------------------------------------------

5.12.3.7. zforce

zforce forces a .gz extension on all gzip files so that gzip will not
compress them twice. This can be useful for files with names truncated after
a file transfer.
-----------------------------------------------------------------------------

5.12.3.8. zgrep

zgrep invokes the grep program on compressed files.
-----------------------------------------------------------------------------

5.12.3.9. zmore

Zmore is a filter which allows examination of compressed or plain text files
one screenful at a time on a soft-copy terminal (similar to the more
program).
-----------------------------------------------------------------------------

5.12.3.10. znew

Znew recompresses files from .Z (compress) format to .gz (gzip) format.
-----------------------------------------------------------------------------

5.13. Installing Make

5.13.1. Installation of Make

Install Make by running the following commands:
   
   
   
    ./configure --prefix=$LFS/usr --disable-nls &&
    make LDFLAGS=-static &&
    make install
     
   
-----------------------------------------------------------------------------
5.13.2. Contents

The Make package contains the make program.
-----------------------------------------------------------------------------

5.13.3. Description

make determine automatically which pieces of a large program need to be
recompiled, and issue the commands to recompile them.
-----------------------------------------------------------------------------

5.14. Installing Sed

5.14.1. Installation of Sed

Install Sed by running the following commands:
   
   
   
    export CPPFLAGS=-Dre_max_failures=re_max_failures2 &&
    ./configure --prefix=$LFS/usr --disable-nls --bindir=$LFS/bin &&
    unset CPPFLAGS &&
    make LDFLAGS=-static &&
    make install
     
   
-----------------------------------------------------------------------------
5.14.2. Contents

The Sed package contains the sed program.
-----------------------------------------------------------------------------

5.14.3. Description

sed is a stream editor. A stream editor is used to perform basic text
transformations on an input stream (a file or input from a pipeline).
-----------------------------------------------------------------------------

5.15. Installing Shellutils

5.15.1. Installation of Sh-utils

Install Shellutils by running the following commands:
   
   
   
    ./configure --prefix=$LFS/usr --disable-nls &&
    make LDFLAGS=-static &&
    make install &&
    cd $LFS/usr/bin &&
    mv date echo false pwd stty $LFS/bin &&
    mv su true uname hostname $LFS/bin
     
   
-----------------------------------------------------------------------------
5.15.2. Contents

The Shellutils package contains the basename, chroot, date, dirname, echo,
env, expr, factor, false, groups, hostid, hostname, id, logname, nice, nohup,
pathchk, pinky, printenv, printf, pwd, seq, sleep, stty, su, tee, test, true,
tty, uname, uptime, users, who, whoami and yes programs.
-----------------------------------------------------------------------------

5.15.3. Description

5.15.3.1. basename

basename strips directory and suffixes from filenames.
-----------------------------------------------------------------------------

5.15.3.2. chroot

chroot runs a command or interactive shell with special root directory.
-----------------------------------------------------------------------------

5.15.3.3. date

date displays the current time in a specified format, or sets the system
date.
-----------------------------------------------------------------------------

5.15.3.4. dirname

dirname strips non-directory suffixes from file name.
-----------------------------------------------------------------------------

5.15.3.5. echo

echo displays a line of text.
-----------------------------------------------------------------------------

5.15.3.6. env

env runs a program in a modified environment.
-----------------------------------------------------------------------------

5.15.3.7. expr

expr evaluates expressions.
-----------------------------------------------------------------------------

5.15.3.8. factor

factor prints the prime factors of all specified integer numbers.
-----------------------------------------------------------------------------

5.15.3.9. false

false always exits with a status code indicating failure.
-----------------------------------------------------------------------------

5.15.3.10. groups

groups prints the groups a user is in.
-----------------------------------------------------------------------------

5.15.3.11. hostid

hostid prints the numeric identifier (in hexadecimal) for the current host.
-----------------------------------------------------------------------------

5.15.3.12. hostname

hostname sets or prints the name of the current host system
-----------------------------------------------------------------------------

5.15.3.13. id

id prints the real and effective UIDs and GIDs of a user or the current user.
-----------------------------------------------------------------------------

5.15.3.14. logname

logname prints the current user's login name.
-----------------------------------------------------------------------------

5.15.3.15. nice

nice runs a program with modified scheduling priority.
-----------------------------------------------------------------------------

5.15.3.16. nohup

nohup runs a command immune to hangups, with output to a non-tty
-----------------------------------------------------------------------------

5.15.3.17. pathchk

pathchk checks whether file names are valid or portable.
-----------------------------------------------------------------------------

5.15.3.18. pinky

pinky is a lightweight finger utility which retrieves information about a
certain user
-----------------------------------------------------------------------------

5.15.3.19. printenv

printenv prints all or part of the environment.
-----------------------------------------------------------------------------

5.15.3.20. printf

printf formats and print data (the same as the printf C function).
-----------------------------------------------------------------------------

5.15.3.21. pwd

pwd prints the name of the current/working directory
-----------------------------------------------------------------------------

5.15.3.22. seq

seq prints numbers in a certain range with a certain increment.
-----------------------------------------------------------------------------

5.15.3.23. sleep

sleep delays for a specified amount of time.
-----------------------------------------------------------------------------

5.15.3.24. stty

stty changes and prints terminal line settings.
-----------------------------------------------------------------------------

5.15.3.25. su

su runs a shell with substitute user and group IDs
-----------------------------------------------------------------------------

5.15.3.26. tee

tee reads from standard input and write to standard output and files.
-----------------------------------------------------------------------------

5.15.3.27. test

test checks file types and compares values.
-----------------------------------------------------------------------------

5.15.3.28. true

True always exitx with a status code indicating success.
-----------------------------------------------------------------------------

5.15.3.29. tty

tty prints the file name of the terminal connected to standard input.
-----------------------------------------------------------------------------

5.15.3.30. uname

uname prints system information.
-----------------------------------------------------------------------------

5.15.3.31. uptime

uptime tells how long the system has been running.
-----------------------------------------------------------------------------

5.15.3.32. users

users prints the user names of users currently logged in to the current host.
-----------------------------------------------------------------------------

5.15.3.33. who

who shows who is logged on.
-----------------------------------------------------------------------------

5.15.3.34. whoami

whoami prints your effective userid.
-----------------------------------------------------------------------------

5.15.3.35. yes

yes outputs a string repeatedly until killed.
-----------------------------------------------------------------------------

5.16. Installing Tar

5.16.1. Installation of Tar

If you want to be able to directly use bzip2 files with tar, use the tar
patch avaiable from the LFS FTP site. This patch will add the -y option to
tar which works the same as the -z option to tar (which you can use for gzip
files).

Apply the patch by running the following command:
   
   
   
    cd src &&
    patch -i ../../gnutarpatch.txt &&
    cd ..
     
   
Install Tar by running the following commands:
   
   
   
    ./configure --prefix=$LFS/usr --disable-nls \
       --libexecdir=$LFS/usr/bin &&
    make LDFLAGS=-static &&
    make prefix=$LFS/usr install &&
    mv $LFS/usr/bin/tar $LFS/bin
     
   
-----------------------------------------------------------------------------
5.16.2. Contents

The tar package contains the tar and rmt programs.
-----------------------------------------------------------------------------

5.16.3. Description

5.16.3.1. tar

tar is an archiving program designed to store and extract files from an
archive file known as a tarfile.
-----------------------------------------------------------------------------

5.16.3.2. rmt

rmt is a program used by the remote dump and restore programs in manipulating
a magnetic tape drive through an interprocess communication connection.
-----------------------------------------------------------------------------

5.17. Installing Textutils

5.17.1. Installation of Textutils

Install Textutils by running the following commands:
   
   
   
    ./configure --prefix=$LFS/usr --disable-nls &&
    make LDFLAGS=-static &&
    make install &&
    mv $LFS/usr/bin/cat $LFS/bin
     
   
-----------------------------------------------------------------------------
5.17.2. Contents

The Textutils package contains the cat, cksum, comm, split, cut, expand, fmt,
fold, head, join, md5sum, nl, od, paste, pr, ptx, sort, split, sum, tac,
tail, tr, tsort, unexpand, uniq and wc programs.
-----------------------------------------------------------------------------

5.17.3. Description

5.17.3.1. cat

cat concatenates file(s) or standard input to standard output.
-----------------------------------------------------------------------------

5.17.3.2. cksum

cksum prints CRC checksum and byte counts of each specified file.
-----------------------------------------------------------------------------

5.17.3.3. comm

comm compares two sorted files line by line.
-----------------------------------------------------------------------------

5.17.3.4. csplit

cplit outputs pieces of a file separated by (a) pattern(s) to files xx01,
xx02, ..., and outputs byte counts of each piece to standard output.
-----------------------------------------------------------------------------

5.17.3.5. cut

cut prints selected parts of lines from specified files to standard output.
-----------------------------------------------------------------------------

5.17.3.6. expand

expand converts tabs in files to spaces, writing to standard output.
-----------------------------------------------------------------------------

5.17.3.7. fmt

fmt reformats each paragraph in the specified file(s), writing to standard
output.
-----------------------------------------------------------------------------

5.17.3.8. fold

fold wraps input lines in each specified file (standard input by default),
writing to standard output.
-----------------------------------------------------------------------------

5.17.3.9. head

Print first xx (10 by default) lines of each specified file to standard
output.
-----------------------------------------------------------------------------

5.17.3.10. join

join joins lines of two files on a common field.
-----------------------------------------------------------------------------

5.17.3.11. md5sum

md5sum prints or checks MD5 checksums.
-----------------------------------------------------------------------------

5.17.3.12. nl

nl writes each specified file to standard output, with line numbers added.
-----------------------------------------------------------------------------

5.17.3.13. od

od writes an unambiguous representation, octal bytes by default, of a
specified file to standard output.
-----------------------------------------------------------------------------

5.17.3.14. paste

paste writes lines consisting of the sequentially corresponding lines from
each specified file, separated by TABs, to standard output.
-----------------------------------------------------------------------------

5.17.3.15. pr

pr paginates or columnates files for printing.
-----------------------------------------------------------------------------

5.17.3.16. ptx

ptx produces a permuted index of file contents.
-----------------------------------------------------------------------------

5.17.3.17. sort

sort writes sorted concatenation of files to standard output.
-----------------------------------------------------------------------------

5.17.3.18. split

split outputs fixed-size pieces of an input file to PREFIXaa, PREFIXab, ...
-----------------------------------------------------------------------------

5.17.3.19. sum

sum prints checksum and block counts for each specified file.
-----------------------------------------------------------------------------

5.17.3.20. tac

tac writes each specified file to standard output, last line first.
-----------------------------------------------------------------------------

5.17.3.21. tail

tail print the last xx (10 by default) lines of each specified file to
standard output.
-----------------------------------------------------------------------------

5.17.3.22. tr

tr translates, squeezes, and/or deletes characters from standard input,
writing to standard output.
-----------------------------------------------------------------------------

5.17.3.23. tsort

tsort writes totally ordered lists consistent with the partial ordering in
specified files.
-----------------------------------------------------------------------------

5.17.3.24. unexpand

unexpand converts spaces in each file to tabs, writing to standard output.
-----------------------------------------------------------------------------

5.17.3.25. uniq

uniq discards all but one of successive identical lines from files or
standard input and writes to files or standard output.
-----------------------------------------------------------------------------

5.17.3.26. wc

wc prints line, word, and byte counts for each specified file, and a total
line if more than one file is specified.
-----------------------------------------------------------------------------

5.18. Creating passwd and group files

In order for user and group root to be recognized and to be able to logon it
needs an entry in the /etc/passwd and /etc/group file. Besides the group root
a couple of other groups are recommended and needed by packages. The groups
with their GID's below aren't part of any standard. The LSB only recommends
besides a group root a group bin to be present with GID 1. Other group names
and GID's can be chosen by yourself. Well written packages don't depend on
GID numbers but just use the group name, it doesn't matter all that much what
GID a group has. Since there aren't any standards for groups I won't follow
any conventions used by Debian, RedHat and others. The groups added here are
the groups the MAKEDEV script (the script that creates the device files in
the /dev directory) mentions.

Create a new file $LFS/etc/passwd by running the following command:
   
   
   
    echo "root:x:0:0:root:/root:/bin/bash" > $LFS/etc/passwd
     
   
Create a new file $LFS/etc/group by running the following:


cat > $LFS/etc/group << "EOF"
root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
tty:x:4:
uucp:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
EOF
 
-----------------------------------------------------------------------------

5.19. Mounting $LFS/proc file system

In order for certain programs to function properly the proc file system must
be mounted and available from within the chroot'ed environment as well. It's
not a problem to mount the proc file system twice or even more than that,
since it's a virtual file system maintained by the kernel itself.

Mount the proc file system under $LFS/proc by running the following command:
   
   
   
    mount proc $LFS/proc -t proc
     
   
-----------------------------------------------------------------------------
Chapter 6. Installing basic system software

6.1. Introduction

The installation of all the software is pretty straightforward and you'll
think it's so much easier and shorter to give the generic installation
instructions for each package and only explain how to install something if a
certain package requires an alternate installation method. Although I agree
with you on that, I, however, choose to give the full instructions for each
and every package. This is simply to avoid any possible confusion and errors.
-----------------------------------------------------------------------------

6.2. About debugging symbols

Most programs and libraries by default are compiled with debugging symbols
and optimizing level 2 (gcc options -g and -O2) and are compiled for a
specific CPU. On Intel platforms software is compiled for i386 processors by
default. If you don't wish to run software on other machines other than your
own, you might want to change the default compiler options so that they will
be compiled with a higher optimization level, no debugging symbols and
generate code for your specific architecture. Let me first explain what
debugging symbols are.

A program compiled with debugging symbols means you can run a program or
library through a debugger and the debugger's output will be user friendlier.
These debugging symbols also enlarge the program or library significantly.

To remove debugging symbols from a binary (must be an a.out or ELF binary)
run strip --strip-debug filename You can use wild cards if you need to strip
debugging symbols from multiple files (use something like strip --strip-debug
$LFS/usr/bin/*). Another, easier, options is just not to compile programs
with debugging symbols. Most people will probably never use a debugger on
software, so by leaving those symbols out you can save a lot of diskspace.

Before you wonder if these debugging symbols would make a big difference,
here are some statistics:

  * A dynamic Bash binary with debugging symbols: 1.2MB
   
  * A dynamic Bash binary without debugging symbols: 478KB
   
  * /lib and /usr/lib (glibc and gcc files) with debugging symbols: 87MB
   
  * /lib and /usr/lib (glibc and gcc files) without debugging symbols: 16MB
   

Sizes may vary depending on which compiler was used and which C library
version was used to link dynamic programs against, but your results will be
similar if you compare programs with and without debugging symbols. After I
was done with this chapter and stripped all debugging symbols from all LFS
binaries and libraries I regained a little over 102 MB of disk space. Quite
the difference.
-----------------------------------------------------------------------------

6.3. Creating $LFS/root/.bash_profile

When we have entered the chroot'ed environment in the next section we want to
export a couple of environment variables in that shell such as PS1, PATH and
others variables you want to have set. For that purpose we'll create the $LFS
/root/.bash_profile file which will be read by bash when we enter the chroot
environment.

Create a new file $LFS/root/.bash_profile by running the following.


cat > $LFS/root/.bash_profile << "EOF"
# Begin /root/.bash_profile

PS1='\u:\w\$ '
PATH=/bin:/usr/bin:/sbin:/usr/sbin

export PS1 PATH

# End /root/.bash_profile
EOF
 

You can add more environment variables,aliases and whatever else you need/
want at your own discretion as you deem them necessary.
-----------------------------------------------------------------------------

6.4. Entering the chroot'ed environment

It's time to enter our chroot'ed environment in order to install the rest of
the software we need.

Enter the following command to enter the chroot'ed environment. From this
point on there's no need to use the $LFS variable anymore, because everything
you do will be restricted to the LFS partition (since / is actually /mnt/lfs
but the shell doesn't know that).
   
   
   
    cd $LFS &&
    chroot $LFS /usr/bin/env -i HOME=/root /bin/bash --login
     
   
Now that we are inside a chroot'ed environment, we can continue to install
all the basic system software. Make sure you execute all the following
commands in this chapter from within the chroot'ed environment.
-----------------------------------------------------------------------------

6.5. Creating device files

6.5.1. Installation of MAKEDEV

Install MAKEDEV by running the following commands:
   
   
   
    sed "s/# 9/9/" MAKEDEV >/dev/MAKEDEV &&
    chmod 754 /dev/MAKEDEV
     
   
-----------------------------------------------------------------------------
6.5.2. Creating the /dev entries

Create the device files by running the following commands:
   
   
   
    cd /dev &&
    ./MAKEDEV -v generic
     
   
The "generic" parameter passed to the MAKEDEV script doesn't create all the
devices you might need, such as audio devices, hdc, hdd and ohters. If you
seem to be missing something tell MAKEDEV to create it. To create hdc replace
generic with hdc. You can also add hdc to generic, so you would execute ./
MAKEDEV -v generic hdc to create the generic set of devices files, plus the
files you need to be able to access hdc (and hdc1, hdc2, etc)

Please note that this script dates back from 1997 and therefore can be
outdated and not support newer hardware. If you need device files which
aren't known by this script please read the Documentation/devices.txt file in
a Linux source tree. This file lists all the major and minor numbers for all
the device files that the kernel knows about. With this list you can create
such device files yourself. See the mknod man page for more information on
how to make device files yourself.
-----------------------------------------------------------------------------

6.5.3. Command explanations

sed "s/# 9/9/" MAKEDEV >/dev/MAKEDEV: By default the Makedev script only
creates the hda1-hda8 and hdb1-hdb8 devices. By replacing "# 9" by "9"'s in
the MAKEDEV script, it will create hda1-hda20, hdb1-hdb20 and possible others
(like hdc and hdd)

chmod 754 /dev/MAKEDEV: This sets the permissions of the MAKEDEV script to
mode 754 which makes it executable only for owner and group and readable by
everybody.
-----------------------------------------------------------------------------

6.5.4. Contents

The MAKEDEV package contains the MAKEDEV script.
-----------------------------------------------------------------------------

6.5.5. Description

MAKEDEV is a script that can aid you in creating the necesarry static device
files that usually reside in the /dev directory.
-----------------------------------------------------------------------------

6.6. Installing Man-pages

6.6.1. Installation of Man-pages

Install Man-pages by running the following commands:
   
   
   
    make install
     
   
-----------------------------------------------------------------------------
6.6.2. Contents

The Man-pages package contains various manual pages that don't come with the
packages.
-----------------------------------------------------------------------------

6.6.3. Description

Examples of provided manual pages are the manual pages describing all the C
and C++ functions, few important /dev/ files and more.
-----------------------------------------------------------------------------

6.7. Installing Ed

6.7.1. Installation of Ed

Install Ed by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install &&
    mv /usr/bin/ed /usr/bin/red /bin
     
   
-----------------------------------------------------------------------------
6.7.2. Contents

The Ed package contains the ed program.
-----------------------------------------------------------------------------

6.7.3. Description

Ed is a line-oriented text editor. It is used to create, display, modify and
otherwise manipulate text files.
-----------------------------------------------------------------------------

6.8. Installing Patch

6.8.1. Installation of Patch

Install Patch by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.8.2. Contents

The Patch package contains the patch program.
-----------------------------------------------------------------------------

6.8.3. Description

The patch program modifies a file according to a patch file. A patch file
usually is a list created by the diff program that contains instructions on
how an original file needs to be modified. Patch is used a lot for source
code patches since it saves time and space. Imagine you have a package that
is 1MB in size. The next version of that package only has changes in two
files of the first version. You can ship an entirely new package of 1MB or
provide a patch file of 1KB which will update the first version to make it
identical to the second version. So if you have downloaded the first version
already, a patch file can save you a second large download.
-----------------------------------------------------------------------------

6.9. Installing Findutils

6.9.1. Installing Findutils

Before you install Findutils you have to unpack the findutils patch file.

Install Findutils by running the following commands:
   
   
   
    patch -Np1 -i ../findutils-4.1.patch &&
    ./configure --prefix=/usr &&
    make &&
    make libexecdir=/usr/bin install
     
   
-----------------------------------------------------------------------------
6.9.2. Contents

The Findutils package contains the find, locate, updatedb and xargs programs.
-----------------------------------------------------------------------------

6.9.3. Description

6.9.3.1. Find

The find program searches for files in a directory hierarchy which match a
certain criteria. If no criteria is given, it lists all files in the current
directory and it's subdirectories.
-----------------------------------------------------------------------------

6.9.3.2. Locate

Locate scans a database which contain all files and directories on a
filesystem. This program lists the files and directories in this database
matching a certain criteria. If you're looking for a file this program will
scan the database and tell you exactly where the files you requested are
located. This only makes sense if your locate database is fairly up-to-date
else it will provide you with out-of-date information.
-----------------------------------------------------------------------------

6.9.3.3. Updatedb

The updatedb program updates the locate database. It scans the entire file
system (including other file system that are currently mounted unless you
specify it not to) and puts every directory and file it finds into the
database that's used by the locate program which retrieves this information.
It's a good practice to update this database once a day so that you are
ensured of a database that is up-to-date.
-----------------------------------------------------------------------------

6.9.3.4. Xargs

The xargs command applies a command to a list of files. If you need to
perform the same command on multiple files, you can create a file that
contains all these files (one per line) and use xargs to perform that command
on the list.
-----------------------------------------------------------------------------

6.10. Installing Mawk

6.10.1. Installation of Mawk

Install Mawk by running the following commands:
   
   
   
    ./configure &&
    make &&
    make BINDIR=/usr/bin \
       MANDIR=/usr/share/man/man1 install &&
    cd /usr/bin &&
    ln -s mawk awk
     
   
-----------------------------------------------------------------------------
6.10.2. Contents

The Mawk package contains the mawk program.
-----------------------------------------------------------------------------

6.10.3. Description

6.10.3.1. mawk

Mawk is an interpreter for the AWK Programming Language. The AWK language is
useful for manipulation of data files, text retrieval and processing, and for
prototyping and experimenting with algorithms.
-----------------------------------------------------------------------------

6.11. Installing Ncurses

6.11.1. Installation of Ncurses

Install Ncurses by running the following commands:
   
   
   
    ./configure --prefix=/usr --libdir=/lib \
       --with-shared --disable-termcap &&
    make &&
    make install &&
    cd /lib &&
    ln -s libncurses.a libcurses.a
     
   
-----------------------------------------------------------------------------
6.11.2. Command explanations

--with-shared: This enables the build of the shared ncurses library files.

--disable-termcap: Disabled the compilation of termcap fallback support.

ln -s libncurses.a libcurses.a: This creates the /lib/libcurses.a symlink
that for some reason isn't created during the libncurses installation.
-----------------------------------------------------------------------------

6.11.3. Contents

The Ncurses package contains the ncurses, panel, menu and form libraries. It
also contains the tic, infocmp, clear, tput, toe and tset programs.
-----------------------------------------------------------------------------

6.11.4. Description

6.11.4.1. The libraries

The libraries that make up the Ncurses library are used to display text
(often in a fancy way) on your screen. An example where ncurses is used is in
the kernel's "make menuconfig" process. The libraries contain routines to
create panels, menu's, form and general text display routines.
-----------------------------------------------------------------------------

6.11.4.2. Tic

Tic is the terminfo entry-description compiler. The program translates a
terminfo file from source format into the binary format for use with the
ncurses library routines. Terminfo files contain information about the
capabilities of your terminal.
-----------------------------------------------------------------------------

6.11.4.3. Infocmp

The infocmp program can be used to compare a binary terminfo entry with other
terminfo entries, rewrite a terminfo description to take advantage of the use
= terminfo field, or print out a terminfo description from the binary file
(term) in a variety of formats (the opposite of what tic does).
-----------------------------------------------------------------------------

6.11.4.4. clear

The clear program clears your screen if this is possible. It looks in the
environment for the terminal type and then in the terminfo database to figure
out how to clear the screen.
-----------------------------------------------------------------------------

6.11.4.5. tput

The tput program uses the terminfo database to make the values of
terminal-dependent capabilities and information available to the shell, to
initialize or reset the terminal, or return the long name of the requested
terminal type.
-----------------------------------------------------------------------------

6.11.4.6. toe

The toe program lists all available terminal types by primary name with
descriptions.
-----------------------------------------------------------------------------

6.11.4.7. tset

The Tset program initializes terminals so they can be used, but it's not
widely used anymore. It's provided for 4.4BSD compatibility.
-----------------------------------------------------------------------------

6.12. Installing Vim

6.12.1. Installation of Vim

If you don't like vim to be installed as an editor on your LFS system, you
may want to download an alternative and install an editor you prefer. There
are a few hints how to install different editors available at [http://
cvs.linuxfromscratch.org/index.cgi/hints/editors/] http://
cvs.linuxfromscratch.org/index.cgi/hints/editors/

You need to unpack both the vim-rt and vim-src packages to install Vim. Both
packages will unpack their files into the vim-5.7 directory. This won't
overwrite any files from the other package. So it doesn't mattter in which
order you do it. Install Vim by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install &&
    cd /usr/bin &&
    ln -s vim vi
     
   
If you are planning on installing the X Window system on your LFS system, you
might want to re-compile Vim after you have installed X. Vim comes with a
nice GUI version of the editor which requires X and a few other libraries to
be installed. For more information read the Vim documentation.
-----------------------------------------------------------------------------

6.12.2. Contents

The Vim package contains the ctags, etags, ex, gview, gvim, rgview, rgvim,
rview, rvim, view, vim, vimtutor and xxd programs.
-----------------------------------------------------------------------------

6.12.3. Description

6.12.3.1. ctags

ctags generate tag files for source code.
-----------------------------------------------------------------------------

6.12.3.2. etags

etags does the same as ctags but it can generate cross reference files which
list information about the various source objects found in a set of lanugage
files.
-----------------------------------------------------------------------------

6.12.3.3. ex

ex starts vim in Ex mode.
-----------------------------------------------------------------------------

6.12.3.4. gview

gview is the GUI version of view.
-----------------------------------------------------------------------------

6.12.3.5. gvim

gvim is the GUI version of vim.
-----------------------------------------------------------------------------

6.12.3.6. rgview

rgview is teh GUI version of rview.
-----------------------------------------------------------------------------

6.12.3.7. rgvim

rgvim is the GUI version of rvim.
-----------------------------------------------------------------------------

6.12.3.8. rview

rview is a restricted version of view. No shell commands can be started and
Vim can't be suspended.
-----------------------------------------------------------------------------

6.12.3.9. rvim

rvim is the restricted version of vim. No shell commands can be started and
Vim can't be suspended.
-----------------------------------------------------------------------------

6.12.3.10. view

view starts vim in read-only mode.
-----------------------------------------------------------------------------

6.12.3.11. vim

vim starts vim in the normal, default way.
-----------------------------------------------------------------------------

6.12.3.12. vimtutor

vimtutor starts the Vim tutor.
-----------------------------------------------------------------------------

6.12.3.13. xxd

xxd makes a hexdump or does the reverse.
-----------------------------------------------------------------------------

6.13. Installing GCC

6.13.1. Installation of GCC

After you unpacked the gcc-2.95.2 archive don't enter the newly created
gcc-2.95.2 directory but stay in the /usr/src directory. Install GCC by
running the following commands:
   
   
   
    mkdir /usr/src/gcc-build &&
    cd /usr/src/gcc-build &&
    ../gcc-2.95.2/configure --prefix=/usr \
       --with-gxx-include-dir=/usr/include/g++ \
       --enable-shared --enable-languages=c,c++ &&
    make bootstrap &&
    make install
     
   
-----------------------------------------------------------------------------
6.13.2. Contents

The GCC package contains compilers, preprocessors and the GNU C++ Library.
-----------------------------------------------------------------------------

6.13.3. Description

6.13.3.1. Compiler

A compiler translates source code in text format to a format that a computer
understands. After a source code file is compiled into an object file, a
linker will create an executable file from one or more of these compiler
generated object files.
-----------------------------------------------------------------------------

6.13.3.2. Pre-processor

A pre-processor pre-processes a source file, such as including the contents
of header files into the source file. You generally don't do this yourself to
save yourself a lot of time. You just insert a line like #include <filename>.
The pre-processor file insert the contents of that file into the source file.
That's one of the things a pre-processor does.
-----------------------------------------------------------------------------

6.13.3.3. C++ Library

The C++ library is used by C++ programs. The C++ library contains functions
that are frequently used in C++ programs. This way the programmer doesn't
have to write certain functions (such as writing a string of text to the
screen) from scratch every time he creates a program.
-----------------------------------------------------------------------------

6.14. Installing Bison

6.14.1. Installation of Bison

Install Bison by running the following commands:
   
   
   
    ./configure --prefix=/usr \
       --datadir=/usr/share/bison &&
    make &&
    make install
     
   
Some programs don't know about bison and try to find the yacc program (bison
is a (better) alternative for yacc). So to please those few programs out
there we'll create a yacc script that calls bison and have it emulate yacc's
output file name conventions).

Create a new file /usr/bin/yacc by running the following:


cat > /usr/bin/yacc << "EOF"
#!/bin/sh
# Begin /usr/bin/yacc

/usr/bin/bison -y $*

# End /usr/bin/yacc
EOF
chmod 755 /usr/bin/yacc
 
-----------------------------------------------------------------------------

6.14.2. Command explanations

--datadir=/usr/share/bison: This install the bison grammar files in /usr/
share/bison rather than /usr/share.
-----------------------------------------------------------------------------

6.14.3. Contents

The Bison package contains the bison program.
-----------------------------------------------------------------------------

6.14.4. Description

Bison is a parser generator, a replacement for YACC. YACC stands for Yet
Another Compiler Compiler. What is Bison then? It is a program that generates
a program that analyses the structure of a textfile. Instead of writing the
actual program you specify how things should be connected and with those
rules a program is constructed that analyses the textfile.

There are alot of examples where structure is needed and one of them is the
calculator.

Given the string :
   
   
            1 + 2 * 3
   
You can easily come to the result 7. Why ? Because of the structure. You know
how to interpretet the string. The computer doesn't know that and Bison is a
tool to help it understand by presenting the string in the following way to
the compiler:
   
   
   
                +
               / \
              *   1
             / \
            2   3
   
You start at the bottom of a tree and you come across the numbers 2 and 3
which are joined by the multiplication symbol, so the computers multiplies 2
and 3. The result of that multiplication is remembered and the next thing
that the computer sees is the result of 2*3 and the number 1 which are joined
by the add symbol. Adding 1 to the previous result makes 7. In calculating
the most complex calculations can be broken down in this tree format and the
computer just starts at the bottom and works it's way up to the top and comes
with the correct answer. Of course, Bison isn't only used for calculators
alone.
-----------------------------------------------------------------------------

6.15. Installing Less

6.15.1. Installation of Less

Install Less by running the following commands:
   
   
   
    ./configure --prefix=/usr --bindir=/bin &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.15.2. Contents

The Less package contains the less program
-----------------------------------------------------------------------------

6.15.3. Description

The less program is a file pager (or text viewer). It displays the contents
of a file with the ability to scroll. Less is an improvement on the common
pager called "more". Less has the ability to scroll backwards through files
as well and it doesn't need to read the entire file when it starts, which
makes it faster when you are reading large files.
-----------------------------------------------------------------------------

6.16. Installing Groff

6.16.1. Installation of Groff

Install Groff by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.16.2. Contents

The Groff packages contains the addftinfo, afmtodit, eqn, grodvi, groff,
grog, grohtml, grolj4, grops, grotty, hpftodit, indxbib, lkbib, lookbib,
neqn, nroff, pfbtops, pic, psbb, refer, soelim, tbl, tfmtodit and troff
programs.
-----------------------------------------------------------------------------

6.16.3. Description

6.16.3.1. addftinfo

addftinfo reads a troff font file and adds some additional font-metric
information that is used by the groff system.
-----------------------------------------------------------------------------

6.16.3.2. afmtodit

afmtodit creates a font file for use with groff and grops.
-----------------------------------------------------------------------------

6.16.3.3. eqn

eqn compiles descriptions of equations embedded within troff input files into
commands that are understood by troff.
-----------------------------------------------------------------------------

6.16.3.4. grodvi

grodvi is a driver for groff that produces TeX dvi format.
-----------------------------------------------------------------------------

6.16.3.5. groff

groff is a front-end to the groff document formatting system. Normally it
runs the troff program and a postprocessor appropriate for the selected
device.
-----------------------------------------------------------------------------

6.16.3.6. grog

grog reads files and guesses which of the groff options -e, -man, -me, -mm,
-ms, -p, -s, and -t are required for printing files, and prints the groff
command including those options on the standard output.
-----------------------------------------------------------------------------

6.16.3.7. grohtml

grohtml translates the output of GNU troff to html
-----------------------------------------------------------------------------

6.16.3.8. grolj4

grolj4 is a driver for groff that produces output in PCL5 format suitable for
an HP Laserjet 4 printer.
-----------------------------------------------------------------------------

6.16.3.9. grops

grops translates the output of GNU troff to PostScript.
-----------------------------------------------------------------------------

6.16.3.10. grotty

grotty translates the output of GNU troff into a form suitable for
typewriter-like devices.
-----------------------------------------------------------------------------

6.16.3.11. hpftodit

hpftodit creates a font file for use with groff -Tlj4 from an HP tagged font
metric file.
-----------------------------------------------------------------------------

6.16.3.12. indxbib

indxbib makes an inverted index for the bibliographic databases a specified
file for use with refer, lookbib, and lkbib.
-----------------------------------------------------------------------------

6.16.3.13. lkbib

lkbib searches bibliographic databases for references that contain specified
keys and prints any references found on the standard output.
-----------------------------------------------------------------------------

6.16.3.14. lookbib

lookbib prints a prompt on the standard error (unless the standard input is
not a terminal), reads from the standard input a line containing a set of
keywords, searches the bibliographic databases in a specified file for
references containing those keywords, prints any references found on the
standard output, and repeats this process until the end of input.
-----------------------------------------------------------------------------

6.16.3.15. neqn

It is currently not known what neqn is and what it does.
-----------------------------------------------------------------------------

6.16.3.16. nroff

The nroff script emulates the nroff command using groff.
-----------------------------------------------------------------------------

6.16.3.17. pfbtops

pfbtops translates a PostScript font in .pfb format to ASCII.
-----------------------------------------------------------------------------

6.16.3.18. pic

pic compiles descriptions of pictures embedded within troff or TeX input
files into commands that are understood by TeX or troff.
-----------------------------------------------------------------------------

6.16.3.19. psbb

psbb reads a file which should be a PostScript document conforming to the
Document Structuring conventions and looks for a %%BoundingBox comment.
-----------------------------------------------------------------------------

6.16.3.20. refer

refer copies the contents of a file to the standard output, except that lines
between .[ and .] are interpreted as citations, and lines between .R1 and .R2
are interpreted as commands about how citations are to be processed.
-----------------------------------------------------------------------------

6.16.3.21. soelim

soelim reads files and replaces lines of the form .so file by the contents of
file.
-----------------------------------------------------------------------------

6.16.3.22. tbl

tbl compiles descriptions of tables embedded within troff input files into
commands that are understood by troff.
-----------------------------------------------------------------------------

6.16.3.23. tfmtodit

tfmtodit creates a font file for use with groff -Tdvi
-----------------------------------------------------------------------------

6.16.3.24. troff

troff is highly compatible with Unix troff. Usually it should be invoked
using the groff command, which will also run preprocessors and postprocessors
in the appropriate order and with the appropriate options.
-----------------------------------------------------------------------------

6.17. Installing Man

6.17.1. Installation of Man

Install Man by running the following commands:
   
   
   
    ./configure -default &&
    make &&
    make install &&
    sed s/AWK=/"AWK=\/usr\/bin\/mawk"/ /usr/sbin/makewhatis > makewhatis-new
    &&
    mv makewhatis-new /usr/sbin/makewhatis &&
    chmod 755 /usr/sbin/makewhatis
     
   
-----------------------------------------------------------------------------
6.17.2. Command explanations

-default: This configures the man package with default settings.

sed s/AWK=/"AWK=\/usr\/bin\/mawk"/ /usr/sbin/makewhatis > makewhatis-new:
This modifies /usr/sbin/makewhatis's AWK variable and fills in the location
of the mawk program.

chmod 755 /usr/sbin/makewhatis: This makes the makewhatis script executable
again.
-----------------------------------------------------------------------------

6.17.3. Contents

The Man package contains the man, apropos whatis and makewhatis programs.
-----------------------------------------------------------------------------

6.17.4. Description

6.17.4.1. man

man formats and displays the on-line manual pages.
-----------------------------------------------------------------------------

6.17.4.2. apropos

apropos searches a set of database files containing short descriptions of
system commands for keywords and displays the result on the standard output.
-----------------------------------------------------------------------------

6.17.4.3. whatis

whatis searches a set of database files containing short descriptions of
system commands for keywords and displays the result on the standard output.
Only complete word matches are displayed.
-----------------------------------------------------------------------------

6.17.4.4. makewhatis

makewhatis reads all the manual pages contained in given sections of manpath
or the preformatted pages contained in the given sections of catpath. For
each page, it writes a line in the whatis database; each line consists of the
name of the page and a short description, separated by a dash. The
description is extracted using the content of the NAME section of the manual
page.
-----------------------------------------------------------------------------

6.18. Installing Perl

6.18.1. Installation of Perl

Install Perl by running the following commands:
   
   
   
    ./Configure -Dprefix=/usr &&
    make &&
    make install
     
   
If you don't want to answer all those questions Perl asks you, you can add
the -d option to the configure script and Perl will use all the default
settings. To avoid the Configure script asking you questions after the
config.sh file has been created you can pass the -e parameter to perl as
well. The commands with these parameters included will be:
   
   
   
    ./Configure -Dprefix=/usr -d -e &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.18.2. Contents

The Perl package contains Perl - Practical Extraction and Report Language
-----------------------------------------------------------------------------

6.18.3. Description

Perl combines the features and capabilities of C, awk, sed and sh into one
powerful programming language.
-----------------------------------------------------------------------------

6.19. Installing M4

6.19.1. Installation of M4

Install M4 by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install
     
   
If you're base system is running a 2.0 kernel and your Glibc version is 2.1
then you will most likely get problems executing M4 in the chroot'ed
environment due to incompatibilities between the M4 program, Glibc-2.1 and
the running 2.0 kernel. If you have problems executing the m4 program in the
chroot'ed environment (for example when you install the autoconf and automake
packages) you'll have to exit the chroot'ed environment and compile M4
statically. This way the binary is linked against Glibc 2.0 (if you run
kernel 2.0 you're Glibc version is 2.0 as well on a decent system. Kernel 2.0
and Glibc-2.1 don't mix very well) and won't give you any problems.

To create a statically linked version of M4, execute the following commands:
   
   
   
    logout
    cd $LFS/usr/src/m4-1.4
    ./configure --prefix=/usr --disable-nls
    make LDFLAGS=-static
    make prefix=$LFS/usr install
     
   
Now you can re-enter the chroot'ed environment and continue with the next
package. If you wish to recompile M4 dynamically, you can do that after you
have rebooted into the LFS system rather than chroot'ed into it.
   
   
   
    chroot $LFS env -i HOME=/root bash --login
     
   
-----------------------------------------------------------------------------
6.19.2. Contents

The M4 package contains the M4 processor
-----------------------------------------------------------------------------

6.19.3. Description

M4 is a macro processor. It copies input to output expanding macros as it
goes. Macros are either builtin or user-defined and can take any number of
arguments. Besides just doing macro expansion m4 has builtin functions for
including named files, running UNIX commands, doing integer arithmetic,
manipulating text in various ways, recursion, etc. M4 can be used either as a
front-end to a compiler or as a macro processor in its own right.
-----------------------------------------------------------------------------

6.20. Installing Texinfo

6.20.1. Installation of Texinfo

Install Texinfo by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.20.2. Contents

The Texinfo package contains the info, install-info, makeinfo, texi2dvi and
texindex programs
-----------------------------------------------------------------------------

6.20.3. Description

6.20.3.1. info

The info program reads Info documents, usually contained in your /usr/doc/
info directory. Info documents are like man(ual) pages, but they tend to be
more in depth than just explaining the options to a program.
-----------------------------------------------------------------------------

6.20.3.2. install-info

The install-info program updates the info entries. When you run the info
program a list with available topics (ie: available info documents) will be
presented. The install-info program is used to maintain this list of
available topics. If you decice to remove info files manually, you need to
delete the topic in the index file as well. This program is used for that. It
also works the other way around when you add info documents.
-----------------------------------------------------------------------------

6.20.3.3. makeinfo

The makeinfo program translates Texinfo source documents into various
formats. Available formats are: info files, plain text and HTML.
-----------------------------------------------------------------------------

6.20.3.4. texi2dvi

The texi2dvi program prints Texinfo documents
-----------------------------------------------------------------------------

6.20.3.5. texindex

The texindex program is used to sort Texinfo index files.
-----------------------------------------------------------------------------

6.21. Installing Autoconf

6.21.1. Installation of Autoconf

Install Autoconf by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.21.2. Contents

The Autoconf package contains the autoconf, autoheader, autoreconf, autoscan,
autoupdate and ifnames programs
-----------------------------------------------------------------------------

6.21.3. Description

6.21.3.1. autoconf

Autoconf is a tool for producing shell scripts that automatically configure
software source code packages to adapt to many kinds of UNIX-like systems.
The configuration scripts produced by Autoconf are independent of Autoconf
when they are run, so their users do not need to have Autoconf.
-----------------------------------------------------------------------------

6.21.3.2. autoheader

The autoheader program can create a template file of C #define statements for
configure to use
-----------------------------------------------------------------------------

6.21.3.3. autoreconf

If you have a lot of Autoconf-generated configure scripts, the autoreconf
program can save you some work. It runs autoconf (and autoheader, where
appropriate) repeatedly to remake the Autoconf configure scripts and
configuration header templates in the directory tree rooted at the current
directory.
-----------------------------------------------------------------------------

6.21.3.4. autoscan

The autoscan program can help you create a configure.in file for a software
package. autoscan examines source files in the directory tree rooted at a
directory given as a command line argument, or the current directory if none
is given. It searches the source files for common portability problems and
creates a file configure.scan which is a preliminary configure.in for that
package.
-----------------------------------------------------------------------------

6.21.3.5. autoupdate

The autoupdate program updates a configure.in file that calls Autoconf macros
by their old names to use the current macro names.
-----------------------------------------------------------------------------

6.21.3.6. ifnames

ifnames can help when writing a configure.in for a software package. It
prints the identifiers that the package already uses in C preprocessor
conditionals. If a package has already been set up to have some portability,
this program can help you figure out what its configure needs to check for.
It may help fill in some gaps in a configure.in generated by autoscan.
-----------------------------------------------------------------------------

6.22. Installing Automake

6.22.1. Installation of Automake

Install Automake by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make install
     
   
-----------------------------------------------------------------------------
6.22.2. Contents

The Automake package contains the aclocal and automake programs
-----------------------------------------------------------------------------

6.22.3. Description

6.22.3.1. aclocal

Automake includes a number of Autoconf macros which can be used in your
package; some of them are actually required by Automake in certain
situations. These macros must be defined in your aclocal.m4; otherwise they
will not be seen by autoconf.

The aclocal program will automatically generate aclocal.m4 files based on the
contents of configure.in. This provides a convenient way to get
Automake-provided macros, without having to search around. Also, the aclocal
mechanism is extensible for use by other packages.
-----------------------------------------------------------------------------

6.22.3.2. automake

To create all the Makefile.in's for a package, run the automake program in
the top level directory, with no arguments. automake will automatically find
each appropriate Makefile.am (by scanning configure.in) and generate the
corresponding Makefile.in.
-----------------------------------------------------------------------------

6.23. Installing Bash

6.23.1. Installation of Bash

Install Bash by running the following commands:
   
   
   
    ./configure --prefix=/usr --with-curses &&
    make &&
    make install &&
    logout
     
   
Replace the static bash with the dynamic bash and re-enter the chroot'ed
environment by running:
   
   
   
    mv $LFS/usr/bin/bash $LFS/usr/bin/bashbug $LFS/bin &&
    chroot $LFS /usr/bin/env -i HOME=/root /bin/bash --login
   
-----------------------------------------------------------------------------
6.23.2. Contents

The Bash package contains the bash program
-----------------------------------------------------------------------------

6.23.3. Description

Bash is the Bourne-Again SHell, which is a widely used command interpreter on
Unix systems. Bash is a program that reads from standard input, the keyboard.
You type something and the program will evaluate what you have typed and do
something with it, like running a program.
-----------------------------------------------------------------------------

6.24. Installing Flex

6.24.1. Installation of Flex

Install Flex by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.24.2. Contents

The Flex package contains the flex program
-----------------------------------------------------------------------------

6.24.3. Description

Flex is a tool for generating programs which regognize patterns in text.
Pattern recognition is very useful in many applications. You set up rules
what to look for and flex will make a program that looks for those patterns.
The reason people use flex is that it is much easier to set up rules for what
to look for than to write the actual program that finds the text.
-----------------------------------------------------------------------------

6.25. Installing File

6.25.1. Installation of File

Install File by running the following commands:
   
   
   
    ./configure --prefix=/usr --datadir=/usr/share/misc &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.25.2. Contents

The File package contains the file program.
-----------------------------------------------------------------------------

6.25.3. Description

File tests each specified file in an attempt to classify it. There are three
sets of tests, performed in this order: filesystem tests, magic number tests,
and language tests. The first test that succeeds causes the file type to be
printed.
-----------------------------------------------------------------------------

6.26. Installing Libtool

6.26.1. Installation of Libtool

Install Libtool by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.26.2. Contents

The Libtool package contains the libtool and libtoolize programs. It also
contains the ltdl library.
-----------------------------------------------------------------------------

6.26.3. Description

6.26.3.1. libtool

Libtool provides generalized library-building support services.
-----------------------------------------------------------------------------

6.26.3.2. libtoolize

libtoolize provides a standard way to add libtool support to your package.
-----------------------------------------------------------------------------

6.26.3.3. ltdl library

Libtool provides a small library, called `libltdl', that aims at hiding the
various difficulties of dlopening libraries from programmers.
-----------------------------------------------------------------------------

6.27. Installing Bin86

6.27.1. Installation of Bin86

Install Linux86 by running the following commands:
   
   
   
    make &&
    make PREFIX=/usr install
     
   
-----------------------------------------------------------------------------
6.27.2. Contents

The Bin86 contains the as86, as86_encap, ld86, objdump86, nm86 and size86
programs.
-----------------------------------------------------------------------------

6.27.3. Description

6.27.3.1. as86

as86 is an assembler for the 8086...80386 processors.
-----------------------------------------------------------------------------

6.27.3.2. as86_encap

as86_encap is a shell script to call as86 and convert the created binary into
a C file prog.v to be included in or linked with programs like boot block
installers.
-----------------------------------------------------------------------------

6.27.3.3. ld86

ld86 understands only the object files produced by the as86 assembler, it can
link them into either an impure or a separate I&D executable.
-----------------------------------------------------------------------------

6.27.3.4. objdump86

No description available.
-----------------------------------------------------------------------------

6.27.3.5. nm86

No description available.
-----------------------------------------------------------------------------

6.27.3.6. size86

No description available.
-----------------------------------------------------------------------------

6.28. Installing Binutils

6.28.1. Installation of Binutils

Install Binutils by running the following commands:
   
   
   
    ./configure --prefix=/usr --enable-shared &&
    make -e tooldir=/usr &&
    make -e tooldir=/usr install
     
   
-----------------------------------------------------------------------------
6.28.2. Description

The Binutils package contains the ld, as, ar, nm, objcopy, objdump, ranlib,
size, strings, strip, c++filt, addr2line and nlmconv programs
-----------------------------------------------------------------------------

6.28.3. Description

6.28.3.1. ld

ld combines a number of object and archive files, relocates their data and
ties up symbol references. Often the last step in building a new compiled
program to run is a call to ld.
-----------------------------------------------------------------------------

6.28.3.2. as

as is primarily intended to assemble the output of the GNU C compiler gcc for
use by the linker ld.
-----------------------------------------------------------------------------

6.28.3.3. ar

The ar program creates, modifies, and extracts from archives. An archive is a
single file holding a collection of other files in a structure that makes it
possible to retrieve the original individual files (called members of the
archive).
-----------------------------------------------------------------------------

6.28.3.4. nm

nm lists the symbols from object files.
-----------------------------------------------------------------------------

6.28.3.5. objcopy

objcopy utility copies the contents of an object file to another. objcopy
uses the GNU BFD Library to read and write the object files. It can write the
destination object file in a format different from that of the source object
file.
-----------------------------------------------------------------------------

6.28.3.6. objdump

objdump displays information about one or more object files. The options
control what particular information to display. This information is mostly
useful to programmers who are working on the compilation tools, as opposed to
programmers who just want their program to compile and work.
-----------------------------------------------------------------------------

6.28.3.7. ranlib

ranlib generates an index to the contents of an archive, and stores it in the
archive. The index lists each symbol defined by a member of an archive that
is a relocatable object file.
-----------------------------------------------------------------------------

6.28.3.8. size

size lists the section sizes --and the total size-- for each of the object
files objfile in its argument list. By default, one line of output is
generated for each object file or each module in an archive.
-----------------------------------------------------------------------------

6.28.3.9. strings

For each file given, strings prints the printable character sequences that
are at least 4 characters long (or the number specified with an option to the
program) and are followed by an unprintable character. By default, it only
prints the strings from the initialized and loaded sections of object files;
for other types of files, it prints the strings from the whole file.

strings is mainly useful for determining the contents of non-text files.
-----------------------------------------------------------------------------

6.28.3.10. strip

strip discards all or specific symbols from object files. The list of object
files may include archives. At least one object file must be given. strip
modifies the files named in its argument, rather than writing modified copies
under different names.
-----------------------------------------------------------------------------

6.28.3.11. c++filt

The C++ language provides function overloading, which means that you can
write many functions with the same name (providing each takes parameters of
different types). All C++ function names are encoded into a low-level
assembly label (this process is known as mangling). The c++filt program does
the inverse mapping: it decodes (demangles) low-level names into user-level
names so that the linker can keep these overloaded functions from clashing.
-----------------------------------------------------------------------------

6.28.3.12. addr2line

addr2line translates program addresses into file names and line numbers.
Given an address and an executable, it uses the debugging information in the
executable to figure out which file name and line number are associated with
a given address.
-----------------------------------------------------------------------------

6.28.3.13. nlmconv

nlmconv converts relocatable object files into the NetWare Loadable Module
files, optionally reading header files for NLM header information.
-----------------------------------------------------------------------------

6.29. Installing Bzip2

6.29.1. Installation of Bzip2

Install Bzip2 by running the following commands:
   
   
   
    make -f Makefile-libbz2_so &&
    make bzip2recover libbz2.a &&
    cp bzip2-shared /bin/bzip2 &&
    cp bzip2recover /bin &&
    cp bzip2.1 /usr/share/man/man1 &&
    cp bzlib.h /usr/include &&
    cp -a libbz2.so* libbz2.a /lib &&
    rm /usr/lib/libbz2.a &&
    cd /bin &&
    rm bunzip2 && ln -s bzip2 bunzip2 &&
    rm bzcat && ln -s bzip2 bzcat &&
    cd /usr/share/man/man1 &&
    ln -s bzip2.1 bunzip2.1 &&
    ln -s bzip2.1 bzcat.1 &&
    ln -s bzip2.1 bzip2recover.1
     
   
Although it's not strictly a part of a basic LFS system it's worth mentioning
that you can download a patch for Tar which enables the tar program to
compress and uncompress using bzip2/bunzip2 easily. With a plain tar you'll
have to use constructions like bzcat file.tar.bz|tar xv or tar
--use-compress-prog=bunzip2 -xvf file.tar.bz2 to use bzip2 and bunzip2 with
tar. This patch gives you the -y option so you can unpack a Bzip2 archive
with tar xvfy file.tar.bz2. Applying this patch will be mentioned later on
when you re-install the Tar package.
-----------------------------------------------------------------------------

6.29.2. Command explanations

make -f Makefile-libbz2_so: This will cause bzip2 to be build 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 against it.
-----------------------------------------------------------------------------

6.29.3. Contents

The Bzip2 packages contains the bzip2, bunzip2, bzcat and bzip2recover
programs.
-----------------------------------------------------------------------------

6.29.4. Description

6.29.4.1. Bzip2

bzip2 compresses files using the Burrows-Wheeler block sorting text
compression algorithm, and Huffman coding. Compression is generally
considerably better than that achieved by more conventional LZ77/LZ78-based
compressors, and approaches the performance of the PPM family of statistical
compressors.
-----------------------------------------------------------------------------

6.29.4.2. Bunzip2

Bunzip2 decompresses files that are compressed with bzip2.
-----------------------------------------------------------------------------

6.29.4.3. bzcat

bzcat (or bzip2 -dc) decompresses all specified files to the standard output.
-----------------------------------------------------------------------------

6.29.4.4. bzip2recover

bzip2recover recovers data from damaged bzip2 files.
-----------------------------------------------------------------------------

6.30. Installing Gettext

6.30.1. Installation of Gettext

Install Gettext by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install &&
    mv /po-mode.el /usr/share/gettext
     
   
-----------------------------------------------------------------------------
6.30.2. Contents

The gettext package contains the gettext, gettextize, msgcmp, msgcomm,
msgfmt, msgmerge, msgunfmt and xgettext programs.
-----------------------------------------------------------------------------

6.30.3. Description

6.30.3.1. gettext

The gettext package is used for internationalization (also known as i18n) and
for localization (also known as l10n). Programs can be compiled with Native
Language Support (NLS) which enable them to output messages in your native
language rather than in the default English language.
-----------------------------------------------------------------------------

6.31. Installing Consoletools

6.31.1. Installation of Console-tools

Before you start installing Console-tools you have to unpack the
console-tools-0.2.3.patch file.

Install Console-tools by running the following commands:
   
   
   
    patch -Np1 -i ../console-tools-0.2.3.patch &&
    ./configure --prefix=/usr &&
    make &&
    make install &&
    cd doc/man &&
    mv consolechars.8.in consolechars.8 &&
    cp *.1 /usr/share/man/man1 &&
    cp *.4 /usr/share/man/man4 &&
    cp *.5 /usr/share/man/man5 &&
    cp *.8 /usr/share/man/man8
     
   
-----------------------------------------------------------------------------
6.31.2. Contents

The Console-tools package contains the charset, chvt, consolechars,
deallocvt, dumpkeys, fgconsole, fix_bs_and_del, font2psf, getkeycodes,
kbd_mode, loadkeys, loadunimap, mapscrn, mk_modmap, openvt, psfaddtable,
psfgettable, psfstriptable, resizecons, saveunimap, screendump, setfont,
setkeycodes, setleds, setmetamode, setvesablank, showcfont, showkey,
splitfont, unicode_start, unicode_stop, vcstime, vt-is-URF8, writevt
-----------------------------------------------------------------------------

6.31.3. Description

6.31.3.1. charset

charset sets an ACM for use in one of the G0/G1 charsets slots.
-----------------------------------------------------------------------------

6.31.3.2. chvt

chvt changes foreground virtual terminal.
-----------------------------------------------------------------------------

6.31.3.3. codepage

No description available.
-----------------------------------------------------------------------------

6.31.3.4. consolechars

consolechars loads EGA/VGA console screen fonts, screen font maps and/or
application-charset maps.
-----------------------------------------------------------------------------

6.31.3.5. deallocvt

deallocvt deallocates unused virtual terminals.
-----------------------------------------------------------------------------

6.31.3.6. dumpkeys

dumpkeys dumps keyboard translation tables.
-----------------------------------------------------------------------------

6.31.3.7. fgconsole

fgconsole prints the number of the active virtual terminal.
-----------------------------------------------------------------------------

6.31.3.8. fix_bs_and_del

No description available.
-----------------------------------------------------------------------------

6.31.3.9. font2psf

No description available.
-----------------------------------------------------------------------------

6.31.3.10. getkeycodes

getkeycodes prints the kernel scancode-to-keycode mapping table.
-----------------------------------------------------------------------------

6.31.3.11. kbd_mode

kbd_mode reports or sets the keyboard mode.
-----------------------------------------------------------------------------

6.31.3.12. loadkeys

loadkeys loads keyboard translation tables.
-----------------------------------------------------------------------------

6.31.3.13. loadunimap

No description available.
-----------------------------------------------------------------------------

6.31.3.14. mapscrn

No description available.
-----------------------------------------------------------------------------

6.31.3.15. mk_modmap

No description available.
-----------------------------------------------------------------------------

6.31.3.16. openvt

openvt starts a program on a new virtual terminal.
-----------------------------------------------------------------------------

6.31.3.17. psfaddtable

psfaddtable adds a Unicode character table to a console font.
-----------------------------------------------------------------------------

6.31.3.18. psfgettable

psfgettable extracts the embedded Unicode character table from a console
font.
-----------------------------------------------------------------------------

6.31.3.19. psfstriptable

psfstriptable removes the embedded Unicode character table from a console
font.
-----------------------------------------------------------------------------

6.31.3.20. resizecons

resizecons changes the kernel idea of the console size.
-----------------------------------------------------------------------------

6.31.3.21. saveunimap

No description available.
-----------------------------------------------------------------------------

6.31.3.22. screendump

No description available.
-----------------------------------------------------------------------------

6.31.3.23. setfont

No description available.
-----------------------------------------------------------------------------

6.31.3.24. setkeycodes

setkeycodes loads kernel scancode-to-keycode mapping table entries.
-----------------------------------------------------------------------------

6.31.3.25. setleds

setleds sets the keyboard leds.
-----------------------------------------------------------------------------

6.31.3.26. setmetamode

setmetamode defines the keyboard meta key handling.
-----------------------------------------------------------------------------

6.31.3.27. setvesablank

No description available.
-----------------------------------------------------------------------------

6.31.3.28. showcfont

showcfont displays all character in the current screenfont.
-----------------------------------------------------------------------------

6.31.3.29. showkey

showkey examines the scancodes and keycodes sent by the keyboard.
-----------------------------------------------------------------------------

6.31.3.30. splitfont

No description available.
-----------------------------------------------------------------------------

6.31.3.31. unicode_start

unicode_start puts the console in Unicode mode.
-----------------------------------------------------------------------------

6.31.3.32. unicode_stop

No description available.
-----------------------------------------------------------------------------

6.31.3.33. vcstime

No description available.
-----------------------------------------------------------------------------

6.31.3.34. vt-is-UTF8

vt-is-UTF8 checks whether the current virtual terminal is in UTF8- or
byte-mode.
-----------------------------------------------------------------------------

6.31.3.35. writevt

No description available.
-----------------------------------------------------------------------------

6.32. Installing Consoledata

6.32.1. Installation of Console-data

Replace <path-to-kmap-file> below with the correct path to the desired
kmap.gz file. An example could be i386/qwerty/us.kmap.gz

Install Console-data by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install &&
    cd /usr/share/keymaps &&
    ln -s <path-to-kmap-file> defkeymap.kmap.gz
     
   
-----------------------------------------------------------------------------
6.32.2. Contents

The console-data package contains the data files that are used and needed by
the console-tools package.
-----------------------------------------------------------------------------

6.33. Installing Diffutils

6.33.1. Installation of Diffutils

Install Diffutils by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.33.2. Contents

The Diffutils package contains the cmp, diff, diff3 and sdiff programs.
-----------------------------------------------------------------------------

6.33.3. Description

6.33.3.1. cmp and diff

cmp and diff both compare two files and report their differences. Both
programs have extra options which compare files in different situations.
-----------------------------------------------------------------------------

6.33.3.2. diff3

The difference between diff and diff3 is that diff comprares 2 files, diff3
compares 3 files.
-----------------------------------------------------------------------------

6.33.3.3. sdiff

sdiff merges two two files and interactively outputs the results.
-----------------------------------------------------------------------------

6.34. Installing E2fsprogs

6.34.1. Installation of E2fsprogs

Install E2fsprogs by running the following commands:

Please note that the empty --with-root-prefix= option below is supposed to be
like this. I did not forget to supply a value there.
   
   
   
    ./configure --prefix=/usr --with-root-prefix= \
       --enable-elf-shlibs &&
    make &&
    make install &&
    make install-libs
     
   
-----------------------------------------------------------------------------
6.34.2. Contents

The e2fsprogs package contains the chattr, lsattr, uuidgen, badblocks,
debugfs, dumpe2fs, e2fsck, e2label, fsck, fsck.ext2, mke2fs, mkfs.ext2,
mklost+found and tune2fs programs.
-----------------------------------------------------------------------------

6.34.3. Description

6.34.3.1. chattr

chattr changes the file attributes on a Linux second extended file system.
-----------------------------------------------------------------------------

6.34.3.2. lsattr

lsattr lists the file attributes on a second extended file system.
-----------------------------------------------------------------------------

6.34.3.3. uuidgen

The uuidgen program creates a new universally unique identifier (UUID) using
the libuuid library. The new UUID can reasonably be considered unique among
all UUIDs created on the local system, and among UUIDs created on other
systems in the past and in the future.
-----------------------------------------------------------------------------

6.34.3.4. badblocks

badblocks is used to search for bad blocks on a device (usually a disk
partition).
-----------------------------------------------------------------------------

6.34.3.5. debugfs

The debugfs program is a file system debugger. It can be used to examine and
change the state of an ext2 file system.
-----------------------------------------------------------------------------

6.34.3.6. dumpe2fs

dumpe2fs prints the super block and blocks group information for the
filesystem present on a specified device.
-----------------------------------------------------------------------------

6.34.3.7. e2fsck and fsck.ext2

e2fsck is used to check a Linux second extended file system. fsck.ext2 does
the same as e2fsck.
-----------------------------------------------------------------------------

6.34.3.8. e2label

e2label will display or change the filesystem label on the ext2 filesystem
located on the specified device.
-----------------------------------------------------------------------------

6.34.3.9. fsck

fsck is used to check and optionally repair a Linux file system.
-----------------------------------------------------------------------------

6.34.3.10. mke2fs and mkfs.ext2

mke2fs is used to create a Linux second extended file system on a device
(usually a disk partition). mkfs.ext2 does the same as mke2fs.
-----------------------------------------------------------------------------

6.34.3.11. mklost+found

mklost+found is used to create a lost+found directory in the current working
directory on a Linux second extended file system. mklost+found pre-allocates
disk blocks to the directory to make it usable by e2fsck.
-----------------------------------------------------------------------------

6.34.3.12. tune2fs

tune2fs adjusts tunable filesystem parameters on a Linux second extended
filesystem.
-----------------------------------------------------------------------------

6.35. Installing Fileutils

6.35.1. Installation of Fileutils

Install Fileutils by running the following commands:
   
   
   
    ./configure --prefix=/usr --bindir=/bin \
       --libexecdir=/usr/bin &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.35.2. Contents

The Fileutils package contains the chgrp, chmod, chown, cp, dd, df, dir,
dircolors, du, install, ln, ls, mkdir, mkfifo, mknod, mv, rm, rmdir, sync,
touch and vdir programs.
-----------------------------------------------------------------------------

6.35.3. Description

6.35.3.1. chgrp

chgrp changes the group ownership of each given file to the named group,
which can be either a group name or a numeric group ID.
-----------------------------------------------------------------------------

6.35.3.2. chmod

chmod changes the permissions of each given file according to mode, which can
be either a symbolic representation of changes to make, or an octal number
representing the bit pattern for the new permissions.
-----------------------------------------------------------------------------

6.35.3.3. chown

chown changes the user and/or group ownership of each given file.
-----------------------------------------------------------------------------

6.35.3.4. cp

cp copies files from one place to another.
-----------------------------------------------------------------------------

6.35.3.5. dd

dd copies a file (from the standard input to the standard output, by default)
with a user-selectable blocksize, while optionally performing conversions on
it.
-----------------------------------------------------------------------------

6.35.3.6. df

df displays the amount of disk space available on the filesystem containing
each file name argument. If no file name is given, the space available on all
currently mounted filesystems is shown.
-----------------------------------------------------------------------------

6.35.3.7. ls, dir and vdir

dir and vdir are versions of ls with different default output formats. These
programs list each given file or directory name. Directory contents are
sorted alphabetically. For ls, files are by default listed in columns, sorted
vertically, if the standard output is a terminal; otherwise they are listed
one per line. For dir, files are by default listed in columns, sorted
vertically. For vdir, files are by default listed in long format.
-----------------------------------------------------------------------------

6.35.3.8. dircolors

dircolors outputs commands to set the LS_COLOR environment variable. The
LS_COLOR variable is use to change the default color scheme used by ls and
related utilities.
-----------------------------------------------------------------------------

6.35.3.9. du

du displays the amount of disk space used by each argument and for each
subdirectory of directory arguments.
-----------------------------------------------------------------------------

6.35.3.10. install

install copies files and sets their permission modes and, if possible, their
owner and group.
-----------------------------------------------------------------------------

6.35.3.11. ln

ln makes hard or soft (symbolic) links between files.
-----------------------------------------------------------------------------

6.35.3.12. mkdir

mkdir creates directories with a given name.
-----------------------------------------------------------------------------

6.35.3.13. mkfifo

mkfifo creates a FIFO with each given name.
-----------------------------------------------------------------------------

6.35.3.14. mknod

mknod creates a FIFO, character special file, or block special file with the
given file name.
-----------------------------------------------------------------------------

6.35.3.15. mv

mv moves files from one directory to another or renames files, depending on
the arguments given to mv.
-----------------------------------------------------------------------------

6.35.3.16. rm

rm removes files or directories.
-----------------------------------------------------------------------------

6.35.3.17. rmdir

rmdir removes directories, if they are empty.
-----------------------------------------------------------------------------

6.35.3.18. sync

sync forces changed blocks to disk and updates the super block.
-----------------------------------------------------------------------------

6.35.3.19. touch

touch changes the access and modification times of each given file to the
current time. Files that do not exist are created empty.
-----------------------------------------------------------------------------

6.36. Installing Grep

6.36.1. Installation of Grep

Install Grep by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.36.2. Contents

The grep package contains the egrep, fgrep and grep programs.
-----------------------------------------------------------------------------

6.36.3. Description

6.36.3.1. egrep

egrep prints lines from files matching an extended regular expression
pattern.
-----------------------------------------------------------------------------

6.36.3.2. fgrep

fgrep prints lines from files matching a list of fixed strings, separated by
newlines, any of which is to be matched.
-----------------------------------------------------------------------------

6.36.3.3. grep

grep prints lines from files matching a basic regular expression pattern.
-----------------------------------------------------------------------------

6.37. Installing Gzip

6.37.1. Installation of Gzip

Install Gzip by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install &&
    cd /usr/bin &&
    mv gzip /bin &&
    rm gunzip /bin/gunzip &&
    cd /bin &&
    ln -s gzip gunzip &&
    ln -s gzip compress &&
    ln -s gunzip uncompress
     
   
-----------------------------------------------------------------------------
6.37.2. Contents

The Gzip package contains the compress, gunzip, gzexe, gzip, uncompress,
zcat, zcmp, zdiff, zforece, zgrep, zmore and znew programs.
-----------------------------------------------------------------------------

6.37.3. Description

6.37.3.1. gunzip

gunzip decompresses files that are compressed with gzip.
-----------------------------------------------------------------------------

6.37.3.2. gzexe

gzexe allows you to compress executables in place and have them automatically
uncompress and execute when you run them (at a penalty in performance).
-----------------------------------------------------------------------------

6.37.3.3. gzip

gzip reduces the size of the named files using Lempel-Ziv coding (LZ77).
-----------------------------------------------------------------------------

6.37.3.4. zcat

zcat uncompresses either a list of files on the command line or its standard
input and writes the uncompressed data on standard output
-----------------------------------------------------------------------------

6.37.3.5. zcmp

zcmp invokes the cmp program on compressed files.
-----------------------------------------------------------------------------

6.37.3.6. zdiff

zdiff invokes the diff program on compressed files.
-----------------------------------------------------------------------------

6.37.3.7. zforce

zforce forces a .gz extension on all gzip files so that gzip will not
compress them twice. This can be useful for files with names truncated after
a file transfer.
-----------------------------------------------------------------------------

6.37.3.8. zgrep

zgrep invokes the grep program on compressed files.
-----------------------------------------------------------------------------

6.37.3.9. zmore

Zmore is a filter which allows examination of compressed or plain text files
one screenful at a time on a soft-copy terminal (similar to the more
program).
-----------------------------------------------------------------------------

6.37.3.10. znew

Znew recompresses files from .Z (compress) format to .gz (gzip) format.
-----------------------------------------------------------------------------

6.38. Installing Ldso

6.38.1. Installation of Ld.so

Install Ld.so by running the following commands:
   
   
   
    cd util &&
    make ldd ldconfig &&
    cp ldd /bin &&
    cp ldconfig /sbin &&
    cd ../man &&
    cp ldd.1 /usr/share/man/man1 &&
    cp *.8 /usr/share/man/man8 &&
    rm /usr/bin/ldd &&
    hash -r
     
   
The "hash -r" command is to make bash forget about the locations of
previously executed commands. If you have executed ldd before, bash expects
it to be found in /usr/bin. Since we moved it to /bin, the cache needs to be
purged so bash can find it in /bin when you want to execute it again.

You might have noticed that we don't use the compiler optimizations for this
package. The reason is that overriding the CFLAGS variable causes compilation
problems. You would have to edit the Config.mk file and add the proper values
to the CFLAGS variable and then compile the package. If you want to do that
it's up to you. I don't think it's worth the trouble though. The ld and ldd
programs usually are only rarely used.
-----------------------------------------------------------------------------

6.38.2. Contents

From the Ld.so package we're using the ldconfig and ldd programs.
-----------------------------------------------------------------------------

6.38.3. Description

6.38.3.1. ldconfig

ldconfig creates the necessary links and cache (for use by the run-time
linker, ld.so) to the most recent shared libraries found in the directories
specified on the command line, in the file /etc/ld.so.conf, and in the
trusted directories (/usr/lib and /lib). ldconfig checks the header and file
names of the libraries it encounters when determining which versions should
have their links updated.
-----------------------------------------------------------------------------

6.38.3.2. ldd

ldd prints the shared libraries required by each program or shared library
specified on the command line.
-----------------------------------------------------------------------------

6.39. Installing Lilo

6.39.1. Installation of Lilo

Install Lilo by running the following commands:
   
   
   
    make &&
    make install
     
   
It appears that compilation of this package fails on certain machines when
the -g compiler flag is being used. If you can't compile Lilo at all, please
try removing the -g value from the CFLAGS variable in the Makefile file.

At the end of the installation the make install process will print a message
stating that you have to execute /sbin/lilo to complete the update. Don't do
this as it has no use. The /etc/lilo.conf isn't present yet. We will complete
the installation of lilo in chapter 8.
-----------------------------------------------------------------------------

6.39.2. Contents

The Lilo package contains the lilo program.
-----------------------------------------------------------------------------

6.39.3. Description

lilo installs the Linux boot loader which is used to start a Linux system.
-----------------------------------------------------------------------------

6.40. Installing Make

6.40.1. Installation of Make

Install Make by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.40.2. Contents

The Make package contains the make program.
-----------------------------------------------------------------------------

6.40.3. Description

make determine automatically which pieces of a large program need to be
recompiled, and issue the commands to recompile them.
-----------------------------------------------------------------------------

6.41. Installing Modutils

6.41.1. Installation of Modutils

Install Modutils by running the following commands:
   
   
   
    ./configure &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.41.2. Contents

The Modutils package contains the depmod, genksyms, insmod,
insmod_ksymoops_clean, kerneld, kernelversion, ksyms, lsmod, modinfo,
modprobe and rmmod programs.
-----------------------------------------------------------------------------

6.41.3. Description

6.41.3.1. depmod

depmod handles dependency descriptions for loadable kernel modules.
-----------------------------------------------------------------------------

6.41.3.2. genksyms

genksyms reads (on standard input) the output from gcc -E source.c and
generates a file containing version information.
-----------------------------------------------------------------------------

6.41.3.3. insmod

insmod installs a loadable module in the running kernel.
-----------------------------------------------------------------------------

6.41.3.4. insmod_ksymoops_clean

insmod_ksymoops_clean deletes saved ksyms and modules not accessed in 2 days.
-----------------------------------------------------------------------------

6.41.3.5. kerneld

kerneld performs kernel action in user space (such as on-demand loading of
modules)
-----------------------------------------------------------------------------

6.41.3.6. kernelversion

kernelversion reports the major version of the running kernel.
-----------------------------------------------------------------------------

6.41.3.7. ksyms

ksyms displays exported kernel symbols.
-----------------------------------------------------------------------------

6.41.3.8. lsmod

lsmod shows information about all loaded modules.
-----------------------------------------------------------------------------

6.41.3.9. modinfo

modinfo examines an object file associated with a kernel module and displays
any information that it can glean.
-----------------------------------------------------------------------------

6.41.3.10. modprobe

Modprobe uses a Makefile-like dependency file, created by depmod, to
automatically load the relevant module(s) from the set of modules available
in predefined directory trees.
-----------------------------------------------------------------------------

6.41.3.11. rmmod

rmmod unloads loadable modules from the running kernel.
-----------------------------------------------------------------------------

6.42. Installing Procinfo

6.42.1. Installation of Procinfo

Install Procinfo by running the following commands:
   
   
   
    sed "s/-ltermcap/-lncurses/" Makefile | make -f - &&
    make install
     
   
-----------------------------------------------------------------------------
6.42.2. Command explanations

sed "s/XConsole/#XConsole/" Makefile | make -f -: This will comment out the
XConsole variable in the Makefile and pipe the output of sed (the modified
Makefile) directly to the make program. This is an alternate and more
efficient way to direct the output to a file and tell make to use that
alternate file. The XConsole build is disabled because it can't be build yet
because we don't have X installed yet.
-----------------------------------------------------------------------------

6.42.3. Contents

The Procinfo package contains the procinfo program.
-----------------------------------------------------------------------------

6.42.4. Description

procinfo gathers some system data from the /proc directory and prints it
nicely formatted on the standard output device.
-----------------------------------------------------------------------------

6.43. Installing Procps

6.43.1. Installation of Procps

Install Procps by running the following commands:
   
   
   
    sed "s/XConsole/#XConsole/" Makefile | make -f - &&
    sed "s/XConsole/#XConsole/" Makefile | make -f - install &&
    mv /usr/bin/kill /bin
     
   
-----------------------------------------------------------------------------
6.43.2. Contents

The Procps package contains the free, kill, oldps, ps, skill, snice, sysctl,
tload, top, uptime, vmstat, w and watch programs.
-----------------------------------------------------------------------------

6.43.3. Description

6.43.3.1. free

free displays the total amount of free and used physical and swap memory in
the system, as well as the shared memory and buffers used by the kernel.
-----------------------------------------------------------------------------

6.43.3.2. kill

kills sends signals to processes.
-----------------------------------------------------------------------------

6.43.3.3. oldps and ps

ps gives a snapshot of the current processes.
-----------------------------------------------------------------------------

6.43.3.4. skill

skill sends signals to process matching a criteria.
-----------------------------------------------------------------------------

6.43.3.5. snice

snice changes the scheduling priority for process matching a criteria.
-----------------------------------------------------------------------------

6.43.3.6. sysctl

sysctl modifies kernel parameters at runtime.
-----------------------------------------------------------------------------

6.43.3.7. tload

tload prints a graph of the current system load average to the specified tty
(or the tty of the tload process if none is specified).
-----------------------------------------------------------------------------

6.43.3.8. top

top provides an ongoing look at processor activity in real time.
-----------------------------------------------------------------------------

6.43.3.9. uptime

uptime gives a one line display of the following information: the current
time, how long the system has been running, how many users are currently
logged on, and the system load averages for the past 1, 5, and 15 minutes.
-----------------------------------------------------------------------------

6.43.3.10. vmstat

vmstat reports information about processes, memory, paging, block IO, traps,
and cpu activity.
-----------------------------------------------------------------------------

6.43.3.11. w

w displays information about the users currently on the machine, and their
processes.
-----------------------------------------------------------------------------

6.43.3.12. watch

watch runs command repeatedly, displaying its output (the first screenfull).
-----------------------------------------------------------------------------

6.44. Installing Psmisc

6.44.1. Installation of Psmisc

Install Psmisc by running the following commands:
   
   
   
    sed "s/-ltermcap/-lncurses/" Makefile | make -f - &&
    make install
     
   
-----------------------------------------------------------------------------
6.44.2. Contents

The Psmisc package contains the fuser, killall and pstree programs.
-----------------------------------------------------------------------------

6.44.3. Description

6.44.3.1. fuser

fuser displays the PIDs of processes using the specified files or file
systems.
-----------------------------------------------------------------------------

6.44.3.2. killall

killall sends a signal to all processes running any of the specified
commands.
-----------------------------------------------------------------------------

6.44.3.3. pstree

pstree shows running processes as a tree.
-----------------------------------------------------------------------------

6.45. Installing Sed

6.45.1. Installation of Sed

Install Sed by running the following commands:
   
   
   
    ./configure --prefix=/usr --bindir=/bin &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.45.2. Contents

The Sed package contains the sed program.
-----------------------------------------------------------------------------

6.45.3. Description

sed is a stream editor. A stream editor is used to perform basic text
transformations on an input stream (a file or input from a pipeline).
-----------------------------------------------------------------------------

6.46. Installing Shellutils

6.46.1. Installation of Sh-utils

Install Shellutils by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install &&
    cd /usr/bin &&
    mv date echo false pwd stty /bin &&
    mv su true uname hostname /bin
     
   
-----------------------------------------------------------------------------
6.46.2. Contents

The Shellutils package contains the basename, chroot, date, dirname, echo,
env, expr, factor, false, groups, hostid, hostname, id, logname, nice, nohup,
pathchk, pinky, printenv, printf, pwd, seq, sleep, stty, su, tee, test, true,
tty, uname, uptime, users, who, whoami and yes programs.
-----------------------------------------------------------------------------

6.46.3. Description

6.46.3.1. basename

basename strips directory and suffixes from filenames.
-----------------------------------------------------------------------------

6.46.3.2. chroot

chroot runs a command or interactive shell with special root directory.
-----------------------------------------------------------------------------

6.46.3.3. date

date displays the current time in a specified format, or sets the system
date.
-----------------------------------------------------------------------------

6.46.3.4. dirname

dirname strips non-directory suffixes from file name.
-----------------------------------------------------------------------------

6.46.3.5. echo

echo displays a line of text.
-----------------------------------------------------------------------------

6.46.3.6. env

env runs a program in a modified environment.
-----------------------------------------------------------------------------

6.46.3.7. expr

expr evaluates expressions.
-----------------------------------------------------------------------------

6.46.3.8. factor

factor prints the prime factors of all specified integer numbers.
-----------------------------------------------------------------------------

6.46.3.9. false

false always exits with a status code indicating failure.
-----------------------------------------------------------------------------

6.46.3.10. groups

groups prints the groups a user is in.
-----------------------------------------------------------------------------

6.46.3.11. hostid

hostid prints the numeric identifier (in hexadecimal) for the current host.
-----------------------------------------------------------------------------

6.46.3.12. hostname

hostname sets or prints the name of the current host system
-----------------------------------------------------------------------------

6.46.3.13. id

id prints the real and effective UIDs and GIDs of a user or the current user.
-----------------------------------------------------------------------------

6.46.3.14. logname

logname prints the current user's login name.
-----------------------------------------------------------------------------

6.46.3.15. nice

nice runs a program with modified scheduling priority.
-----------------------------------------------------------------------------

6.46.3.16. nohup

nohup runs a command immune to hangups, with output to a non-tty
-----------------------------------------------------------------------------

6.46.3.17. pathchk

pathchk checks whether file names are valid or portable.
-----------------------------------------------------------------------------

6.46.3.18. pinky

pinky is a lightweight finger utility which retrieves information about a
certain user
-----------------------------------------------------------------------------

6.46.3.19. printenv

printenv prints all or part of the environment.
-----------------------------------------------------------------------------

6.46.3.20. printf

printf formats and print data (the same as the printf C function).
-----------------------------------------------------------------------------

6.46.3.21. pwd

pwd prints the name of the current/working directory
-----------------------------------------------------------------------------

6.46.3.22. seq

seq prints numbers in a certain range with a certain increment.
-----------------------------------------------------------------------------

6.46.3.23. sleep

sleep delays for a specified amount of time.
-----------------------------------------------------------------------------

6.46.3.24. stty

stty changes and prints terminal line settings.
-----------------------------------------------------------------------------

6.46.3.25. su

su runs a shell with substitute user and group IDs
-----------------------------------------------------------------------------

6.46.3.26. tee

tee reads from standard input and write to standard output and files.
-----------------------------------------------------------------------------

6.46.3.27. test

test checks file types and compares values.
-----------------------------------------------------------------------------

6.46.3.28. true

True always exitx with a status code indicating success.
-----------------------------------------------------------------------------

6.46.3.29. tty

tty prints the file name of the terminal connected to standard input.
-----------------------------------------------------------------------------

6.46.3.30. uname

uname prints system information.
-----------------------------------------------------------------------------

6.46.3.31. uptime

uptime tells how long the system has been running.
-----------------------------------------------------------------------------

6.46.3.32. users

users prints the user names of users currently logged in to the current host.
-----------------------------------------------------------------------------

6.46.3.33. who

who shows who is logged on.
-----------------------------------------------------------------------------

6.46.3.34. whoami

whoami prints your effective userid.
-----------------------------------------------------------------------------

6.46.3.35. yes

yes outputs a string repeatedly until killed.
-----------------------------------------------------------------------------

6.47. Installing Shadowpwd

6.47.1. Installation of Shadow Password Suite

Install the Shadow Password Suite by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install &&
    cd etc &&
    cp limits login.access \
       login.defs.linux shells suauth /etc &&
    mv /etc/login.defs.linux /etc/login.defs
     
   
-----------------------------------------------------------------------------
6.47.2. Command explanations

cp limits login.access and others: These files were not installed during the
installation of the package so we copy them manually as those files are used
to configure authentication details on your system.
-----------------------------------------------------------------------------

6.47.3. Contents

The Shadow Password Suite contains the chage, chfn, chsh, expiry, faillog,
gpasswd, lastlog, login, newgrp, passwd, sg, su, chpasswd, dpasswd, groupadd,
groupdel, groupmod, grpck, grpconv, grpunconv, logoutd, mkpasswd, newusers,
pwck, pwconv, pwunconv, useradd, userdel, usermod and vipw programs.
-----------------------------------------------------------------------------

6.47.4. Description

6.47.4.1. chage

chage changes the number of days between password changes and the date of the
last password change.
-----------------------------------------------------------------------------

6.47.4.2. chfn

chfn changes user fullname, office number, office extension, and home phone
number information for a user's account.
-----------------------------------------------------------------------------

6.47.4.3. chsh

chsh changes the user login shell.
-----------------------------------------------------------------------------

6.47.4.4. expiry

It's currently unknown what this program is for.
-----------------------------------------------------------------------------

6.47.4.5. faillog

faillog formats the contents of the failure log,/var/log/faillog, and
maintains failure counts and limits.
-----------------------------------------------------------------------------

6.47.4.6. gpasswd

gpasswd is used to administer the /etc/group file
-----------------------------------------------------------------------------

6.47.4.7. lastlog

lastlog formats and prints the contents of the last login log, /var/log/
lastlog. The login-name, port, and last login time will be printed.
-----------------------------------------------------------------------------

6.47.4.8. login

login is used to establish a new session with the system.
-----------------------------------------------------------------------------

6.47.4.9. newgrp

newgrp is used to change the current group ID during a login session.
-----------------------------------------------------------------------------

6.47.4.10. passwd

passwd changes passwords for user and group accounts.
-----------------------------------------------------------------------------

6.47.4.11. sg

sg executes command as a different group ID.
-----------------------------------------------------------------------------

6.47.4.12. su

Change the effective user id and group id to that of a user. This replaces
the su programs that's installed from the Shellutils package.
-----------------------------------------------------------------------------

6.47.4.13. chpasswd

chpasswd reads a file of user name and password pairs from standard input and
uses this information to update a group of existing users.
-----------------------------------------------------------------------------

6.47.4.14. dpasswd

dpasswd adds, deletes, and updates dialup passwords for user login shells.
-----------------------------------------------------------------------------

6.47.4.15. groupadd

The groupadd command creates a new group account using the values specified
on the command line and the default values from the system.
-----------------------------------------------------------------------------

6.47.4.16. groupdel

The groupdel command modifies the system account files, deleting all entries
that refer to group.
-----------------------------------------------------------------------------

6.47.4.17. groupmod

The groupmod command modifies the system account files to reflect the changes
that are specified on the command line.
-----------------------------------------------------------------------------

6.47.4.18. grpck

grpck verifies the integrity of the system authentication information.
-----------------------------------------------------------------------------

6.47.4.19. grpconv

grpunconv converts to shadow group files from normal group files.
-----------------------------------------------------------------------------

6.47.4.20. grpunconv

grpunconv converts from shadow group files to normal group files.
-----------------------------------------------------------------------------

6.47.4.21. logoutd

logoutd enforces the login time and port restrictions specified in /etc/
porttime.
-----------------------------------------------------------------------------

6.47.4.22. mkpasswd

mkpasswd reads a file in the format given by the flags and converts it to the
corresponding database file format.
-----------------------------------------------------------------------------

6.47.4.23. newusers

newusers reads a file of user name and cleartext password pairs and uses this
information to update a group of existing users or to create new users.
-----------------------------------------------------------------------------

6.47.4.24. pwck

pwck verifies the integrity of the system authentication information.
-----------------------------------------------------------------------------

6.47.4.25. pwconv

pwconv converts to shadow passwd files from normal passwd files.
-----------------------------------------------------------------------------

6.47.4.26. pwunconv

pwunconv converts from shadow passwd files to normal files.
-----------------------------------------------------------------------------

6.47.4.27. useradd

useradd creates a new user or update default new user information.
-----------------------------------------------------------------------------

6.47.4.28. userdel

userdel modifies the system account files, deleting all entries that refer to
a specified login name.
-----------------------------------------------------------------------------

6.47.4.29. usermod

usermod modifies the system account files to reflect the changes that are
specified on the command line.
-----------------------------------------------------------------------------

6.47.4.30. vipw and vigr

vipw and vigr will edit the files /etc/passwd and /etc/group, respectively.
With the -s flag, they will edit the shadow versions of those files, /etc/
shadow and /etc/gshadow, respectively.
-----------------------------------------------------------------------------

6.48. Installing Sysklogd

6.48.1. Installation of Sysklogd

Install Sysklogd by running the following commands:
   
   
   
    patch -Np1 -i ../sysklogd-1.4.patch &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.48.2. Contents

The Sysklogd package contains the klogd and syslogd programs.
-----------------------------------------------------------------------------

6.48.3. Description

6.48.3.1. klogd

klogd is a system daemon which intercepts and logs Linux kernel messages.
-----------------------------------------------------------------------------

6.48.3.2. syslogd

Syslogd provides a kind of logging that many modern programs use. Every
logged message contains at least a time and a hostname field, normally a
program name field, too, but that depends on how trusty the logging program
is.
-----------------------------------------------------------------------------

6.49. Installing Sysvinit

6.49.1. Installation of Sysvinit

When you change run levels (for example when you are going to shutdown your
system) the init program is going to send the TERM and KILL signals to all
the processes that init started. But init prints a message to the screen
saying "sending all processes the TERM signal" and the same for the KILL
signal. This implies that init sends this signal to all the currently running
processes, which isn't the case. To avoid this confusion you can apply the
sysvinit patch found on the LFS FTP site to sysvinit that changes the
sentence in the shutdown.c file and have it print "sending all processes
started by init the TERM signal".

Apply the patch by running the following command:
   
   
    patch -Np1 -i ../sysvinit-2.78.patch
   
Install Sysvinit by running the following commands:
   
   
   
    cd src &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.49.2. Contents

The Sysvinit package contains the pidof, last, lastb, mesg, utmpdump, wall,
halt, init, killall5, poweroff, reboot, runlevel, shutdown, sulogin and
telinit programs.
-----------------------------------------------------------------------------

6.49.3. Description

6.49.3.1. pidof

Pidof finds the process id's (pids) of the named programs and prints those
id's on standard output.
-----------------------------------------------------------------------------

6.49.3.2. last

last searches back through the file /var/log/wtmp (or the file designated by
the -f flag) and displays a list of all users logged in (and out) since that
file was created.
-----------------------------------------------------------------------------

6.49.3.3. lastb

lastb is the same as last, except that by default it shows a log of the file
/var/log/btmp, which contains all the bad login attempts. 
-----------------------------------------------------------------------------

6.49.3.4. mesg

Mesg controls the access to your terminal by others. It's typically used to
allow or disallow other users to write to your terminal.
-----------------------------------------------------------------------------

6.49.3.5. utmpdump

utmpdumps prints the content of a file (usually /var/run/utmp) on standard
output in a user friendly format.
-----------------------------------------------------------------------------

6.49.3.6. wall

Wall sends a message to everybody logged in with their mesg permission set to
yes.
-----------------------------------------------------------------------------

6.49.3.7. halt

Halt notes that the system is being brought down in the file /var/log/wtmp,
and then either tells the kernel to halt, reboot or poweroff the system. If
halt or reboot is called when the system is not in runlevel 0 or 6, shutdown
will be invoked instead (with the flag -h or -r).
-----------------------------------------------------------------------------

6.49.3.8. init

Init is the parent of all processes. Its primary role is to create processes
from a script stored in the file /etc/inittab. This file usually has entries
which cause init to spawn gettys on each line that users can log in. It also
controls autonomous processes required by any particular system.
-----------------------------------------------------------------------------

6.49.3.9. killall5

killall5 is the SystemV killall command. It sends a signal to all processes
except the processes in its own session, so it won't kill the shell that is
running the script it was called from.
-----------------------------------------------------------------------------

6.49.3.10. poweroff

poweroff is equivalent to shutdown -h -p now. It halts the computer and
switches off the computer (when using an APM compliant BIOS and APM is
enabled in the kernel).
-----------------------------------------------------------------------------

6.49.3.11. reboot

reboot is equivalent to shutdown -r now. It reboots the computer.
-----------------------------------------------------------------------------

6.49.3.12. runlevel

Runlevel reads the system utmp file (typically /var/run/utmp) to locate the
runlevel record, and then prints the previous and current system runlevel on
its standard output, separated by a single space.
-----------------------------------------------------------------------------

6.49.3.13. shutdown

shutdown brings the system down in a secure way. All logged-in users are
notified that the system is going down, and login is blocked.
-----------------------------------------------------------------------------

6.49.3.14. sulogin

sulogin is invoked by init when the system goes into single user mode (this
is done through an entry in /etc/inittab). Init also tries to execute sulogin
when it is passed the -b flag from the bootmonitor (eg, LILO).
-----------------------------------------------------------------------------

6.49.3.15. telinit

telinit sends appropriate signals to init, telling it which runlevel to
change to.
-----------------------------------------------------------------------------

6.50. Installing Tar

6.50.1. Installation of Tar

If you want to be able to directly use bzip2 files with tar, use the tar
patch avaiable from the LFS FTP site. This patch will add the -y option to
tar which works the same as the -z option to tar (which you can use for gzip
files).

Apply the patch by running the following command:
   
   
   
    cd src &&
    patch -i ../../gnutarpatch.txt &&
    cd ..
     
   
Install Tar by running the following commands from the toplevel directory:
   
   
   
    ./configure --prefix=/usr --libexecdir=/usr/bin &&
    make &&
    make install &&
    mv /usr/bin/tar /bin
     
   
-----------------------------------------------------------------------------
6.50.2. Contents

The tar package contains the tar and rmt programs.
-----------------------------------------------------------------------------

6.50.3. Description

6.50.3.1. tar

tar is an archiving program designed to store and extract files from an
archive file known as a tarfile.
-----------------------------------------------------------------------------

6.50.3.2. rmt

rmt is a program used by the remote dump and restore programs in manipulating
a magnetic tape drive through an interprocess communication connection.
-----------------------------------------------------------------------------

6.51. Installing Textutils

6.51.1. Installation of Textutils

Install Textutuils by running the following commands:
   
   
   
    ./configure --prefix=/usr &&
    make &&
    make install &&
    mv /usr/bin/cat /bin
     
   
-----------------------------------------------------------------------------
6.51.2. Contents

The Textutils package contains the cat, cksum, comm, split, cut, expand, fmt,
fold, head, join, md5sum, nl, od, paste, pr, ptx, sort, split, sum, tac,
tail, tr, tsort, unexpand, uniq and wc programs.
-----------------------------------------------------------------------------

6.51.3. Description

6.51.3.1. cat

cat concatenates file(s) or standard input to standard output.
-----------------------------------------------------------------------------

6.51.3.2. cksum

cksum prints CRC checksum and byte counts of each specified file.
-----------------------------------------------------------------------------

6.51.3.3. comm

comm compares two sorted files line by line.
-----------------------------------------------------------------------------

6.51.3.4. csplit

cplit outputs pieces of a file separated by (a) pattern(s) to files xx01,
xx02, ..., and outputs byte counts of each piece to standard output.
-----------------------------------------------------------------------------

6.51.3.5. cut

cut prints selected parts of lines from specified files to standard output.
-----------------------------------------------------------------------------

6.51.3.6. expand

expand converts tabs in files to spaces, writing to standard output.
-----------------------------------------------------------------------------

6.51.3.7. fmt

fmt reformats each paragraph in the specified file(s), writing to standard
output.
-----------------------------------------------------------------------------

6.51.3.8. fold

fold wraps input lines in each specified file (standard input by default),
writing to standard output.
-----------------------------------------------------------------------------

6.51.3.9. head

Print first xx (10 by default) lines of each specified file to standard
output.
-----------------------------------------------------------------------------

6.51.3.10. join

join joins lines of two files on a common field.
-----------------------------------------------------------------------------

6.51.3.11. md5sum

md5sum prints or checks MD5 checksums.
-----------------------------------------------------------------------------

6.51.3.12. nl

nl writes each specified file to standard output, with line numbers added.
-----------------------------------------------------------------------------

6.51.3.13. od

od writes an unambiguous representation, octal bytes by default, of a
specified file to standard output.
-----------------------------------------------------------------------------

6.51.3.14. paste

paste writes lines consisting of the sequentially corresponding lines from
each specified file, separated by TABs, to standard output.
-----------------------------------------------------------------------------

6.51.3.15. pr

pr paginates or columnates files for printing.
-----------------------------------------------------------------------------

6.51.3.16. ptx

ptx produces a permuted index of file contents.
-----------------------------------------------------------------------------

6.51.3.17. sort

sort writes sorted concatenation of files to standard output.
-----------------------------------------------------------------------------

6.51.3.18. split

split outputs fixed-size pieces of an input file to PREFIXaa, PREFIXab, ...
-----------------------------------------------------------------------------

6.51.3.19. sum

sum prints checksum and block counts for each specified file.
-----------------------------------------------------------------------------

6.51.3.20. tac

tac writes each specified file to standard output, last line first.
-----------------------------------------------------------------------------

6.51.3.21. tail

tail print the last xx (10 by default) lines of each specified file to
standard output.
-----------------------------------------------------------------------------

6.51.3.22. tr

tr translates, squeezes, and/or deletes characters from standard input,
writing to standard output.
-----------------------------------------------------------------------------

6.51.3.23. tsort

tsort writes totally ordered lists consistent with the partial ordering in
specified files.
-----------------------------------------------------------------------------

6.51.3.24. unexpand

unexpand converts spaces in each file to tabs, writing to standard output.
-----------------------------------------------------------------------------

6.51.3.25. uniq

uniq discards all but one of successive identical lines from files or
standard input and writes to files or standard output.
-----------------------------------------------------------------------------

6.51.3.26. wc

wc prints line, word, and byte counts for each specified file, and a total
line if more than one file is specified.
-----------------------------------------------------------------------------

6.52. Installing Utillinux

6.52.1. Installation of Util-Linux

Install Util-Linux by running the following commands:
   
   
   
    sed -e s/HAVE_SLN=no/HAVE_SLN=yes/ \
       -e s/HAVE_TSORT=no/HAVE_TSORT=yes/ \
       MCONFIG > MCONFIG~ &&
    mv MCONFIG~ MCONFIG &&
    ./configure &&
    make &&
    make install
     
   
-----------------------------------------------------------------------------
6.52.2. Command explanations

HAVE_SLN=yes: We don't build this program because it already was installed by
Glibc.

HAVE_TSORT=yes: We don't build this program either becuase it already was
installed by Textutils.
-----------------------------------------------------------------------------

6.52.3. Contents

The Util-linux package contains the arch, dmesg, kill, more, mount, umount,
agetty, blockdev, cfdisk, ctrlaltdel, elvtune, fdisk, fsck.minix, hwclock,
kbdrate, losetup, mkfs, mkfs.bfs, mkfs.minix, mkswap, sfdisk, swapoff,
swapon, cal, chkdupexe, col, colcrt, colrm, column, cytune, ddate, fdformat,
getopt, hexdump, ipcrm, ipcs, logger, look, mcookie, namei, rename, renice,
rev, script, setfdprm, setsid, setterm, ul, whereis, write, ramsize, rdev,
readprofile, rootflags, swapdev, tunelp and vidmode programs.
-----------------------------------------------------------------------------

6.52.4. Description

6.52.4.1. arch

arch prints the machine architecture.
-----------------------------------------------------------------------------

6.52.4.2. dmesg

dmesg is used to examine or control the kernel ring buffer (boot messages
from the kernel).
-----------------------------------------------------------------------------

6.52.4.3. kill

kill sends a specified signal to the specified process.
-----------------------------------------------------------------------------

6.52.4.4. more

more is a filter for paging through text one screenful at a time.
-----------------------------------------------------------------------------

6.52.4.5. mount

mount mounts a filesystem from a device to a directory (mount point).
-----------------------------------------------------------------------------

6.52.4.6. umount

umount unmounts a mounted filesystem.
-----------------------------------------------------------------------------

6.52.4.7. agetty

agetty opens a tty port, prompts for a login name and invokes the /bin/login
command.
-----------------------------------------------------------------------------

6.52.4.8. blockdev

blockdev allows you to call block device ioctls from the command line
-----------------------------------------------------------------------------

6.52.4.9. cfdisk

cfdisk is an libncurses based disk partition table manipulator.
-----------------------------------------------------------------------------

6.52.4.10. ctrlaltdel

ctrlaltdel sets the function of the CTRL+ALT+DEL key combination (hard or
soft reset).
-----------------------------------------------------------------------------

6.52.4.11. elvtune

elvtune allows to tune the I/O elevator per blockdevice queue basis.
-----------------------------------------------------------------------------

6.52.4.12. fdisk

fdisk is a disk partition table manipulator.
-----------------------------------------------------------------------------

6.52.4.13. fsck.minix

fsck.minix performs a consistency check for the Linux MINIX filesystem.
-----------------------------------------------------------------------------

6.52.4.14. hwclock

hwclock queries and sets the hardware clock (Also called the RTC or BIOS
clock).
-----------------------------------------------------------------------------

6.52.4.15. kbdrate

kbdrate resets the keyboard repeat rate and delay time.
-----------------------------------------------------------------------------

6.52.4.16. losetup

losetup sets up and controls loop devices.
-----------------------------------------------------------------------------

6.52.4.17. mkfs

mkfs builds a Linux filesystem on a device, usually a harddisk partition.
-----------------------------------------------------------------------------

6.52.4.18. mkfs.bfs

mkfs.bfs creates a SCO bfs file system on a device, usually a harddisk
partition.
-----------------------------------------------------------------------------

6.52.4.19. mkfs.minix

mkfs.minix creates a Linux MINIX filesystem on a device, usually a harddisk
partition.
-----------------------------------------------------------------------------

6.52.4.20. mkswap

mkswap sets up a Linux swap area on a device or in a file.
-----------------------------------------------------------------------------

6.52.4.21. sfdisk

sfdisk is a disk partition table manipulator.
-----------------------------------------------------------------------------

6.52.4.22. swapoff

swapoff disables devices and files for paging an swapping.
-----------------------------------------------------------------------------

6.52.4.23. swapon

swapon enables devices and files for paging and swapping.
-----------------------------------------------------------------------------

6.52.4.24. cal

cal displays a simple calender.
-----------------------------------------------------------------------------

6.52.4.25. chkdupexe

chkdupexe finds duplicate executables.
-----------------------------------------------------------------------------

6.52.4.26. col

col filters reverse line feeds from input.
-----------------------------------------------------------------------------

6.52.4.27. colcrt

colcrt filters nroff output for CRT previewing.
-----------------------------------------------------------------------------

6.52.4.28. colrm

colrm removes columns from a file.
-----------------------------------------------------------------------------

6.52.4.29. column

column columnates lists.
-----------------------------------------------------------------------------

6.52.4.30. cytune

cytune queries and modifies the interruption threshold for the Cyclades
driver.
-----------------------------------------------------------------------------

6.52.4.31. ddate

ddate converts Gregorian dates to Discordian dates.
-----------------------------------------------------------------------------

6.52.4.32. fdformat

fdformat low-level formats a floppy disk.
-----------------------------------------------------------------------------

6.52.4.33. getopt

getops parses command options the same way as the getopt C command.
-----------------------------------------------------------------------------

6.52.4.34. hexdump

hexdump displays specified files, or standard input, in a user specified
format (ascii, decimal, hexadecimal, octal).
-----------------------------------------------------------------------------

6.52.4.35. ipcrm

ipcrm removes a specified resource.
-----------------------------------------------------------------------------

6.52.4.36. ipcs

ipcs provides information on ipc facilities.
-----------------------------------------------------------------------------

6.52.4.37. logger

logger makes entries in the system log.
-----------------------------------------------------------------------------

6.52.4.38. look

look displays lines beginning with a given string.
-----------------------------------------------------------------------------

6.52.4.39. mcookie

mcookie generates magic cookies for xauth.
-----------------------------------------------------------------------------

6.52.4.40. namei

namei follows a pathname until a terminal point is found.
-----------------------------------------------------------------------------

6.52.4.41. rename

rename renames files.
-----------------------------------------------------------------------------

6.52.4.42. renice

renice alters priority of running processes.
-----------------------------------------------------------------------------

6.52.4.43. rev

rev reverses lines of a file.
-----------------------------------------------------------------------------

6.52.4.44. script

script makes typescript of terminal session.
-----------------------------------------------------------------------------

6.52.4.45. setfdprm

setfdprm sets user-provides floppy disk parameters.
-----------------------------------------------------------------------------

6.52.4.46. setsid

setsid runs programs in a new session.
-----------------------------------------------------------------------------

6.52.4.47. setterm

setterm sets terminal attributes.
-----------------------------------------------------------------------------

6.52.4.48. ul

ul reads a file and translates occurences of underscores to the sequence
which indicates underlining for the terminal in use.
-----------------------------------------------------------------------------

6.52.4.49. whereis

whereis locates a binary, source and manual page for a command.
-----------------------------------------------------------------------------

6.52.4.50. write

write sends a message to another user.
-----------------------------------------------------------------------------

6.52.4.51. ramsize

ramsize queries and sets RAM disk size.
-----------------------------------------------------------------------------

6.52.4.52. rdev

rdev queries and sets image root device, swap device, RAM disk size, or video
mode.
-----------------------------------------------------------------------------

6.52.4.53. readprofile

readprofile reads kernel profiling information.
-----------------------------------------------------------------------------

6.52.4.54. rootflags

rootflags queries and sets extra information used when mounting root.
-----------------------------------------------------------------------------

6.52.4.55. swapdev

swapdev queries and sets swap device.
-----------------------------------------------------------------------------

6.52.4.56. tunelp

tunelp sets various paramters for the lp device.
-----------------------------------------------------------------------------

6.52.4.57. vidmode

vidmode queries and sets the video mode.
-----------------------------------------------------------------------------

6.53. Removing old NSS library files

If you have copied the NSS Library files from your normal Linux system to the
LFS system (because your normal system runs glibc-2.0) it's time to remove
them now by running:
   
   
   
    rm /lib/libnss*.so.1 /lib/libnss*2.0*
     
   
-----------------------------------------------------------------------------
6.54. Configuring essential software

Now that all software is installed, all that we need to do to get a few
programs running properly is to create their configuration files.
-----------------------------------------------------------------------------

6.54.1. Configuring Vim

By default Vim runs in vi compatible mode. Some people might like this, but I
have a high preference to run vim in vim mode (else I wouldn't have included
Vim in this book but the original Vi). Create the /root/.vimrc by running the
following:


cat > /root/.vimrc << "EOF"
" Begin /root/.vimrc

set nocompatible
set bs=2

" End /root/.vimrc
EOF
 
-----------------------------------------------------------------------------

6.54.2. Configuring Glibc

We need to create the /etc/nsswitch.conf file. Although glibc should provide
defaults when this file is missing or corrupt, it's defaults don't work work
well with networking which will be dealt with in a later chapter. Also, our
timezone needs to be setup.

Create a new file /etc/nsswitch.conf by running the following:


cat > /etc/nsswitch.conf << "EOF"
# Begin /etc/nsswitch.conf

passwd: files
group: files
shadow: files

publickey: files

hosts: files dns
networks: files

protocols: db files
services: db files
ethers: db files
rpc: db files

netgroup: db files

# End /etc/nsswitch.conf
EOF
 

Run the tzselect script and answer the questions regarding your timezone.
When you're done, the script will give you the location of the timezone file
you need.

Create the /etc/localtime symlink by running:
   
   
   
    cd /etc &&
    rm localtime &&
    ln -s ../usr/share/zoneinfo/<tzselect's output> localtime
     
   
tzselect's output can be something like EST5EDT or Canada/Eastern.

The symlink you would create with that information would be:
   
   
   
    ln -s ../usr/share/zoneinfo/EST5EDT localtime 
     
   
Or:
   
   
   
    ln -s ../usr/share/zoneinfo/Canada/Eastern localtime
     
   
-----------------------------------------------------------------------------
6.54.3. Configuring Dynamic Loader

By default the dynamic loader searches a few default paths for dynamic
libraries, so there normally isn't a need for the /etc/ld.so.conf file unless
you have extra directories in which you want the system to search for paths.
The /usr/local/lib directory isn't searched through for dynamic libraries by
default, so we want to add this path so when you install software you won't
be suprised by them not running for some reason.

Create a new file /etc/ld.so.conf by running the following:


cat > /etc/ld.so.conf << "EOF"
# Begin /etc/ld.so.conf

/lib
/usr/lib
/usr/local/lib

# End /etc/ld.so.conf
EOF
 

Although it's not necessary to add the /lib and /usr/lib directories it
doesn't hurt. This way you see right away what's being searched and don't
have to remeber the default search paths if you don't want to.
-----------------------------------------------------------------------------

6.54.4. Configuring Lilo

We're not going to create lilo's configuration file from scratch, but we'll
use the file from your normal Linux system. This file is different on every
machine and thus I can't create it here. Since you would want to have the
same options regarding lilo as you have when you're using your normal Linux
system you would create the file exactly as it is on the normal system.

Copy the Lilo configuration file and kernel images that Lilo uses by running
the following commands from a shell on your normal Linux system. Don't
execute these commands from your chroot'ed shell.
   
   
   
    cp /etc/lilo.conf $LFS/etc
    cp /boot/<kernel images> $LFS/boot
     
   
Before you can execute the second command you need to know the names of the
kernel images. You can't just copy all files from the /boot directory. The /
etc/lilo.conf file contains the names of the kernel images you're using. Open
the file and look for lines like this:
   
   
   
    image=/boot/vmlinuz
     
   
Look for all image variables and their values represent the name and location
of the image files. These files will usually be in /boot but they might be in
other directories as well, depending on your distribution's conventions.
-----------------------------------------------------------------------------

6.54.5. Configuring Sysklogd

Create a new file /etc/syslog.conf by running the following:


cat > /etc/syslog.conf << "EOF"
# Begin /etc/syslog.conf

auth,authpriv.* -/var/log/auth.log
*.*;auth,authpriv.none -/var/log/sys.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
*.emerg *

# End /etc/syslog.conf
EOF
 
-----------------------------------------------------------------------------

6.54.6. Configuring Shadow Password Suite

This package contains the utilities to modify user's passwords, add new users
/groups, delete users/groups and more. I'm not going to explain to you what
'password shadowing' means. You can read all about that in the doc/HOWTO file
within the unpacked shadow password suite's source tree. There's one thing
you should keep in mind, if you decide to use shadow support, that programs
that need to verify passwords (examples are xdm, ftp daemons, pop3 daemons,
etc) need to be 'shadow-compliant', eg. they need to be able to work with
shadow'ed passwords.

Shadow'ed passwords are not enabled by default. Simply installing the shadow
password suite does not enable shadow'ed passwords.

Now is a very good moment to read chapter 5 of the doc/HOWTO file. You can
read how you can enable shadow'ed passwords, how to test whether shadowing
works and if not, how to disable it again.

The documentation mentions something about the creastion of npasswd and
nshadow after you run pwconv. This is an error in the documentation. Those
two files will be be created. After you run pwconv, /etc/passwd will no
longer contain the passwords and /etc/shadow will. You don't need to rename
the npasswd and nshadow files yourself.
-----------------------------------------------------------------------------

6.54.7. Configuring Sysvinit

Create a new file /etc/inittab by running the following:


cat > /etc/inittab << "EOF"
# Begin /etc/inittab

id:3:initdefault:

si::sysinit:/etc/init.d/rcS

l0:0:wait:/etc/init.d/rc 0
l1:S1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6

ft:06:respawn:/sbin/sulogin

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

su:S1:respawn:/sbin/sulogin
1:2345:respawn:/sbin/agetty tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600

# End /etc/inittab
EOF
 
-----------------------------------------------------------------------------

6.54.8. Creating the /var/run/utmp, /var/log/wtmp and /var/log/btmp files

Programs like login, shutdown, uptime and others want to read from and write
to the /var/run/utmp /var/log/btmp and /var/log/wtmp. These files contain
information about who is currently logged in. It also contains information on
when the computer was last booted and shutdown and a record of the bad login
attemps.

Create these files with their proper permissions by running the following
commands:
   
   
   
    touch /var/run/utmp /var/log/wtmp /var/log/btmp /var/log/lastlog &&
    chmod 644 /var/run/utmp /var/log/wtmp /var/log/btmp /var/log/lastlog
     
   
-----------------------------------------------------------------------------
6.54.9. Creating root password

Choose a password for user root and create it by running the following
command:
   
   
   
    passwd root
     
   
-----------------------------------------------------------------------------
Chapter 7. Creating system boot scripts

7.1. Introduction

This chapter will create the necessary scripts that are run at boottime.
These scripts perform tasks such as remounting the root file system mounted
read-only by the kernel into read-write mode, activiating the swap partition
(s), running a check on the root file system to make sure it's intact and
starting the daemons that the system uses.
-----------------------------------------------------------------------------

7.2. Creating directories

We need to start by creating a few extra directories that are used by the
boot scripts. Create these directories by running:
   
   
   
    cd /etc &&
    mkdir sysconfig rc0.d rc1.d rc2.d rc3.d &&
    mkdir rc4.d rc5.d rc6.d init.d rcS.d &&
    cd init.d
     
   
-----------------------------------------------------------------------------
7.3. Creating the rc script

The first main bootscript is the /etc/init.d/rc script. Create a new file /
etc/init.d/rc containing the following:


cat > rc << "EOF"
#!/bin/sh
# Begin /etc/init.d/rc
#
# By Jason Pearce  - [email protected]
# Modified by Gerard Beekmans - [email protected]
# print_error_msg based on ideas by Simon Perreault - [email protected]

#
# Include the functions declared in the /etc/init.d/functions file
#

source /etc/init.d/functions

#
# The print_error_msg function prints an error message when an unforseen
# error occured that wasn't trapped for some reason by a evaluate_retval
# call or error checking in different ways.

print_error_msg()
{

        echo
        $FAILURE
        echo -n "You should not read this error message. It means "
        echo "that an unforseen error "
        echo -n "took place and subscript $i exited with "
        echo "a return value "
        echo -n "of $error_value for an unknown reason. If you're able "
        echo "to trace this error down "
        echo -n "to a bug in one of the files provided by this book, "
        echo "please be so kind to "
        echo -n "inform us at [email protected]"
        $NORMAL
        echo
        echo
        echo "Press a key to continue..."
        read
}

#
# If you uncomment the debug variable below none of the scripts will be
# executed, just the script name and parameters will be echo'ed to the
# screen so you can see how the scripts are called by rc.
#

# Un-comment the following for debugging.
# debug=echo

#
# Start script or program.
# 
startup() {

$debug $*

}   

#
# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
#

trap ":" INT QUIT TSTP

#
# Now find out what the current and what the previous runlevel are. The
# $RUNLEVEL variable is set by init for all it's children. This script
# runs as a child of init.
#

runlevel=$RUNLEVEL

#
# Get first argument. Set new runlevel to this argument. If no runlevel
# was passed to this script we won't change runlevels.
#

[ "$1" != "" ] && runlevel=$1
if [ "$runlevel" = "" ]
then
        echo "Usage: $0 <runlevel>" >&2
        exit 1
fi

#
# The same goes for $PREVLEVEL (see above for $RUNLEVEL). previous will
# be set to the previous run level. If $PREVLEVEL is not set it means
# that there is no previous runlevel and we'll set previous to N.
#

previous=$PREVLEVEL
[ "$previous" = "" ] && previous=N

export runlevel previous

#
# Is there an rc directory for the new runlevel?
#

if [ -d /etc/rc$runlevel.d ]

then

#
# If so, first collect all the K* scripts in the new run level.
#

        if [ $previous != N ]
        then
                for i in /etc/rc$runlevel.d/K*
                do
                [ ! -f $i ] && continue

#
# the suffix variable will contain the script name without the leading
# Kxxx
#

                        suffix=${i#/etc/rc$runlevel.d/K[0-9][0-9][0-9]}
#
# If there is a start script for this K script in the previous runlevel
# determine what it's full path is
#
            previous_start=/etc/rc$previous.d/S[0-9][0-9][0-9]$suffix
#
# If there was no previous run level it could be that something was
# started in rcS.d (sysinit level) so we'll determine the path for that
# possibility as well.
#

                        sysinit_start=/etc/rcS.d/S[0-9][0-9][0-9]$suffix

#
# Stop the service if there is a start script in the previous run level 
# or in the sysinit level. If previous_start or sysinit_start do not 
# exist the 'continue' command is run which causes the script to abort
# this iteration of the for loop and continue with the next iteration.
# This boils down to that it won't run the commands after the next two
# lines and start over from the top of this for loop. See man bash for
# more info on this.
#

                        [ ! -f $previous_start ] && 
                        [ ! -f $sysinit_start ] && continue

#
# If we found previous_start or sysinit_start, run the K script
#

                        startup $i stop
                        error_value=$?
#
# If the return value of the script is not 0, something went wrong with
# error checking inside the script. the print_error_msg function will be
# called and the message plus the return value of the K script will be
# printed to the screen

#

                        if [ $error_value != 0 ]
                        then
                                print_error_msg 
                        fi

                done
        fi

#
# Now run the START scripts for this runlevel.
#

        for i in /etc/rc$runlevel.d/S*
        do
                [ ! -f $i ] && continue

                if [ $previous != N ]
        then
#
# Find start script in previous runlevel and stop script in this
# runlevel.
#

                        suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9][0-9]}
                        stop=/etc/rc$runlevel.d/K[0-9][0-9][0-9]$suffix
                previous_start=/etc/rc$previous.d/S[0-9][0-9][0-9]$suffix
#
# If there is a start script in the previous level and no stop script in 
# this level, we don't have to re-start the service; abort this
# iteration and start the next one.
#

                        [ -f $previous_start ] && [ ! -f $stop ] && 
                        continue
                fi

                case "$runlevel" in
                        0|6)

#
# levels 0 and 6 are halt and reboot levels. We don't really start
# anything here so we call with the 'stop' parameter
#

                                startup $i stop
                                error_value=$?
#
# If the return value of the script is not 0, something went wrong with
# error checking inside the script. the print_error_msg function will be
# called and the message plus the return value of the K script will be
# printed to the screen
#

                                if [ $error_value != 0 ]
                                then
                                        print_error_msg
                                fi
                                ;;
                        *)
                                startup $i start
                                error_value=$?
#
# If the return value of the script is not 0, something went wrong with
# error checking inside the script. the print_error_msg function will be
# called and the message plus the return value of the K script will be
# printed to the screen
#

                                if [ $error_value != 0 ]
                                then
                                        print_error_msg
                                fi
                                ;;
                esac
        done
fi

# End /etc/init.d/rc
EOF
 
-----------------------------------------------------------------------------

7.4. Creating the rcS script

The second main bootscript is the rcS script. Create a new file /etc/init.d/
rcS containing the following:


cat > rcS << "EOF"
#!/bin/sh
# Begin /etc/init.d/rcS

#
# See the rc script for the extensive comments on the constructions
# used here
#

runlevel=S
prevlevel=N
umask 022
export runlevel prevlevel

trap ":" INT QUIT TSTP

#
# Collect all the S scripts in /etc/rcS.d and execute them in the same
#

for i in /etc/rcS.d/S??*
do
        [ ! -f  "$i" ] && continue;
                $i start
done

# End /etc/init.d/rcS
EOF
 
-----------------------------------------------------------------------------

7.5. Creating the functions script

Create a new file /etc/init.d/functions containing the following:


cat > functions << "EOF"
#!/bin/sh
# Begin /etc/init.d/functions

#
# Set a few variables that influence the text that's printed on the
# screen. The SET_COL variable starts the text in column number 70 (as
# defined by the COL variable). NORMAL prints text in normal mode.
# SUCCESS prints text in a green colour and FAILURE prints text in a red
# colour
#

COL=70
SET_COL="echo -en \\033[${COL}G"
NORMAL="echo -en \\033[0;39m"
SUCCESS="echo -en \\033[1;32m"
FAILURE="echo -en \\033[1;31m"

#
# The evaluate_retval function evaluates the return value of the process
# that was run just before this function was called. If the return value
# was 0, indicating success, the print_status function is called with
# the 'success' parameter. Otherwise the print_status function is called
# with the failure parameter.
#

evaluate_retval()
{
        if [ $? = 0 ]
        then
                print_status success
        else
                print_status failure
        fi
}

#
# The print_status prints [  OK  ] or [FAILED] to the screen. OK appears
# in the colour defined by the SUCCESS variable and FAILED appears in
# the colour defined by the FAILURE variable. Both are printed starting
# in the colomn defined by the COL variable.
#

print_status()
{

#
# If no parameters are given to the print_status function, print usage
# information.
#

        if [ $# = 0 ]
        then
                echo "Usage: print_status {success|failure}"
                return 1
        fi

        case "$1" in
                success)
                        $SET_COL
                        echo -n "[  "
                        $SUCCESS
                        echo -n "OK"
                        $NORMAL
                        echo "  ]"
                        ;;
                failure)
                        $SET_COL
                        echo -n "["
                        $FAILURE
                        echo -n "FAILED"
                        $NORMAL
                        echo "]"
                        ;;
        esac

}

#
# The loadproc function starts a process (often a daemon) with
# proper error checking
#

loadproc()
{

#
# If no parameters are given to the print_status function, print usage
# information.

#

        if [ $# = 0 ]
        then
                echo "Usage: loadproc {program}"
                exit 1
        fi
#
# Find the basename of the first parameter (the daemon's name without
# the path
# that was provided so /usr/sbin/syslogd becomes plain 'syslogd' after
# basename ran)
#

        base=$(/usr/bin/basename $1)
#
# the pidlist variable will contains the output of the pidof command.
# pidof will try to find the PID's that belong to a certain string;
# $base in this case
#

        pidlist=$(/bin/pidof -o $$ -o $PPID -o %PPID -x $base)

        pid=""

        for apid in $pidlist
        do
                if [ -d /proc/$apid ]
                then
                        pid="$pid $apid"
                fi
        done
#
# If the $pid variable contains anything (from the previous for loop) it
# means the daemon is already running
#

        if [ ! -n "$pid" ]
        then
#
# Empty $pid variable means it's not running, so we run $* (all
# parameters giving to this function from the script) and then check the
# return value
#
                $*
                evaluate_retval
        else
#
# The variable $pid was not empty, meaning it was already running. We
# print [FAILED] now
#
                print_status failure
        fi

}

#
# The killproc function kills a process with proper error checking
#

killproc()
{

#
# If no parameters are given to the print_status function, print usage
# information.

#

        if [ $# = 0 ]
        then
                echo "Usage: killproc {program} [signal]"
                exit 1
        fi

#
# Find the basename of the first parameter (the daemon's name without
# the path
# that was provided so /usr/sbin/syslogd becomes plain 'syslogd' after
# basename ran)
#

        base=$(/usr/bin/basename $1)

#
# Check if we gave a signal to kill the process with (like -HUP, -TERM,
# -KILL, etc) to this function (the second parameter). If no second
# parameter was provided set the nolevel variable. Else set the
# killlevel variable to the value of $2 (the second parameter)
#

        if [ "$2" != "" ]
        then
                killlevel=-$2
        else
                nolevel=1
        fi

#
# the pidlist variable will contains the output of the pidof command.
# pidof will try to find the PID's that belong to a certain string;
# $base in this case

        pidlist=$(/bin/pidof -o $$ -o $PPID -o %PPID -x $base)

        pid=""

        for apid in $pidlist
        do
                if [ -d /proc/$apid ]
                then
                        pid="$pid $apid"
                fi
        done

#
# If $pid contains something from the previous for loop it means one or

# more PID's were found that belongs to the processes to be killed
#
        if [ -n "$pid" ]
        then
#
# If no kill level was specified we'll try -TERM first and then sleep
# for 2 seconds to allow the kill to be completed
#
                if [ "$nolevel" = 1 ]
                then
                        /bin/kill -TERM $pid
/usr/bin/sleep 2
#
# If after -TERM the PID still exists we'll try killing it with -KILL
# and wait for 2 seconds again to allow the kill to be completed
#
 
                       if ps h $pid >/dev/null 2>&1
                        then
                                /bin/kill -KILL $pid
/usr/bin/sleep 2
                        fi
                        /bin/ps h $pid >/dev/null 2>&1
                        if [ $? = 0 ]
                        then
#
# If after the -KILL it still exists it can't be killed for some reason
# and we'll print [FAILED]
#
                                print_status failure
                        else
#
# It was killed, remove possible stale PID file in /var/run and 
# print [  OK  ]
#
                                /bin/rm -f /var/run/$base.pid
                                print_status success
                        fi
                else
#
# A kill level was provided. Kill with the provided kill level and wait
# for 2 seconds to allow the kill to be completed

#
                        /bin/kill $killlevel $pid
/usr/bin/sleep 2
                        /bin/ps h $pid >/dev/null 2>&1
                        if [ $? = 0 ]
                        then
#
# If ps' return value is 0 it means it ran ok which indicates that the
# PID still exists. This means the process wasn't killed properly with
# the signal provided. Print [FAILED]
#
                                print_status failure
                        else
#
# If the return value was 1 or higher it means the PID didn't exist
# anymore which means it was killed successfully. Remove possible stale
# PID file and print [  OK  ]
#
                                /bin/rm -f /var/run/$base.pid
                                print_status success
                        fi
                fi
        else
#
# The PID didn't exist so we can't attempt to kill it. Print [FAILED]
#
                print_status failure
        fi
}

#
# The reloadproc functions sends a signal to a daemon telling it to
# reload it's configuration file. This is almost identical to the
# killproc function with the exception that it won't try to kill it with
# a -KILL signal (aka -9)
#

reloadproc()
{

#
# If no parameters are given to the print_status function, print usage
# information.

#

        if [ $# = 0 ]
        then
                echo "Usage: reloadproc {program} [signal]"
                exit 1
        fi

#
# Find the basename of the first parameter (the daemon's name without
# the path
# that was provided so /usr/sbin/syslogd becomes plain 'syslogd' after
# basename ran)
#

        base=$(/usr/bin/basename $1)

#
# Check if we gave a signal to send to the process (like -HUP)
# to this function (the second parameter). If no second
# parameter was provided set the nolevel variable. Else set the
# killlevel variable to the value of $2 (the second parameter)
#


        if [ -n "$2" ]
        then
                killlevel=-$2
        else
                nolevel=1
        fi

#
# the pidlist variable will contains the output of the pidof command.
# pidof will try to find the PID's that belong to a certain string;
# $base in this case

#

        pidlist=$(/bin/pidof -o $$ -o $PPID -o %PPID -x $base)

        pid=""

        for apid in $pidlist
        do
                if [ -d /proc/$apid ]
                then
                        pid="$pid $apid"
                fi
        done

#
# If $pid contains something from the previous for loop it means one or
# more PID's were found that belongs to the processes to be reloaded
#

        if [ -n "$pid" ]
        then

#
# If nolevel was set we will use the default reload signal SIGHUP.
#

                if [ "$nolevel" = 1 ]
                then
                        /bin/kill -SIGHUP $pid
                        evaluate_retval
                else
#
# Else we will use the provided signal
#

                        /bin/kill $killlevel $pid
                        evaluate_retval
                fi
        else
#
# If $pid is empty no PID's have been found that belong to the process
# and print [FAILED]
#

                print_status failure
        fi
}

#
# The statusproc function will try to find out if a process is running
# or not
#

statusproc()
{

#
# If no parameters are given to the print_status function, print usage
# information.

#

        if [ $# = 0 ]
        then
                echo "Usage: status {program}"
                return 1
        fi

#
# $pid will contain a list of PID's that belong to a process
#

        pid=$(/bin/pidof -o $$ -o $PPID -o %PPID -x $1)
        if [ -n "$pid" ]
        then
#
# If $pid contains something, the process is running, print the contents
# of the $pid variable
#
                echo "$1 running with Process ID $pid"
                return 0
        fi

#
# If $pid doesn't contain it check if a PID file exists and inform the
# user about this stale file.
#

        if [ -f /var/run/$1.pid ]
        then
                pid=$(/usr/bin/head -1 /var/run/$1.pid)
                if [ -n "$pid" ]
                then
                        echo "$1 not running but /var/run/$1.pid exists"
                        return 1
                fi
        else
                echo "$1 is not running"
        fi

}

# End /etc/init.d/functions
EOF
 
-----------------------------------------------------------------------------

7.6. Creating the checkfs script

Create a new file /etc/init.d/checkfs containing the following:


cat > checkfs << "EOF"
#!/bin/sh
# Begin /etc/init.d/checkfs

#
# Include the functions declared in the /etc/init.d/functions file
#

source /etc/init.d/functions

#
# Activate all the swap partitions declared in the /etc/fstab file
#

echo -n "Activating swap..."
/sbin/swapon -a
evaluate_retval

#
# If the /fastboot file exists we don't want to run the partition checks
#

if [ -f /fastboot ]
then
        echo "Fast boot, no file system check"
else

#
# Mount the root partition read-only (just in case the kernel mounts it
# read-write and we don't want to run fsck on a read-write mounted 
# partition).
#

        /bin/mount -n -o remount,ro /
        if [ $? = 0 ]
        then

#
# If the /forcefsck file exists we want to force a partition check even 
# if the partition was unmounted cleanly the last time
#

                if [ -f /forcefsck ]
                then
                        echo -n "/forcefsck exists, forcing "
                        echo "file system check"
                        force="-f"
                else
                        force=""
                fi

#
# Check all the file systems mentioned in /etc/fstab that have the
# fs_passno value set to 1 or 2 (the 6th field. See man fstab for more
# info)
#

                echo "Checking file systems..."
                /sbin/fsck $force -a -A -C -T

#
# If something went wrong during the checks of one of the partitions,
# fsck will exit with a return value greater than 1. If this is
# the case we start sulogin so you can repair the damage manually
#

                if [ $? -gt 1 ]
                then
                        $FAILURE
                        echo
                        echo -n "fsck failed. Please repair your file "
                        echo "systems manually by running /sbin/fsck"
                        echo "without the -a option"
                        echo
                        echo -n "Please note that the root file system " 
                        echo "is currently mounted in read-only mode."
                        echo
                        echo -n "I will start sulogin now. When you  "
                        echo "logout I will reboot your system."
                        echo
                        $NORMAL
                        /sbin/sulogin
                        /sbin/reboot -f
                else
                        print_status success
                fi

        else

#
# If the remount to read-only mode didn't work abort the fsck and print
# an error
#

                echo -n "Cannot check root file system because it "
                echo "could not be mounted in read-only mode."
        fi
fi

# End /etc/init.d/checkfs
EOF
 
-----------------------------------------------------------------------------

7.7. Creating the halt script

Create a new file /etc/init.d/halt containing the following:


cat > halt << "EOF"
#!/bin/sh
# Begin /etc/init.d/halt

#
# Call halt. See man halt for the meaning of the parameters
#

/sbin/halt -d -f -i -p

# End /etc/init.d/halt
EOF
 
-----------------------------------------------------------------------------

7.8. Creating the loadkeys script

You only need to create this script if you don't have a default 101 keys US
keyboard layout. Create a new file /etc/init.d/loadkeys containing the
following:


cat > loadkeys << "EOF"
#!/bin/sh
# Begin /etc/init.d/loadkeys

#
# Include the functions declared in the /etc/init.d/functions file
#

source /etc/init.d/functions

#
# Load the default keymap file
#

echo -n "Loading keymap..."
/usr/bin/loadkeys -d >/dev/null
evaluate_retval

# End /etc/init.d/loadkeys
EOF
 
-----------------------------------------------------------------------------

7.9. Creating the mountfs script

Create a new file /etc/init.d/mountfs containing the following:


cat > mountfs << "EOF"
#!/bin/sh
# Begin /etc/init.d/mountfs

#
# Include the functions declared in the /etc/init.d/functions file
#

source /etc/init.d/functions

case "$1" in
    start)

        #
        # Remount the root partition in read-write mode. -n tells mount
        # not to
        # write to the /etc/mtab file (because it can't do this. The
        # root
        # partition is most likely still mounted in read-only mode
        #

        echo -n "Remounting root file system in read-write mode..."
        /bin/mount -n -o remount,rw /
        evaluate_retval

        #
        # First empty the /etc/mtab file. Then remount root partition 
        # in read-write 
        # mode again but pass -f to mount. This way mount does
        # everything 
        # except the mount itself. This is needed for it to write to the
        # mtab 
        # file which contains a list of currently mounted file systems.
        #

        echo > /etc/mtab
        /bin/mount -f -o remount,rw /

        #
        # Remove the possible /fastboot and /forcefsck files. they are
        # only
        # supposed to be used during the next reboot's checkfs wich just
        # happened. If you want to fastboot or forcefsck again you'll
        # have to
        # recreate the files
        #

        /bin/rm -f /fastboot /forcefsck

        #
        # Walk through /etc/fstab and mount all file systems that don't 
        # have the noauto option set in the fs_mntops field (the 4th
        # field. 
        # See man fstab for more info)
        #

        echo -n "Mounting other file systems..."
        /bin/mount -a
        evaluate_retval
        ;;

    stop)

        #
        # Deactive all the swap partitions
        #

        echo -n "Deactivating swap..."
        /sbin/swapoff -a
        evaluate_retval

        #
        # And unmount all the file systems, mounting the root file
        # system
        # read-only (all are unmounted but because root can't be
        # unmounted 
        # at this point mount will automatically mount it read-only
        # which 
        # is what supposed to happen. This way no data can be written 
        # anymore from disk)
        #

        echo -n "Unmounting file systems..."
        /bin/umount -a -r
        evaluate_retval
        ;;

    *)
        echo "Usage: $0 {start|stop}"
        exit 1
    ;;
esac

# End /etc/init.d/mountfs
EOF
 
-----------------------------------------------------------------------------

7.10. Creating the reboot script

Create a new file /etc/init.d/reboot containing the following:


cat > reboot << "EOF"
#!/bin/sh
# Begin /etc/init.d/reboot

#
# Call reboot. See man halt for the meaning of the parameters
#


echo "System reboot in progress..."

/sbin/reboot -d -f -i

# End /etc/init.d/reboot
EOF
 
-----------------------------------------------------------------------------

7.11. Creating the sendsignals script

Create a new file /etc/init.d/sendsignals containing the following:


cat > sendsignals << "EOF"
#!/bin/sh
# Begin /etc/init.d/sendsignals

#
# Include the functions declared in the /etc/init.d/functions file
#

source /etc/init.d/functions

#
# Send all the remaining processes the TERM signal
#

echo -n "Sending all processes the TERM signal..."
/sbin/killall5 -15
evaluate_retval

#
# Send all the remaining process (after sending them the TERM signal
# before) the KILL signal.
#

echo -n "Sending all processes the KILL signal..."
/sbin/killall5 -9
evaluate_retval

# End /etc/init.d/sendsignals
EOF
 
-----------------------------------------------------------------------------

7.12. Creating the setclock script

The following script is only for real use when your hardware clock (also
known as BIOS or CMOS clock) isn't set to GMT time. The recommended setup is
setting your hardware clock to GMT and have the time converted to localtime
using the /etc/localtime symbolic link. But if you run an OS that doesn't
understand a clock set to GMT (most notable are Microsoft OS'es) you might
want to set your clock to localtime so that the time is properly displayed on
those OS'es. This script will reset the kernel time to the hardware clock
without converting the time using the /etc/localtime symlink.

If you want to use this script on your system even if you have your hardware
clock set to GMT, then change the UTC variable below to the value of 1.


cat > setclock << "EOF"
#!/bin/sh
# Begin /etc/init.d/setclock

#
# Include the functions declared in the /etc/init.d/functions file
# and include the variables from the /etc/sysconfig/clock file
#

source /etc/init.d/functions
source /etc/sysconfig/clock

#
# Right now we want to set the kernel clock according to the hardware
# clock, so we use the -hctosys parameter.
#

CLOCKPARAMS="--hctosys"

#
# If the UTC variable is set in the /etc/sysconfig/clock file, add the
# -u parameter as well which tells hwclock that the hardware clock is
# set to UTC time instead of local time.
#

case "$UTC" in
        yes|true|1)
                CLOCKPARAMS="$CLOCKPARAMS -u"
                ;;
esac

echo -n "Setting clock..."
/sbin/hwclock $CLOCKPARAMS
evaluate_retval

# End /etc/init.d/setclock
EOF
 
-----------------------------------------------------------------------------

7.12.1. Creating the /etc/sysconfig/clock file

Create a new file /etc/sysconfig/clock by running the following:


cat > /etc/sysconfig/clock << "EOF"
# Begin /etc/sysconfig/clock

UTC=1

# End /etc/sysconfig/clock
EOF
 

If your hardware clock (also known as BIOS or CMOS clock) is not set to GMT
time, than set the UTC variable in the /etc/sysconfig/clock file to the value
0 (zero).
-----------------------------------------------------------------------------

7.13. Creating the sysklogd script

Create a new file /etc/init.d/sysklogd containing the following:


cat > sysklogd << "EOF"
#!/bin/sh
# Begin /etc/init.d/sysklogd

#
# Include the functions declared in the /etc/init.d/functions file
#

source /etc/init.d/functions

case "$1" in
        start)
                echo -n "Starting system log daemon..."
                loadproc /usr/sbin/syslogd -m 0

                echo -n "Starting kernel log daemon..."
                loadproc /usr/sbin/klogd
                ;;

        stop)
                echo -n "Stopping kernel log daemon..."
                killproc klogd

                echo -n "Stopping system log daemon..."
                killproc syslogd
                ;;

        reload)
        echo -n "Reloading system log daemon configuration file..."
                reloadproc syslogd 1
                ;;

        restart)
                $0 stop
                /usr/bin/sleep 1
                $0 start
                ;;

        status)
                statusproc /usr/sbin/syslogd
                statusproc /usr/sbin/klogd
                ;;

        *)
                echo "Usage: $0 {start|stop|reload|restart|status}"
                exit 1
        ;;

esac

# End /etc/init.d/sysklogd
EOF
 
-----------------------------------------------------------------------------

7.14. Creating the template script

Create a new file /etc/init.d/template containing the following:


cat > template << "EOF"
#!/bin/sh
# Begin /etc/init.d/

#
# Include the functions declared in the /etc/init.d/functions file
#

source /etc/init.d/functions

case "$1" in
        start)
                echo -n "Starting ..."
                loadproc
                ;;

        stop)
                echo -n "Stopping ..."
                killproc
                ;;

        reload)
                echo -n "Reloading ..."
                reloadproc
                ;;

        restart)
                $0 stop
                /usr/bin/sleep 1
                $0 start
                ;;

        status)
                statusproc
                ;;

        *)
                echo "Usage: $0 {start|stop|reload|restart|status}"
                exit 1
        ;;

esac

# End /etc/init.d/
EOF
 
-----------------------------------------------------------------------------

7.15. Setting up symlinks and permissions

Give these files the proper permissions and create the necessary symlinks by
running the following commands. If you did not create the loadkeys and
setclock scripts, make sure you don't type them in the commands below.
   
   
   
    cd /etc/init.d &&
    chmod 754 rc rcS functions checkfs halt loadkeys mountfs reboot &&
    chmod 754 sendsignals setclock sysklogd template &&
    cd ../rc0.d &&
    ln -s ../init.d/sysklogd K900sysklogd &&
    ln -s ../init.d/sendsignals S800sendsignals &&
    ln -s ../init.d/mountfs S900mountfs &&
    ln -s ../init.d/halt S999halt &&
    cd ../rc6.d &&
    ln -s ../init.d/sysklogd K900sysklogd &&
    ln -s ../init.d/sendsignals S800sendsignals &&
    ln -s ../init.d/mountfs S900mountfs &&
    ln -s ../init.d/reboot S999reboot &&
    cd ../rcS.d &&
    ln -s ../init.d/checkfs S200checkfs &&
    ln -s ../init.d/mountfs S300mountfs &&
    ln -s ../init.d/setclock S400setclock &&
    ln -s ../init.d/loadkeys S500loadkeys &&
    cd ../rc1.d &&
    ln -s ../init.d/sysklogd K900sysklogd &&
    cd ../rc2.d &&
    ln -s ../init.d/sysklogd S100sysklogd &&
    cd ../rc3.d &&
    ln -s ../init.d/sysklogd S100sysklogd &&
    cd ../rc4.d &&
    ln -s ../init.d/sysklogd S100sysklogd &&
    cd ../rc5.d &&
    ln -s ../init.d/sysklogd S100sysklogd
     
   
-----------------------------------------------------------------------------
7.16. Creating the /etc/fstab file

In order for certain programs to be able to determine where certain
partitions are supposed to be mounted by default, the /etc/fstab file is
used. Create a new file /etc/fstab containing the following:


cat > /etc/fstab << "EOF"
# Begin /etc/fstab

/dev/<LFS-partition designation> / ext2 defaults 1 1
/dev/<swap-partition designation> swap swap defaults 0 0
proc /proc proc defaults 0 0

# End /etc/fstab
EOF
 

Replace <LFS-partition designation> and <swap-partition designation> with the
appropriate devices (/dev/hda5 and /dev/hda6 in my case).
-----------------------------------------------------------------------------

Chapter 8. Making the LFS system bootable

8.1. Introduction

This chapter will make LFS bootable. This chapter deals with building a new
kernel for our new LFS system and adding the proper entries to LILO so that
you can select to boot the LFS system at the LILO: prompt.
-----------------------------------------------------------------------------

8.2. Installing a kernel

A kernel is the heart of a Linux system. We could use the kernel image from
our normal system, but we might as well compile a new kernel from the most
recent kernel sources available.

Building the kernel involves a few steps: configuring it and compiling it.
There are a few ways to configure the kernel. If you don't like the way this
book does it, read the README file and find out what your other options are.
Run the following commands to build the kernel:
   
   
   
    cd /usr/src/linux &&
    make mrproper &&
    make menuconfig &&
    make dep &&
    make bzImage &&
    make modules &&
    make modules_install &&
    cp arch/i386/boot/bzImage /boot/lfskernel &&
    cp System.map /boot
     
   
-----------------------------------------------------------------------------
8.3. Adding an entry to LILO

In order to being able to boot from this partition, we need to update our /
etc/lilo.conf file. Add the following lines to lilo.conf by running:


cat >> /etc/lilo.conf << "EOF"
image=/boot/lfskernel
        label=lfs
        root=<partition>
        read-only
EOF
 

<partition> must be replaced by your partition's designation (which would be
/dev/hda5 in my case).

Now update the boot loader by running:
   
   
   
    /sbin/lilo
     
   
-----------------------------------------------------------------------------
8.4. Rebooting the system

Now that all software has been installed, bootscripts have been created, it's
time for you to reboot your computer. Shutdown your system with shutdown -r
now and reboot into LFS. After the reboot you will have a normal login prompt
like you have on your normal Linux system (unless you use XDM or some sort of
other Display Manger (like KDM - KDE's version of XDM).

One thing remains to be done and that's setting up networking. After you
rebooted and finished the next chapter of this book your LFS system is ready
for use and you can do with it whatever you want.
-----------------------------------------------------------------------------

Chapter 9. Setting up basic networking

9.1. Introduction

This chapter will setup basic networking. Although you might not be connected
to a network, Linux software uses network functions anyway. We'll be
installing at least the local loopback device and a network card as well if
applicable. Also the proper bootscripts will be created so that networking
will be enabled during boot time.
-----------------------------------------------------------------------------

9.2. Installing network software

9.2.1. Installing Netkit-base

Install Netkit-base by running the following commands:
   
   
            
    ./configure &&
    make &&
    make install &&
    cd etc.sample &&
    cp services protocols /etc
     
   
There are other files in the etc.sample directory which might be of interest
to you.
-----------------------------------------------------------------------------

9.2.2. Installing Net-tools

Edit the Makefile file and edit the CFLAGS variable if you want to add
compiler optimzations.

Install Net-tools by running the following commands:
   
   
   
    make &&
    make install
     
   
-----------------------------------------------------------------------------
9.3. Creating the /etc/init.d/localnet bootscript

Create a new file /etc/init.d/localnet containing the following:


cat > /etc/init.d/localnet << "EOF"
#!/bin/sh 
# Begin /etc/init.d/localnet

#
# Include the functions declared in the /etc/init.d/functions file
# and include the variables from the /etc/sysconfig/network file.
# 

source /etc/init.d/functions
source /etc/sysconfig/network

case "$1" in
        start)
                echo -n "Bringing up the loopback interface..."
                /sbin/ifconfig lo 127.0.0.1
                evaluate_retval

                echo -n "Setting up hostname..."
                /bin/hostname $HOSTNAME
                evaluate_retval
                ;;

        stop)
                echo -n "Bringing down the loopback interface..."
                /sbin/ifconfig lo down
                evaluate_retval
                ;;

        restart)
                $0 stop
                sleep 1
                $0 start
                ;;
        *)
                echo "Usage: $0: {start|stop|restart}"
                exit 1
                ;;
esac

# End /etc/init.d/localnet
EOF
 
-----------------------------------------------------------------------------

9.3.1. Setting up permissions and symlink

Set the proper file permissions and create the necessary symlink by running
the following commands:
   
   
   
    cd /etc/init.d &&
    chmod 754 localnet &&
    cd ../rcS.d &&
    ln -s ../init.d/localnet S100localnet
     
   
-----------------------------------------------------------------------------
9.4. Creating the /etc/sysconfig/network file

Create a new file /etc/sysconfig/network and put the hostname in it by
running:
   
   
   
    echo "HOSTNAME=lfs" > /etc/sysconfig/network
     
   
Replace "lfs" by the name you wish to call your computer. Please not that you
should not enter the FQDN (Fully Qualified Domain Name) here. That
information will be put in the /etc/hosts file later.
-----------------------------------------------------------------------------

9.5. Creating the /etc/hosts file

If you want to configure a network card, you have to decide on the
IP-address, FQDN and possible aliases for use in the /etc/hosts file. An
example is:
   
   
   
    <my-IP> myhost.mydomain.org aliases
     
   
Make sure the IP-address is in the private network IP-address range. Valid
ranges are:
   
   
   
    Class Networks
    A     10.0.0.0
    B     172.16.0.0 through 172.31.0.0
    C     192.168.0.0 through 192.168.255.0
     
   
A valid IP address could be 192.168.1.1. A valid FQDN for this IP could be
www.linuxfromscratch.org

If you're not going to use a network card, you still need to come up with a
FQDN. This is necessary for programs like Sendmail to operate correctly (in
fact; Sendmail won't run when it can't determine the FQDN).

If you don't configure a network card, create a new file /etc/hosts by
running:


cat > /etc/hosts << "EOF"
# Begin /etc/hosts (no network card version)

127.0.0.1 www.mydomain.com <value of HOSTNAME> localhost

# End /etc/hosts (no network card version)
EOF
 

If you do configure a network card, create a new file /etc/hosts containing:


cat > /etc/hosts << "EOF"
# Begin /etc/hosts (network card version)

127.0.0.1 localhost.localdomain localhost
192.168.1.1 www.mydomain.org <value of HOSTNAME>

# End /etc/hosts (network card version)
EOF
 

Of course, change the 192.168.1.1 and www.mydomain.org to your own liking (or
requirements if you are assigned an IP-address by a network/system
administrator and you plan on connecting this machine to that network).
-----------------------------------------------------------------------------

9.6. Creating the /etc/init.d/ethnet script

This section only applies if you are going to configure a network card. If
you're not, skip this section.

Create a new file /etc/init.d/ethnet containing the following:


cat > /etc/init.d/ethnet << "EOF"
#!/bin/sh
# Begin /etc/init.d/ethnet
#
# Main script by Gerard Beekmans - [email protected]
# GATEWAY check by Jean-François Le Ray - [email protected]
#

#
# Include the functions declared in the /etc/init.d/functions file
# and the variables from the /etc/sysconfig/network file.
#

source /etc/init.d/functions
source /etc/sysconfig/network

case "$1" in
        start)

#
# Obtain all the network card configuration files
#

        for interface in $(ls /etc/sysconfig/network-scripts/ifcfg* | \
            grep -v ifcfg-lo)
        do
#
# Load the variables from that file
#

            source $interface
#
# If the ONBOOT variable is set to yes, process this file and bring the
# interface down.
#

            if [ "$ONBOOT" == yes ]
            then
                echo -n "Bringing up the $DEVICE interface..."
                /sbin/ifconfig $DEVICE $IP broadcast $BROADCAST \
                    netmask $NETMASK
                evaluate_retval
            fi
        done

#
# If the /etc/sysconfig/network file contains a GATEWAY variable, set
# the gateway.

#

            if [ "$GATEWAY" != "" ]; then
                echo -n "Setting up routing for eth0 interface..."
                /sbin/route add default gw $GATEWAY metric 1
                evaluate_retval
            fi
                ;;

        stop)

#
# Obtain all the network card configuration files
#

        for interface in $(ls /etc/sysconfig/network-scripts/ifcfg* | \
            grep -v ifcfg-lo)
        do
#
# Load the variables from that file
#

            source $interface
#
# If the ONBOOT variable is set, process the file and bring the
# interface down
#

            if [ $ONBOOT == yes ]
            then
                echo -n "Bringing down the $DEVICE interface..."
                /sbin/ifconfig $DEVICE down
                evaluate_retval
            fi
        done
                ;;

        restart)
                $0 stop
                sleep 1
                $0 start
                ;;
        *)
                echo "Usage: $0 {start|stop|restart}"
                exit 1
                ;;
esac

# End /etc/init.d/ethnet
EOF
 
-----------------------------------------------------------------------------

9.6.1. Adding default gateway to /etc/sysconfig/network

If you require a default gateway to be setup, run the following command:


cat >> /etc/sysconfig/network << "EOF"
GATEWAY=192.168.1.2
EOF
 

Change GATEWAY to match your network setup.
-----------------------------------------------------------------------------

9.6.2. Creating NIC configuration files

Which interfaces are brought up and down by the ethnet script depends on the
files in the /etc/sysconfig/network-scripts directory. This directory should
contain files in the form of ifcfg-x where x is an identification number (or
whatever you choose to name it).

First create the network-scripts directory by running:
   
   
   
    mkdir /etc/sysconfig/network-scripts
     
   
Now, create new files in that directory containing the following. Example
file names are ifcfg-eth0, ifcfg-eth0:3 and ifcfg-eth1:2
   
   
   
    ONBOOT=yes
    DEVICE=eth0
    IP=192.168.1.1
    NETMASK=255.255.255.0
    BROADCAST=192.168.1.255
     
   
Of course, change the values of those four variables in every file to match
the proper setup. Usually NETMASK and BROADCAST will remain the same, just
the DEVICE IP variables will change per network interface. If the ONBOOT
variable is set to yes, the ethnet script will bring it up during boot up of
the system. If set to anything else but yes it will be ignored by the ethnet
script and thus not brought up.
-----------------------------------------------------------------------------

9.6.3. Setting up permissions and symlink

Set the proper file permissions and create the necessary symlink by running
the following commands:
   
   
   
    cd /etc/init.d &&
    chmod 754 ethnet &&
    cd ../rc3.d &&
    ln -s ../init.d/ethnet S200ethnet &&
    cd ../rc4.d &&
    ln -s ../init.d/ethnet S200ethnet &&
    cd ../rc5.d &&
    ln -s ../init.d/ethnet S200ethnet
     
   
III. Part III - Appendixes

Table of Contents
A. Package descriptions
    A.1. Introduction
    A.2. Glibc
    A.3. Linux kernel
    A.4. Ed
    A.5. Patch
    A.6. GCC
    A.7. Bison
    A.8. Mawk
    A.9. Findutils
    A.10. Ncurses
    A.11. Less
    A.12. Groff
    A.13. Man
    A.14. Perl
    A.15. M4
    A.16. Texinfo
    A.17. Autoconf
    A.18. Automake
    A.19. Bash
    A.20. Flex
    A.21. Binutils
    A.22. Bzip2
    A.23. Diffutils
    A.24. E2fsprogs
    A.25. File
    A.26. Fileutils
    A.27. Gettext
    A.28. Grep
    A.29. Gzip
    A.30. Ld.so
    A.31. Libtool
    A.32. Bin86
    A.33. Lilo
    A.34. Make
    A.35. Shellutils
    A.36. Shadow Password Suite
    A.37. Modutils
    A.38. Procinfo
    A.39. Procps
    A.40. Vim
    A.41. Psmisc
    A.42. Sed
    A.43. Sysklogd
    A.44. Sysvinit
    A.45. Tar
    A.46. Textutils
    A.47. Util Linux
    A.48. Console-tools
    A.49. Console-data
    A.50. Man-pages
   
   
B. Resources
    B.1. Introduction
    B.2. Books
    B.3. HOWTOs and Guides
    B.4. Other
   
   
C. Official download locations

-----------------------------------------------------------------------------
Appendix A. Package descriptions

A.1. Introduction

This appendix describes the following aspect of each and every package that
is installed in this book:

  * What every package contains
   
  * What every program from a package does
   

The packages are listed in the same order as they are installed in chapter 5
(Intel system) or chapter 11 (PPC systems).

Most information about these packages (especially the descriptions of it)
come from the man pages from those packages. I'm not going to print the
entire man page, just the core elements to make you understand what a program
does. If you want to know full details on a program, I suggest you start by
reading the complete man page in addition to this appendix.

You will also find that certain packages are documented more in depth than
others. The reason is that I just happen to know more about certain packages
than I know about others. If you have anything to add on the following
descriptions, please don't hesitate to email me. This list is going to
contain an in depth description of every package installed, but I can't do
this on my own. I have had help from various people but more help is needed.

Please note that currently only what a package does is described and not why
you need to install it. That will be added later.
-----------------------------------------------------------------------------

A.2. Glibc

A.2.1. Contents

The Glibc package contains the GNU C Library.
-----------------------------------------------------------------------------

A.2.2. Description

The C Library is a collection of commonly used functions in programs. This
way a programmer doens't need to create his own functions for every single
task. The most common things like writing a string to your screen are already
present and at the disposal of the programmer.

The C library (actually almost every library) come in two flavours: dynamic
ones and static ones. In short when a program uses a static C library, the
code from the C library will be copied into the executable file. When a
program uses a dynamic library, that executable will not contain the code
from the C library, but instead a routine that loads the functions from the
library at the time the program is run. This means a significant decrease in
the file size of a program. If you don't understand this concept, you better
read the documentation that comes with the C Library as it is too complicated
to explain here in one or two lines.
-----------------------------------------------------------------------------

A.3. Linux kernel

A.3.1. Contents

The Linux kernel package contains the Linux kernel.
-----------------------------------------------------------------------------

A.3.2. Description

The Linux kernel is at the core of every Linux system. It's what makes Linux
tick. When you turn on your computer and boot a Linux system, the very first
piece of Linux software that gets loaded is the kernel. The kernel
initializes the system's hardware components such as serial ports, parallel
ports, sound cards, network cards, IDE controllers, SCSI controllers and a
lot more. In a nutshell the kernel makes the hardware available so that the
software can run.
-----------------------------------------------------------------------------

A.4. Ed

A.4.1. Contents

The Ed package contains the ed program.
-----------------------------------------------------------------------------

A.4.2. Description

Ed is a line-oriented text editor. It is used to create, display, modify and
otherwise manipulate text files.
-----------------------------------------------------------------------------

A.5. Patch

A.5.1. Contents

The Patch package contains the patch program.
-----------------------------------------------------------------------------

A.5.2. Description

The patch program modifies a file according to a patch file. A patch file
usually is a list created by the diff program that contains instructions on
how an original file needs to be modified. Patch is used a lot for source
code patches since it saves time and space. Imagine you have a package that
is 1MB in size. The next version of that package only has changes in two
files of the first version. You can ship an entirely new package of 1MB or
provide a patch file of 1KB which will update the first version to make it
identical to the second version. So if you have downloaded the first version
already, a patch file can save you a second large download.
-----------------------------------------------------------------------------

A.6. GCC

A.6.1. Contents

The GCC package contains compilers, preprocessors and the GNU C++ Library.
-----------------------------------------------------------------------------

A.6.2. Description

A.6.2.1. Compiler

A compiler translates source code in text format to a format that a computer
understands. After a source code file is compiled into an object file, a
linker will create an executable file from one or more of these compiler
generated object files.
-----------------------------------------------------------------------------

A.6.2.2. Pre-processor

A pre-processor pre-processes a source file, such as including the contents
of header files into the source file. You generally don't do this yourself to
save yourself a lot of time. You just insert a line like #include <filename>.
The pre-processor file insert the contents of that file into the source file.
That's one of the things a pre-processor does.
-----------------------------------------------------------------------------

A.6.2.3. C++ Library

The C++ library is used by C++ programs. The C++ library contains functions
that are frequently used in C++ programs. This way the programmer doesn't
have to write certain functions (such as writing a string of text to the
screen) from scratch every time he creates a program.
-----------------------------------------------------------------------------

A.7. Bison

A.7.1. Contents

The Bison package contains the bison program.
-----------------------------------------------------------------------------

A.7.2. Description

Bison is a parser generator, a replacement for YACC. YACC stands for Yet
Another Compiler Compiler. What is Bison then? It is a program that generates
a program that analyses the structure of a textfile. Instead of writing the
actual program you specify how things should be connected and with those
rules a program is constructed that analyses the textfile.

There are alot of examples where structure is needed and one of them is the
calculator.

Given the string :
   
   
            1 + 2 * 3
   
You can easily come to the result 7. Why ? Because of the structure. You know
how to interpretet the string. The computer doesn't know that and Bison is a
tool to help it understand by presenting the string in the following way to
the compiler:
   
   
   
                +
               / \
              *   1
             / \
            2   3
   
You start at the bottom of a tree and you come across the numbers 2 and 3
which are joined by the multiplication symbol, so the computers multiplies 2
and 3. The result of that multiplication is remembered and the next thing
that the computer sees is the result of 2*3 and the number 1 which are joined
by the add symbol. Adding 1 to the previous result makes 7. In calculating
the most complex calculations can be broken down in this tree format and the
computer just starts at the bottom and works it's way up to the top and comes
with the correct answer. Of course, Bison isn't only used for calculators
alone.
-----------------------------------------------------------------------------

A.8. Mawk

A.8.1. Contents

The Mawk package contains the mawk program.
-----------------------------------------------------------------------------

A.8.2. Description

A.8.2.1. mawk

Mawk is an interpreter for the AWK Programming Language. The AWK language is
useful for manipulation of data files, text retrieval and processing, and for
prototyping and experimenting with algorithms.
-----------------------------------------------------------------------------

A.9. Findutils

A.9.1. Contents

The Findutils package contains the find, locate, updatedb and xargs programs.
-----------------------------------------------------------------------------

A.9.2. Description

A.9.2.1. Find

The find program searches for files in a directory hierarchy which match a
certain criteria. If no criteria is given, it lists all files in the current
directory and it's subdirectories.
-----------------------------------------------------------------------------

A.9.2.2. Locate

Locate scans a database which contain all files and directories on a
filesystem. This program lists the files and directories in this database
matching a certain criteria. If you're looking for a file this program will
scan the database and tell you exactly where the files you requested are
located. This only makes sense if your locate database is fairly up-to-date
else it will provide you with out-of-date information.
-----------------------------------------------------------------------------

A.9.2.3. Updatedb

The updatedb program updates the locate database. It scans the entire file
system (including other file system that are currently mounted unless you
specify it not to) and puts every directory and file it finds into the
database that's used by the locate program which retrieves this information.
It's a good practice to update this database once a day so that you are
ensured of a database that is up-to-date.
-----------------------------------------------------------------------------

A.9.2.4. Xargs

The xargs command applies a command to a list of files. If you need to
perform the same command on multiple files, you can create a file that
contains all these files (one per line) and use xargs to perform that command
on the list.
-----------------------------------------------------------------------------

A.10. Ncurses

A.10.1. Contents

The Ncurses package contains the ncurses, panel, menu and form libraries. It
also contains the tic, infocmp, clear, tput, toe and tset programs.
-----------------------------------------------------------------------------

A.10.2. Description

A.10.2.1. The libraries

The libraries that make up the Ncurses library are used to display text
(often in a fancy way) on your screen. An example where ncurses is used is in
the kernel's "make menuconfig" process. The libraries contain routines to
create panels, menu's, form and general text display routines.
-----------------------------------------------------------------------------

A.10.2.2. Tic

Tic is the terminfo entry-description compiler. The program translates a
terminfo file from source format into the binary format for use with the
ncurses library routines. Terminfo files contain information about the
capabilities of your terminal.
-----------------------------------------------------------------------------

A.10.2.3. Infocmp

The infocmp program can be used to compare a binary terminfo entry with other
terminfo entries, rewrite a terminfo description to take advantage of the use
= terminfo field, or print out a terminfo description from the binary file
(term) in a variety of formats (the opposite of what tic does).
-----------------------------------------------------------------------------

A.10.2.4. clear

The clear program clears your screen if this is possible. It looks in the
environment for the terminal type and then in the terminfo database to figure
out how to clear the screen.
-----------------------------------------------------------------------------

A.10.2.5. tput

The tput program uses the terminfo database to make the values of
terminal-dependent capabilities and information available to the shell, to
initialize or reset the terminal, or return the long name of the requested
terminal type.
-----------------------------------------------------------------------------

A.10.2.6. toe

The toe program lists all available terminal types by primary name with
descriptions.
-----------------------------------------------------------------------------

A.10.2.7. tset

The Tset program initializes terminals so they can be used, but it's not
widely used anymore. It's provided for 4.4BSD compatibility.
-----------------------------------------------------------------------------

A.11. Less

A.11.1. Contents

The Less package contains the less program
-----------------------------------------------------------------------------

A.11.2. Description

The less program is a file pager (or text viewer). It displays the contents
of a file with the ability to scroll. Less is an improvement on the common
pager called "more". Less has the ability to scroll backwards through files
as well and it doesn't need to read the entire file when it starts, which
makes it faster when you are reading large files.
-----------------------------------------------------------------------------

A.12. Groff

A.12.1. Contents

The Groff packages contains the addftinfo, afmtodit, eqn, grodvi, groff,
grog, grohtml, grolj4, grops, grotty, hpftodit, indxbib, lkbib, lookbib,
neqn, nroff, pfbtops, pic, psbb, refer, soelim, tbl, tfmtodit and troff
programs.
-----------------------------------------------------------------------------

A.12.2. Description

A.12.2.1. addftinfo

addftinfo reads a troff font file and adds some additional font-metric
information that is used by the groff system.
-----------------------------------------------------------------------------

A.12.2.2. afmtodit

afmtodit creates a font file for use with groff and grops.
-----------------------------------------------------------------------------

A.12.2.3. eqn

eqn compiles descriptions of equations embedded within troff input files into
commands that are understood by troff.
-----------------------------------------------------------------------------

A.12.2.4. grodvi

grodvi is a driver for groff that produces TeX dvi format.
-----------------------------------------------------------------------------

A.12.2.5. groff

groff is a front-end to the groff document formatting system. Normally it
runs the troff program and a postprocessor appropriate for the selected
device.
-----------------------------------------------------------------------------

A.12.2.6. grog

grog reads files and guesses which of the groff options -e, -man, -me, -mm,
-ms, -p, -s, and -t are required for printing files, and prints the groff
command including those options on the standard output.
-----------------------------------------------------------------------------

A.12.2.7. grohtml

grohtml translates the output of GNU troff to html
-----------------------------------------------------------------------------

A.12.2.8. grolj4

grolj4 is a driver for groff that produces output in PCL5 format suitable for
an HP Laserjet 4 printer.
-----------------------------------------------------------------------------

A.12.2.9. grops

grops translates the output of GNU troff to PostScript.
-----------------------------------------------------------------------------

A.12.2.10. grotty

grotty translates the output of GNU troff into a form suitable for
typewriter-like devices.
-----------------------------------------------------------------------------

A.12.2.11. hpftodit

hpftodit creates a font file for use with groff -Tlj4 from an HP tagged font
metric file.
-----------------------------------------------------------------------------

A.12.2.12. indxbib

indxbib makes an inverted index for the bibliographic databases a specified
file for use with refer, lookbib, and lkbib.
-----------------------------------------------------------------------------

A.12.2.13. lkbib

lkbib searches bibliographic databases for references that contain specified
keys and prints any references found on the standard output.
-----------------------------------------------------------------------------

A.12.2.14. lookbib

lookbib prints a prompt on the standard error (unless the standard input is
not a terminal), reads from the standard input a line containing a set of
keywords, searches the bibliographic databases in a specified file for
references containing those keywords, prints any references found on the
standard output, and repeats this process until the end of input.
-----------------------------------------------------------------------------

A.12.2.15. neqn

It is currently not known what neqn is and what it does.
-----------------------------------------------------------------------------

A.12.2.16. nroff

The nroff script emulates the nroff command using groff.
-----------------------------------------------------------------------------

A.12.2.17. pfbtops

pfbtops translates a PostScript font in .pfb format to ASCII.
-----------------------------------------------------------------------------

A.12.2.18. pic

pic compiles descriptions of pictures embedded within troff or TeX input
files into commands that are understood by TeX or troff.
-----------------------------------------------------------------------------

A.12.2.19. psbb

psbb reads a file which should be a PostScript document conforming to the
Document Structuring conventions and looks for a %%BoundingBox comment.
-----------------------------------------------------------------------------

A.12.2.20. refer

refer copies the contents of a file to the standard output, except that lines
between .[ and .] are interpreted as citations, and lines between .R1 and .R2
are interpreted as commands about how citations are to be processed.
-----------------------------------------------------------------------------

A.12.2.21. soelim

soelim reads files and replaces lines of the form .so file by the contents of
file.
-----------------------------------------------------------------------------

A.12.2.22. tbl

tbl compiles descriptions of tables embedded within troff input files into
commands that are understood by troff.
-----------------------------------------------------------------------------

A.12.2.23. tfmtodit

tfmtodit creates a font file for use with groff -Tdvi
-----------------------------------------------------------------------------

A.12.2.24. troff

troff is highly compatible with Unix troff. Usually it should be invoked
using the groff command, which will also run preprocessors and postprocessors
in the appropriate order and with the appropriate options.
-----------------------------------------------------------------------------

A.13. Man

A.13.1. Contents

The Man package contains the man, apropos whatis and makewhatis programs.
-----------------------------------------------------------------------------

A.13.2. Description

A.13.2.1. man

man formats and displays the on-line manual pages.
-----------------------------------------------------------------------------

A.13.2.2. apropos

apropos searches a set of database files containing short descriptions of
system commands for keywords and displays the result on the standard output.
-----------------------------------------------------------------------------

A.13.2.3. whatis

whatis searches a set of database files containing short descriptions of
system commands for keywords and displays the result on the standard output.
Only complete word matches are displayed.
-----------------------------------------------------------------------------

A.13.2.4. makewhatis

makewhatis reads all the manual pages contained in given sections of manpath
or the preformatted pages contained in the given sections of catpath. For
each page, it writes a line in the whatis database; each line consists of the
name of the page and a short description, separated by a dash. The
description is extracted using the content of the NAME section of the manual
page.
-----------------------------------------------------------------------------

A.14. Perl

A.14.1. Contents

The Perl package contains Perl - Practical Extraction and Report Language
-----------------------------------------------------------------------------

A.14.2. Description

Perl combines the features and capabilities of C, awk, sed and sh into one
powerful programming language.
-----------------------------------------------------------------------------

A.15. M4

A.15.1. Contents

The M4 package contains the M4 processor
-----------------------------------------------------------------------------

A.15.2. Description

M4 is a macro processor. It copies input to output expanding macros as it
goes. Macros are either builtin or user-defined and can take any number of
arguments. Besides just doing macro expansion m4 has builtin functions for
including named files, running UNIX commands, doing integer arithmetic,
manipulating text in various ways, recursion, etc. M4 can be used either as a
front-end to a compiler or as a macro processor in its own right.
-----------------------------------------------------------------------------

A.16. Texinfo

A.16.1. Contents

The Texinfo package contains the info, install-info, makeinfo, texi2dvi and
texindex programs
-----------------------------------------------------------------------------

A.16.2. Description

A.16.2.1. info

The info program reads Info documents, usually contained in your /usr/doc/
info directory. Info documents are like man(ual) pages, but they tend to be
more in depth than just explaining the options to a program.
-----------------------------------------------------------------------------

A.16.2.2. install-info

The install-info program updates the info entries. When you run the info
program a list with available topics (ie: available info documents) will be
presented. The install-info program is used to maintain this list of
available topics. If you decice to remove info files manually, you need to
delete the topic in the index file as well. This program is used for that. It
also works the other way around when you add info documents.
-----------------------------------------------------------------------------

A.16.2.3. makeinfo

The makeinfo program translates Texinfo source documents into various
formats. Available formats are: info files, plain text and HTML.
-----------------------------------------------------------------------------

A.16.2.4. texi2dvi

The texi2dvi program prints Texinfo documents
-----------------------------------------------------------------------------

A.16.2.5. texindex

The texindex program is used to sort Texinfo index files.
-----------------------------------------------------------------------------

A.17. Autoconf

A.17.1. Contents

The Autoconf package contains the autoconf, autoheader, autoreconf, autoscan,
autoupdate and ifnames programs
-----------------------------------------------------------------------------

A.17.2. Description

A.17.2.1. autoconf

Autoconf is a tool for producing shell scripts that automatically configure
software source code packages to adapt to many kinds of UNIX-like systems.
The configuration scripts produced by Autoconf are independent of Autoconf
when they are run, so their users do not need to have Autoconf.
-----------------------------------------------------------------------------

A.17.2.2. autoheader

The autoheader program can create a template file of C #define statements for
configure to use
-----------------------------------------------------------------------------

A.17.2.3. autoreconf

If you have a lot of Autoconf-generated configure scripts, the autoreconf
program can save you some work. It runs autoconf (and autoheader, where
appropriate) repeatedly to remake the Autoconf configure scripts and
configuration header templates in the directory tree rooted at the current
directory.
-----------------------------------------------------------------------------

A.17.2.4. autoscan

The autoscan program can help you create a configure.in file for a software
package. autoscan examines source files in the directory tree rooted at a
directory given as a command line argument, or the current directory if none
is given. It searches the source files for common portability problems and
creates a file configure.scan which is a preliminary configure.in for that
package.
-----------------------------------------------------------------------------

A.17.2.5. autoupdate

The autoupdate program updates a configure.in file that calls Autoconf macros
by their old names to use the current macro names.
-----------------------------------------------------------------------------

A.17.2.6. ifnames

ifnames can help when writing a configure.in for a software package. It
prints the identifiers that the package already uses in C preprocessor
conditionals. If a package has already been set up to have some portability,
this program can help you figure out what its configure needs to check for.
It may help fill in some gaps in a configure.in generated by autoscan.
-----------------------------------------------------------------------------

A.18. Automake

A.18.1. Contents

The Automake package contains the aclocal and automake programs
-----------------------------------------------------------------------------

A.18.2. Description

A.18.2.1. aclocal

Automake includes a number of Autoconf macros which can be used in your
package; some of them are actually required by Automake in certain
situations. These macros must be defined in your aclocal.m4; otherwise they
will not be seen by autoconf.

The aclocal program will automatically generate aclocal.m4 files based on the
contents of configure.in. This provides a convenient way to get
Automake-provided macros, without having to search around. Also, the aclocal
mechanism is extensible for use by other packages.
-----------------------------------------------------------------------------

A.18.2.2. automake

To create all the Makefile.in's for a package, run the automake program in
the top level directory, with no arguments. automake will automatically find
each appropriate Makefile.am (by scanning configure.in) and generate the
corresponding Makefile.in.
-----------------------------------------------------------------------------

A.19. Bash

A.19.1. Contents

The Bash package contains the bash program
-----------------------------------------------------------------------------

A.19.2. Description

Bash is the Bourne-Again SHell, which is a widely used command interpreter on
Unix systems. Bash is a program that reads from standard input, the keyboard.
You type something and the program will evaluate what you have typed and do
something with it, like running a program.
-----------------------------------------------------------------------------

A.20. Flex

A.20.1. Contents

The Flex package contains the flex program
-----------------------------------------------------------------------------

A.20.2. Description

Flex is a tool for generating programs which regognize patterns in text.
Pattern recognition is very useful in many applications. You set up rules
what to look for and flex will make a program that looks for those patterns.
The reason people use flex is that it is much easier to set up rules for what
to look for than to write the actual program that finds the text.
-----------------------------------------------------------------------------

A.21. Binutils

A.21.1. Description

The Binutils package contains the ld, as, ar, nm, objcopy, objdump, ranlib,
size, strings, strip, c++filt, addr2line and nlmconv programs
-----------------------------------------------------------------------------

A.21.2. Description

A.21.2.1. ld

ld combines a number of object and archive files, relocates their data and
ties up symbol references. Often the last step in building a new compiled
program to run is a call to ld.
-----------------------------------------------------------------------------

A.21.2.2. as

as is primarily intended to assemble the output of the GNU C compiler gcc for
use by the linker ld.
-----------------------------------------------------------------------------

A.21.2.3. ar

The ar program creates, modifies, and extracts from archives. An archive is a
single file holding a collection of other files in a structure that makes it
possible to retrieve the original individual files (called members of the
archive).
-----------------------------------------------------------------------------

A.21.2.4. nm

nm lists the symbols from object files.
-----------------------------------------------------------------------------

A.21.2.5. objcopy

objcopy utility copies the contents of an object file to another. objcopy
uses the GNU BFD Library to read and write the object files. It can write the
destination object file in a format different from that of the source object
file.
-----------------------------------------------------------------------------

A.21.2.6. objdump

objdump displays information about one or more object files. The options
control what particular information to display. This information is mostly
useful to programmers who are working on the compilation tools, as opposed to
programmers who just want their program to compile and work.
-----------------------------------------------------------------------------

A.21.2.7. ranlib

ranlib generates an index to the contents of an archive, and stores it in the
archive. The index lists each symbol defined by a member of an archive that
is a relocatable object file.
-----------------------------------------------------------------------------

A.21.2.8. size

size lists the section sizes --and the total size-- for each of the object
files objfile in its argument list. By default, one line of output is
generated for each object file or each module in an archive.
-----------------------------------------------------------------------------

A.21.2.9. strings

For each file given, strings prints the printable character sequences that
are at least 4 characters long (or the number specified with an option to the
program) and are followed by an unprintable character. By default, it only
prints the strings from the initialized and loaded sections of object files;
for other types of files, it prints the strings from the whole file.

strings is mainly useful for determining the contents of non-text files.
-----------------------------------------------------------------------------

A.21.2.10. strip

strip discards all or specific symbols from object files. The list of object
files may include archives. At least one object file must be given. strip
modifies the files named in its argument, rather than writing modified copies
under different names.
-----------------------------------------------------------------------------

A.21.2.11. c++filt

The C++ language provides function overloading, which means that you can
write many functions with the same name (providing each takes parameters of
different types). All C++ function names are encoded into a low-level
assembly label (this process is known as mangling). The c++filt program does
the inverse mapping: it decodes (demangles) low-level names into user-level
names so that the linker can keep these overloaded functions from clashing.
-----------------------------------------------------------------------------

A.21.2.12. addr2line

addr2line translates program addresses into file names and line numbers.
Given an address and an executable, it uses the debugging information in the
executable to figure out which file name and line number are associated with
a given address.
-----------------------------------------------------------------------------

A.21.2.13. nlmconv

nlmconv converts relocatable object files into the NetWare Loadable Module
files, optionally reading header files for NLM header information.
-----------------------------------------------------------------------------

A.22. Bzip2

A.22.1. Contents

The Bzip2 packages contains the bzip2, bunzip2, bzcat and bzip2recover
programs.
-----------------------------------------------------------------------------

A.22.2. Description

A.22.2.1. Bzip2

bzip2 compresses files using the Burrows-Wheeler block sorting text
compression algorithm, and Huffman coding. Compression is generally
considerably better than that achieved by more conventional LZ77/LZ78-based
compressors, and approaches the performance of the PPM family of statistical
compressors.
-----------------------------------------------------------------------------

A.22.2.2. Bunzip2

Bunzip2 decompresses files that are compressed with bzip2.
-----------------------------------------------------------------------------

A.22.2.3. bzcat

bzcat (or bzip2 -dc) decompresses all specified files to the standard output.
-----------------------------------------------------------------------------

A.22.2.4. bzip2recover

bzip2recover recovers data from damaged bzip2 files.
-----------------------------------------------------------------------------

A.23. Diffutils

A.23.1. Contents

The Diffutils package contains the cmp, diff, diff3 and sdiff programs.
-----------------------------------------------------------------------------

A.23.2. Description

A.23.2.1. cmp and diff

cmp and diff both compare two files and report their differences. Both
programs have extra options which compare files in different situations.
-----------------------------------------------------------------------------

A.23.2.2. diff3

The difference between diff and diff3 is that diff comprares 2 files, diff3
compares 3 files.
-----------------------------------------------------------------------------

A.23.2.3. sdiff

sdiff merges two two files and interactively outputs the results.
-----------------------------------------------------------------------------

A.24. E2fsprogs

A.24.1. Contents

The e2fsprogs package contains the chattr, lsattr, uuidgen, badblocks,
debugfs, dumpe2fs, e2fsck, e2label, fsck, fsck.ext2, mke2fs, mkfs.ext2,
mklost+found and tune2fs programs.
-----------------------------------------------------------------------------

A.24.2. Description

A.24.2.1. chattr

chattr changes the file attributes on a Linux second extended file system.
-----------------------------------------------------------------------------

A.24.2.2. lsattr

lsattr lists the file attributes on a second extended file system.
-----------------------------------------------------------------------------

A.24.2.3. uuidgen

The uuidgen program creates a new universally unique identifier (UUID) using
the libuuid library. The new UUID can reasonably be considered unique among
all UUIDs created on the local system, and among UUIDs created on other
systems in the past and in the future.
-----------------------------------------------------------------------------

A.24.2.4. badblocks

badblocks is used to search for bad blocks on a device (usually a disk
partition).
-----------------------------------------------------------------------------

A.24.2.5. debugfs

The debugfs program is a file system debugger. It can be used to examine and
change the state of an ext2 file system.
-----------------------------------------------------------------------------

A.24.2.6. dumpe2fs

dumpe2fs prints the super block and blocks group information for the
filesystem present on a specified device.
-----------------------------------------------------------------------------

A.24.2.7. e2fsck and fsck.ext2

e2fsck is used to check a Linux second extended file system. fsck.ext2 does
the same as e2fsck.
-----------------------------------------------------------------------------

A.24.2.8. e2label

e2label will display or change the filesystem label on the ext2 filesystem
located on the specified device.
-----------------------------------------------------------------------------

A.24.2.9. fsck

fsck is used to check and optionally repair a Linux file system.
-----------------------------------------------------------------------------

A.24.2.10. mke2fs and mkfs.ext2

mke2fs is used to create a Linux second extended file system on a device
(usually a disk partition). mkfs.ext2 does the same as mke2fs.
-----------------------------------------------------------------------------

A.24.2.11. mklost+found

mklost+found is used to create a lost+found directory in the current working
directory on a Linux second extended file system. mklost+found pre-allocates
disk blocks to the directory to make it usable by e2fsck.
-----------------------------------------------------------------------------

A.24.2.12. tune2fs

tune2fs adjusts tunable filesystem parameters on a Linux second extended
filesystem.
-----------------------------------------------------------------------------

A.25. File

A.25.1. Contents

The File package contains the file program.
-----------------------------------------------------------------------------

A.25.2. Description

File tests each specified file in an attempt to classify it. There are three
sets of tests, performed in this order: filesystem tests, magic number tests,
and language tests. The first test that succeeds causes the file type to be
printed.
-----------------------------------------------------------------------------

A.26. Fileutils

A.26.1. Contents

The Fileutils package contains the chgrp, chmod, chown, cp, dd, df, dir,
dircolors, du, install, ln, ls, mkdir, mkfifo, mknod, mv, rm, rmdir, sync,
touch and vdir programs.
-----------------------------------------------------------------------------

A.26.2. Description

A.26.2.1. chgrp

chgrp changes the group ownership of each given file to the named group,
which can be either a group name or a numeric group ID.
-----------------------------------------------------------------------------

A.26.2.2. chmod

chmod changes the permissions of each given file according to mode, which can
be either a symbolic representation of changes to make, or an octal number
representing the bit pattern for the new permissions.
-----------------------------------------------------------------------------

A.26.2.3. chown

chown changes the user and/or group ownership of each given file.
-----------------------------------------------------------------------------

A.26.2.4. cp

cp copies files from one place to another.
-----------------------------------------------------------------------------

A.26.2.5. dd

dd copies a file (from the standard input to the standard output, by default)
with a user-selectable blocksize, while optionally performing conversions on
it.
-----------------------------------------------------------------------------

A.26.2.6. df

df displays the amount of disk space available on the filesystem containing
each file name argument. If no file name is given, the space available on all
currently mounted filesystems is shown.
-----------------------------------------------------------------------------

A.26.2.7. ls, dir and vdir

dir and vdir are versions of ls with different default output formats. These
programs list each given file or directory name. Directory contents are
sorted alphabetically. For ls, files are by default listed in columns, sorted
vertically, if the standard output is a terminal; otherwise they are listed
one per line. For dir, files are by default listed in columns, sorted
vertically. For vdir, files are by default listed in long format.
-----------------------------------------------------------------------------

A.26.2.8. dircolors

dircolors outputs commands to set the LS_COLOR environment variable. The
LS_COLOR variable is use to change the default color scheme used by ls and
related utilities.
-----------------------------------------------------------------------------

A.26.2.9. du

du displays the amount of disk space used by each argument and for each
subdirectory of directory arguments.
-----------------------------------------------------------------------------

A.26.2.10. install

install copies files and sets their permission modes and, if possible, their
owner and group.
-----------------------------------------------------------------------------

A.26.2.11. ln

ln makes hard or soft (symbolic) links between files.
-----------------------------------------------------------------------------

A.26.2.12. mkdir

mkdir creates directories with a given name.
-----------------------------------------------------------------------------

A.26.2.13. mkfifo

mkfifo creates a FIFO with each given name.
-----------------------------------------------------------------------------

A.26.2.14. mknod

mknod creates a FIFO, character special file, or block special file with the
given file name.
-----------------------------------------------------------------------------

A.26.2.15. mv

mv moves files from one directory to another or renames files, depending on
the arguments given to mv.
-----------------------------------------------------------------------------

A.26.2.16. rm

rm removes files or directories.
-----------------------------------------------------------------------------

A.26.2.17. rmdir

rmdir removes directories, if they are empty.
-----------------------------------------------------------------------------

A.26.2.18. sync

sync forces changed blocks to disk and updates the super block.
-----------------------------------------------------------------------------

A.26.2.19. touch

touch changes the access and modification times of each given file to the
current time. Files that do not exist are created empty.
-----------------------------------------------------------------------------

A.27. Gettext

A.27.1. Contents

The gettext package contains the gettext, gettextize, msgcmp, msgcomm,
msgfmt, msgmerge, msgunfmt and xgettext programs.
-----------------------------------------------------------------------------

A.27.2. Description

A.27.2.1. gettext

The gettext package is used for internationalization (also known as i18n) and
for localization (also known as l10n). Programs can be compiled with Native
Language Support (NLS) which enable them to output messages in your native
language rather than in the default English language.
-----------------------------------------------------------------------------

A.28. Grep

A.28.1. Contents

The grep package contains the egrep, fgrep and grep programs.
-----------------------------------------------------------------------------

A.28.2. Description

A.28.2.1. egrep

egrep prints lines from files matching an extended regular expression
pattern.
-----------------------------------------------------------------------------

A.28.2.2. fgrep

fgrep prints lines from files matching a list of fixed strings, separated by
newlines, any of which is to be matched.
-----------------------------------------------------------------------------

A.28.2.3. grep

grep prints lines from files matching a basic regular expression pattern.
-----------------------------------------------------------------------------

A.29. Gzip

A.29.1. Contents

The Gzip package contains the compress, gunzip, gzexe, gzip, uncompress,
zcat, zcmp, zdiff, zforece, zgrep, zmore and znew programs.
-----------------------------------------------------------------------------

A.29.2. Description

A.29.2.1. gunzip

gunzip decompresses files that are compressed with gzip.
-----------------------------------------------------------------------------

A.29.2.2. gzexe

gzexe allows you to compress executables in place and have them automatically
uncompress and execute when you run them (at a penalty in performance).
-----------------------------------------------------------------------------

A.29.2.3. gzip

gzip reduces the size of the named files using Lempel-Ziv coding (LZ77).
-----------------------------------------------------------------------------

A.29.2.4. zcat

zcat uncompresses either a list of files on the command line or its standard
input and writes the uncompressed data on standard output
-----------------------------------------------------------------------------

A.29.2.5. zcmp

zcmp invokes the cmp program on compressed files.
-----------------------------------------------------------------------------

A.29.2.6. zdiff

zdiff invokes the diff program on compressed files.
-----------------------------------------------------------------------------

A.29.2.7. zforce

zforce forces a .gz extension on all gzip files so that gzip will not
compress them twice. This can be useful for files with names truncated after
a file transfer.
-----------------------------------------------------------------------------

A.29.2.8. zgrep

zgrep invokes the grep program on compressed files.
-----------------------------------------------------------------------------

A.29.2.9. zmore

Zmore is a filter which allows examination of compressed or plain text files
one screenful at a time on a soft-copy terminal (similar to the more
program).
-----------------------------------------------------------------------------

A.29.2.10. znew

Znew recompresses files from .Z (compress) format to .gz (gzip) format.
-----------------------------------------------------------------------------

A.30. Ld.so

A.30.1. Contents

From the Ld.so package we're using the ldconfig and ldd programs.
-----------------------------------------------------------------------------

A.30.2. Description

A.30.2.1. ldconfig

ldconfig creates the necessary links and cache (for use by the run-time
linker, ld.so) to the most recent shared libraries found in the directories
specified on the command line, in the file /etc/ld.so.conf, and in the
trusted directories (/usr/lib and /lib). ldconfig checks the header and file
names of the libraries it encounters when determining which versions should
have their links updated.
-----------------------------------------------------------------------------

A.30.2.2. ldd

ldd prints the shared libraries required by each program or shared library
specified on the command line.
-----------------------------------------------------------------------------

A.31. Libtool

A.31.1. Contents

The Libtool package contains the libtool and libtoolize programs. It also
contains the ltdl library.
-----------------------------------------------------------------------------

A.31.2. Description

A.31.2.1. libtool

Libtool provides generalized library-building support services.
-----------------------------------------------------------------------------

A.31.2.2. libtoolize

libtoolize provides a standard way to add libtool support to your package.
-----------------------------------------------------------------------------

A.31.2.3. ltdl library

Libtool provides a small library, called `libltdl', that aims at hiding the
various difficulties of dlopening libraries from programmers.
-----------------------------------------------------------------------------

A.32. Bin86

A.32.1. Contents

The Bin86 contains the as86, as86_encap, ld86, objdump86, nm86 and size86
programs.
-----------------------------------------------------------------------------

A.32.2. Description

A.32.2.1. as86

as86 is an assembler for the 8086...80386 processors.
-----------------------------------------------------------------------------

A.32.2.2. as86_encap

as86_encap is a shell script to call as86 and convert the created binary into
a C file prog.v to be included in or linked with programs like boot block
installers.
-----------------------------------------------------------------------------

A.32.2.3. ld86

ld86 understands only the object files produced by the as86 assembler, it can
link them into either an impure or a separate I&D executable.
-----------------------------------------------------------------------------

A.32.2.4. objdump86

No description available.
-----------------------------------------------------------------------------

A.32.2.5. nm86

No description available.
-----------------------------------------------------------------------------

A.32.2.6. size86

No description available.
-----------------------------------------------------------------------------

A.33. Lilo

A.33.1. Contents

The Lilo package contains the lilo program.
-----------------------------------------------------------------------------

A.33.2. Description

lilo installs the Linux boot loader which is used to start a Linux system.
-----------------------------------------------------------------------------

A.34. Make

A.34.1. Contents

The Make package contains the make program.
-----------------------------------------------------------------------------

A.34.2. Description

make determine automatically which pieces of a large program need to be
recompiled, and issue the commands to recompile them.
-----------------------------------------------------------------------------

A.35. Shellutils

A.35.1. Contents

The Shellutils package contains the basename, chroot, date, dirname, echo,
env, expr, factor, false, groups, hostid, hostname, id, logname, nice, nohup,
pathchk, pinky, printenv, printf, pwd, seq, sleep, stty, su, tee, test, true,
tty, uname, uptime, users, who, whoami and yes programs.
-----------------------------------------------------------------------------

A.35.2. Description

A.35.2.1. basename

basename strips directory and suffixes from filenames.
-----------------------------------------------------------------------------

A.35.2.2. chroot

chroot runs a command or interactive shell with special root directory.
-----------------------------------------------------------------------------

A.35.2.3. date

date displays the current time in a specified format, or sets the system
date.
-----------------------------------------------------------------------------

A.35.2.4. dirname

dirname strips non-directory suffixes from file name.
-----------------------------------------------------------------------------

A.35.2.5. echo

echo displays a line of text.
-----------------------------------------------------------------------------

A.35.2.6. env

env runs a program in a modified environment.
-----------------------------------------------------------------------------

A.35.2.7. expr

expr evaluates expressions.
-----------------------------------------------------------------------------

A.35.2.8. factor

factor prints the prime factors of all specified integer numbers.
-----------------------------------------------------------------------------

A.35.2.9. false

false always exits with a status code indicating failure.
-----------------------------------------------------------------------------

A.35.2.10. groups

groups prints the groups a user is in.
-----------------------------------------------------------------------------

A.35.2.11. hostid

hostid prints the numeric identifier (in hexadecimal) for the current host.
-----------------------------------------------------------------------------

A.35.2.12. hostname

hostname sets or prints the name of the current host system
-----------------------------------------------------------------------------

A.35.2.13. id

id prints the real and effective UIDs and GIDs of a user or the current user.
-----------------------------------------------------------------------------

A.35.2.14. logname

logname prints the current user's login name.
-----------------------------------------------------------------------------

A.35.2.15. nice

nice runs a program with modified scheduling priority.
-----------------------------------------------------------------------------

A.35.2.16. nohup

nohup runs a command immune to hangups, with output to a non-tty
-----------------------------------------------------------------------------

A.35.2.17. pathchk

pathchk checks whether file names are valid or portable.
-----------------------------------------------------------------------------

A.35.2.18. pinky

pinky is a lightweight finger utility which retrieves information about a
certain user
-----------------------------------------------------------------------------

A.35.2.19. printenv

printenv prints all or part of the environment.
-----------------------------------------------------------------------------

A.35.2.20. printf

printf formats and print data (the same as the printf C function).
-----------------------------------------------------------------------------

A.35.2.21. pwd

pwd prints the name of the current/working directory
-----------------------------------------------------------------------------

A.35.2.22. seq

seq prints numbers in a certain range with a certain increment.
-----------------------------------------------------------------------------

A.35.2.23. sleep

sleep delays for a specified amount of time.
-----------------------------------------------------------------------------

A.35.2.24. stty

stty changes and prints terminal line settings.
-----------------------------------------------------------------------------

A.35.2.25. su

su runs a shell with substitute user and group IDs
-----------------------------------------------------------------------------

A.35.2.26. tee

tee reads from standard input and write to standard output and files.
-----------------------------------------------------------------------------

A.35.2.27. test

test checks file types and compares values.
-----------------------------------------------------------------------------

A.35.2.28. true

True always exitx with a status code indicating success.
-----------------------------------------------------------------------------

A.35.2.29. tty

tty prints the file name of the terminal connected to standard input.
-----------------------------------------------------------------------------

A.35.2.30. uname

uname prints system information.
-----------------------------------------------------------------------------

A.35.2.31. uptime

uptime tells how long the system has been running.
-----------------------------------------------------------------------------

A.35.2.32. users

users prints the user names of users currently logged in to the current host.
-----------------------------------------------------------------------------

A.35.2.33. who

who shows who is logged on.
-----------------------------------------------------------------------------

A.35.2.34. whoami

whoami prints your effective userid.
-----------------------------------------------------------------------------

A.35.2.35. yes

yes outputs a string repeatedly until killed.
-----------------------------------------------------------------------------

A.36. Shadow Password Suite

A.36.1. Contents

The Shadow Password Suite contains the chage, chfn, chsh, expiry, faillog,
gpasswd, lastlog, login, newgrp, passwd, sg, su, chpasswd, dpasswd, groupadd,
groupdel, groupmod, grpck, grpconv, grpunconv, logoutd, mkpasswd, newusers,
pwck, pwconv, pwunconv, useradd, userdel, usermod and vipw programs.
-----------------------------------------------------------------------------

A.36.2. Description

A.36.2.1. chage

chage changes the number of days between password changes and the date of the
last password change.
-----------------------------------------------------------------------------

A.36.2.2. chfn

chfn changes user fullname, office number, office extension, and home phone
number information for a user's account.
-----------------------------------------------------------------------------

A.36.2.3. chsh

chsh changes the user login shell.
-----------------------------------------------------------------------------

A.36.2.4. expiry

It's currently unknown what this program is for.
-----------------------------------------------------------------------------

A.36.2.5. faillog

faillog formats the contents of the failure log,/var/log/faillog, and
maintains failure counts and limits.
-----------------------------------------------------------------------------

A.36.2.6. gpasswd

gpasswd is used to administer the /etc/group file
-----------------------------------------------------------------------------

A.36.2.7. lastlog

lastlog formats and prints the contents of the last login log, /var/log/
lastlog. The login-name, port, and last login time will be printed.
-----------------------------------------------------------------------------

A.36.2.8. login

login is used to establish a new session with the system.
-----------------------------------------------------------------------------

A.36.2.9. newgrp

newgrp is used to change the current group ID during a login session.
-----------------------------------------------------------------------------

A.36.2.10. passwd

passwd changes passwords for user and group accounts.
-----------------------------------------------------------------------------

A.36.2.11. sg

sg executes command as a different group ID.
-----------------------------------------------------------------------------

A.36.2.12. su

Change the effective user id and group id to that of a user. This replaces
the su programs that's installed from the Shellutils package.
-----------------------------------------------------------------------------

A.36.2.13. chpasswd

chpasswd reads a file of user name and password pairs from standard input and
uses this information to update a group of existing users.
-----------------------------------------------------------------------------

A.36.2.14. dpasswd

dpasswd adds, deletes, and updates dialup passwords for user login shells.
-----------------------------------------------------------------------------

A.36.2.15. groupadd

The groupadd command creates a new group account using the values specified
on the command line and the default values from the system.
-----------------------------------------------------------------------------

A.36.2.16. groupdel

The groupdel command modifies the system account files, deleting all entries
that refer to group.
-----------------------------------------------------------------------------

A.36.2.17. groupmod

The groupmod command modifies the system account files to reflect the changes
that are specified on the command line.
-----------------------------------------------------------------------------

A.36.2.18. grpck

grpck verifies the integrity of the system authentication information.
-----------------------------------------------------------------------------

A.36.2.19. grpconv

grpunconv converts to shadow group files from normal group files.
-----------------------------------------------------------------------------

A.36.2.20. grpunconv

grpunconv converts from shadow group files to normal group files.
-----------------------------------------------------------------------------

A.36.2.21. logoutd

logoutd enforces the login time and port restrictions specified in /etc/
porttime.
-----------------------------------------------------------------------------

A.36.2.22. mkpasswd

mkpasswd reads a file in the format given by the flags and converts it to the
corresponding database file format.
-----------------------------------------------------------------------------

A.36.2.23. newusers

newusers reads a file of user name and cleartext password pairs and uses this
information to update a group of existing users or to create new users.
-----------------------------------------------------------------------------

A.36.2.24. pwck

pwck verifies the integrity of the system authentication information.
-----------------------------------------------------------------------------

A.36.2.25. pwconv

pwconv converts to shadow passwd files from normal passwd files.
-----------------------------------------------------------------------------

A.36.2.26. pwunconv

pwunconv converts from shadow passwd files to normal files.
-----------------------------------------------------------------------------

A.36.2.27. useradd

useradd creates a new user or update default new user information.
-----------------------------------------------------------------------------

A.36.2.28. userdel

userdel modifies the system account files, deleting all entries that refer to
a specified login name.
-----------------------------------------------------------------------------

A.36.2.29. usermod

usermod modifies the system account files to reflect the changes that are
specified on the command line.
-----------------------------------------------------------------------------

A.36.2.30. vipw and vigr

vipw and vigr will edit the files /etc/passwd and /etc/group, respectively.
With the -s flag, they will edit the shadow versions of those files, /etc/
shadow and /etc/gshadow, respectively.
-----------------------------------------------------------------------------

A.37. Modutils

A.37.1. Contents

The Modutils package contains the depmod, genksyms, insmod,
insmod_ksymoops_clean, kerneld, kernelversion, ksyms, lsmod, modinfo,
modprobe and rmmod programs.
-----------------------------------------------------------------------------

A.37.2. Description

A.37.2.1. depmod

depmod handles dependency descriptions for loadable kernel modules.
-----------------------------------------------------------------------------

A.37.2.2. genksyms

genksyms reads (on standard input) the output from gcc -E source.c and
generates a file containing version information.
-----------------------------------------------------------------------------

A.37.2.3. insmod

insmod installs a loadable module in the running kernel.
-----------------------------------------------------------------------------

A.37.2.4. insmod_ksymoops_clean

insmod_ksymoops_clean deletes saved ksyms and modules not accessed in 2 days.
-----------------------------------------------------------------------------

A.37.2.5. kerneld

kerneld performs kernel action in user space (such as on-demand loading of
modules)
-----------------------------------------------------------------------------

A.37.2.6. kernelversion

kernelversion reports the major version of the running kernel.
-----------------------------------------------------------------------------

A.37.2.7. ksyms

ksyms displays exported kernel symbols.
-----------------------------------------------------------------------------

A.37.2.8. lsmod

lsmod shows information about all loaded modules.
-----------------------------------------------------------------------------

A.37.2.9. modinfo

modinfo examines an object file associated with a kernel module and displays
any information that it can glean.
-----------------------------------------------------------------------------

A.37.2.10. modprobe

Modprobe uses a Makefile-like dependency file, created by depmod, to
automatically load the relevant module(s) from the set of modules available
in predefined directory trees.
-----------------------------------------------------------------------------

A.37.2.11. rmmod

rmmod unloads loadable modules from the running kernel.
-----------------------------------------------------------------------------

A.38. Procinfo

A.38.1. Contents

The Procinfo package contains the procinfo program.
-----------------------------------------------------------------------------

A.38.2. Description

procinfo gathers some system data from the /proc directory and prints it
nicely formatted on the standard output device.
-----------------------------------------------------------------------------

A.39. Procps

A.39.1. Contents

The Procps package contains the free, kill, oldps, ps, skill, snice, sysctl,
tload, top, uptime, vmstat, w and watch programs.
-----------------------------------------------------------------------------

A.39.2. Description

A.39.2.1. free

free displays the total amount of free and used physical and swap memory in
the system, as well as the shared memory and buffers used by the kernel.
-----------------------------------------------------------------------------

A.39.2.2. kill

kills sends signals to processes.
-----------------------------------------------------------------------------

A.39.2.3. oldps and ps

ps gives a snapshot of the current processes.
-----------------------------------------------------------------------------

A.39.2.4. skill

skill sends signals to process matching a criteria.
-----------------------------------------------------------------------------

A.39.2.5. snice

snice changes the scheduling priority for process matching a criteria.
-----------------------------------------------------------------------------

A.39.2.6. sysctl

sysctl modifies kernel parameters at runtime.
-----------------------------------------------------------------------------

A.39.2.7. tload

tload prints a graph of the current system load average to the specified tty
(or the tty of the tload process if none is specified).
-----------------------------------------------------------------------------

A.39.2.8. top

top provides an ongoing look at processor activity in real time.
-----------------------------------------------------------------------------

A.39.2.9. uptime

uptime gives a one line display of the following information: the current
time, how long the system has been running, how many users are currently
logged on, and the system load averages for the past 1, 5, and 15 minutes.
-----------------------------------------------------------------------------

A.39.2.10. vmstat

vmstat reports information about processes, memory, paging, block IO, traps,
and cpu activity.
-----------------------------------------------------------------------------

A.39.2.11. w

w displays information about the users currently on the machine, and their
processes.
-----------------------------------------------------------------------------

A.39.2.12. watch

watch runs command repeatedly, displaying its output (the first screenfull).
-----------------------------------------------------------------------------

A.40. Vim

A.40.1. Contents

The Vim package contains the ctags, etags, ex, gview, gvim, rgview, rgvim,
rview, rvim, view, vim, vimtutor and xxd programs.
-----------------------------------------------------------------------------

A.40.2. Description

A.40.2.1. ctags

ctags generate tag files for source code.
-----------------------------------------------------------------------------

A.40.2.2. etags

etags does the same as ctags but it can generate cross reference files which
list information about the various source objects found in a set of lanugage
files.
-----------------------------------------------------------------------------

A.40.2.3. ex

ex starts vim in Ex mode.
-----------------------------------------------------------------------------

A.40.2.4. gview

gview is the GUI version of view.
-----------------------------------------------------------------------------

A.40.2.5. gvim

gvim is the GUI version of vim.
-----------------------------------------------------------------------------

A.40.2.6. rgview

rgview is teh GUI version of rview.
-----------------------------------------------------------------------------

A.40.2.7. rgvim

rgvim is the GUI version of rvim.
-----------------------------------------------------------------------------

A.40.2.8. rview

rview is a restricted version of view. No shell commands can be started and
Vim can't be suspended.
-----------------------------------------------------------------------------

A.40.2.9. rvim

rvim is the restricted version of vim. No shell commands can be started and
Vim can't be suspended.
-----------------------------------------------------------------------------

A.40.2.10. view

view starts vim in read-only mode.
-----------------------------------------------------------------------------

A.40.2.11. vim

vim starts vim in the normal, default way.
-----------------------------------------------------------------------------

A.40.2.12. vimtutor

vimtutor starts the Vim tutor.
-----------------------------------------------------------------------------

A.40.2.13. xxd

xxd makes a hexdump or does the reverse.
-----------------------------------------------------------------------------

A.41. Psmisc

A.41.1. Contents

The Psmisc package contains the fuser, killall and pstree programs.
-----------------------------------------------------------------------------

A.41.2. Description

A.41.2.1. fuser

fuser displays the PIDs of processes using the specified files or file
systems.
-----------------------------------------------------------------------------

A.41.2.2. killall

killall sends a signal to all processes running any of the specified
commands.
-----------------------------------------------------------------------------

A.41.2.3. pstree

pstree shows running processes as a tree.
-----------------------------------------------------------------------------

A.42. Sed

A.42.1. Contents

The Sed package contains the sed program.
-----------------------------------------------------------------------------

A.42.2. Description

sed is a stream editor. A stream editor is used to perform basic text
transformations on an input stream (a file or input from a pipeline).
-----------------------------------------------------------------------------

A.43. Sysklogd

A.43.1. Contents

The Sysklogd package contains the klogd and syslogd programs.
-----------------------------------------------------------------------------

A.43.2. Description

A.43.2.1. klogd

klogd is a system daemon which intercepts and logs Linux kernel messages.
-----------------------------------------------------------------------------

A.43.2.2. syslogd

Syslogd provides a kind of logging that many modern programs use. Every
logged message contains at least a time and a hostname field, normally a
program name field, too, but that depends on how trusty the logging program
is.
-----------------------------------------------------------------------------

A.44. Sysvinit

A.44.1. Contents

The Sysvinit package contains the pidof, last, lastb, mesg, utmpdump, wall,
halt, init, killall5, poweroff, reboot, runlevel, shutdown, sulogin and
telinit programs.
-----------------------------------------------------------------------------

A.44.2. Description

A.44.2.1. pidof

Pidof finds the process id's (pids) of the named programs and prints those
id's on standard output.
-----------------------------------------------------------------------------

A.44.2.2. last

last searches back through the file /var/log/wtmp (or the file designated by
the -f flag) and displays a list of all users logged in (and out) since that
file was created.
-----------------------------------------------------------------------------

A.44.2.3. lastb

lastb is the same as last, except that by default it shows a log of the file
/var/log/btmp, which contains all the bad login attempts. 
-----------------------------------------------------------------------------

A.44.2.4. mesg

Mesg controls the access to your terminal by others. It's typically used to
allow or disallow other users to write to your terminal.
-----------------------------------------------------------------------------

A.44.2.5. utmpdump

utmpdumps prints the content of a file (usually /var/run/utmp) on standard
output in a user friendly format.
-----------------------------------------------------------------------------

A.44.2.6. wall

Wall sends a message to everybody logged in with their mesg permission set to
yes.
-----------------------------------------------------------------------------

A.44.2.7. halt

Halt notes that the system is being brought down in the file /var/log/wtmp,
and then either tells the kernel to halt, reboot or poweroff the system. If
halt or reboot is called when the system is not in runlevel 0 or 6, shutdown
will be invoked instead (with the flag -h or -r).
-----------------------------------------------------------------------------

A.44.2.8. init

Init is the parent of all processes. Its primary role is to create processes
from a script stored in the file /etc/inittab. This file usually has entries
which cause init to spawn gettys on each line that users can log in. It also
controls autonomous processes required by any particular system.
-----------------------------------------------------------------------------

A.44.2.9. killall5

killall5 is the SystemV killall command. It sends a signal to all processes
except the processes in its own session, so it won't kill the shell that is
running the script it was called from.
-----------------------------------------------------------------------------

A.44.2.10. poweroff

poweroff is equivalent to shutdown -h -p now. It halts the computer and
switches off the computer (when using an APM compliant BIOS and APM is
enabled in the kernel).
-----------------------------------------------------------------------------

A.44.2.11. reboot

reboot is equivalent to shutdown -r now. It reboots the computer.
-----------------------------------------------------------------------------

A.44.2.12. runlevel

Runlevel reads the system utmp file (typically /var/run/utmp) to locate the
runlevel record, and then prints the previous and current system runlevel on
its standard output, separated by a single space.
-----------------------------------------------------------------------------

A.44.2.13. shutdown

shutdown brings the system down in a secure way. All logged-in users are
notified that the system is going down, and login is blocked.
-----------------------------------------------------------------------------

A.44.2.14. sulogin

sulogin is invoked by init when the system goes into single user mode (this
is done through an entry in /etc/inittab). Init also tries to execute sulogin
when it is passed the -b flag from the bootmonitor (eg, LILO).
-----------------------------------------------------------------------------

A.44.2.15. telinit

telinit sends appropriate signals to init, telling it which runlevel to
change to.
-----------------------------------------------------------------------------

A.45. Tar

A.45.1. Contents

The tar package contains the tar and rmt programs.
-----------------------------------------------------------------------------

A.45.2. Description

A.45.2.1. tar

tar is an archiving program designed to store and extract files from an
archive file known as a tarfile.
-----------------------------------------------------------------------------

A.45.2.2. rmt

rmt is a program used by the remote dump and restore programs in manipulating
a magnetic tape drive through an interprocess communication connection.
-----------------------------------------------------------------------------

A.46. Textutils

A.46.1. Contents

The Textutils package contains the cat, cksum, comm, split, cut, expand, fmt,
fold, head, join, md5sum, nl, od, paste, pr, ptx, sort, split, sum, tac,
tail, tr, tsort, unexpand, uniq and wc programs.
-----------------------------------------------------------------------------

A.46.2. Description

A.46.2.1. cat

cat concatenates file(s) or standard input to standard output.
-----------------------------------------------------------------------------

A.46.2.2. cksum

cksum prints CRC checksum and byte counts of each specified file.
-----------------------------------------------------------------------------

A.46.2.3. comm

comm compares two sorted files line by line.
-----------------------------------------------------------------------------

A.46.2.4. csplit

cplit outputs pieces of a file separated by (a) pattern(s) to files xx01,
xx02, ..., and outputs byte counts of each piece to standard output.
-----------------------------------------------------------------------------

A.46.2.5. cut

cut prints selected parts of lines from specified files to standard output.
-----------------------------------------------------------------------------

A.46.2.6. expand

expand converts tabs in files to spaces, writing to standard output.
-----------------------------------------------------------------------------

A.46.2.7. fmt

fmt reformats each paragraph in the specified file(s), writing to standard
output.
-----------------------------------------------------------------------------

A.46.2.8. fold

fold wraps input lines in each specified file (standard input by default),
writing to standard output.
-----------------------------------------------------------------------------

A.46.2.9. head

Print first xx (10 by default) lines of each specified file to standard
output.
-----------------------------------------------------------------------------

A.46.2.10. join

join joins lines of two files on a common field.
-----------------------------------------------------------------------------

A.46.2.11. md5sum

md5sum prints or checks MD5 checksums.
-----------------------------------------------------------------------------

A.46.2.12. nl

nl writes each specified file to standard output, with line numbers added.
-----------------------------------------------------------------------------

A.46.2.13. od

od writes an unambiguous representation, octal bytes by default, of a
specified file to standard output.
-----------------------------------------------------------------------------

A.46.2.14. paste

paste writes lines consisting of the sequentially corresponding lines from
each specified file, separated by TABs, to standard output.
-----------------------------------------------------------------------------

A.46.2.15. pr

pr paginates or columnates files for printing.
-----------------------------------------------------------------------------

A.46.2.16. ptx

ptx produces a permuted index of file contents.
-----------------------------------------------------------------------------

A.46.2.17. sort

sort writes sorted concatenation of files to standard output.
-----------------------------------------------------------------------------

A.46.2.18. split

split outputs fixed-size pieces of an input file to PREFIXaa, PREFIXab, ...
-----------------------------------------------------------------------------

A.46.2.19. sum

sum prints checksum and block counts for each specified file.
-----------------------------------------------------------------------------

A.46.2.20. tac

tac writes each specified file to standard output, last line first.
-----------------------------------------------------------------------------

A.46.2.21. tail

tail print the last xx (10 by default) lines of each specified file to
standard output.
-----------------------------------------------------------------------------

A.46.2.22. tr

tr translates, squeezes, and/or deletes characters from standard input,
writing to standard output.
-----------------------------------------------------------------------------

A.46.2.23. tsort

tsort writes totally ordered lists consistent with the partial ordering in
specified files.
-----------------------------------------------------------------------------

A.46.2.24. unexpand

unexpand converts spaces in each file to tabs, writing to standard output.
-----------------------------------------------------------------------------

A.46.2.25. uniq

uniq discards all but one of successive identical lines from files or
standard input and writes to files or standard output.
-----------------------------------------------------------------------------

A.46.2.26. wc

wc prints line, word, and byte counts for each specified file, and a total
line if more than one file is specified.
-----------------------------------------------------------------------------

A.47. Util Linux

A.47.1. Contents

The Util-linux package contains the arch, dmesg, kill, more, mount, umount,
agetty, blockdev, cfdisk, ctrlaltdel, elvtune, fdisk, fsck.minix, hwclock,
kbdrate, losetup, mkfs, mkfs.bfs, mkfs.minix, mkswap, sfdisk, swapoff,
swapon, cal, chkdupexe, col, colcrt, colrm, column, cytune, ddate, fdformat,
getopt, hexdump, ipcrm, ipcs, logger, look, mcookie, namei, rename, renice,
rev, script, setfdprm, setsid, setterm, ul, whereis, write, ramsize, rdev,
readprofile, rootflags, swapdev, tunelp and vidmode programs.
-----------------------------------------------------------------------------

A.47.2. Description

A.47.2.1. arch

arch prints the machine architecture.
-----------------------------------------------------------------------------

A.47.2.2. dmesg

dmesg is used to examine or control the kernel ring buffer (boot messages
from the kernel).
-----------------------------------------------------------------------------

A.47.2.3. kill

kill sends a specified signal to the specified process.
-----------------------------------------------------------------------------

A.47.2.4. more

more is a filter for paging through text one screenful at a time.
-----------------------------------------------------------------------------

A.47.2.5. mount

mount mounts a filesystem from a device to a directory (mount point).
-----------------------------------------------------------------------------

A.47.2.6. umount

umount unmounts a mounted filesystem.
-----------------------------------------------------------------------------

A.47.2.7. agetty

agetty opens a tty port, prompts for a login name and invokes the /bin/login
command.
-----------------------------------------------------------------------------

A.47.2.8. blockdev

blockdev allows you to call block device ioctls from the command line
-----------------------------------------------------------------------------

A.47.2.9. cfdisk

cfdisk is an libncurses based disk partition table manipulator.
-----------------------------------------------------------------------------

A.47.2.10. ctrlaltdel

ctrlaltdel sets the function of the CTRL+ALT+DEL key combination (hard or
soft reset).
-----------------------------------------------------------------------------

A.47.2.11. elvtune

elvtune allows to tune the I/O elevator per blockdevice queue basis.
-----------------------------------------------------------------------------

A.47.2.12. fdisk

fdisk is a disk partition table manipulator.
-----------------------------------------------------------------------------

A.47.2.13. fsck.minix

fsck.minix performs a consistency check for the Linux MINIX filesystem.
-----------------------------------------------------------------------------

A.47.2.14. hwclock

hwclock queries and sets the hardware clock (Also called the RTC or BIOS
clock).
-----------------------------------------------------------------------------

A.47.2.15. kbdrate

kbdrate resets the keyboard repeat rate and delay time.
-----------------------------------------------------------------------------

A.47.2.16. losetup

losetup sets up and controls loop devices.
-----------------------------------------------------------------------------

A.47.2.17. mkfs

mkfs builds a Linux filesystem on a device, usually a harddisk partition.
-----------------------------------------------------------------------------

A.47.2.18. mkfs.bfs

mkfs.bfs creates a SCO bfs file system on a device, usually a harddisk
partition.
-----------------------------------------------------------------------------

A.47.2.19. mkfs.minix

mkfs.minix creates a Linux MINIX filesystem on a device, usually a harddisk
partition.
-----------------------------------------------------------------------------

A.47.2.20. mkswap

mkswap sets up a Linux swap area on a device or in a file.
-----------------------------------------------------------------------------

A.47.2.21. sfdisk

sfdisk is a disk partition table manipulator.
-----------------------------------------------------------------------------

A.47.2.22. swapoff

swapoff disables devices and files for paging an swapping.
-----------------------------------------------------------------------------

A.47.2.23. swapon

swapon enables devices and files for paging and swapping.
-----------------------------------------------------------------------------

A.47.2.24. cal

cal displays a simple calender.
-----------------------------------------------------------------------------

A.47.2.25. chkdupexe

chkdupexe finds duplicate executables.
-----------------------------------------------------------------------------

A.47.2.26. col

col filters reverse line feeds from input.
-----------------------------------------------------------------------------

A.47.2.27. colcrt

colcrt filters nroff output for CRT previewing.
-----------------------------------------------------------------------------

A.47.2.28. colrm

colrm removes columns from a file.
-----------------------------------------------------------------------------

A.47.2.29. column

column columnates lists.
-----------------------------------------------------------------------------

A.47.2.30. cytune

cytune queries and modifies the interruption threshold for the Cyclades
driver.
-----------------------------------------------------------------------------

A.47.2.31. ddate

ddate converts Gregorian dates to Discordian dates.
-----------------------------------------------------------------------------

A.47.2.32. fdformat

fdformat low-level formats a floppy disk.
-----------------------------------------------------------------------------

A.47.2.33. getopt

getops parses command options the same way as the getopt C command.
-----------------------------------------------------------------------------

A.47.2.34. hexdump

hexdump displays specified files, or standard input, in a user specified
format (ascii, decimal, hexadecimal, octal).
-----------------------------------------------------------------------------

A.47.2.35. ipcrm

ipcrm removes a specified resource.
-----------------------------------------------------------------------------

A.47.2.36. ipcs

ipcs provides information on ipc facilities.
-----------------------------------------------------------------------------

A.47.2.37. logger

logger makes entries in the system log.
-----------------------------------------------------------------------------

A.47.2.38. look

look displays lines beginning with a given string.
-----------------------------------------------------------------------------

A.47.2.39. mcookie

mcookie generates magic cookies for xauth.
-----------------------------------------------------------------------------

A.47.2.40. namei

namei follows a pathname until a terminal point is found.
-----------------------------------------------------------------------------

A.47.2.41. rename

rename renames files.
-----------------------------------------------------------------------------

A.47.2.42. renice

renice alters priority of running processes.
-----------------------------------------------------------------------------

A.47.2.43. rev

rev reverses lines of a file.
-----------------------------------------------------------------------------

A.47.2.44. script

script makes typescript of terminal session.
-----------------------------------------------------------------------------

A.47.2.45. setfdprm

setfdprm sets user-provides floppy disk parameters.
-----------------------------------------------------------------------------

A.47.2.46. setsid

setsid runs programs in a new session.
-----------------------------------------------------------------------------

A.47.2.47. setterm

setterm sets terminal attributes.
-----------------------------------------------------------------------------

A.47.2.48. ul

ul reads a file and translates occurences of underscores to the sequence
which indicates underlining for the terminal in use.
-----------------------------------------------------------------------------

A.47.2.49. whereis

whereis locates a binary, source and manual page for a command.
-----------------------------------------------------------------------------

A.47.2.50. write

write sends a message to another user.
-----------------------------------------------------------------------------

A.47.2.51. ramsize

ramsize queries and sets RAM disk size.
-----------------------------------------------------------------------------

A.47.2.52. rdev

rdev queries and sets image root device, swap device, RAM disk size, or video
mode.
-----------------------------------------------------------------------------

A.47.2.53. readprofile

readprofile reads kernel profiling information.
-----------------------------------------------------------------------------

A.47.2.54. rootflags

rootflags queries and sets extra information used when mounting root.
-----------------------------------------------------------------------------

A.47.2.55. swapdev

swapdev queries and sets swap device.
-----------------------------------------------------------------------------

A.47.2.56. tunelp

tunelp sets various paramters for the lp device.
-----------------------------------------------------------------------------

A.47.2.57. vidmode

vidmode queries and sets the video mode.
-----------------------------------------------------------------------------

A.48. Console-tools

A.48.1. Contents

The Console-tools package contains the charset, chvt, consolechars,
deallocvt, dumpkeys, fgconsole, fix_bs_and_del, font2psf, getkeycodes,
kbd_mode, loadkeys, loadunimap, mapscrn, mk_modmap, openvt, psfaddtable,
psfgettable, psfstriptable, resizecons, saveunimap, screendump, setfont,
setkeycodes, setleds, setmetamode, setvesablank, showcfont, showkey,
splitfont, unicode_start, unicode_stop, vcstime, vt-is-URF8, writevt
-----------------------------------------------------------------------------

A.48.2. Description

A.48.2.1. charset

charset sets an ACM for use in one of the G0/G1 charsets slots.
-----------------------------------------------------------------------------

A.48.2.2. chvt

chvt changes foreground virtual terminal.
-----------------------------------------------------------------------------

A.48.2.3. codepage

No description available.
-----------------------------------------------------------------------------

A.48.2.4. consolechars

consolechars loads EGA/VGA console screen fonts, screen font maps and/or
application-charset maps.
-----------------------------------------------------------------------------

A.48.2.5. deallocvt

deallocvt deallocates unused virtual terminals.
-----------------------------------------------------------------------------

A.48.2.6. dumpkeys

dumpkeys dumps keyboard translation tables.
-----------------------------------------------------------------------------

A.48.2.7. fgconsole

fgconsole prints the number of the active virtual terminal.
-----------------------------------------------------------------------------

A.48.2.8. fix_bs_and_del

No description available.
-----------------------------------------------------------------------------

A.48.2.9. font2psf

No description available.
-----------------------------------------------------------------------------

A.48.2.10. getkeycodes

getkeycodes prints the kernel scancode-to-keycode mapping table.
-----------------------------------------------------------------------------

A.48.2.11. kbd_mode

kbd_mode reports or sets the keyboard mode.
-----------------------------------------------------------------------------

A.48.2.12. loadkeys

loadkeys loads keyboard translation tables.
-----------------------------------------------------------------------------

A.48.2.13. loadunimap

No description available.
-----------------------------------------------------------------------------

A.48.2.14. mapscrn

No description available.
-----------------------------------------------------------------------------

A.48.2.15. mk_modmap

No description available.
-----------------------------------------------------------------------------

A.48.2.16. openvt

openvt starts a program on a new virtual terminal.
-----------------------------------------------------------------------------

A.48.2.17. psfaddtable

psfaddtable adds a Unicode character table to a console font.
-----------------------------------------------------------------------------

A.48.2.18. psfgettable

psfgettable extracts the embedded Unicode character table from a console
font.
-----------------------------------------------------------------------------

A.48.2.19. psfstriptable

psfstriptable removes the embedded Unicode character table from a console
font.
-----------------------------------------------------------------------------

A.48.2.20. resizecons

resizecons changes the kernel idea of the console size.
-----------------------------------------------------------------------------

A.48.2.21. saveunimap

No description available.
-----------------------------------------------------------------------------

A.48.2.22. screendump

No description available.
-----------------------------------------------------------------------------

A.48.2.23. setfont

No description available.
-----------------------------------------------------------------------------

A.48.2.24. setkeycodes

setkeycodes loads kernel scancode-to-keycode mapping table entries.
-----------------------------------------------------------------------------

A.48.2.25. setleds

setleds sets the keyboard leds.
-----------------------------------------------------------------------------

A.48.2.26. setmetamode

setmetamode defines the keyboard meta key handling.
-----------------------------------------------------------------------------

A.48.2.27. setvesablank

No description available.
-----------------------------------------------------------------------------

A.48.2.28. showcfont

showcfont displays all character in the current screenfont.
-----------------------------------------------------------------------------

A.48.2.29. showkey

showkey examines the scancodes and keycodes sent by the keyboard.
-----------------------------------------------------------------------------

A.48.2.30. splitfont

No description available.
-----------------------------------------------------------------------------

A.48.2.31. unicode_start

unicode_start puts the console in Unicode mode.
-----------------------------------------------------------------------------

A.48.2.32. unicode_stop

No description available.
-----------------------------------------------------------------------------

A.48.2.33. vcstime

No description available.
-----------------------------------------------------------------------------

A.48.2.34. vt-is-UTF8

vt-is-UTF8 checks whether the current virtual terminal is in UTF8- or
byte-mode.
-----------------------------------------------------------------------------

A.48.2.35. writevt

No description available.
-----------------------------------------------------------------------------

A.49. Console-data

A.49.1. Contents

The console-data package contains the data files that are used and needed by
the console-tools package.
-----------------------------------------------------------------------------

A.50. Man-pages

A.50.1. Contents

The Man-pages package contains various manual pages that don't come with the
packages.
-----------------------------------------------------------------------------

A.50.2. Description

Examples of provided manual pages are the manual pages describing all the C
and C++ functions, few important /dev/ files and more.
-----------------------------------------------------------------------------

Appendix B. Resources

B.1. Introduction

A list of books, HOWTOs and other documents you might find useful to download
or buy follows. This list is just a small list to start with. We hope to be
able to expand this list in time as we come across more useful documents or
books.
-----------------------------------------------------------------------------

B.2. Books

  * Linux Network Administrator's Guide published by O'Reilly. ISBN:
    1-56502-087-2
   
  * Running Linux published by O'Reilly. ISBN: 1-56592-151-8
   

-----------------------------------------------------------------------------
B.3. HOWTOs and Guides

All of the following HOWTOs can be downloaded from the Linux Documentation
Project site at [http://www.linuxdoc.org] http://www.linuxdoc.org

  * Linux Network Administrator's Guide
   
  * Powerup2Bash-HOWTO
   

-----------------------------------------------------------------------------
B.4. Other

  * The various man and info pages that come with the packages
   

-----------------------------------------------------------------------------
Appendix C. Official download locations

Below you find the list with packages from chapter 3 with their original
download locations. This might help you to find a newer version of a package
quicker.

  *  Bash (2.04): [ftp://ftp.gnu.org/gnu/bash/] ftp://ftp.gnu.org/gnu/bash/ 
   
  *  Binutils (2.10.1): [ftp://ftp.gnu.org/gnu/binutils/] ftp://ftp.gnu.org/
    gnu/binutils/ 
   
  *  Bzip2 (1.0.1): [ftp://sourceware.cygnus.com/pub/bzip2/] ftp://
    sourceware.cygnus.com/pub/bzip2/ 
   
  *  Diff Utils (2.7): [ftp://ftp.gnu.org/gnu/diffutils/] ftp://ftp.gnu.org/
    gnu/diffutils/ 
   
  *  File Utils (4.0): [ftp://ftp.gnu.org/gnu/fileutils/] ftp://ftp.gnu.org/
    gnu/fileutils/ 
   
  *  GCC (2.95.2): [ftp://ftp.gnu.org/gnu/gcc/] ftp://ftp.gnu.org/gnu/gcc/ 
   
  *  Linux Kernel (2.2.18): [ftp://ftp.kernel.org/pub/linux/kernel/] ftp://
    ftp.kernel.org/pub/linux/kernel/ 
   
  *  Glibc (2.1.3): [ftp://ftp.gnu.org/gnu/glibc/] ftp://ftp.gnu.org/gnu/
    glibc/ 
   
  *  Glibc-crypt (2.1.3): [ftp://ftp.gnu.org/gnu/glibc/] ftp://ftp.gnu.org/
    gnu/glibc/ 
   
  *  Glibc-linuxthreads (2.1.3): [ftp://ftp.gnu.org/gnu/glibc/] ftp://
    ftp.gnu.org/gnu/glibc/ 
   
  *  Glibc Patch (2.1.3): [ftp://packages.linuxfromscratch.org/pub/
    common-packages] ftp://packages.linuxfromscratch.org/pub/common-packages 
   
  *  Grep (2.4.2): [ftp://ftp.gnu.org/gnu/grep/] ftp://ftp.gnu.org/gnu/grep/ 
   
  *  Gzip (1.2.4a): [ftp://ftp.gnu.org/gnu/gzip/] ftp://ftp.gnu.org/gnu/gzip/
   
  *  Make (3.79.1): [ftp://ftp.gnu.org/gnu/make/] ftp://ftp.gnu.org/gnu/make/
   
  *  Sed (3.02): [ftp://ftp.gnu.org/gnu/sed/] ftp://ftp.gnu.org/gnu/sed/ 
   
  *  Sh-utils (2.0): [ftp://ftp.gnu.org/gnu/sh-utils/] ftp://ftp.gnu.org/gnu/
    sh-utils/ 
   
  *  Tar (1.13): [ftp://ftp.gnu.org/gnu/tar/] ftp://ftp.gnu.org/gnu/tar/ 
   
  *  Tar Patch (1.13): [http://sourceware.cygnus.com/bzip2/] http://
    sourceware.cygnus.com/bzip2/ 
   
  *  Text Utils (2.0): [ftp://ftp.gnu.org/gnu/textutils/] ftp://ftp.gnu.org/
    gnu/textutils/ 
   
  *  MAKEDEV (2.5): [ftp://ftp.ihg.uni-duisburg.de/Linux/system/] ftp://
    ftp.ihg.uni-duisburg.de/Linux/system/ 
   
  *  Bison (1.28): [ftp://ftp.gnu.org/gnu/bison/] ftp://ftp.gnu.org/gnu/bison
    / 
   
  *  Mawk (1.3.3): [ftp://ftp.whidbey.net/pub/brennan/] ftp://ftp.whidbey.net
    /pub/brennan/ 
   
  *  Patch (2.5.4): [ftp://ftp.gnu.org/gnu/patch/] ftp://ftp.gnu.org/gnu/
    patch/ 
   
  *  Find Utils (4.1): [ftp://ftp.gnu.org/gnu/findutils/] ftp://ftp.gnu.org/
    gnu/findutils/ 
   
  *  Find Utils Patch (4.1): [ftp://packages.linuxfromscratch.org/pub/
    common-packages] ftp://packages.linuxfromscratch.org/pub/common-packages 
   
  *  Ncurses (5.2): [ftp://ftp.gnu.org/gnu/ncurses/] ftp://ftp.gnu.org/gnu/
    ncurses/ 
   
  *  Less (358): [ftp://ftp.gnu.org/gnu/less/] ftp://ftp.gnu.org/gnu/less/ 
   
  *  Groff (1.16.1): [ftp://ftp.gnu.org/gnu/groff/] ftp://ftp.gnu.org/gnu/
    groff/ 
   
  *  Man (1.5h1): [ftp://ftp.win.tue.nl/pub/linux-local/utils/man/] ftp://
    ftp.win.tue.nl/pub/linux-local/utils/man/ 
   
  *  Perl (5.6.0): [http://www.perl.com] http://www.perl.com 
   
  *  M4 (1.4): [ftp://ftp.gnu.org/gnu/m4/] ftp://ftp.gnu.org/gnu/m4/ 
   
  *  Texinfo (4.0): [ftp://ftp.gnu.org/gnu/texinfo/] ftp://ftp.gnu.org/gnu/
    texinfo/ 
   
  *  Autoconf (2.13): [ftp://ftp.gnu.org/gnu/autoconf/] ftp://ftp.gnu.org/gnu
    /autoconf/ 
   
  *  Automake (1.4): [ftp://ftp.gnu.org/gnu/automake/] ftp://ftp.gnu.org/gnu/
    automake/ 
   
  *  Flex (2.5.4a): [ftp://ftp.gnu.org/non-gnu/flex/] ftp://ftp.gnu.org/
    non-gnu/flex/ 
   
  *  File (3.33): [ftp://ftp.gw.com/mirrors/pub/unix/file/] ftp://ftp.gw.com/
    mirrors/pub/unix/file/ 
   
  *  Libtool (1.3.5): [ftp://ftp.gnu.org/gnu/libtool/] ftp://ftp.gnu.org/gnu/
    libtool/ 
   
  *  Bin86 (0.15.4): [http://www.cix.co.uk/~mayday/] http://www.cix.co.uk/
    ~mayday/ 
   
  *  Gettext (0.10.35): [ftp://ftp.gnu.org/gnu/gettext/] ftp://ftp.gnu.org/
    gnu/gettext/ 
   
  *  Console-tools (0.2.3): [ftp://metalab.unc.edu/pub/Linux/system/keyboards
    /] ftp://metalab.unc.edu/pub/Linux/system/keyboards/ 
   
  *  Console-tools Patch (0.2.3): [ftp://packages.linuxfromscratch.org/pub/
    common-packages] ftp://packages.linuxfromscratch.org/pub/common-packages 
   
  *  Console-data (1999.08.29): [ftp://metalab.unc.edu/pub/Linux/system/
    keyboards/] ftp://metalab.unc.edu/pub/Linux/system/keyboards/ 
   
  *  E2fsprogs (1.19): [ftp://download.sourceforge.net/pub/sourceforge/
    e2fsprogs/] ftp://download.sourceforge.net/pub/sourceforge/e2fsprogs/ 
   
  *  Ed (0.2): [ftp://ftp.gnu.org/gnu/ed/] ftp://ftp.gnu.org/gnu/ed/ 
   
  * Ld.so (1.9.9): [ftp://packages.linuxfromscratch.org/pub/common-packages]
    ftp://packages.linuxfromscratch.org/pub/common-packages
   
  * Lilo (21.6): [ftp://brun.dyndns.org/pub/linux/lilo] ftp://brun.dyndns.org
    /pub/linux/lilo 
   
  *  Modutils (2.4.0): [ftp://ftp.kernel.org/pub/linux/utils/kernel/modutils]
    ftp://ftp.kernel.org/pub/linux/utils/kernel/modutils 
   
  *  Vim-rt (5.7) 1,073 KB: [ftp://ftp.vim.org/pub/editors/vim/unix/] ftp://
    ftp.vim.org/pub/editors/vim/unix/ 
   
  * Vim-src (5.7) 1,202 KB: [ftp://ftp.vim.org/pub/editors/vim/unix/] ftp://
    ftp.vim.org/pub/editors/vim/unix/ 
   
  *  Procinfo (17): [ftp://ftp.cistron.nl/pub/people/svm/] ftp://
    ftp.cistron.nl/pub/people/svm/ 
   
  *  Procps (2.0.7): [ftp://people.redhat.com/johnsonm/procps/] ftp://
    people.redhat.com/johnsonm/procps/ 
   
  *  Psmisc (19): [ftp://lrcftp.epfl.ch/pub/linux/local/psmisc/] ftp://
    lrcftp.epfl.ch/pub/linux/local/psmisc/ 
   
  *  Shadow Password Suite (20000902): [ftp://ftp.ists.pwr.wroc.pl/pub/linux/
    shadow/] ftp://ftp.ists.pwr.wroc.pl/pub/linux/shadow/ 
   
  *  Sysklogd (1.4): [ftp://sunsite.unc.edu/pub/Linux/system/daemons/] ftp://
    sunsite.unc.edu/pub/Linux/system/daemons/ 
   
  *  Sysklogd Patch (1.4): [ftp://packages.linuxfromscratch.org/pub/
    common-packages/] ftp://packages.linuxfromscratch.org/pub/common-packages
    / 
   
  *  Sysvinit (2.78): [ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/]
    ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/ 
   
  *  Sysvinit Patch (2.78): [ftp://packages.linuxfromscratch.org/pub/
    common-packages/] ftp://packages.linuxfromscratch.org/pub/common-packages
    / 
   
  *  Util Linux (2.10r): [ftp://ftp.win.tue.nl/pub/linux-local/utils/
    util-linux/] ftp://ftp.win.tue.nl/pub/linux-local/utils/util-linux/ 
   
  *  Man-pages (1.33): [ftp://ftp.win.tue.nl/pub/linux-local/manpages/] ftp:/
    /ftp.win.tue.nl/pub/linux-local/manpages/ 
   
  *  Netkit-base (0.17): [ftp://ftp.uk.linux.org/pub/linux/Networking/netkit
    /] ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/ 
   
  *  Net-tools (1.57): [http://www.tazenda.demon.co.uk/phil/net-tools/] http:
    //www.tazenda.demon.co.uk/phil/net-tools/