Changes in / [964103c:6cad449]


Ignore:
Files:
6 deleted
27 edited

Legend:

Unmodified
Added
Removed
  • chapter01/how.xml

    r964103c r6cad449  
    99  <?dbhtml filename="how.html"?>
    1010
    11   <title>How to Cross Build an LFS System</title>
     11  <title>How to Build an LFS System</title>
    1212
    1313  <para>The LFS system will be built by using an already installed
    14   UNIX-like system (such as Debian Linux or Mac OS X). This
    15   existing UNIX-like system (the host) will be used as a starting point to
     14  Linux distribution (such as Debian, OpenMandriva, Fedora, or openSUSE). This
     15  existing Linux system (the host) will be used as a starting point to
    1616  provide necessary programs, including a compiler, linker, and shell,
    1717  to build the new system. Select the <quote>development</quote> option
     
    5454  cross-compile basic utilities using the just built cross-toolchain.</para>
    5555
    56   <para><xref linkend="chapter-chroot-temporary-tools"/> then boots the
    57   minimal Linux environment on the target machine and uses the previously
    58   built tools to build the additional tools needed to build and test the
    59   final system.  Note that in the book the minimal Linux environment may be
    60   referred as <quote>chroot environment</quote> only to keep the consistency
    61   with the original LFS book.</para>
     56  <para><xref linkend="chapter-chroot-temporary-tools"/> then enters a
     57  "chroot" environment and uses the previously built tools to build
     58  the additional tools needed to build and test the final system.</para>
    6259
    6360  <para>This effort to isolate the new system from the host distribution may
     
    6663
    6764  <para>In <xref linkend="chapter-building-system"/>, The
    68   full LFS system is built.</para>
     65  full LFS system is built. Another advantage provided by the chroot
     66  environment is that it allows you to continue using the host system
     67  while LFS is being built. While waiting for package compilations to
     68  complete, you can continue using your computer as normal.</para>
    6969
    7070  <para>To finish the installation, the basic system configuration is set up in
  • chapter02/aboutlfs.xml

    r964103c r6cad449  
    1616  directory where you will be building your LFS system - we will use
    1717  <filename class="directory">/mnt/lfs</filename> as an example, but the
    18   directory choice is up to you. Choose a directory location and set the
    19   variable with the following command:</para>
     18  directory choice is up to you. If you are building LFS on a separate
     19  partition, this directory will be the mount point for the partition.
     20  Choose a directory location and set the variable with the
     21  following command:</para>
    2022
    2123<screen role="nodump"><userinput>export LFS=<replaceable>/mnt/lfs</replaceable></userinput></screen>
     
    2628  <quote>/mnt/lfs</quote> (or whatever the variable was set to) when it
    2729  processes the command line.</para>
    28 
    29   <para>Create the directory:</para>
    30 
    31 <screen role="nodump"><userinput>mkdir -pv $LFS</userinput></screen>
    32 
    33   <para>If you don't have much space in the partition holding the directory,
    34   you can mount another partition on it.</para>
    3530
    3631  <caution>
  • chapter02/chapter02.xml

    r964103c r6cad449  
    1515  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostreqs.xml"/>
    1616  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="stages.xml"/>
     17  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingpartition.xml"/>
     18  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingfilesystem.xml"/>
    1719  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="aboutlfs.xml"/>
     20  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mounting.xml"/>
    1821
    1922</chapter>
  • chapter02/hostreqs.xml

    r964103c r6cad449  
    3636
    3737    <listitem>
    38       <!-- needed to cross build the kernel in chapter 6 -->
    39       <para><emphasis role="strong">Bc-1.07.0</emphasis></para>
    40     </listitem>
    41 
    42     <listitem>
    4338      <para><emphasis role="strong">Bison-2.7</emphasis> (/usr/bin/yacc
    4439      should be a link to bison or small script that executes bison)</para>
     
    7671    <listitem>
    7772      <para><emphasis role="strong">Gzip-1.3.12</emphasis></para>
     73    </listitem>
     74
     75    <listitem>
     76      <para><emphasis role="strong">Linux Kernel-&min-kernel;</emphasis></para>
     77
     78      <para>The reason for the kernel version requirement is that we specify
     79      that version when building <application>glibc</application> in
     80      <xref linkend="chapter-cross-tools"/> and
     81      <xref linkend="chapter-building-system"/>,
     82      at the recommendation of the developers.  It is also required by
     83      udev.</para>
     84
     85      <para>If the host kernel is earlier than &min-kernel; you will need to replace
     86      the kernel with a more up to date version. There are two ways
     87      you can go about this. First, see if your Linux vendor provides a &min-kernel;
     88      or later kernel package. If so, you may wish to install it. If your
     89      vendor doesn't offer an acceptable kernel package, or you would prefer not to
     90      install it, you can compile a kernel yourself. Instructions for
     91      compiling the kernel and configuring the boot loader (assuming the host
     92      uses GRUB) are located in <xref linkend="chapter-bootable"/>.</para>
     93
    7894    </listitem>
    7995
     
    145161unset MYSH
    146162
    147 bc --version | head -n1
    148163echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
    149164bison --version | head -n1
  • chapter02/stages.xml

    r964103c r6cad449  
    6565    <itemizedlist>
    6666      <listitem>
    67         <para>You must boot the temporary system on the target machine.</para>
     67         <para>The /mnt/lfs partition must be mounted.</para>
    6868      </listitem>
    6969
    7070      <listitem>
    71         <para>A few operations, from
    72         <quote>Preparing Virtual Kernel File Systems</quote> to
    73         <quote>Setting up Environment</quote> must be done.</para>
     71        <para>A few operations, from <quote>Changing Ownership</quote> to
     72        <quote>Entering the Chroot Environment</quote> must be done as the
     73        <systemitem class="username">root</systemitem> user, with the LFS
     74        environment variable set for the
     75        <systemitem class="username">root</systemitem>user.</para>
    7476      </listitem>
    7577
    7678      <listitem>
    77         <para>The operations in <xref linkend="ch-tools-lo"/> must be done
    78         before starting or continuing from
    79         <xref linkend="chapter-building-system"/>.</para>
     79         <para> When entering chroot, the LFS environment variable must be set
     80         for <systemitem class="username">root</systemitem>. The LFS
     81         variable is not used afterwards.</para>
    8082      </listitem>
    8183
     84      <listitem>
     85         <para> The virtual file systems must be mounted.  This can be done
     86         before or after entering chroot by changing to a host virtual terminal
     87         and, as <systemitem class="username">root</systemitem>, running the
     88         commands in
     89         <xref linkend='ch-tools-bindmount'/> and
     90         <xref linkend='ch-tools-kernfsmount'/>.</para>
     91      </listitem>
    8292    </itemizedlist>
    8393  </sect2>
  • chapter04/aboutsbus.xml

    r964103c r6cad449  
    3838
    3939  <note>
    40     <para>In the cross edition, the SBUs are kept same as the original LFS
    41     book.  They should only be considered as a reference. It obviously does
    42     not make sense to predict the building time in Chapter 7 or 8 with
    43     <quote>1 SBU</quote> measured in Chapter 5, as the target machine and
    44     the machine running the host distro may be completely different.</para>
    45   </note>
    46 
    47   <note>
    4840    <para>For many modern systems with multiple processors (or cores) the
    4941    compilation time for a package can be reduced by performing a "parallel
  • chapter04/addinguser.xml

    r964103c r6cad449  
    8181  <systemitem class="username">lfs</systemitem> the directory owner:</para>
    8282
    83 <screen><userinput>chown -v lfs $LFS/{usr{,/*},lib*,boot,var,etc,bin,sbin,tools}</userinput></screen>
     83<screen><userinput>chown -v lfs $LFS/{usr{,/*},lib,var,etc,bin,sbin,tools}
     84case $(uname -m) in
     85  x86_64) chown -v lfs $LFS/lib64 ;;
     86esac</userinput></screen>
    8487
    8588  <para>If a separate working directory was created as suggested, give
  • chapter04/creatingminlayout.xml

    r964103c r6cad449  
    2121  <systemitem class="username">root</systemitem>:</para>
    2222
    23 <screen><userinput>mkdir -pv $LFS/{boot,etc,var} $LFS/usr/{bin,lib,sbin}
     23<screen><userinput>mkdir -pv $LFS/{etc,var} $LFS/usr/{bin,lib,sbin}
    2424
    2525for i in bin lib sbin; do
    2626  ln -sv usr/$i $LFS/$i
    27 done</userinput></screen>
     27done
    2828
    29   <para>Some targets (for example, x86_64) needs
    30   <filename class="directory">/lib64</filename> directory.  If you are
    31   building for one of those targets, create it as
    32   <systemitem class="username">root</systemitem>:</para>
    33 
    34 <screen><userinput>mkdir -pv $LFS/lib64</userinput></screen>
     29case $(uname -m) in
     30  x86_64) mkdir -pv $LFS/lib64 ;;
     31esac</userinput></screen>
    3532
    3633  <para>Programs in <xref linkend="chapter-temporary-tools"/> will be compiled
  • chapter04/settingenviron.xml

    r964103c r6cad449  
    4343LFS=/mnt/lfs
    4444LC_ALL=POSIX
    45 LFS_TGT=<replaceable>x86_64</replaceable>-lfs-linux-gnu
     45LFS_TGT=$(uname -m)-lfs-linux-gnu
    4646PATH=/usr/bin
    4747if [ ! -L /bin ]; then PATH=/bin:$PATH; fi
     
    104104
    105105    <varlistentry>
    106       <term><parameter>LFS_TGT=<replaceable>x86_64</replaceable>-lfs-linux-gnu</parameter></term>
     106      <term><parameter>LFS_TGT=(uname -m)-lfs-linux-gnu</parameter></term>
    107107      <listitem>
    108108  <para>The <envar>LFS_TGT</envar> variable sets a non-default, but compatible machine
    109109  description for use when building our cross compiler and linker and when cross
    110110  compiling our temporary toolchain. More information is contained in
    111   <xref linkend="ch-tools-toolchaintechnotes" role=""/>.
    112   If you are not building for 64-bit x86, replace
    113   <replaceable>x86_64</replaceable> with some value suitable for your target
    114   machine, for example <literal>i686</literal> for 32-bit x86.</para>
     111  <xref linkend="ch-tools-toolchaintechnotes" role=""/>.</para>
    115112      </listitem>
    116113    </varlistentry>
  • chapter05/gcc-pass1.xml

    r964103c r6cad449  
    6363mv -v mpc-&mpc-version; mpc</userinput></screen>
    6464
    65     <para>For x86_64 target, set the default directory name for
    66     64-bit libraries to <quote>lib</quote>.  The command is unnecessary,
    67     but harmless for 32-bit x86.  If you are building for another target,
    68     you may need to adjust the command for your target.</para>
    69 
    70 <screen><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
    71     -i.orig gcc/config/i386/t-linux64</userinput></screen>
     65    <para>On x86_64 hosts, set the default directory name for
     66    64-bit libraries to <quote>lib</quote>:</para>
     67
     68<screen><userinput remap="pre">case $(uname -m) in
     69  x86_64)
     70    sed -e '/m64=/s/lib64/lib/' \
     71        -i.orig gcc/config/i386/t-linux64
     72 ;;
     73esac</userinput></screen>
    7274
    7375    <para>The GCC documentation recommends building GCC
  • chapter05/glibc.xml

    r964103c r6cad449  
    4646    <para>First, create a symbolic link for LSB compliance. Additionally,
    4747    for x86_64, create a compatibility symbolic link required for proper
    48     operation of the dynamic library loader.  It's needed to adjust the
    49     command if you are building LFS for a target other than 32-bit or
    50     64-bit x86.</para>
    51 
    52 <screen><userinput remap="pre">case $LFS_TGT in
    53     i?86*)   ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
     48    operation of the dynamic library loader:</para>
     49
     50<screen><userinput remap="pre">case $(uname -m) in
     51    i?86)   ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
    5452    ;;
    55     x86_64*) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
    56              ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3
     53    x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
     54            ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3
    5755    ;;
    5856esac</userinput></screen>
     
    9290      --host=$LFS_TGT                    \
    9391      --build=$(../scripts/config.guess) \
    94       --enable-kernel=&linux-major-version;.&linux-minor-version;               \
     92      --enable-kernel=&min-kernel;                \
    9593      --with-headers=$LFS/usr/include    \
    9694      libc_cv_slibdir=/usr/lib</userinput></screen>
     
    109107
    110108      <varlistentry>
    111         <term><parameter>--enable-kernel=&linux-major-version;.&linux-minor-version;</parameter></term>
    112         <listitem>
    113           <para>This option tells the build system that this glibc may
    114           be used with kernels as old as
    115           &linux-major-version;.&linux-minor-version;. This means generating
    116           workarounds in case a system call introduced in a later version
    117           cannot be used.</para>
     109        <term><parameter>--enable-kernel=&min-kernel;</parameter></term>
     110        <listitem>
     111          <para>This tells Glibc to compile the library with support
     112          for &min-kernel; and later Linux kernels.  Workarounds for older
     113          kernels are not enabled.</para>
    118114        </listitem>
    119115      </varlistentry>
  • chapter05/linux-headers.xml

    r964103c r6cad449  
    5757    be available. The headers are first placed in
    5858    <filename class="directory">./usr</filename>, then copied to the needed
    59     location.  Replace <replaceable>x86</replaceable> with a value suitable
    60     for your target machine if it's not a 32-bit or 64-bit x86:</para>
    61 
    62 <screen><userinput remap="make">make headers ARCH=<replaceable>x86</replaceable>
     59    location.</para>
     60
     61<screen><userinput remap="make">make headers
    6362find usr/include -name '.*' -delete
    6463rm usr/include/Makefile
  • chapter06/chapter06.xml

    r964103c r6cad449  
    3232  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass2.xml"/>
    3333
    34   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>
    35   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="grub.xml"/>
    36   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kernel.xml"/>
    37   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="grub-cfg.xml"/>
    38 
    3934</chapter>
  • chapter06/gcc-pass2.xml

    r964103c r6cad449  
    5555mv -v mpc-&mpc-version; mpc</userinput></screen>
    5656
    57     <para>For x86_64 target, set the default directory name for
    58     64-bit libraries to <quote>lib</quote>.  The command is unnecessary,
    59     but harmless for 32-bit x86.  If you are building for another target,
    60     you may need to adjust the command for your target.</para>
     57    <para>If building on x86_64, change the default directory name for 64-bit
     58    libraries to <quote>lib</quote>:</para>
    6159
    62 <screen><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
    63     -i.orig gcc/config/i386/t-linux64</userinput></screen>
     60<screen><userinput remap="pre">case $(uname -m) in
     61  x86_64)
     62    sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
     63  ;;
     64esac</userinput></screen>
    6465
    6566    <!-- https://gcc.gnu.org/PR100017 -->
  • chapter07/chapter07.xml

    r964103c r6cad449  
    1010  <?dbhtml filename="chapter07.html"?>
    1111
    12   <title>Booting the Target System and Building Additional Temporary Tools</title>
     12  <title>Entering Chroot and Building Additional Temporary Tools</title>
    1313
    1414  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
    15   <!--xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changingowner.xml"/-->
     15  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changingowner.xml"/>
    1616  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kernfs.xml"/>
    1717  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chroot.xml"/>
     
    2424  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="texinfo.xml"/>
    2525  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>
    26   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="iproute2.xml"/>
    2726
    2827<!--
  • chapter07/chroot.xml

    r964103c r6cad449  
    77
    88<sect1 id="ch-tools-chroot">
    9   <?dbhtml filename="env.html"?>
     9  <?dbhtml filename="chroot.html"?>
    1010
    11   <title>Setting up the Environment</title>
     11  <title>Entering the Chroot Environment</title>
    1212
    13     <para>The standard I/O streams of the initial shell process is connected
    14     with <filename>/dev/console</filename>.  However, the testsuite of some
    15     packages may expect the standard I/O streams to be connected with a
    16     <quote>real</quote> TTY device node.  Spawn a new shell process on the
    17     TTY device with <command>agetty</command>:</para>
     13  <para>Now that all the packages which are required to build the rest of the
     14  needed tools are on the system, it is time to enter the chroot environment to
     15  finish installing the remaining temporary tools. This environment will be in
     16  use also for installing the final system. As user <systemitem
     17  class="username">root</systemitem>, run the following command to enter the
     18  environment that is, at the moment, populated with only the temporary
     19  tools:</para>
    1820
    19 <screen role="nodump"><userinput>agetty -n -l /bin/bash <replaceable>tty0</replaceable></userinput></screen>
    20 
    21     <para>If you are working via a serial console, replace
    22     <replaceable>tty0</replaceable> with the name of the serial console
    23     device node, for example <literal>ttyS0</literal>.</para>
    24 
    25     <para>The command above spawns a new shell process on the TTY device
    26     specified in the command, and the initial shell process will run in
    27     background as an init process with very limited functions. The new shell
    28     process will output:</para>
    29 
    30 <screen role="nodump"><computeroutput>bash: cannot set terminal process group (-1): Inappropriate ioctl for device
    31 bash: no job control in this shell</computeroutput></screen>
    32 
    33     <para>This is normal because the shell is not assigned with a
    34     controlling terminal yet.  Now set up controlling terminal and
    35     environment variables:</para>
    36 
    37 <screen><userinput>exec setsid -c /usr/bin/env -i  \
     21<screen role="nodump"><userinput>chroot "$LFS" /usr/bin/env -i   \
    3822    HOME=/root                  \
    3923    TERM="$TERM"                \
    40     PS1='(lfs) \u:\w\$ '        \
     24    PS1='(lfs chroot) \u:\w\$ ' \
    4125    PATH=/usr/bin:/usr/sbin     \
    4226    /bin/bash --login</userinput></screen>
    4327
    44     <para>The command replace the current shell process with a new shell
    45     process, with controlling terminal set up.</para>
    46 
    4728  <para>The <parameter>-i</parameter> option given to the <command>env</command>
    48   command will clear all variables of the environment. After that, only
     29  command will clear all variables of the chroot environment. After that, only
    4930  the <envar>HOME</envar>, <envar>TERM</envar>, <envar>PS1</envar>, and
    5031  <envar>PATH</envar> variables are set again. The
    5132  <parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar>
    52   variable to the default value specified by <command>agetty</command>. This variable is
     33  variable inside chroot to the same value as outside chroot. This variable is
    5334  needed for programs like <command>vim</command> and <command>less</command>
    5435  to operate properly.  If other variables are desired, such as
     
    5637  them again.</para>
    5738
     39  <para>From this point on, there is no need to use the
     40  <envar>LFS</envar> variable anymore because all work will be restricted
     41  to the LFS file system.  This is because the Bash shell is told that
     42  <filename class="directory">$LFS</filename> is now the root
     43  (<filename class="directory">/</filename>) directory.</para>
     44
    5845  <para>Notice that <filename class="directory">/tools/bin</filename> is not
    5946  in the <envar>PATH</envar>. This means that the cross toolchain will no longer be
    60   used on the target machine.</para>
     47  used in the chroot environment.</para>
    6148
    6249  <para>Note that the <command>bash</command> prompt will say
     
    6451  <filename>/etc/passwd</filename> file has not been created yet.</para>
    6552
    66   <para>Now set up a temporary hostname, which is required by test suite of
    67   some packages:</para>
    68 
    69 <screen><userinput>hostname lfs</userinput></screen>
    70 
    7153  <note>
    7254    <para>It is important that all the commands throughout the remainder of this
    73     chapter and the following chapters are run from within the environment
    74     we've set. If you leave this environment for any reason (rebooting for
     55    chapter and the following chapters are run from within the chroot
     56    environment. If you leave this environment for any reason (rebooting for
    7557    example), ensure that the virtual kernel filesystems are mounted as
    76     explained in <xref linkend="ch-tools-kernfsmount"/> and
    77     <xref linkend="ch-tools-devadjust"/> and set up the environment again before
    78     continuing with the installation.</para>
     58    explained in <xref linkend="ch-tools-bindmount"/> and <xref
     59    linkend="ch-tools-kernfsmount"/> and enter chroot again before continuing
     60    with the installation.</para>
    7961  </note>
    8062
  • chapter07/cleanup.xml

    r964103c r6cad449  
    2121    <para>Second, the libtool .la files are only useful when linking with static
    2222    libraries. They are unneeded and potentially harmful when using dynamic
    23     shared libraries, specially when using non-autotools build systems.
    24     While still on the target machine, remove those files now:</para>
     23    shared libraries, especially when using non-autotools build systems.
     24    While still in chroot, remove those files now:</para>
    2525
    2626<screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen>
     
    5858
    5959    <para>
    60        If you are making a backup, mount the partition for backup:
     60      The following steps are performed from outside the chroot
     61      environment. That means, you have to leave the chroot environment
     62      first before continuing. The reason for that is to
     63      get access to file system locations outside of the chroot
     64      environment to store/read the backup archive which should
     65      not be placed within the
     66      <filename class="directory">$LFS</filename> hierarchy for
     67      safety reasons.
    6168    </para>
    6269
    63 <screen role="nodump"><userinput>mount -v /dev/sda<replaceable>4</replaceable> /mnt</userinput></screen>
     70    <para>
     71       If you have decided to make a backup, leave the chroot environment:
     72    </para>
     73
     74<screen role="nodump"><userinput>exit</userinput></screen>
     75
     76    <important>
     77      <para>
     78        All of the following instructions are executed by
     79        <systemitem class="username">root</systemitem> on your host system.
     80        Take extra care about the commands you're going to run as mistakes
     81        here can modify your host system. Be aware that the
     82        environment variable <envar>LFS</envar>
     83        is set for user <systemitem class="username">lfs</systemitem> by default
     84        but may <emphasis>not</emphasis> be set for
     85        <systemitem class="username">root</systemitem>.
     86     </para>
     87     <para>
     88        Whenever commands are to be executed by <systemitem class="username">root</systemitem>,
     89        make sure you have set <envar>LFS</envar>.
     90     </para>
     91     <para>
     92        This has been discussed in <xref linkend='ch-partitioning-aboutlfs'/>.
     93      </para>
     94    </important>
     95
     96    <para>Before making a backup, unmount the virtual file systems:</para>
     97
     98<screen role="nodump"><userinput>umount $LFS/dev/pts
     99umount $LFS/{sys,proc,run,dev}</userinput></screen>
    64100
    65101    <para>
    66102      Make sure you have at least 1 GB free disk space (the source tarballs
    67       will be included in the backup archive) in the partition prepared for
    68       backup.
     103      will be included in the backup archive) on the filesystem containing
     104      directory where you create the backup archive.
    69105    </para>
    70106
     
    92128    </note>
    93129
    94 <screen role="nodump"><userinput>cd /
    95 tar -cJpf /mnt/lfs-temp-tools-&version;.tar.xz . \
    96     --exclude="dev/*" --exclude="proc/*"
    97     --exclude="sys/*" --exclude="run/*"
    98     --exclude="mnt/*"</userinput></screen>
     130<screen role="nodump"><userinput>cd $LFS
     131tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz .</userinput></screen>
    99132
    100     <para>Unmount the partition containing the backup:</para>
    101 
    102 <screen role="nodump"><userinput>umount /mnt</userinput></screen>
     133    <note>
     134      <para>
     135        If continuing to chapter 8, don't forget to reenter the chroot
     136        environment as explained in the <quote>Important</quote> box below.
     137      </para>
     138    </note>
    103139
    104140  </sect2>
     
    110146      In case some mistakes have been made and you need to start over, you can
    111147      use this backup to restore the system and save some recovery time.
    112       Since the sources are included in the
    113       backup archive as well, so they do not need to be downloaded again.
     148      Since the sources are located under
     149      <filename class="directory">$LFS</filename>, they are included in the
     150      backup archive as well, so they do not need to be downloaded again. After
     151      checking that <envar>$LFS</envar> is set properly,
     152      restore the backup by executing the following commands:
    114153    </para>
    115 
    116     <warning><para>
    117       Power off the target system and reconnect the disk containing LFS
    118       temporary system to the host for restoring the backup.  It's necessary
    119       to avoid overwriting some binaries being used.  Because the package
    120       providing <command>shutdown</command> command is not built yet, the
    121       system can't be shut down cleanly.  Issue <command>sync</command> to
    122       ensure all filesystem writes cached in memory to be really written
    123       into the disk, then power off the system physically (for example,
    124       unplug the AC cord).
    125     </para></warning>
    126 
    127     <para>Mount the LFS partition and the backup partition on
    128     <emphasis role="bold">the host system</emphasis>:</para>
    129154
    130155<!-- Make the following look different so users don't blindly run the
    131156     restore when they don't need to. -->
    132157
    133 <screen role="nodump"><computeroutput>mkdir -pv /mnt/lfs-{target,backup}
    134 mount -v -t ext4 <replaceable>/dev/sdx</replaceable>3 /mnt/lfs-target
    135 mount -v -t ext4 <replaceable>/dev/sdx4</replaceable> /mnt/lfs-backup</computeroutput></screen>
    136 
    137 
    138158    <warning><para>The following commands are extremely dangerous.  If
    139159    you run <command>rm -rf ./*</command> as the root user and you
    140     do not change to the <filename>lfs-target</filename> directory,
    141     it will destroy your entire host system.
    142     YOU ARE WARNED.</para></warning>
     160    do not change to the $LFS directory or the <envar>LFS</envar>
     161    environment variable is not set for the root user, it will destroy
     162    your entire host system.  YOU ARE WARNED.</para></warning>
    143163
    144 <screen role="nodump"><computeroutput>cd /mnt/lfs-target
     164<screen role="nodump"><computeroutput>cd $LFS
    145165rm -rf ./*
    146 tar -xpf /mnt/lfs-backup/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
     166tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
    147167
    148168    <para>
    149        Again, unmount the two partitions, reconnect the device to the target
    150        machine, boot it and continue building the rest of system:
     169       Again, double check that the environment has been setup properly
     170       and continue building the rest of the system.
    151171    </para>
    152 
    153 <screen role="nodump"><computeroutput>umount /mnt/lfs-{target,backup}</computeroutput></screen>
    154172
    155173    <important>
    156174      <para>
    157          If you reboot your target machine and restart
    158          building using a restore, remount the virtual filesystems now as
    159          described in <xref linkend='ch-tools-kernfs'/> and re-enter the build
     175         If you left the chroot environment to create a backup or restart
     176         building using a restore, remember to check that the virtual
     177         filesystems are still mounted (<command>findmnt | grep
     178         $LFS</command>).  If they are not mounted, remount them now as
     179         described in <xref linkend='ch-tools-kernfs'/> and re-enter the chroot
    160180         environment (see <xref linkend='ch-tools-chroot'/>) before continuing.
    161181       </para>
  • chapter07/introduction.xml

    r964103c r6cad449  
    1111  <title>Introduction</title>
    1212
    13   <warning>
    14     <para>Please make sure the temporary system is already booted on the
    15     target machine.  All commands in this chapter and the following chapters
    16     should be executed on the target machine instead of the host distro,
    17     unless the book explicitly says a command is for the host.  Running a
    18     command for the temporary system on the host can completely destroy the
    19     host distro.</para>
    20   </warning>
    21 
    2213  <para>This chapter shows how to build the last missing bits of the temporary
    2314  system: the tools needed by the build machinery of various packages.  Now
    24   that all circular dependencies have been resolved and the temporary system
    25   is already bootable, we can boot it on the target machine and it would be
    26   completely isolated from the host operating system.  Then we can continue
    27   to build on the target machine.</para>
     15  that all circular dependencies have been resolved, a <quote>chroot</quote>
     16  environment, completely isolated from the host operating system (except for
     17  the running kernel), can be used for the build.</para>
    2818
    29   <para>For proper operation of the temporary system, some communication
     19  <para>For proper operation of the isolated environment, some communication
    3020  with the running kernel must be established. This is done through the
    3121  so-called <emphasis>Virtual Kernel File Systems</emphasis>, which must be
    32   mounted as soon as possible after boot. You may want to check
    33   that they are mounted by issuing <command>mount</command>.</para>
     22  mounted when entering the chroot environment. You may want to check
     23  that they are mounted by issuing <command>findmnt</command>.</para>
    3424
    35   <para>All commands in this and following chapters are run as root on the
    36   target system, fortunately without access to the host system.
    37   Be careful anyway, as if the storage devices of your target system already
    38   contain some important data, it's possible to destroy them with badly
    39   formed commands.</para>
     25  <para>Until <xref linkend="ch-tools-chroot"/>, the commands must be
     26  run as <systemitem class="username">root</systemitem>, with the
     27  <envar>LFS</envar> variable set. After entering chroot, all commands
     28  are run as root, fortunately without access to the OS of the computer
     29  you built LFS on. Be careful anyway, as it is easy to destroy the whole
     30  LFS system with badly formed commands.</para>
    4031
    4132</sect1>
  • chapter07/kernfs.xml

    r964103c r6cad449  
    2323    mounted:</para>
    2424
    25 <screen><userinput>mkdir -pv /{proc,sys,run}</userinput></screen>
     25<screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen>
     26
     27  <sect2>
     28    <title>Creating Initial Device Nodes</title>
     29
     30    <para>When the kernel boots the system, it requires the presence of a few
     31    device nodes, in particular the <filename
     32    class="devicefile">console</filename> and <filename
     33    class="devicefile">null</filename> devices. The device nodes must be
     34    created on the hard disk so that they are available before the kernel
     35    populates <systemitem class="filesystem">/dev</systemitem>), and
     36    additionally when Linux is started with
     37    <parameter>init=/bin/bash</parameter>. Create the devices by running the
     38    following commands:</para>
     39
     40<screen><userinput>mknod -m 600 $LFS/dev/console c 5 1
     41mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
     42
     43  </sect2>
     44
     45  <sect2 id="ch-tools-bindmount">
     46    <title>Mounting and Populating /dev</title>
     47
     48      <para>The recommended method of populating the <filename
     49      class="directory">/dev</filename> directory with devices is to mount a
     50      virtual filesystem (such as <systemitem
     51      class="filesystem">tmpfs</systemitem>) on the <filename
     52      class="directory">/dev</filename> directory, and allow the devices to be
     53      created dynamically on that virtual filesystem as they are detected or
     54      accessed. Device creation is generally done during the boot process
     55      by Udev. Since this new system does not yet have Udev and has not yet
     56      been booted, it is necessary to mount and populate <filename
     57      class="directory">/dev</filename> manually. This is accomplished by bind
     58      mounting the host system's <filename class="directory">/dev</filename>
     59      directory. A bind mount is a special type of mount that allows you to
     60      create a mirror of a directory or mount point to some other location. Use
     61      the following command to achieve this:</para>
     62
     63<screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
     64
     65  </sect2>
    2666
    2767  <sect2 id="ch-tools-kernfsmount">
    2868    <title>Mounting Virtual Kernel File Systems</title>
    2969
    30     <para>The kernel has already mounted
    31     <systemitem class="filesystem">devtmpfs</systemitem>.
    32     Mount the remaining virtual kernel filesystems:</para>
     70      <para>Now mount the remaining virtual kernel filesystems:</para>
    3371
    34 <screen><userinput>mkdir -pv /dev/{pts,shm}
    35 mount -vt devpts /dev/pts /dev/pts -o gid=5,mode=620
    36 mount -vt proc  proc  /proc
    37 mount -vt sysfs sysfs /sys
    38 mount -vt tmpfs tmpfs /run
    39 mount -vt tmpfs tmpfs /dev/shm</userinput></screen>
    40 
     72<screen><userinput>mount -v --bind /dev/pts $LFS/dev/pts
     73mount -vt proc proc $LFS/proc
     74mount -vt sysfs sysfs $LFS/sys
     75mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
     76<!--
    4177    <variablelist>
    4278      <title>The meaning of the mount options for devpts:</title>
     
    66102
    67103    </variablelist>
     104-->
     105      <para>In some host systems, <filename>/dev/shm</filename> is a
     106      symbolic link to <filename class="directory">/run/shm</filename>.
     107      The /run tmpfs was mounted above so in this case only a
     108      directory needs to be created.</para>
    68109
    69   </sect2>
    70 
    71   <sect2 id="ch-tools-devadjust">
    72     <title>Adjusting devtmpfs</title>
    73 
    74     <para>Now <systemitem class='filesystem'>proc</systemitem> filesystem
    75     is mounted, we can replace the device nodes for standard I/O streams
    76     with symlinks to pseudo files in
    77     <filename class="directory">/proc/self/fd</filename> (which are symlinks
    78     to the files connected to the standard I/O streams for the current
    79     process).  This is necessary for I/O redirection in the building system
    80     of some packages to function properly:</para>
    81 
    82 <screen><userinput>ln -sfv /proc/self/fd/0 /dev/stdin
    83 ln -sfv /proc/self/fd/1 /dev/stdout
    84 ln -sfv /proc/self/fd/2 /dev/stderr</userinput></screen>
     110<screen><userinput>if [ -h $LFS/dev/shm ]; then
     111  mkdir -pv $LFS/$(readlink $LFS/dev/shm)
     112fi</userinput></screen>
    85113
    86114  </sect2>
  • chapter08/coreutils.xml

    r964103c r6cad449  
    116116
    117117<screen><userinput remap="test">make NON_ROOT_USERNAME=tester check-root</userinput></screen>
    118 
    119     <!-- TODO: Only happens in clfs-ng.  Need to investigate.  -->
    120     <para>One test named <filename>chroot-credentials.sh</filename> is
    121     known to fail, but it will pass after booting the LFS system.</para>
    122118
    123119    <para>We're going to run the remainder of the tests as the
  • chapter08/gcc.xml

    r964103c r6cad449  
    5050    -i libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp</userinput></screen>
    5151
    52     <para>For x86_64 target, set the default directory name for
    53     64-bit libraries to <quote>lib</quote>.  The command is unnecessary,
    54     but harmless for 32-bit x86.  If you are building for another target,
    55     you may need to adjust the command for your target.</para>
    56 
    57 <screen><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
    58     -i.orig gcc/config/i386/t-linux64</userinput></screen>
     52    <para>If building on x86_64, change the default directory name for 64-bit
     53    libraries to <quote>lib</quote>:</para>
     54
     55<screen><userinput remap="pre">case $(uname -m) in
     56  x86_64)
     57    sed -e '/m64=/s/lib64/lib/' \
     58        -i.orig gcc/config/i386/t-linux64
     59  ;;
     60esac</userinput></screen>
    5961
    6062    <para>The GCC documentation recommends building GCC in a dedicated build directory:</para>
  • chapter08/glibc.xml

    r964103c r6cad449  
    7373<screen><userinput remap="configure">../configure --prefix=/usr                            \
    7474             --disable-werror                         \
    75              --enable-kernel=&linux-major-version;.&linux-minor-version;                     \
     75             --enable-kernel=&min-kernel;                      \
    7676             --enable-stack-protector=strong          \
    7777             --with-headers=/usr/include              \
     
    9090
    9191      <varlistentry>
    92         <term><parameter>--enable-kernel=&linux-major-version;.&linux-minor-version;</parameter></term>
     92        <term><parameter>--enable-kernel=&min-kernel;</parameter></term>
    9393        <listitem>
    9494          <para>This option tells the build system that this glibc may
    95           be used with kernels as old as
    96           &linux-major-version;.&linux-minor-version;. This means generating
     95          be used with kernels as old as &min-kernel;. This means generating
    9796          workarounds in case a system call introduced in a later version
    9897          cannot be used.</para>
  • chapter11/reboot.xml

    r964103c r6cad449  
    8282
    8383  <para>Now that we have said that, let's move on to booting our shiny new LFS
    84   installation for the first time!</para>
     84  installation for the first time! First exit from the chroot environment:</para>
    8585
    86   <para>Synchronize cached writes to prevent data loss on reboot without a
    87   fully functional <command>init</command> process:</para>
     86<screen><userinput>logout</userinput></screen>
     87<!-- We need to show the user the details...
     88  <para>Unmount the LFS file system hierarchy:</para>
    8889
    89 <screen role="nodump"><userinput>sync</userinput></screen>
     90<screen><userinput>umount -Rv $LFS</userinput></screen>
     91-->
     92
     93  <para>Then unmount the virtual file systems:</para>
     94
     95<screen><userinput>umount -v $LFS/dev/pts
     96umount -v $LFS/dev
     97umount -v $LFS/run
     98umount -v $LFS/proc
     99umount -v $LFS/sys</userinput></screen>
     100
     101  <para>If multiple partitions were created, unmount the other
     102  partitions before unmounting the main one, like this:</para>
     103
     104<screen role="nodump"><userinput>umount -v $LFS/usr
     105umount -v $LFS/home
     106umount -v $LFS</userinput></screen>
     107
     108  <para>Unmount the LFS file system itself:</para>
     109
     110<screen role="nodump"><userinput>umount -v $LFS</userinput></screen>
    90111
    91112  <para>Now, reboot the system with:</para>
    92113
    93 <screen role="nodump"><userinput>reboot -ff</userinput></screen>
    94 
    95   <para><parameter>-ff</parameter> option allows to reboot the system
    96   without support from the <command>init</command> process.</para>
     114<screen role="nodump"><userinput>shutdown -r now</userinput></screen>
    97115
    98116  <para>Assuming the GRUB boot loader was set up as outlined earlier, the menu
  • git-version.sh

    r964103c r6cad449  
    5050sha="$(git describe --abbrev=1)"
    5151rev=$(echo "$sha" | sed 's/-g[^-]*$//')
    52 version="cross-$rev"
    53 versiond="cross-$rev-systemd"
     52version="$rev"
     53versiond="$rev-systemd"
    5454
    5555if [ "$(git diff HEAD | wc -l)" != "0" ]; then
  • packages.ent

    r964103c r6cad449  
    310310<!ENTITY grub-fin-du "158 MB">
    311311<!ENTITY grub-fin-sbu "0.7 SBU">
    312 <!ENTITY grub-tmp-du "158 MB">
    313 <!ENTITY grub-tmp-sbu "0.7 SBU">
    314312
    315313<!ENTITY gzip-version "1.11">
     
    355353<!ENTITY iproute2-fin-du "15 MB">
    356354<!ENTITY iproute2-fin-sbu "0.2 SBU">
    357 <!ENTITY iproute2-tmp-du "15 MB">
    358 <!ENTITY iproute2-tmp-sbu "less than 0.1 SBU">
    359355
    360356<!ENTITY jinja2-version "3.0.3">
     
    444440<!ENTITY linux-knl-du "1200 - 8800 MB (typically about 1700 MB)">
    445441<!ENTITY linux-knl-sbu "1.5 - 130.0 SBU (typically about 12 SBU)">
    446 <!ENTITY linux-tmp-du "1200 MB">
    447 <!ENTITY linux-tmp-sbu "1.5 SBU">
    448442
    449443<!ENTITY linux-headers-tmp-du "1.2 GB">
     
    726720<!ENTITY util-linux-fin-du "261 MB">
    727721<!ENTITY util-linux-fin-sbu "1.1 SBU">
    728 <!ENTITY mount-setsid-du "85 MB">
    729 <!ENTITY mount-setsid-sbu "less than 0.1 SBU">
    730722
    731723<!ENTITY vim-version "8.2.4383">
  • prologue/architecture.xml

    r964103c r6cad449  
    1313<para>The primary target architectures of LFS are the AMD/Intel x86 (32-bit)
    1414and x86_64 (64-bit) CPUs.  On the other hand, the instructions in this book are
    15 also known to work, with some modifications, with the Power PC and ARM
    16 CPUs.</para>
     15also known to work, with some modifications, with the Power PC and ARM CPUs. To
     16build a system that utilizes one of these CPUs, the main prerequisite, in
     17addition to those on the next page, is an existing Linux system such as an
     18earlier LFS installation, Ubuntu, Red Hat/Fedora, SuSE, or other distribution
     19that targets the architecture that you have. Also note that a 32-bit
     20distribution can be installed and used as a host system on a 64-bit AMD/Intel
     21computer.</para>
    1722
    1823<para>For building LFS, the gain of building on a 64-bit system
  • prologue/preface.xml

    r964103c r6cad449  
    1616  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="architecture.xml"/>
    1717  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="prerequisites.xml"/>
    18   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="cross.xml"/>
    1918  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="standards.xml"/>
    2019  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="why.xml"/>
Note: See TracChangeset for help on using the changeset viewer.