Changes in / [e4b4c5a0:201aa93]
- Files:
-
- 6 deleted
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter01/how.xml
re4b4c5a0 r201aa93 9 9 <?dbhtml filename="how.html"?> 10 10 11 <title>How to CrossBuild an LFS System</title>11 <title>How to Build an LFS System</title> 12 12 13 13 <para>The LFS system will be built by using an already installed 14 UNIX-like system (such as Debian Linux or Mac OS X). This15 existing UNIX-likesystem (the host) will be used as a starting point to14 Linux distribution (such as Debian, OpenMandriva, Fedora, or openSUSE). This 15 existing Linux system (the host) will be used as a starting point to 16 16 provide necessary programs, including a compiler, linker, and shell, 17 17 to build the new system. Select the <quote>development</quote> option … … 52 52 cross-compile basic utilities using the just built cross-toolchain.</para> 53 53 54 <para><xref linkend="chapter-chroot-temporary-tools"/> then boots the 55 minimal Linux environment on the target machine, 56 where we use the new tools to build all 57 the rest of the tools needed to create the LFS system. 58 Note that in the book the minimal Linux environment may be 59 referred as <quote>chroot environment</quote> only to keep the consistency 60 with the original LFS book.</para> 54 <para><xref linkend="chapter-chroot-temporary-tools"/> then enters a 55 "chroot" environment, where we use the new tools to build all 56 the rest of the tools needed to create the LFS system.</para> 61 57 62 58 <para>This effort to isolate the new system from the host distribution may … … 65 61 66 62 <para>In <xref linkend="chapter-building-system"/> the 67 full LFS system is built.</para> 63 full-blown LFS system is built. Another advantage provided by the chroot 64 environment is that it allows you to continue using the host system 65 while LFS is being built. While waiting for package compilations to 66 complete, you can continue using your computer as usual.</para> 68 67 69 68 <para>To finish the installation, the basic system configuration is set up in -
chapter02/aboutlfs.xml
re4b4c5a0 r201aa93 15 15 throughout the LFS build process. It should be set to the name of the 16 16 directory where you will be building your LFS system - we will use 17 <filename class="directory">/mnt/lfs</filename> as an example, but the 18 choose any directory name you want. Choose a directory location and set the 19 variable with the following command:</para> 17 <filename class="directory">/mnt/lfs</filename> as an example, but you may 18 choose any directory name you want. 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> 20 22 21 23 <screen role="nodump"><userinput>export LFS=<replaceable>/mnt/lfs</replaceable></userinput></screen> … … 26 28 <quote>/mnt/lfs</quote> (or whatever value the variable was set to) when it 27 29 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>35 30 36 31 <caution> -
chapter02/chapter02.xml
re4b4c5a0 r201aa93 15 15 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostreqs.xml"/> 16 16 <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"/> 17 19 <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"/> 18 21 19 22 </chapter> -
chapter02/hostreqs.xml
re4b4c5a0 r201aa93 16 16 <para>The LFS editors recommend that the system CPU have at least 17 17 four cores and that the system have at least 8 GB of memory. 18 19 For the Cross Edition, it's recommended that both the system running20 the host distribution and the target system should meet the21 requirements.22 23 18 Older systems that do not meet these requirements will still work, 24 19 but the time to build packages will be significantly longer … … 57 52 58 53 <listitem> 59 <!-- needed to cross build the kernel in chapter 6 -->60 <para><emphasis role="strong">Bc-1.07.0</emphasis></para>61 </listitem>62 63 <listitem>64 54 <para><emphasis role="strong">Bison-2.7</emphasis> (/usr/bin/yacc 65 55 should be a link to bison or a small script that executes bison)</para> … … 100 90 <listitem> 101 91 <para><emphasis role="strong">Gzip-1.3.12</emphasis></para> 92 </listitem> 93 94 <listitem> 95 <para><emphasis role="strong">Linux Kernel-&min-kernel;</emphasis></para> 96 97 <para>The reason for the kernel version requirement is that we specify 98 that version when building <application>glibc</application> in 99 <xref linkend="chapter-cross-tools"/> and 100 <xref linkend="chapter-building-system"/>, so the workarounds for 101 older kernels are not enabled and the compiled 102 <application>glibc</application> is slightly faster and smaller. 103 As at Feb 2024, &min-kernel; is the oldest kernel release still 104 supported by the kernel developers. Some kernel releases older than 105 &min-kernel; may be still supported by third-party teams, but they 106 are not considered official upstream kernel releases; read 107 <ulink url='https://kernel.org/category/releases.html'/> for the 108 details.</para> 109 110 <para>If the host kernel is earlier than &min-kernel; you will need to replace 111 the kernel with a more up-to-date version. There are two ways 112 you can go about this. First, see if your Linux vendor provides a &min-kernel; 113 or later kernel package. If so, you may wish to install it. If your 114 vendor doesn't offer an acceptable kernel package, or you would prefer not to 115 install it, you can compile a kernel yourself. Instructions for 116 compiling the kernel and configuring the boot loader (assuming the host 117 uses GRUB) are located in <xref linkend="chapter-bootable"/>.</para> 118 119 <para>We require the host kernel to support UNIX 98 pseudo terminal 120 (PTY). It should be enabled on all desktop or server distros shipping 121 Linux &min-kernel; or a newer kernel. If you are building a custom 122 host kernel, ensure <option>CONFIG_UNIX98_PTYS</option> is set to 123 <literal>y</literal> in the kernel configuration.</para> 124 102 125 </listitem> 103 126 … … 190 213 } 191 214 215 ver_kernel() 216 { 217 kver=$(uname -r | grep -E -o '^[0-9\.]+') 218 if printf '%s\n' $1 $kver | sort --version-sort --check &>/dev/null 219 then 220 printf "OK: Linux Kernel $kver >= $1\n"; return 0; 221 else 222 printf "ERROR: Linux Kernel ($kver) is TOO OLD ($1 or later required)\n" "$kver"; 223 return 1; 224 fi 225 } 226 192 227 # Coreutils first because --version-sort needs Coreutils >= 7.0 193 228 ver_check Coreutils sort 8.1 || bail "Coreutils too old, stop" 194 229 ver_check Bash bash 3.2 195 ver_check Bc bc 1.07.0196 230 ver_check Binutils ld 2.13.1 197 231 ver_check Bison bison 2.7 … … 212 246 ver_check Texinfo texi2any 5.0 213 247 ver_check Xz xz 5.0.0 248 ver_kernel &min-kernel; 249 250 if mount | grep -q 'devpts on /dev/pts' && [ -e /dev/ptmx ] 251 then echo "OK: Linux Kernel supports UNIX 98 PTY"; 252 else echo "ERROR: Linux Kernel does NOT support UNIX 98 PTY"; fi 214 253 215 254 alias_check() { -
chapter02/stages.xml
re4b4c5a0 r201aa93 65 65 <itemizedlist> 66 66 <listitem> 67 <para>You must boot the temporary system on the target machine.</para>67 <para>The /mnt/lfs partition must be mounted.</para> 68 68 </listitem> 69 69 70 70 <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 &root; user.</para> 74 75 </listitem> 75 76 76 77 <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" role='.'/></para> 78 <para> When entering chroot, the LFS environment variable must be set 79 for <systemitem class="username">root</systemitem>. The LFS 80 variable is not used after the chroot environment has been entered.</para> 81 </listitem> 82 83 <listitem> 84 <para> The virtual file systems must be mounted. This can be done 85 before or after entering chroot by changing to a host virtual terminal 86 and, as <systemitem class="username">root</systemitem>, running the 87 commands in 88 <xref linkend='ch-tools-bindmount'/> and 89 <xref linkend='ch-tools-kernfsmount' role='.'/></para> 80 90 </listitem> 81 91 </itemizedlist> -
chapter04/aboutsbus.xml
re4b4c5a0 r201aa93 38 38 39 39 <note> 40 <para>In the cross edition, the SBUs are kept same as the original LFS41 book. They should only be considered as a reference. It obviously does42 not make sense to predict the building time in Chapter 7 or 8 with43 <quote>1 SBU</quote> measured in Chapter 5, as the target machine and44 the machine running the host distro may be completely different.</para>45 </note>46 47 <note>48 40 <para>When multiple processors are used in this way, the SBU units in the 49 41 book will vary even more than they normally would. In some cases, the make -
chapter04/addinguser.xml
re4b4c5a0 r201aa93 81 81 <systemitem class="username">lfs</systemitem> the owner:</para> 82 82 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} 84 case $(uname -m) in 85 x86_64) chown -v lfs $LFS/lib64 ;; 86 esac</userinput></screen> 84 87 85 88 <note><para>In some host systems, the following <command>su</command> command does not complete -
chapter04/creatingminlayout.xml
re4b4c5a0 r201aa93 22 22 <systemitem class="username">root</systemitem>:</para> 23 23 24 <screen><userinput>mkdir -pv $LFS/{ boot,etc,var} $LFS/usr/{bin,lib,sbin}24 <screen><userinput>mkdir -pv $LFS/{etc,var} $LFS/usr/{bin,lib,sbin} 25 25 26 26 for i in bin lib sbin; do 27 27 ln -sv usr/$i $LFS/$i 28 done </userinput></screen>28 done 29 29 30 <para>Some targets (for example, x86_64) needs 31 <filename class="directory">/lib64</filename> directory. If you are 32 building for one of those targets, create it as 33 <systemitem class="username">root</systemitem>:</para> 34 35 <screen><userinput>mkdir -pv $LFS/lib64</userinput></screen> 30 case $(uname -m) in 31 x86_64) mkdir -pv $LFS/lib64 ;; 32 esac</userinput></screen> 36 33 37 34 <para>Programs in <xref linkend="chapter-temporary-tools"/> will be compiled -
chapter04/settingenviron.xml
re4b4c5a0 r201aa93 44 44 LFS=/mnt/lfs 45 45 LC_ALL=POSIX 46 LFS_TGT= <replaceable>x86_64</replaceable>-lfs-linux-gnu46 LFS_TGT=$(uname -m)-lfs-linux-gnu 47 47 PATH=/usr/bin 48 48 if [ ! -L /bin ]; then PATH=/bin:$PATH; fi … … 105 105 106 106 <varlistentry> 107 <term><parameter>LFS_TGT= <replaceable>x86_64</replaceable>-lfs-linux-gnu</parameter></term>107 <term><parameter>LFS_TGT=$(uname -m)-lfs-linux-gnu</parameter></term> 108 108 <listitem> 109 109 <para>The <envar>LFS_TGT</envar> variable sets a non-default, but compatible machine 110 110 description for use when building our cross-compiler and linker and when 111 111 cross-compiling our temporary toolchain. More information is provided by 112 <xref linkend="ch-tools-toolchaintechnotes" role=""/>. 113 If you are not building for 64-bit x86, replace 114 <replaceable>x86_64</replaceable> with some value suitable for your target 115 machine, for example <literal>i686</literal> for 32-bit x86.</para> 112 <xref linkend="ch-tools-toolchaintechnotes" role=""/>.</para> 116 113 </listitem> 117 114 </varlistentry> -
chapter05/gcc-pass1.xml
re4b4c5a0 r201aa93 63 63 mv -v mpc-&mpc-version; mpc</userinput></screen> 64 64 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 ;; 73 esac</userinput></screen> 72 74 73 75 <para>The GCC documentation recommends building GCC -
chapter05/glibc.xml
re4b4c5a0 r201aa93 46 46 <para>First, create a symbolic link for LSB compliance. Additionally, 47 47 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 54 52 ;; 55 x86_64 *) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib6456 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 57 55 ;; 58 56 esac</userinput></screen> … … 93 91 --host=$LFS_TGT \ 94 92 --build=$(../scripts/config.guess) \ 95 --enable-kernel=& linux-major-version;.&linux-minor-version;\93 --enable-kernel=&min-kernel; \ 96 94 --with-headers=$LFS/usr/include \ 97 95 --disable-nscd \ … … 111 109 112 110 <varlistentry> 113 <term><parameter>--enable-kernel=&linux-major-version;.&linux-minor-version;</parameter></term> 114 <listitem> 115 <para>This option tells the build system that this glibc may 116 be used with kernels as old as 117 &linux-major-version;.&linux-minor-version;. This means generating 118 workarounds in case a system call introduced in a later version 119 cannot be used.</para> 111 <term><parameter>--enable-kernel=&min-kernel;</parameter></term> 112 <listitem> 113 <para>This tells Glibc to compile the library with support 114 for &min-kernel; and later Linux kernels. Workarounds for older 115 kernels are not enabled.</para> 120 116 </listitem> 121 117 </varlistentry> -
chapter05/linux-headers.xml
re4b4c5a0 r201aa93 57 57 be available. The headers are first placed in 58 58 <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 63 62 find usr/include -type f ! -name '*.h' -delete 64 63 </userinput><userinput remap="install">cp -rv usr/include $LFS/usr</userinput></screen> -
chapter06/chapter06.xml
re4b4c5a0 r201aa93 32 32 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass2.xml"/> 33 33 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 39 34 </chapter> -
chapter06/gcc-pass2.xml
re4b4c5a0 r201aa93 58 58 mv -v mpc-&mpc-version; mpc</userinput></screen> 59 59 60 <para>For x86_64 target, set the default directory name for 61 64-bit libraries to <quote>lib</quote>. The command is unnecessary, 62 but harmless for 32-bit x86. If you are building for another target, 63 you may need to adjust the command for your target.</para> 60 <para>If building on x86_64, change the default directory name for 64-bit 61 libraries to <quote>lib</quote>:</para> 64 62 65 <screen><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \ 66 -i.orig gcc/config/i386/t-linux64</userinput></screen> 63 <screen><userinput remap="pre">case $(uname -m) in 64 x86_64) 65 sed -e '/m64=/s/lib64/lib/' \ 66 -i.orig gcc/config/i386/t-linux64 67 ;; 68 esac</userinput></screen> 67 69 68 70 <para>Override the building rule of libgcc and libstdc++ headers, to -
chapter07/chapter07.xml
re4b4c5a0 r201aa93 10 10 <?dbhtml filename="chapter07.html"?> 11 11 12 <title> Booting the Target Systemand Building Additional Temporary Tools</title>12 <title>Entering Chroot and Building Additional Temporary Tools</title> 13 13 14 14 <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"/> 16 16 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kernfs.xml"/> 17 17 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chroot.xml"/> … … 24 24 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="texinfo.xml"/> 25 25 <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"/>27 26 28 27 <!-- -
chapter07/chroot.xml
re4b4c5a0 r201aa93 7 7 8 8 <sect1 id="ch-tools-chroot"> 9 <?dbhtml filename=" env.html"?>9 <?dbhtml filename="chroot.html"?> 10 10 11 <title> Setting up theEnvironment</title>11 <title>Entering the Chroot Environment</title> 12 12 13 <para>The current shell is also the <command>init</command> process, 14 so exiting from it will cause kernel panic. Prevent exiting from the 15 shell accidentally:</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 and 15 finish installing the temporary tools. This environment will also be 16 used to install 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 nothing but temporary 19 tools:</para> 16 20 17 <screen role="nodump"><userinput>enable -n exit exec 18 readonly IGNOREEOF=1000</userinput></screen> 19 20 <para>The standard I/O streams of the initial shell process is connected 21 with <filename>/dev/console</filename>. However, the testsuite of some 22 packages may expect the standard I/O streams to be connected with a 23 <quote>real</quote> TTY device node. Spawn a new shell process on the 24 TTY device with <command>agetty</command>:</para> 25 26 <screen role="nodump"><userinput>agetty -n -l /bin/bash <replaceable>tty0</replaceable></userinput></screen> 27 28 <para>If you are working via a serial console, replace 29 <replaceable>tty0</replaceable> with the name of the serial console 30 device node, for example <literal>ttyS0</literal>.</para> 31 32 <para>The command above spawns a new shell process on the TTY device 33 specified in the command, and the initial shell process will run in 34 background as an init process with very limited functions. The new shell 35 process will output:</para> 36 37 <screen role="nodump"><computeroutput>bash: cannot set terminal process group (-1): Inappropriate ioctl for device 38 bash: no job control in this shell</computeroutput></screen> 39 40 <para>This is normal because the shell is not assigned with a 41 controlling terminal yet. Now set up the controlling terminal and 42 some environment variables:</para> 43 44 <screen><userinput>exec setsid -c /usr/bin/env -i \ 21 <screen role="nodump"><userinput>chroot "$LFS" /usr/bin/env -i \ 45 22 HOME=/root \ 46 23 TERM="$TERM" \ 47 PS1='(lfs ) \u:\w\$ '\24 PS1='(lfs chroot) \u:\w\$ ' \ 48 25 PATH=/usr/bin:/usr/sbin \ 49 26 MAKEFLAGS="-j<replaceable>$(nproc)</replaceable>" \ 50 27 TESTSUITEFLAGS="-j<replaceable>$(nproc)</replaceable>" \ 51 28 /bin/bash --login</userinput></screen> 52 53 <para>The command replaces the current shell process with a new shell54 process, with controlling terminal set up.</para>55 29 56 30 <para> … … 65 39 66 40 <para>The <parameter>-i</parameter> option given to the <command>env</command> 67 command will clear all the variables in the environment. After that, only41 command will clear all the variables in the chroot environment. After that, only 68 42 the <envar>HOME</envar>, <envar>TERM</envar>, <envar>PS1</envar>, and 69 43 <envar>PATH</envar> variables are set again. The 70 <parameter>TERM=$TERM</parameter> construct will setthe <envar>TERM</envar>71 variable to the default value specified by <command>agetty</command>. This variable is44 <parameter>TERM=$TERM</parameter> construct sets the <envar>TERM</envar> 45 variable inside chroot to the same value as outside chroot. This variable is 72 46 needed so programs like <command>vim</command> and <command>less</command> 73 47 can operate properly. If other variables are desired, such as 74 48 <envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is a good place to set 75 49 them.</para> 50 51 <para>From this point on, there is no need to use the 52 <envar>LFS</envar> variable any more because all work will be restricted 53 to the LFS file system; the <command>chroot</command> command runs the 54 Bash shell with the root 55 (<filename class="directory">/</filename>) directory set to 56 <filename class='directory'>$LFS</filename>.</para> 76 57 77 58 <para>Notice that <filename class="directory">/tools/bin</filename> is not … … 83 64 <filename>/etc/passwd</filename> file has not been created yet.</para> 84 65 85 <para>Now set up a temporary hostname, which is required by test suite of86 some packages:</para>87 88 <screen><userinput>hostname lfs</userinput></screen>89 90 66 <note> 91 67 <para>It is important that all the commands throughout the remainder of this 92 chapter and the following chapters are run from within the environment93 we've set. If you leave this environment for any reason (rebooting for68 chapter and the following chapters are run from within the chroot 69 environment. If you leave this environment for any reason (rebooting for 94 70 example), ensure that the virtual kernel filesystems are mounted as 95 explained in <xref linkend="ch-tools- kernfsmount"/> and96 <xref linkend="ch-tools-devadjust"/> and set up the environment again before97 continuingwith the installation.</para>71 explained in <xref linkend="ch-tools-bindmount"/> and <xref 72 linkend="ch-tools-kernfsmount"/> and enter chroot again before continuing 73 with the installation.</para> 98 74 </note> 99 75 -
chapter07/cleanup.xml
re4b4c5a0 r201aa93 58 58 59 59 <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 ought 65 not be placed within the 66 <filename class="directory">$LFS</filename> hierarchy. 61 67 </para> 62 68 63 <screen role="nodump"><userinput>mount -v /dev/sda<replaceable>4</replaceable> /mnt</userinput></screen> 69 <para> 70 If you have decided to make a backup, leave the chroot environment: 71 </para> 72 73 <screen role="nodump"><userinput>exit</userinput></screen> 74 75 <important> 76 <para> 77 All of the following instructions are executed by 78 <systemitem class="username">root</systemitem> on your host system. 79 Take extra care about the commands you're going to run as mistakes 80 made here can modify your host system. Be aware that the 81 environment variable <envar>LFS</envar> 82 is set for user <systemitem class="username">lfs</systemitem> by default 83 but may <emphasis>not</emphasis> be set for 84 <systemitem class="username">root</systemitem>. 85 </para> 86 <para> 87 Whenever commands are to be executed by <systemitem class="username">root</systemitem>, 88 make sure you have set <envar>LFS</envar>. 89 </para> 90 <para> 91 This has been discussed in 92 <xref linkend='ch-partitioning-aboutlfs' role='.'/> 93 </para> 94 </important> 95 96 <para>Before making a backup, unmount the virtual file systems:</para> 97 98 <screen role="nodump"><userinput>mountpoint -q $LFS/dev/shm && umount $LFS/dev/shm 99 umount $LFS/dev/pts 100 umount $LFS/{sys,proc,run,dev}</userinput></screen> 64 101 65 102 <para> 66 103 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 for68 backup.104 will be included in the backup archive) on the file system containing 105 the directory where you create the backup archive. 69 106 </para> 70 107 … … 89 126 </note> 90 127 91 <screen role="nodump"><userinput>cd / 92 tar -cJpf /mnt/lfs-temp-tools-&version;.tar.xz . \ 93 --exclude="dev/*" --exclude="proc/*" 94 --exclude="sys/*" --exclude="run/*" 95 --exclude="mnt/*"</userinput></screen> 128 <screen role="nodump"><userinput>cd $LFS 129 tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz .</userinput></screen> 96 130 97 <para>Unmount the partition containing the backup:</para> 98 99 <screen role="nodump"><userinput>umount /mnt</userinput></screen> 131 <note> 132 <para> 133 If continuing to chapter 8, don't forget to reenter the chroot 134 environment as explained in the <quote>Important</quote> box below. 135 </para> 136 </note> 100 137 101 138 </sect2> … … 107 144 In case some mistakes have been made and you need to start over, you can 108 145 use this backup to restore the system and save some recovery time. 109 Since the sources are included in the 110 backup archive as well, so they do not need to be downloaded again. 146 Since the sources are located under 147 <filename class="directory">$LFS</filename>, they are included in the 148 backup archive as well, so they do not need to be downloaded again. After 149 checking that <envar>$LFS</envar> is set properly, you can 150 restore the backup by executing the following commands: 111 151 </para> 112 113 <warning><para>114 Power off the target system and reconnect the disk containing LFS115 temporary system to the host for restoring the backup. It's necessary116 to avoid overwriting some binaries being used. Because the package117 providing <command>shutdown</command> command is not built yet, the118 system can't be shut down cleanly. Issue <command>sync</command> to119 ensure all filesystem writes cached in memory to be really written120 into the disk, then power off the system physically (for example,121 unplug the AC cord).122 </para></warning>123 124 <para>Mount the LFS partition and the backup partition on125 <emphasis role="bold">the host system</emphasis>:</para>126 152 127 153 <!-- Make the following look different so users don't blindly run the 128 154 restore when they don't need to. --> 129 155 130 <screen role="nodump"><computeroutput>mkdir -pv /mnt/lfs-{target,backup}131 mount -v -t ext4 <replaceable>/dev/sdx</replaceable>3 /mnt/lfs-target132 mount -v -t ext4 <replaceable>/dev/sdx4</replaceable> /mnt/lfs-backup</computeroutput></screen>133 134 135 156 <warning><para>The following commands are extremely dangerous. If 136 157 you run <command>rm -rf ./*</command> as the &root; user and you 137 do not change to the <filename>lfs-target</filename> directory,138 it will destroy your entire host system.139 YOU ARE WARNED.</para></warning>158 do not change to the $LFS directory or the <envar>LFS</envar> 159 environment variable is not set for the &root; user, it will destroy 160 your entire host system. YOU ARE WARNED.</para></warning> 140 161 141 <screen role="nodump"><computeroutput>cd /mnt/lfs-target162 <screen role="nodump"><computeroutput>cd $LFS 142 163 rm -rf ./* 143 tar -xpf /mnt/lfs-backup/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>164 tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen> 144 165 145 166 <para> 146 Again, unmount the two partitions, reconnect the device to the target147 machine, boot it and continue building the rest of system:167 Again, double check that the environment has been set up properly 168 and continue building the rest of the system. 148 169 </para> 149 150 <screen role="nodump"><computeroutput>umount /mnt/lfs-{target,backup}</computeroutput></screen>151 170 152 171 <important> 153 172 <para> 154 If you reboot your target machine and restart 155 building using a restore, remount the virtual filesystems now as 156 described in <xref linkend='ch-tools-kernfs'/> and re-enter the build 173 If you left the chroot environment to create a backup or restart 174 building using a restore, remember to check that the virtual 175 file systems are still mounted (<command>findmnt | grep 176 $LFS</command>). If they are not mounted, remount them now as 177 described in <xref linkend='ch-tools-kernfs'/> and re-enter the chroot 157 178 environment (see <xref linkend='ch-tools-chroot'/>) before continuing. 158 179 </para> -
chapter07/introduction.xml
re4b4c5a0 r201aa93 11 11 <title>Introduction</title> 12 12 13 <warning>14 <para>Please make sure the temporary system is already booted on the15 target machine. All commands in this chapter and the following chapters16 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 a18 command for the temporary system on the host can completely destroy the19 host distro.</para>20 </warning>21 22 13 <para>This chapter shows how to build the last missing bits of the temporary 23 14 system: the tools needed to build the 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> 28 18 29 <para>For proper operation of the temporary system, some communication30 with the running kernel must be established. This is done throughthe19 <para>For proper operation of the isolated environment, some communication 20 with the running kernel must be established. This is done via the 31 21 so-called <emphasis>Virtual Kernel File Systems</emphasis>, which will be 32 mounted as soon as possible after boot. You may want to check33 that they are mounted by issuing <command>mount</command>.</para>22 mounted before entering the chroot environment. You may want to verify 23 that they are mounted by issuing the <command>findmnt</command> command.</para> 34 24 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 contains some important data, it's possible to destroy them with bad 39 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 bad commands.</para> 40 31 41 32 </sect1> -
chapter07/kernfs.xml
re4b4c5a0 r201aa93 19 19 with the kernel itself. These file systems are virtual: no disk 20 20 space is used for them. The content of these file systems resides in 21 memory.</para> 21 memory. These file systems must be mounted in the $LFS directory tree 22 so the applications can find them in the chroot environment.</para> 22 23 23 24 <para>Begin by creating the directories on which these virtual file systems will be 24 25 mounted:</para> 25 26 26 <screen><userinput>mkdir -pv /{proc,sys,run}</userinput></screen> 27 <screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen> 28 29 <sect2 id="ch-tools-bindmount"> 30 <title>Mounting and Populating /dev</title> 31 32 <para>During a normal boot of an LFS system, the kernel automatically 33 mounts the <systemitem class="filesystem">devtmpfs</systemitem> 34 file system on the 35 <filename class="directory">/dev</filename> directory; the kernel 36 creates device nodes on that virtual file system during the boot process, 37 or when a device is first detected or accessed. The udev daemon may 38 change the ownership or permissions of the device nodes created by the 39 kernel, and create new device nodes or symlinks, to ease the work of 40 distro maintainers and system administrators. (See 41 <xref linkend='ch-config-udev-device-node-creation'/> for details.) 42 If the host kernel supports &devtmpfs;, we can simply mount a 43 &devtmpfs; at <filename class='directory'>$LFS/dev</filename> and rely 44 on the kernel to populate it.</para> 45 46 <para>But some host kernels lack &devtmpfs; support; these 47 host distros use different methods to create the content of 48 <filename class="directory">/dev</filename>. 49 So the only host-agnostic way to populate the 50 <filename class="directory">$LFS/dev</filename> directory is 51 by bind mounting the host system's 52 <filename class="directory">/dev</filename> directory. A bind mount is 53 a special type of mount that makes a directory subtree or a file 54 visible at some other location. Use the following 55 command to do this.</para> 56 57 <screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen> 58 59 </sect2> 27 60 28 61 <sect2 id="ch-tools-kernfsmount"> 29 62 <title>Mounting Virtual Kernel File Systems</title> 30 63 31 <para>The kernel has already mounted 32 <systemitem class="filesystem">devtmpfs</systemitem>. 33 Mount the remaining virtual kernel file systems:</para> 64 <para>Now mount the remaining virtual kernel file systems:</para> 34 65 35 66 <!-- Do not put any option after $LFS/${mountpoint} or jhalfs cannot 36 67 handle it! --> 37 68 38 <screen><userinput>mkdir -pv /dev/{pts,shm} 39 mount -vt devpts devpts -o gid=5,mode=0620 /dev/pts 40 mount -vt proc proc /proc 41 mount -vt sysfs sysfs /sys 42 mount -vt tmpfs tmpfs /run 43 mount -vt tmpfs tmpfs /dev/shm -o nosuid,nodev</userinput></screen> 69 <screen><userinput>mount -vt devpts devpts -o gid=5,mode=0620 $LFS/dev/pts 70 mount -vt proc proc $LFS/proc 71 mount -vt sysfs sysfs $LFS/sys 72 mount -vt tmpfs tmpfs $LFS/run</userinput></screen> 44 73 45 74 <variablelist> … … 71 100 </variablelist> 72 101 73 </sect2> 102 <para>In some host systems, <filename>/dev/shm</filename> is a 103 symbolic link to a directory, typically 104 <filename class="directory">/run/shm</filename>. 105 The /run tmpfs was mounted above so in this case only a 106 directory needs to be created with the correct permissions.</para> 74 107 75 <sect2 id="ch-tools-devadjust"> 76 <title>Adjusting devtmpfs</title> 108 <para>In other host systems <filename>/dev/shm</filename> is a mount point 109 for a tmpfs. In that case the mount of /dev above will only create 110 /dev/shm as a directory in the chroot environment. In this situation 111 we must explicitly mount a tmpfs:</para> 77 112 78 <para>Now with the 79 <systemitem class='filesystem'>proc</systemitem> filesystem 80 mounted, we can replace the device nodes for standard I/O streams 81 with symlinks to pseudo files in 82 <filename class="directory">/proc/self/fd</filename> (which are symlinks 83 to the files connected to the standard I/O streams for the current 84 process). And, create another symlink recommended by the kernel 85 documentation. These are necessary for I/O redirection in the building 86 system of some packages to function properly:</para> 87 88 <screen><userinput>ln -sfv /proc/self/fd/0 /dev/stdin 89 ln -sfv /proc/self/fd/1 /dev/stdout 90 ln -sfv /proc/self/fd/2 /dev/stderr 91 ln -sv /proc/self/fd /dev</userinput></screen> 113 <screen><userinput>if [ -h $LFS/dev/shm ]; then 114 install -v -d -m 1777 $LFS$(realpath /dev/shm) 115 else 116 mount -vt tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm 117 fi</userinput></screen> 92 118 93 119 </sect2> -
chapter08/bash.xml
re4b4c5a0 r201aa93 101 101 <!-- Some host distros set core file size hard limit < 1000, then the 102 102 test "ulimit -c -S 1000" attempts to set soft limit > hard limit 103 and fail. [Cannot affect cross build.]103 and fail. --> 104 104 One test named <filename>run-builtins</filename> is known to fail on 105 105 some host distros with a difference on the first line of the 106 output. --></para>106 output.</para> 107 107 108 108 <para>Install the package:</para> -
chapter08/coreutils.xml
re4b4c5a0 r201aa93 102 102 meant to be run as user <systemitem class="username">root</systemitem>:</para> 103 103 104 <!-- CLFS note: "su -c" to set the supplementary group IDs. 105 For a normal LFS build, they are already set by 'login' or 'su'. 106 But for CLFS there is no such tool available at the beginning of 107 chapter 7. Currently coreutils is the only package of which the 108 test suite needs the supplementary GIDs set up. --> 109 <screen><userinput remap="test">su -c 'make NON_ROOT_USERNAME=tester check-root'</userinput></screen> 104 <screen><userinput remap="test">make NON_ROOT_USERNAME=tester check-root</userinput></screen> 110 105 111 106 <para>We're going to run the remainder of the tests as the -
chapter08/expect.xml
re4b4c5a0 r201aa93 58 58 If, instead, the output includes <computeroutput>OSError: out of pty 59 59 devices</computeroutput>, then the environment is not set up for proper 60 PTY operation. You need to read60 PTY operation. You need to exit from the chroot environment, read 61 61 <xref linkend='ch-tools-kernfs'/> again, and ensure the 62 62 <systemitem class="filesystem">devpts</systemitem> file system (and 63 other virtual kernel file systems) mounted correctly. 63 other virtual kernel file systems) mounted correctly. Then reenter 64 the chroot environment following <xref linkend='ch-tools-chroot'/>. 64 65 This issue needs to be resolved before continuing, or the test suites 65 66 requiring Expect (for example the test suites of Bash, Binutils, GCC, -
chapter08/gcc.xml
re4b4c5a0 r201aa93 42 42 <title>Installation of GCC</title> 43 43 44 <para>For x86_64 target, set the default directory name for 45 64-bit libraries to <quote>lib</quote>. The command is unnecessary, 46 but harmless for 32-bit x86. If you are building for another target, 47 you may need to adjust the command for your target.</para> 48 49 <screen><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \ 50 -i.orig gcc/config/i386/t-linux64</userinput></screen> 44 <para>If building on x86_64, change the default directory name for 64-bit 45 libraries to <quote>lib</quote>:</para> 46 47 <screen><userinput remap="pre">case $(uname -m) in 48 x86_64) 49 sed -e '/m64=/s/lib64/lib/' \ 50 -i.orig gcc/config/i386/t-linux64 51 ;; 52 esac</userinput></screen> 51 53 52 54 <para>The GCC documentation recommends building GCC in a dedicated build directory:</para> -
chapter08/glibc.xml
re4b4c5a0 r201aa93 71 71 <screen><userinput remap="configure">../configure --prefix=/usr \ 72 72 --disable-werror \ 73 --enable-kernel=& linux-major-version;.&linux-minor-version;\73 --enable-kernel=&min-kernel; \ 74 74 --enable-stack-protector=strong \ 75 75 --disable-nscd \ … … 88 88 89 89 <varlistentry> 90 <term><parameter>--enable-kernel=& linux-major-version;.&linux-minor-version;</parameter></term>90 <term><parameter>--enable-kernel=&min-kernel;</parameter></term> 91 91 <listitem> 92 92 <para>This option tells the build system that this Glibc may 93 be used with kernels as old as 94 &linux-major-version;.&linux-minor-version;. This means generating 93 be used with kernels as old as &min-kernel;. This means generating 95 94 workarounds in case a system call introduced in a later version 96 95 cannot be used.</para> … … 158 157 159 158 <itemizedlist> 159 160 <listitem> 161 <para><emphasis>io/tst-lchmod</emphasis> 162 is known to fail in the LFS chroot environment.</para> 163 </listitem> 160 164 161 165 <listitem> -
chapter10/fstab.xml
re4b4c5a0 r201aa93 26 26 # order 27 27 28 /dev/<replaceable> sda</replaceable>2/ <replaceable><fff></replaceable> defaults 1 129 /dev/<replaceable> sda</replaceable>3swap swap pri=1 0 028 /dev/<replaceable><xxx></replaceable> / <replaceable><fff></replaceable> defaults 1 1 29 /dev/<replaceable><yyy></replaceable> swap swap pri=1 0 0 30 30 proc /proc proc nosuid,noexec,nodev 0 0 31 31 sysfs /sys sysfs nosuid,noexec,nodev 0 0 … … 45 45 # order 46 46 47 /dev/<replaceable> sda</replaceable>3 / ext4defaults 1 148 /dev/<replaceable> sda</replaceable>2 /boot ext4 defaults 0 247 /dev/<replaceable><xxx></replaceable> / <replaceable><fff></replaceable> defaults 1 1 48 /dev/<replaceable><yyy></replaceable> swap swap pri=1 0 0 49 49 50 50 # End /etc/fstab</literal> 51 51 EOF</userinput></screen> 52 52 53 <para>Replace <replaceable>sda</replaceable> to the name of the device 54 node for your disk where LFS is being built. For details on the six 53 <para>Replace <replaceable><xxx></replaceable>, 54 <replaceable><yyy></replaceable>, and <replaceable><fff></replaceable> 55 with the values appropriate for the system, for example, <filename 56 class="partition">sda2</filename>, <filename 57 class="partition">sda5</filename>, and <systemitem 58 class="filesystem">ext4</systemitem>. For details on the six 55 59 fields in this file, see <ulink role='man' url='&man;fstab.5'>fstab(5)</ulink>.</para> 56 60 -
chapter10/grub.xml
re4b4c5a0 r201aa93 79 79 is /boot/grub/.</para> 80 80 81 <para>For the following example, it is assumed that the root 82 partition is <filename class="partition">sda3</filename>, and the 83 seperate boot partition is 84 <filename class="partition">sda2</filename>. Replace 85 <replaceable>sda</replaceable> to the name of the device node for your 86 disk where LFS is being built.</para> 81 <para>The location of the boot partition is a choice of the user that 82 affects the configuration. One recommendation is to have a separate small 83 (suggested size is 200 MB) partition just for boot information. That way 84 each build, whether LFS or some commercial distro, can access the same boot 85 files and access can be made from any booted system. If you choose to do 86 this, you will need to mount the separate partition, move all files in the 87 current <filename class="directory">/boot</filename> directory (e.g. the 88 Linux kernel you just built in the previous section) to the new partition. 89 You will then need to unmount the partition and remount it as <filename 90 class="directory">/boot</filename>. If you do this, be sure to update 91 <filename>/etc/fstab</filename>.</para> 92 93 <para>Leaving <filename class="directory">/boot</filename> on 94 the current LFS partition will also work, but configuration 95 for multiple systems is more difficult.</para> 96 97 <para>Using the above information, determine the appropriate 98 designator for the root partition (or boot partition, if a separate 99 one is used). For the following example, it is assumed that the root 100 (or separate boot) partition is <filename 101 class="partition">sda2</filename>.</para> 87 102 88 103 <para>Install the GRUB files into <filename … … 123 138 124 139 menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" { 125 linux / vmlinuz-&linux-version;-lfs-&version; root=/dev/sda3ro140 linux /boot/vmlinuz-&linux-version;-lfs-&version; root=/dev/sda2 ro 126 141 }</literal> 127 142 EOF</userinput></screen> -
chapter10/kernel.xml
re4b4c5a0 r201aa93 338 338 339 339 <caution> 340 <para>As the cross-built LFS system has a separate &boot-dir; 341 partition, the files copied below should go there. The easiest way to 340 <para>If you've decided to use a separate &boot-dir; partition for the 341 LFS system (maybe sharing a &boot-dir; partition with the host 342 distro) , the files copied below should go there. The easiest way to 342 343 do that is to create the entry for &boot-dir; in &fstab; first (read 343 344 the previous section for details), then issue the following command 344 as the &root; user:</para> 345 as the &root; user in the 346 <emphasis>chroot environment</emphasis>:</para> 345 347 346 348 <screen role="nodump"><userinput>mount /boot</userinput></screen> 347 349 348 <para> We don't need to specify the path to the device node, as it's349 already given in <filename>/etc/fstab</filename>.</para>350 <para>The path to the device node is omitted in the command because 351 <command>mount</command> can read it from &fstab;.</para> 350 352 </caution> 351 353 -
chapter11/afterlfs.xml
re4b4c5a0 r201aa93 74 74 75 75 <sect3> 76 <title>Work from the LFS host in chroot</title> 77 78 <para> 79 This method provides a complete graphical environment where a full 80 featured browser and copy/paste capabilities are available. This method 81 allows using applications like the host's version of wget to download 82 package sources to a location available when working in the chroot 83 environment. 84 </para> 85 86 <para> 87 In order to properly build packages in chroot, you will also need to 88 remember to mount the virtual file systems if they are not already 89 mounted. One way to do this is to create a script on the 90 <emphasis role="bold">HOST</emphasis> system: 91 </para> 92 93 <screen><command>cat > ~/mount-virt.sh << "EOF" 94 #!/bin/bash 95 96 function mountbind 97 { 98 if ! mountpoint $LFS/$1 >/dev/null; then 99 $SUDO mount --bind /$1 $LFS/$1 100 echo $LFS/$1 mounted 101 else 102 echo $LFS/$1 already mounted 103 fi 104 } 105 106 function mounttype 107 { 108 if ! mountpoint $LFS/$1 >/dev/null; then 109 $SUDO mount -t $2 $3 $4 $5 $LFS/$1 110 echo $LFS/$1 mounted 111 else 112 echo $LFS/$1 already mounted 113 fi 114 } 115 116 if [ $EUID -ne 0 ]; then 117 SUDO=sudo 118 else 119 SUDO="" 120 fi 121 122 if [ x$LFS == x ]; then 123 echo "LFS not set" 124 exit 1 125 fi 126 127 mountbind dev 128 mounttype dev/pts devpts devpts -o gid=5,mode=620 129 mounttype proc proc proc 130 mounttype sys sysfs sysfs 131 mounttype run tmpfs run 132 if [ -h $LFS/dev/shm ]; then 133 install -v -d -m 1777 $LFS$(realpath /dev/shm) 134 else 135 mounttype dev/shm tmpfs tmpfs -o nosuid,nodev 136 fi 137 138 #mountbind usr/src 139 #mountbind boot 140 #mountbind home 141 EOF</command></screen> 142 143 <para> 144 Note that the last three commands in the script are commented out. These 145 are useful if those directories are mounted as separate partitions on the 146 host system and will be mounted when booting the completed LFS/BLFS system. 147 </para> 148 149 <para> 150 The script can be run with <command>bash ~/mount-virt.sh</command> as 151 either a regular user (recommended) or as &root;. If run as a regular 152 user, sudo is required on the host system. 153 </para> 154 155 <para> 156 Another issue pointed out by the script is where to store downloaded 157 package files. This location is arbitrary. It can be in a regular 158 user's home directory such as ~/sources or in a global location like 159 /usr/src. Our recommendation is not to mix BLFS sources and LFS sources 160 in (from the chroot environment) /sources. In any case, the packages 161 must be accessible inside the chroot environment. 162 </para> 163 164 <para> 165 A last convenience feature presented here is to streamline the process 166 of entering the chroot environment. This can be done with an alias 167 placed in a user's ~/.bashrc file on the host system: 168 </para> 169 170 <screen><command>alias lfs='sudo /usr/sbin/chroot /mnt/lfs /usr/bin/env -i HOME=/root TERM="$TERM" PS1="\u:\w\\\\$ " 171 PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login'</command></screen> 172 173 <para> 174 This alias is a little tricky because of the quoting and levels of 175 backslash characters. It must be all on a single line. The above command 176 has been split in two for presentation purposes. 177 </para> 178 179 </sect3> 180 181 <sect3> 76 182 <title>Work remotely via ssh</title> 77 183 … … 80 186 requires installing 81 187 <ulink url="&blfs-book;postlfs/openssh.html">sshd</ulink> 82 on the LFS system, usually in the LFS command line. It also requires 83 a second computer. 188 on the LFS system, usually in chroot. It also requires a second 189 computer. This method has the advantage of being simple by not requiring 190 the complexity of the chroot environment. It also uses your LFS built 191 kernel for all additional packages and still provides a complete system 192 for installing packages. 84 193 </para> 85 194 … … 109 218 <ulink url="&blfs-book;basicnet/links.html">links</ulink> 110 219 (or <ulink url="&blfs-book;basicnet/lynx.html">lynx</ulink>) 111 after rebooting into the new LFS system. You may need a removable 112 stroage device to copy these packages into the target system. At this 220 in chroot and then rebooting into the new LFS system. At this 113 221 point the default system has six virtual consoles. Switching 114 222 consoles is as easy as using the -
chapter11/reboot.xml
re4b4c5a0 r201aa93 105 105 106 106 <para>Now that we have said that, let's move on to booting our shiny new LFS 107 installation for the first time!</para> 107 installation for the first time! <emphasis>First exit from the chroot 108 environment</emphasis>:</para> 108 109 109 <para>Unmount the boot partition:</para> 110 <screen><userinput>logout</userinput></screen> 111 <!-- We need to show the user the details...--> 110 112 111 <screen role="nodump"><userinput>umount /boot</userinput></screen>113 <para>Then unmount the virtual file systems:</para> 112 114 113 <para>Synchronize cached writes to prevent data loss on reboot without a 114 fully functional <command>init</command> process:</para> 115 <screen><userinput>umount -v $LFS/dev/pts 116 mountpoint -q $LFS/dev/shm && umount -v $LFS/dev/shm 117 umount -v $LFS/dev 118 umount -v $LFS/run 119 umount -v $LFS/proc 120 umount -v $LFS/sys</userinput></screen> 115 121 116 <screen role="nodump"><userinput>sync</userinput></screen> 122 <para>If multiple partitions were created, unmount the other 123 partitions before unmounting the main one, like this:</para> 117 124 118 <para>Now, reboot the system:</para> 125 <screen role="nodump"><userinput>umount -v $LFS/home 126 umount -v $LFS</userinput></screen> 119 127 120 <screen role="nodump"><userinput>reboot -ff</userinput></screen>128 <para>Unmount the LFS file system itself:</para> 121 129 122 <para><parameter>-ff</parameter> option allows to reboot the system 123 without support from the <command>init</command> process.</para> 130 <screen role="nodump"><userinput>umount -v $LFS</userinput></screen> 131 132 <para>Now, reboot the system.</para> 133 134 <!-- Commented out because we don't have a host system requirement on 135 its init, and different init system may recommend different commands 136 for reboot. --> 137 <!--<screen role="nodump"><userinput>shutdown -r now</userinput></screen>--> 124 138 125 139 <para>Assuming the GRUB boot loader was set up as outlined earlier, the menu -
git-version.sh
re4b4c5a0 r201aa93 54 54 sha="$(git describe --abbrev=1)" 55 55 rev=$(echo "$sha" | sed 's/-g[^-]*$//') 56 version=" cross-$rev"57 versiond=" cross-$rev-systemd"56 version="$rev" 57 versiond="$rev-systemd" 58 58 59 59 if [ "$(git diff HEAD | wc -l)" != "0" ]; then -
packages.ent
re4b4c5a0 r201aa93 307 307 <!ENTITY grub-fin-du "166 MB"> 308 308 <!ENTITY grub-fin-sbu "0.3 SBU"> 309 <!ENTITY grub-tmp-du "161 MB">310 <!ENTITY grub-tmp-sbu "0.3 SBU">311 309 312 310 <!ENTITY gzip-version "1.13"> … … 351 349 <!ENTITY iproute2-fin-du "17 MB"> 352 350 <!ENTITY iproute2-fin-sbu "0.1 SBU"> 353 <!ENTITY iproute2-tmp-du "15 MB">354 <!ENTITY iproute2-tmp-sbu "less than 0.1 SBU">355 351 356 352 <!ENTITY jinja2-version "3.1.4"> … … 452 448 <!ENTITY linux-knl-sbu "0.6 - 20.4 SBU (typically about 1.4 SBU)"> 453 449 454 <!-- For temporary kernel use the minimal value -->455 <!ENTITY linux-tmp-du "1.8 GB">456 <!ENTITY linux-tmp-sbu "0.6 SBU">457 458 450 <!ENTITY linux-headers-tmp-du "1.5 GB"> 459 451 <!ENTITY linux-headers-tmp-sbu "less than 0.1 SBU"> … … 752 744 <!ENTITY util-linux-fin-sbu "0.5 SBU"> 753 745 754 <!ENTITY mount-setsid-du "85 MB">755 <!ENTITY mount-setsid-sbu "less than 0.1 SBU">756 757 746 <!ENTITY vim-version "9.1.0478"> 758 747 <!-- <!ENTITY vim-majmin "90"> --> -
prologue/architecture.xml
re4b4c5a0 r201aa93 13 13 <para>The primary target architectures of LFS are the AMD/Intel x86 (32-bit) 14 14 and 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> 15 also known to work, with some modifications, with the Power PC and ARM CPUs. To 16 build a system that utilizes one of these alternative CPUs, the main prerequisite, in 17 addition to those on the next page, is an existing Linux system such as an 18 earlier LFS installation, Ubuntu, Red Hat/Fedora, SuSE, or some other distribution 19 that targets that architecture. (Note that a 32-bit 20 distribution can be installed and used as a host system on a 64-bit AMD/Intel 21 computer.)</para> 17 22 18 23 <para>The gain from building on a 64-bit system, as -
prologue/preface.xml
re4b4c5a0 r201aa93 16 16 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="architecture.xml"/> 17 17 <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"/>19 18 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="standards.xml"/> 20 19 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="why.xml"/>
Note:
See TracChangeset
for help on using the changeset viewer.