Changeset 1f6dfd4


Ignore:
Timestamp:
09/19/2022 06:47:24 AM (19 months ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
xry111/clfs-ng
Children:
0ea3431
Parents:
6c952e3
Message:

clfs-ng: remove chroot method from afterlfs

It's obviously not possible for a cross build :(.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter11/afterlfs.xml

    r6c952e3 r1f6dfd4  
    7474
    7575  <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 capabilites 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       envirnment.
    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 &gt; ~/mount-virt.sh &lt;&lt; "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 mkdir $LFS/run/shm
    133 #mountbind usr/src
    134 #mountbind boot
    135 #mountbind home
    136 EOF</command></screen>
    137 
    138     <para>
    139        Note that the last three commands in the script are commented out. These
    140        are useful if those directories are mounted as separate partitions on the
    141        host system and will be mounted when booting the completed LFS/BLFS system.
    142     </para>
    143 
    144     <para>
    145         The script can be run with <command>bash ~/mount-virt.sh</command> as
    146         either a regular user (recommended) or as &root;. If run as a regular
    147         user, sudo is required on the host system.
    148     </para>
    149 
    150     <para>
    151         Another issue pointed out by the script is where to store downloaded
    152         package files. This location is arbitrary. It can be in a regular
    153         user's home directory such as ~/sources or in a global location like
    154         /usr/src. Our recommendation is not to mix BLFS sources and LFS sources
    155         in (from the chroot environment) /sources. In any case, the packages
    156         must be accessible inside the chroot environment.
    157     </para>
    158 
    159     <para>
    160         A last convenience feature presented here is to streamline the process
    161         of entering the chroot environment. This can be done with an alias
    162         placed in a user's ~/.bashrc file on the host system:
    163     </para>
    164 
    165 <screen><command>alias lfs='sudo /usr/sbin/chroot /mnt/lfs /usr/bin/env -i HOME=/root TERM="$TERM" PS1="\u:\w\\\\$ "
    166 PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login'</command></screen>
    167 
    168      <para>
    169        This alias is a little tricky because of the quoting and levels of
    170        backslash characters. It must be all on a single line. The above command
    171        has been split in two for presentation purposes.
    172     </para>
    173 
    174   </sect3>
    175 
    176   <sect3>
    17776  <title>Work remotely via ssh</title>
    17877
     
    18281        <ulink url="&blfs-book;postlfs/openssh.html">sshd</ulink> and
    18382        <ulink url="&blfs-book;basicnet/wget.html">wget</ulink>
    184        on the LFS system, usually in chroot. It also requires a second
    185        computer. This method has the advantage of being simple by not requiring
    186        the complexity of the chroot environment. It also uses your LFS built
    187        kernel for all additional packages and still provides a complete system
    188        for installing packages.
     83       on the LFS system, usually in the LFS command line. It also requires
     84       a second computer.
    18985    </para>
    19086
     
    20399        <ulink url="&blfs-book;basicnet/links.html">links</ulink>
    204100        (or <ulink url="&blfs-book;basicnet/lynx.html">lynx</ulink>)
    205        in chroot and then rebooting into the new LFS system. At this
     101       after rebooting into the new LFS system.  You may need a removable
     102       stroage device to copy these packages into the target system. At this
    206103       point the default system has six virtual consoles. Switching
    207104       consoles is as easy as using the
Note: See TracChangeset for help on using the changeset viewer.