From fcc027677da55c41dcaea045f5b9ff8b088e6495 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Sun, 7 Jun 2020 20:16:00 +0000 Subject: Initial commit of alternative cross LFS git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11897 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter08/grub.xml | 495 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 339 insertions(+), 156 deletions(-) (limited to 'chapter08/grub.xml') diff --git a/chapter08/grub.xml b/chapter08/grub.xml index d6897d5e5..25a61077b 100644 --- a/chapter08/grub.xml +++ b/chapter08/grub.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -14,178 +14,361 @@
&grub-url;
- Using GRUB to Set Up the Boot Process - - - Introduction - - Configuring GRUB incorrectly can render your system - inoperable without an alternate boot device such as a CD-ROM. This - section is not required to boot your LFS system. You may just - want to modify your current boot loader, e.g. Grub-Legacy, GRUB2, or - LILO. - - - Ensure that an emergency boot disk is ready to rescue - the computer if the computer becomes unusable (un-bootable). If you do not - already have a boot device, you can create one. In order for the procedure - below to work, you need to jump ahead to BLFS and install - xorriso from the - libisoburn package. - -cd /tmp -grub-mkrescue --output=grub-img.iso -xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso - - - - To boot LFS on host systems that have UEFI enabled, the kernel needs to - have been built with the CONFIG_EFI_STUB capabality described in the - previous section. However, LFS can be booted using GRUB2 without such - an addition. To do this, the UEFI Mode and Secure Boot capabilities in - the host system's BIOS need to be turned off. For details, see - the lfs-uefi.txt hint at - &hints-root;lfs-uefi.txt. - - + GRUB-&grub-version; - + + GRUB + - - GRUB Naming Conventions - - GRUB uses its own naming structure for drives and partitions in - the form of (hdn,m), where n - is the hard drive number and m is the partition - number. The hard drive number starts from zero, but the partition number - starts from one for normal partitions and five for extended partitions. - Note that this is different from earlier versions where - both numbers started from zero. For example, partition sda1 is (hd0,1) to - GRUB and sdb3 is - (hd1,3). In contrast to Linux, GRUB does not - consider CD-ROM drives to be hard drives. For example, if using a CD - on hdb and a second hard drive - on hdc, that second hard drive - would still be (hd1). + + - </sect2> + <para>The GRUB package contains the GRand Unified Bootloader.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&grub-ch6-sbu;</seg> + <seg>&grub-ch6-du;</seg> + </seglistitem> + </segmentedlist> - <sect2> - <title>Setting Up the Configuration - - GRUB works by writing data to the first physical track of the - hard disk. This area is not part of any file system. The programs - there access GRUB modules in the boot partition. The default location - is /boot/grub/. - - The location of the boot partition is a choice of the user that - affects the configuration. One recommendation is to have a separate small - (suggested size is 100 MB) partition just for boot information. That way - each build, whether LFS or some commercial distro, can access the same boot - files and access can be made from any booted system. If you choose to do - this, you will need to mount the separate partition, move all files in the - current /boot directory (e.g. the - linux kernel you just built in the previous section) to the new partition. - You will then need to unmount the partition and remount it as /boot. If you do this, be sure to update - /etc/fstab. - - Using the current lfs partition will also work, but configuration - for multiple systems is more difficult. - - Using the above information, determine the appropriate - designator for the root partition (or boot partition, if a separate - one is used). For the following example, it is assumed that the root - (or separate boot) partition is sda2. - - Install the GRUB files into /boot/grub and set up the boot track: - - - The following command will overwrite the current boot loader. Do not - run the command if this is not desired, for example, if using a third party - boot manager to manage the Master Boot Record (MBR). - - -grub-install /dev/sda - - - If the system has been booted using UEFI, - grub-install will try to install files for the - x86_64-efi target, but those files - have not been installed in chapter 6. If this is the case, add - to the command above. - - - - - Creating the GRUB Configuration File + + Installation of GRUB + + Prepare GRUB for compilation: - Generate /boot/grub/grub.cfg: +./configure --prefix=/usr \ + --sbindir=/sbin \ + --sysconfdir=/etc \ + --disable-efiemu \ + --disable-werror - cat > /boot/grub/grub.cfg << "EOF" -# Begin /boot/grub/grub.cfg -set default=0 -set timeout=5 + + The meaning of the new configure options: -insmod ext2 -set root=(hd0,2) + + --disable-werror + + This allows the build to complete with warnings introduced + by more recent Flex versions. + + -menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" { - linux /boot/vmlinuz-&linux-version;-lfs-&version; root=/dev/sda2 ro -} -EOF + + --disable-efiemu + + This option minimizes what is built by disabling a feature and + testing programs not needed for LFS. + + - cat > /boot/grub/grub.cfg << "EOF" -# Begin /boot/grub/grub.cfg -set default=0 -set timeout=5 + -insmod ext2 -set root=(hd0,2) + Compile the package: -menuentry "GNU/Linux, Linux &linux-version;-lfs-&versiond;" { - linux /boot/vmlinuz-&linux-version;-lfs-&versiond; root=/dev/sda2 ro -} -EOF +make + This package does not come with a test suite. - From GRUB's perspective, the - kernel files are relative to the partition used. If you - used a separate /boot partition, remove /boot from the above - linux line. You will also need to change the - set root line to point to the boot partition. - + Install the package: - GRUB is an extremely powerful program and it provides a tremendous - number of options for booting from a wide variety of devices, operating - systems, and partition types. There are also many options for customization - such as graphical splash screens, playing sounds, mouse input, etc. The - details of these options are beyond the scope of this introduction. +make install +mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions - There is a command, grub-mkconfig, that - can write a configuration file automatically. It uses a set of scripts in - /etc/grub.d/ and will destroy any customizations that you make. These scripts - are designed primarily for non-source distributions and are not recommended for - LFS. If you install a commercial Linux distribution, there is a good chance - that this program will be run. Be sure to back up your grub.cfg file. + Using GRUB to make your LFS system bootable will be discussed in + . - + + + + Contents of GRUB + + + Installed programs + Installed directories + + + + grub-bios-setup, grub-editenv, grub-file, grub-fstest, + grub-glue-efi, grub-install, grub-kbdcomp, grub-macbless, + grub-menulst2cfg, grub-mkconfig, + grub-mkimage, grub-mklayout, grub-mknetdir, + grub-mkpasswd-pbkdf2, grub-mkrelpath, grub-mkrescue, grub-mkstandalone, + grub-ofpathname, grub-probe, grub-reboot, grub-render-label, + grub-script-check, + grub-set-default, grub-sparc64-setup, and grub-syslinux2cfg + + /usr/lib/grub, /etc/grub.d, /usr/share/grub, and /boot/grub (when grub-install + is first run) + + + + + Short Descriptions + + + + + grub-bios-setup + + Is a helper program for grub-install + + grub-bios-setup + + + + + + grub-editenv + + A tool to edit the environment block + + grub-editenv + + + + + + grub-file + + Checks if FILE is of the specified type. + + grub-file + + + + + + grub-fstest + + Tool to debug the filesystem driver + + grub-fstest + + + + + + grub-glue-efi + + Processes ia32 and amd64 EFI images and glues them + according to Apple format. + + grub-glue-efi + + + + + + grub-install + + Install GRUB on your drive + + grub-install + + + + + + grub-kbdcomp + + Script that converts an xkb layout into one recognized by + GRUB + + grub-kbdcomp + + + + + + grub-macbless + + Mac-style bless on HFS or HFS+ files + + grub-macbless + + + + + + grub-menulst2cfg + + Converts a GRUB Legacy menu.lst + into a grub.cfg for use with GRUB 2 + + grub-menulst2cfg + + + + + + grub-mkconfig + + Generate a grub config file + + grub-mkconfig + + + + + + grub-mkimage + + Make a bootable image of GRUB + + grub-mkimage + + + + + + grub-mklayout + + Generates a GRUB keyboard layout file + + grub-mklayout + + + + + + grub-mknetdir + + Prepares a GRUB netboot directory + + grub-mknetdir + + + + + + grub-mkpasswd-pbkdf2 + + Generates an encrypted PBKDF2 password for use in the boot + menu + + grub-mkpasswd-pbkdf2 + + + + + + grub-mkrelpath + + Makes a system pathname relative to its root + + grub-mkrelpath + + + + + + grub-mkrescue + + Make a bootable image of GRUB suitable for a floppy disk or CDROM/DVD + + grub-mkrescue + + + + + + grub-mkstandalone + + Generates a standalone image + + grub-mkstandalone + + + + + + grub-ofpathname + + Is a helper program that prints the path of a GRUB device + + grub-ofpathname + + + + + + grub-probe + + Probe device information for a given path or device + + grub-probe + + + + + + grub-reboot + + Sets the default boot entry for GRUB for the next boot only + + grub-reboot + + + + + + grub-render-label + + Render Apple .disk_label for Apple Macs + + grub-render-label + + + + + + grub-script-check + + Checks GRUB configuration script for syntax errors + + grub-script-check + + + + + + grub-set-default + + Sets the default boot entry for GRUB + + grub-set-default + + + + + + grub-sparc64-setup + + Is a helper program for grub-setup + + grub-setup + + + + + + grub-syslinux2cfg + + Transform a syslinux config file into grub.cfg format + + grub-syslinux2cfg + + + + + + +
-- cgit v1.2.3-54-g00ecf