cvs commit: LFS/BOOK/chapter06 createfiles.xml creatingdirs.xml kernel-exp-headers.xml kernel-exp.xml kernel-inst.xml kernel.xml mountproc.xml pwdgroup.xml

gerard at linuxfromscratch.org gerard at linuxfromscratch.org
Fri May 24 17:21:12 PDT 2002


gerard      02/05/24 17:21:12

  Modified:    BOOK     index.xml
  Added:       BOOK/chapter05 creatingstaticdir.xml findutils-exp.xml
                        findutils-inst.xml findutils.xml utillinux-inst.xml
                        utillinux.xml
               BOOK/chapter06 createfiles.xml creatingdirs.xml
                        kernel-exp-headers.xml kernel-exp.xml
                        kernel-inst.xml kernel.xml mountproc.xml
                        pwdgroup.xml
  Log:
  second set of commits for keep-chap5-chap6-seperate
  
  Revision  Changes    Path
  1.421     +2 -2      LFS/BOOK/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvsroot/LFS/BOOK/index.xml,v
  retrieving revision 1.420
  retrieving revision 1.421
  diff -u -r1.420 -r1.421
  --- index.xml	23 May 2002 17:00:34 -0000	1.420
  +++ index.xml	25 May 2002 00:21:11 -0000	1.421
  @@ -4,8 +4,8 @@
   
   <!ENTITY book SYSTEM "book/book.xml">
   
  -<!ENTITY version "20020523">
  -<!ENTITY releasedate "May 23rd, 2002">
  +<!ENTITY version "20020524">
  +<!ENTITY releasedate "May 24th, 2002">
   
   <!ENTITY ftp-root "ftp://ftp.linuxfromscratch.org">
   <!ENTITY http-root "http://ftp.linuxfromscratch.org">
  
  
  
  1.1                  LFS/BOOK/chapter05/creatingstaticdir.xml
  
  Index: creatingstaticdir.xml
  ===================================================================
  <sect1 id="ch05-creatingstaticdir">
  <title>Creating the $LFS/static directory</title>
  <?dbhtml filename="creatingstaticdir.html" dir="chapter05"?>
  
  <para>As explained in this chapter's introduction, everything we install
  from this chapter will be installed under the <filename
  class="directory">$LFS/static</filename> directory. This way it won't
  pollute the LFS partition with a bunch of temporary files. All we need to
  do is create this directory so we can start installing. Simply run this
  command to create the directory:</para>
  
  <para><screen><userinput>mkdir $LFS/static</userinput></screen></para>
  
  <para>You may want to move the packages you downloaded in chapter 3 to this
  <filename class="directory">$LFS/static</filename> directory, perhaps
  create a subdirectory <filename
  class="directory">$LFS/static/src</filename> to keep them in.</para>
  
  </sect1>
  
  
  
  
  1.1                  LFS/BOOK/chapter05/findutils-exp.xml
  
  Index: findutils-exp.xml
  ===================================================================
  <sect2>
  <title>Command explanations</title>
  
  <para><userinput>patch -Np1 -i ../findutils-4.1.patch</userinput>: This 
  patch is to fix some compilation errors by
  avoiding a variable conflict and changing some bad syntax.</para>
  
  </sect2>
  
  
  
  
  1.1                  LFS/BOOK/chapter05/findutils-inst.xml
  
  Index: findutils-inst.xml
  ===================================================================
  <sect2>
  <title>Installing Findutils</title>
  
  <para>This package requires its patch to be applied before you can
  install it. Make sure it's unpacked before running the installation 
  commands.</para>
  
  <para>Install Findutils by running the following commands:</para>
  
  <para><screen><userinput>patch -Np1 -i ../findutils-4.1.patch &&
  ./configure --prefix=$LFS/static &&
  make libexecdir=/static/bin LDFLAGS=-static &&
  make libexecdir=/static/bin install</userinput></screen></para>
  
  </sect2>
  
  
  
  1.1                  LFS/BOOK/chapter05/findutils.xml
  
  Index: findutils.xml
  ===================================================================
  <sect1 id="ch05-findutils">
  <title>Installing Findutils-&findutils-version;</title>
  <?dbhtml filename="findutils.html" dir="chapter05"?>
  
  <screen>Estimated build time:           &findutils-time;
  Estimated required disk space:  &findutils-compsize;</screen>
  
  &c5-findutils-inst;
  &c5-findutils-exp;
  &aa-findutils-desc;
  &aa-findutils-dep;
  
  </sect1>
  
  
  
  
  1.1                  LFS/BOOK/chapter05/utillinux-inst.xml
  
  Index: utillinux-inst.xml
  ===================================================================
  <sect2>
  <title>Installation of Util-Linux</title>
  
  <para>We only need the mount and umount programs at the moment, so we won't
  be compiling the entire package.</para>
  
  <para>Install Util-Linux by running the following commands:</para>
  
  <para><screen><userinput>./configure &&
  make -C lib &&
  make -C mount LDFLAGS=-static mount umount &&
  cp mount/{mount,umount} $LFS/static/bin</userinput></screen></para>
  
  </sect2>
  
  
  
  
  1.1                  LFS/BOOK/chapter05/utillinux.xml
  
  Index: utillinux.xml
  ===================================================================
  <sect1 id="ch05-utillinux">
  <title>Installing Util-linux-&util-linux-version;</title>
  <?dbhtml filename="util-linux.html" dir="chapter05"?>
  
  <screen>Estimated build time:           &util-linux-time;
  Estimated required disk space:  &util-linux-compsize;</screen>
  
  &c5-utillinux-inst;
  &aa-utillinux-dep;
  
  </sect1>
  
  
  
  1.1                  LFS/BOOK/chapter06/createfiles.xml
  
  Index: createfiles.xml
  ===================================================================
  <sect1 id="ch06-createfiles">
  <title>Creating a few missing files</title>
  <?dbhtml filename="createfiles.html" dir="chapter06"?>
  
  <para>A few files need to be created because programs hard-wire paths
  that don't exist yet. The most frequently ones used are
  <filename>/bin/sh</filename> and <filename>/dev/null</filename> so we'll be
  creating those for the time being and replace them properly when the file's
  package is (re)installed.</para>
  
  <para>Create the files by running the following commands:</para>
  
  <para><screen><userinput>ln -s /static/bin/bash /bin/sh &&
  mknod -m 0666 /dev/null c 1 3</userinput></screen></para>
  
  </sect1>
  
  
  
  
  1.1                  LFS/BOOK/chapter06/creatingdirs.xml
  
  Index: creatingdirs.xml
  ===================================================================
  <sect1 id="ch06-creatingdirs">
  <title>Creating directories</title>
  <?dbhtml filename="creatingdirs.html" dir="chapter06"?>
  
  <para>Let's now create the directory tree on the LFS partition based on
  the FHS standard, which can be found at
  <ulink url="http://www.pathname.com/fhs/"/>.
  Issuing the following commands will create a default directory layout:</para>
   
  <para><screen><userinput>mkdir -p /{bin,boot,dev/pts,etc/opt,home,lib,mnt,proc} &&
  mkdir -p /{root,sbin,tmp,usr,usr/local,var,opt} &&
  for dirname in /usr /usr/local
      do
      mkdir $dirname/{bin,etc,include,lib,sbin,share,src}
      ln -s share/{man,doc,info} $dirname
      mkdir $dirname/share/{dict,doc,info,locale,man}
      mkdir $dirname/share/{nls,misc,terminfo,zoneinfo}
      mkdir $dirname/share/man/man{1,2,3,4,5,6,7,8}
  done &&
  mkdir /var/{lock,log,mail,run,spool} &&
  mkdir -p /var/{tmp,opt,cache,lib/misc,local} &&
  mkdir /opt/{bin,doc,include,info} &&
  mkdir -p /opt/{lib,man/man{1,2,3,4,5,6,7,8}} &&
  ln -s ../var/tmp /usr</userinput></screen></para>
  
  <para>Normally, directories are created with permission mode 755, which isn't
  desired for all directories. 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 a user would do with /home/username 
  directories). The second change is a mode 1777 for the tmp 
  directories. This way, any user can write data to the /tmp or /var/tmp 
  directory but cannot remove another user's files (the latter is caused 
  by the so-called "sticky bit" - bit 1 of the 1777 bit mask).</para>
  
  <para><screen><userinput>cd $LFS &&
  chmod 0750 root &&
  chmod 1777 tmp var/tmp</userinput></screen></para>
  
  <para>Now that the directories are created, copy the source files that were
  downloaded in chapter 3 to some subdirectory under $LFS/usr/src (you
  will need to create the desired directory yourself).</para>
  
  <sect2>
  <title>FHS compliance notes</title>
  
  <para>The FHS stipulates that the /usr/local directory should contain the
  bin, games, include, lib, man, sbin, and share subdirectories. You can
  alter your /usr/local directory yourself if you want your system to be
  FHS-compliant.</para>
  
  <para>Also, the standard says that there should exist a /usr/share/games 
  directory, which we don't much like for a base system. But feel free to 
  make your system FHS-compliant if you wish. The FHS isn't precise as 
  to the structure of the /usr/local/share subdirectories, so we took the 
  liberty of creating the directories that we felt were needed.</para>
  
  </sect2>
  
  </sect1>
  
  
  
  
  1.1                  LFS/BOOK/chapter06/kernel-exp-headers.xml
  
  Index: kernel-exp-headers.xml
  ===================================================================
  <sect2>
  <title>Why we copy the kernel headers and don't symlink them</title>
  
  <para>In the past, it was common practice for people to symlink the
  /usr/include/linux and asm directories to /usr/src/linux/include/linux
  and asm respectively.  This is a <emphasis>bad</emphasis> idea as 
  this extract from a post by Linus Torvalds to the Linux Kernel 
  Mailing List points out:</para>
  
  <screen>I would suggest that people who compile new kernels should: 
  
   - not have a single symbolic link in sight (except the one that the 
     kernel build itself sets up, namely the "linux/include/asm" symlink 
     that is only used for the internal kernel compile itself) 
  
  And yes, this is what I do. My /usr/src/linux still has the old 2.2.13 
  header files, even though I haven't run a 2.2.13 kernel in a _loong_ 
  time. But those headers were what glibc was compiled against, so those 
  headers are what matches the library object files. 
  
  And this is actually what has been the suggested environment for at 
  least the last five years. I don't know why the symlink business keeps 
  on living on, like a bad zombie. Pretty much every distribution still 
  has that broken symlink, and people still remember that the linux 
  sources should go into "/usr/src/linux" even though that hasn't been 
  true in a _loong_ time.</screen>
  
  <para>The relevant part here is where he states that the headers should
  be the ones which <emphasis>glibc was compiled against</emphasis>.  These are 
  the headers which should remain accessible and so by copying them, we ensure
  that we follow these guidelines.  Also note that as long as you don't have 
  those symlinks, it is perfectly fine to have the kernel sources 
  in <filename>/usr/src/linux</filename>.</para>
  
  </sect2>
  
  
  
  1.1                  LFS/BOOK/chapter06/kernel-exp.xml
  
  Index: kernel-exp.xml
  ===================================================================
  <sect2>
  <title>Command explanations</title>
  
  <para><userinput>ln -s /static/bin/pwd /bin/pwd</userinput>: The kernel
  source hard-wires the path to <filename>pwd</filename> to be
  <filename>/bin/pwd</filename> so we create a temporary symlink to deal with
  it.</para>
  
  <para><userinput>make mrproper:</userinput> This will ensure that the kernel
  tree is absolutely clean.  We do this because the kernel team recommend
  that this is done prior to <emphasis>each</emphasis> kernel compilation,
  and that we shouldn't rely on the source tree being automatically clean
  after untarring.</para>
  
  <para><userinput>make include/linux/version.h</userinput> and
  <userinput>make symlinks</userinput>: This creates the
  <filename>include/linux/version.h</filename>, as well as the <filename
  class="symlink">include/asm</filename> symlink.</para>
  
  <para><userinput>mkdir $LFS/usr/include/asm</userinput>
  and <userinput>cp include/asm/* $LFS/usr/include/asm</userinput>:
  This copies the platform-specific assembler kernel header files to
  <filename>$LFS/usr/include/asm</filename></para>
  
  <para><userinput>cp -R include/linux $LFS/usr/include</userinput>:
  This command copies the cross-platform kernel header files to
  <filename>$LFS/usr/include</filename></para>
  
  <para><userinput>touch $LFS/usr/include/linux/autoconf.h</userinput>: Some
  kernel header files include this <filename>autoconf.h</filename> file, but
  outside the Linux source tree, that file has no meaning so we just create
  an empty one so we don't get compile errors whenever it happens to be a
  dependency of another kernel header file.</para>
  
  </sect2>
  
  
  
  
  1.1                  LFS/BOOK/chapter06/kernel-inst.xml
  
  Index: kernel-inst.xml
  ===================================================================
  <sect2>
  <title>Installation of the Linux Kernel</title>
  
  <para>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 needs the kernel header files, we're
  going to unpack the kernel archive now and set it up so that we can
  compile the packages that need the kernel.</para>
  
  <para>The kernel configuration file is created by running the following 
  command:</para>
  
  <para><screen><userinput>ln -s /static/bin/pwd /bin/pwd &&
  make mrproper &&
  make include/linux/version.h &&
  make symlinks &&
  mkdir /usr/include/asm &&
  cp include/asm/* /usr/include/asm &&
  cp -R include/linux /usr/include &&
  touch /usr/include/linux/autoconf.h &&
  rm /bin/pwd</userinput></screen></para>
  
  </sect2>
  
  
  
  
  1.1                  LFS/BOOK/chapter06/kernel.xml
  
  Index: kernel.xml
  ===================================================================
  <sect1 id="ch06-kernel">
  <title>Installing Linux-&kernel-version;</title>
  <?dbhtml filename="kernel.html" dir="chapter06"?>
  
  <screen>Estimated build time:           &kernel-time-static;
  Estimated required disk space:  &kernel-compsize-static;</screen>
  
  &c6-kernel-inst;
  &c6-kernel-exp;
  &c6-kernel-exp-headers;
  &aa-kernel-desc;
  &aa-kernel-dep;
  
  </sect1>
  
  
  
  
  1.1                  LFS/BOOK/chapter06/mountproc.xml
  
  Index: mountproc.xml
  ===================================================================
  <sect1 id="ch06-proc">
  <title>Mounting $LFS/proc file system</title>
  <?dbhtml filename="proc.html" dir="chapter06"?>
  
  <para>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 (or any other
  file system for that matter) twice or even more than that.</para>
  
  <para>If you're still logged in as user "lfs", you should log out and log
  in again as user root. The reason for this is simple: only root is allowed
  to mount filesystems and to run chroot.</para>
  
  <para>The proc file system is mounted under $LFS/proc by running the
  following command. We'll also chown it to user root/group root while we're
  at it (the rest of the filesystem is chown'ed to root:root in a minute when
  we start with chapter 6).</para>
  
  <para><screen><userinput>mount proc /proc -t proc</userinput></screen></para>
  
  </sect1>
  
  
  
  
  1.1                  LFS/BOOK/chapter06/pwdgroup.xml
  
  Index: pwdgroup.xml
  ===================================================================
  <sect1 id="ch06-pwdgroup">
  <title>Creating passwd and group files</title>
  <?dbhtml filename="pwdgroup.html" dir="chapter06"?>
  
  <para>In order for the user and group root to be recognized and to be able to 
  login, there needs to be 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 created below aren't part of any standard.
  The LSB only recommends a group bin with GID 1 to be present besides 
  group root. Other group names and GID's can be chosen by the user. Well
  written packages don't depend on GID numbers but just use the group
  name, so it doesn't matter which GID a group has. Since there
  aren't any standards for groups the groups created here are the groups the
  MAKEDEV script (the script that creates the device files in the /dev
  directory) mentions.</para>
  
  <para>Create a new file <filename>/etc/passwd</filename> by running the
  following command:</para>
  
  <para><screen><userinput>echo "root:x:0:0:root:/root:/bin/bash" > /etc/passwd</userinput></screen></para>
  
  <para>Create a new file <filename>/etc/group</filename> by running the
  following command:</para>
  
  <para><screen><userinput>cat > /etc/group << "EOF"</userinput>
  root:x:0:
  bin:x:1:
  sys:x:2:
  kmem:x:3:
  tty:x:4:
  tape:x:5:
  daemon:x:6:
  floppy:x:7:
  disk:x:8:
  lp:x:9:
  dialout:x:10:
  audio:x:11:
  <userinput>EOF</userinput></screen></para>
  
  </sect1>
  
  
  
  
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-book' in the subject header of the message



More information about the lfs-book mailing list