Changeset 4e82d47 for chapter08/grub.xml


Ignore:
Timestamp:
12/05/2008 08:46:02 PM (15 years ago)
Author:
Jeremy Huntwork <jhuntwork@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
6f2cc22
Parents:
6e88633
Message:

Bring in DIY's next generation build method. Move GRUB to chapter 8.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8755 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter08/grub.xml

    r6e88633 r4e82d47  
    66]>
    77
    8 <sect1 id="ch-bootable-grub">
     8<sect1 id="ch-bootable-grub" role="wrap">
    99  <?dbhtml filename="grub.html"?>
    1010
    11   <title>Making the LFS System Bootable</title>
     11  <sect1info condition="script">
     12    <productname>grub</productname>
     13    <productnumber>&grub-version;</productnumber>
     14    <address>&grub-url;</address>
     15  </sect1info>
     16
     17  <title>GRUB-&grub-version;</title>
    1218
    1319  <indexterm zone="ch-bootable-grub">
    1420    <primary sortas="a-Grub">GRUB</primary>
    15     <secondary>configuring</secondary>
    1621  </indexterm>
    1722
    18   <para>Your shiny new LFS system is almost complete. One of the last
    19   things to do is to ensure that the system can be properly booted. The
    20   instructions below apply only to computers of IA-32 architecture,
    21   meaning mainstream PCs. Information on <quote>boot loading</quote> for
    22   other architectures should be available in the usual resource-specific
    23   locations for those architectures.</para>
    24 
    25   <para>Boot loading can be a complex area, so a few cautionary
    26   words are in order. Be familiar with the current boot loader and any other
    27   operating systems present on the hard drive(s) that need to be
    28   bootable. Make sure that an emergency boot disk is ready to
    29   <quote>rescue</quote> the computer if the computer becomes
    30   unusable (un-bootable).</para>
    31 
    32   <para>Earlier, we compiled and installed the GRUB boot loader software
    33   in preparation for this step. The procedure involves writing some
    34   special GRUB files to specific locations on the hard drive. We highly
    35   recommend creating a GRUB boot floppy diskette as a backup. Insert a
    36   blank floppy diskette and run the following commands:</para>
     23  <sect2 role="package">
     24    <title/>
     25
     26    <para>The GRUB package contains the GRand Unified Bootloader.</para>
     27
     28    <segmentedlist>
     29      <segtitle>&buildtime;</segtitle>
     30      <segtitle>&diskspace;</segtitle>
     31
     32      <seglistitem>
     33        <seg>&grub-ch6-sbu;</seg>
     34        <seg>&grub-ch6-du;</seg>
     35      </seglistitem>
     36    </segmentedlist>
     37
     38  </sect2>
     39
     40  <sect2 role="installation">
     41    <title>Installation of GRUB</title>
     42
     43    <caution>
     44      <para>This package will only build for x86 and x86_64 architectures
     45      containing 32-bit libs. If you chose to build on x86_64 without 32-bit
     46      libriaries (no multilib), then you must use LILO instead.</para>
     47    </caution>
     48
     49    <para>This package is known to have issues when its default
     50    optimization flags (including the <parameter>-march</parameter> and
     51    <parameter>-mcpu</parameter> options) are changed. If any environment
     52    variables that override default optimizations have been defined, such
     53    as <envar>CFLAGS</envar> and <envar>CXXFLAGS</envar>,
     54    unset them when building GRUB.</para>
     55
     56    <para>Start by applying the following patch to allow for better drive
     57    detection, fix some GCC 4.x issues, and provide better SATA support
     58    for some disk controllers:</para>
     59
     60<screen><userinput remap="pre">patch -Np1 -i ../&grub-geometry-patch;</userinput></screen>
     61
     62    <para>By default, GRUB doesn't support ext2 filesystems with 256-byte inodes.
     63    Fix this by applying the following patch:</para>
     64
     65<screen><userinput remap="pre">patch -Np1 -i ../&grub-inode-patch;</userinput></screen>
     66
     67    <para>Prepare GRUB for compilation:</para>
     68
     69<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
     70
     71    <para>Compile the package:</para>
     72
     73<screen><userinput remap="make">make</userinput></screen>
     74
     75    <para>To test the results, issue:</para>
     76
     77<screen><userinput remap="test">make check</userinput></screen>
     78
     79    <para>Install the package:</para>
     80
     81<screen><userinput remap="install">make install
     82mkdir -v /boot/grub
     83cp -v /usr/lib/grub/i386-pc/stage{1,2} /boot/grub</userinput></screen>
     84
     85    <para>Replace <filename class="directory">i386-pc</filename> with whatever
     86    directory is appropriate for the hardware in use.</para>
     87
     88    <para>The <filename class="directory">i386-pc</filename> directory
     89    contains a number of <filename>*stage1_5</filename> files, different
     90    ones for different file systems. Review the files available and copy
     91    the appropriate ones to the <filename
     92    class="directory">/boot/grub</filename> directory. Most users will
     93    copy the <filename>e2fs_stage1_5</filename> and/or
     94    <filename>reiserfs_stage1_5</filename> files.</para>
     95
     96  </sect2>
     97
     98  <sect2 role="configuration">
     99    <title>Configuring GRUB</title>
     100
     101    <para>Your shiny new LFS system is almost complete. One of the last
     102    things to do is to ensure that the system can be properly booted. The
     103    instructions below apply only to computers of IA-32 architecture,
     104    meaning mainstream PCs. Information on <quote>boot loading</quote> for
     105    other architectures should be available in the usual resource-specific
     106    locations for those architectures.</para>
     107
     108    <para>Boot loading can be a complex area, so a few cautionary
     109    words are in order. Be familiar with the current boot loader and any other
     110    operating systems present on the hard drive(s) that need to be
     111    bootable. Make sure that an emergency boot disk is ready to
     112    <quote>rescue</quote> the computer if the computer becomes
     113    unusable (un-bootable).</para>
     114
     115    <para>Earlier, we compiled and installed the GRUB boot loader software
     116    in preparation for this step. The procedure involves writing some
     117    special GRUB files to specific locations on the hard drive. We highly
     118    recommend creating a GRUB boot floppy diskette as a backup. Insert a
     119    blank floppy diskette and run the following commands:</para>
    37120
    38121<screen><userinput>dd if=/boot/grub/stage1 of=/dev/fd0 bs=512 count=1
    39122dd if=/boot/grub/stage2 of=/dev/fd0 bs=512 seek=1</userinput></screen>
    40123
    41   <para>Remove the diskette and store it somewhere safe. Now, run the
    42   <command>grub</command> shell:</para>
     124    <para>Remove the diskette and store it somewhere safe. Now, run the
     125    <command>grub</command> shell:</para>
    43126
    44127<screen><userinput>grub</userinput></screen>
    45128
    46   <para>GRUB uses its own naming structure for drives and partitions in
    47   the form of <emphasis>(hdn,m)</emphasis>, where <emphasis>n</emphasis>
    48   is the hard drive number and <emphasis>m</emphasis> is the partition
    49   number, both starting from zero. For example, partition <filename
    50   class="partition">hda1</filename> is <emphasis>(hd0,0)</emphasis> to
    51   GRUB and <filename class="partition">hdb3</filename> is
    52   <emphasis>(hd1,2)</emphasis>. In contrast to Linux, GRUB does not
    53   consider CD-ROM drives to be hard drives. For example, if using a CD
    54   on <filename class="partition">hdb</filename> and a second hard drive
    55   on <filename class="partition">hdc</filename>, that second hard drive
    56   would still be <emphasis>(hd1)</emphasis>.</para>
    57 
    58   <para>Using the above information, determine the appropriate
    59   designator for the root partition (or boot partition, if a separate
    60   one is used). For the following example, it is assumed that the root
    61   (or separate boot) partition is <filename
    62   class="partition">hda4</filename>.</para>
    63 
    64   <para>Tell GRUB where to search for its
    65   <filename>stage{1,2}</filename> files. The Tab key can be used
    66   everywhere to make GRUB show the alternatives:</para>
     129    <para>GRUB uses its own naming structure for drives and partitions in
     130    the form of <emphasis>(hdn,m)</emphasis>, where <emphasis>n</emphasis>
     131    is the hard drive number and <emphasis>m</emphasis> is the partition
     132    number, both starting from zero. For example, partition <filename
     133    class="partition">hda1</filename> is <emphasis>(hd0,0)</emphasis> to
     134    GRUB and <filename class="partition">hdb3</filename> is
     135    <emphasis>(hd1,2)</emphasis>. In contrast to Linux, GRUB does not
     136    consider CD-ROM drives to be hard drives. For example, if using a CD
     137    on <filename class="partition">hdb</filename> and a second hard drive
     138    on <filename class="partition">hdc</filename>, that second hard drive
     139    would still be <emphasis>(hd1)</emphasis>.</para>
     140
     141    <para>Using the above information, determine the appropriate
     142    designator for the root partition (or boot partition, if a separate
     143    one is used). For the following example, it is assumed that the root
     144    (or separate boot) partition is <filename
     145    class="partition">hda4</filename>.</para>
     146
     147    <para>Tell GRUB where to search for its
     148    <filename>stage{1,2}</filename> files. The Tab key can be used
     149    everywhere to make GRUB show the alternatives:</para>
    67150
    68151<screen><userinput>root (hd0,3)</userinput></screen>
    69152
    70   <warning>
    71     <para>The following command will overwrite the current boot loader. Do not
    72     run the command if this is not desired, for example, if using a third party
    73     boot manager to manage the Master Boot Record (MBR). In this scenario, it
    74     would make more sense to install GRUB into the <quote>boot sector</quote>
    75     of the LFS partition. In this case, this next command would become
    76     <userinput>setup (hd0,3)</userinput>.</para>
    77   </warning>
    78 
    79   <para>Tell GRUB to install itself into the MBR of
    80   <filename class="partition">hda</filename>:</para>
     153    <warning>
     154      <para>The following command will overwrite the current boot loader. Do not
     155      run the command if this is not desired, for example, if using a third party
     156      boot manager to manage the Master Boot Record (MBR). In this scenario, it
     157      would make more sense to install GRUB into the <quote>boot sector</quote>
     158      of the LFS partition. In this case, this next command would become
     159      <userinput>setup (hd0,3)</userinput>.</para>
     160    </warning>
     161
     162    <para>Tell GRUB to install itself into the MBR of
     163    <filename class="partition">hda</filename>:</para>
    81164
    82165<screen><userinput>setup (hd0)</userinput></screen>
    83166
    84   <para>If all went well, GRUB will have reported finding its files in
    85   <filename class="directory">/boot/grub</filename>. That's all there is
    86   to it. Quit the <command>grub</command> shell:</para>
     167    <para>If all went well, GRUB will have reported finding its files in
     168    <filename class="directory">/boot/grub</filename>. That's all there is
     169    to it. Quit the <command>grub</command> shell:</para>
    87170
    88171<screen><userinput>quit</userinput></screen>
    89172
    90   <para>Create a <quote>menu list</quote> file defining GRUB's boot menu:</para>
     173    <para>Create a <quote>menu list</quote> file defining GRUB's boot menu:</para>
    91174
    92175<screen><userinput>cat &gt; /boot/grub/menu.lst &lt;&lt; "EOF"
     
    108191EOF</userinput></screen>
    109192
    110   <para>Add an entry for the host distribution if desired. It might look
    111   like this:</para>
     193    <para>Add an entry for the host distribution if desired. It might look
     194    like this:</para>
    112195
    113196<screen><userinput>cat &gt;&gt; /boot/grub/menu.lst &lt;&lt; "EOF"
     
    118201EOF</userinput></screen>
    119202
    120   <para>If dual-booting Windows, the following entry will allow
    121   booting it:</para>
     203    <para>If dual-booting Windows, the following entry will allow
     204    booting it:</para>
    122205
    123206<screen><userinput>cat &gt;&gt; /boot/grub/menu.lst &lt;&lt; "EOF"
     
    127210EOF</userinput></screen>
    128211
    129   <para>If <command>info grub</command> does not provide all necessary material,
    130   additional information regarding GRUB is located on its website at:
    131   <ulink url="http://www.gnu.org/software/grub/"/>.</para>
    132 
    133   <para>The FHS stipulates that GRUB's <filename>menu.lst</filename> file should
    134   be symlinked to <filename class="symlink">/etc/grub/menu.lst</filename>. To
    135   satisfy this requirement, issue the following command:</para>
     212    <para>If <command>info grub</command> does not provide all necessary material,
     213    additional information regarding GRUB is located on its website at:
     214    <ulink url="http://www.gnu.org/software/grub/"/>.</para>
     215
     216    <para>The FHS stipulates that GRUB's <filename>menu.lst</filename> file should
     217    be symlinked to <filename class="symlink">/etc/grub/menu.lst</filename>. To
     218    satisfy this requirement, issue the following command:</para>
    136219
    137220<screen><userinput>mkdir -v /etc/grub
    138221ln -sv /boot/grub/menu.lst /etc/grub</userinput></screen>
    139222
     223  </sect2>
     224
     225  <sect2 id="contents-gRUB" role="content">
     226    <title>Contents of GRUB</title>
     227
     228    <segmentedlist>
     229      <segtitle>Installed programs</segtitle>
     230
     231      <seglistitem>
     232        <seg>grub, grub-install, grub-md5-crypt, grub-set-default,
     233        grub-terminfo, and mbchk</seg>
     234      </seglistitem>
     235    </segmentedlist>
     236
     237    <variablelist>
     238      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
     239      <?dbfo list-presentation="list"?>
     240      <?dbhtml list-presentation="table"?>
     241
     242      <varlistentry id="grub">
     243        <term><command>grub</command></term>
     244        <listitem>
     245          <para>The Grand Unified Bootloader's command shell</para>
     246          <indexterm zone="ch-bootable-grub grub">
     247            <primary sortas="b-grub">grub</primary>
     248          </indexterm>
     249        </listitem>
     250      </varlistentry>
     251
     252      <varlistentry id="grub-install">
     253        <term><command>grub-install</command></term>
     254        <listitem>
     255          <para>Installs GRUB on the given device</para>
     256          <indexterm zone="ch-bootable-grub grub-install">
     257            <primary sortas="b-grub-install">grub-install</primary>
     258          </indexterm>
     259        </listitem>
     260      </varlistentry>
     261
     262      <varlistentry id="grub-md5-crypt">
     263        <term><command>grub-md5-crypt</command></term>
     264        <listitem>
     265          <para>Encrypts a password in MD5 format</para>
     266          <indexterm zone="ch-bootable-grub grub-md5-crypt">
     267            <primary sortas="b-grub-md5-crypt">grub-md5-crypt</primary>
     268          </indexterm>
     269        </listitem>
     270      </varlistentry>
     271
     272      <varlistentry id="grub-set-default">
     273        <term><command>grub-set-default</command></term>
     274        <listitem>
     275          <para>Sets the default boot entry for GRUB</para>
     276          <indexterm zone="ch-bootable-grub grub-set-default">
     277            <primary sortas="b-grub-set-default">grub-set-default</primary>
     278          </indexterm>
     279        </listitem>
     280      </varlistentry>
     281
     282      <varlistentry id="grub-terminfo">
     283        <term><command>grub-terminfo</command></term>
     284        <listitem>
     285          <para>Generates a terminfo command from a terminfo name; it can be
     286          employed if an unknown terminal is being used</para>
     287          <indexterm zone="ch-bootable-grub grub-terminfo">
     288            <primary sortas="b-grub-terminfo">grub-terminfo</primary>
     289          </indexterm>
     290        </listitem>
     291      </varlistentry>
     292
     293      <varlistentry id="mbchk">
     294        <term><command>mbchk</command></term>
     295        <listitem>
     296          <para>Checks the format of a multi-boot kernel</para>
     297          <indexterm zone="ch-bootable-grub mbchk">
     298            <primary sortas="b-mbchk">mbchk</primary>
     299          </indexterm>
     300        </listitem>
     301      </varlistentry>
     302
     303    </variablelist>
     304
     305  </sect2>
     306
    140307</sect1>
Note: See TracChangeset for help on using the changeset viewer.