lfs-uefi: fix efivar-37 FTBFS
[linux_from_scratch_hints.git] / grub2.txt
blob9629986d18bfc2d3a88e3aa584ac071dbcf3baf6
1 AUTHOR:         Bruce Dubbs <bdubbs@linuxfromscratch.org>
3 DATE:           2009-09-12
5 LICENSE:        The MIT License
7 SYNOPSIS:       Installing and using GRUB2
9 PREREQUISITES:  None
12 DESCRIPTION:
13     GRUB2 is the next generation of GNU GRUB. The version, as of this date, 
14     is grub-1.97~beta2.  This is a very workable system for most LFS 
15     installations and can be built and run on several architectures
16     including i386, powerpc, and x86_64.
17     
18 REFERENCES: http://grub.enbug.org/ 
21 HINT:
23 Installing GRUB2:
24    wget ftp://alpha.gnu.org/gnu/grub/grub-1.97~beta3.tar.gz
25    
26    The md5sum is 542917012de4d2e47241bdffb67bedef and the file size is 1.3Mb.
27    
28    tar -xf grub-1.97~beta3.tar.gz
29    cd grub-1.97~beta3
31    ./configure --prefix=/usr --sysconfdir=/etc --disable-largefile \
32           --disable-grub-emu  --disable-grub-emu-usb  --disable-grub-fstest \
33           --disable-efiemu
35    The --disable switches just minimze what is built by disabling features
36    and testing programs not really needed for LFS.
38    make
39    sudo make install
41    The install adds the following programs and directories:
43    /usr/bin:
44    grub-editenv  grub-mkelfimage  grub-mkfont  grub-mkimage  grub-mkrescue
46    /usr/sbin:
47    grub-dumpbios  grub-install  grub-mkconfig  grub-mkdevicemap  grub-probe  grub-setup
49    /etc/grub.d:
50    00_header  10_linux  30_os-prober  40_custom  README
52    /usr/include/:
53    grub/  multiboot.h  multiboot2.h
55    /usr/lib/grub:  Many supporting files
57    No man pages are installed unless you have the help2man program installed.  
58    To get minimal help, use --help on each executable program.  There are no
59    info pages yet available.
61 Configuring GRUB2:
63    When setting up the boot directory on LFS, I highly recommend using a separate
64    partition for /boot.  That way each build, whether LFS or some commercial distro,
65    can access the same boot files and access can be made from any booted system.
67    I use /dev/sda1 and create the boot partition as 100Mb.  That leaves lots
68    of room for new kernels, but does not take up much space from the large 
69    disk drives generally in use today.  
71    The rest of this hint assumes a separately mounted boot partition:
73    /dev/sda1 on /boot type ext3 (rw)
75    Step 1.  As root, install the GRUB2 files into /boot/grub
77    grub-install --grub-setup=/bin/true /dev/sda
79    This step creates the core.img file needed to boot, but does not install it
80    into the master boot record (MBR).  If the --grub-setup=/bin/true switch
81    is not set, the MBR *will* be updated.  That is probably not what you want
82    until you have tested the installation.
84    This step populates /boot/grub/ with many files.  GRUB2 utilizes a system
85    of modules to extend basic functionality.  Right now there are 125 modules 
86    installed.  There are also a few other files with extentions of .img, .map,
87    .o, and .lst.
89    Step2.  As root, generate /boot/grub/grub.cfg
91    grub-mkconfig -o /boot/grub/grub.cfg
93    This program uses the scripts in /etc/grub.d/ to generate the configuruation
94    file.  By default, it looks for files with the naming convention of
95    vmlinu[xz]-*.  My naming conventions for kernels is different.  For
96    instance, one kernel is named linux-2.6.30.2-lfs65.  I had to modify line 64
97    of /etc/grub.d/10_linux to add /boot/linux* to the list of filenames
98    searched.
100    The entries in /boot/grub/grub.cfg look like:
102    menuentry "GNU/Linux, Linux 2.6.30.2-lfs65" {
103       insmod ext2
104       set root=(hd0,1)
105       #search --no-floppy --fs-uuid --set 2ae9c39c-c1ee-4006-80af-5a3d41f1255c
106       linux /linux-2.6.30.2-lfs65 root=/dev/sda5 ro
107    }
109    Note that I commented out the search line above because it was assuming the
110    wrong root partition.  The linux line specifies the / directory because
111    the /boot directory is mounted on a separate partition and the files are
112    relative to the unmounted partition.
114    One other comment is that GRUB2 uses partition numbers relative to 1.  Legacy 
115    GRUB used partitions relative to 0.  Therefore the line using (hd0,1) refers
116    to /dev/sda1.  
118    Step 3.  Test the configuration.
120    The core image of GRUB 2 is also a Multiboot kernel, so you can load GRUB2 
121    by GRUB Legacy:
123    /sbin/reboot
124    ...
125    grub> root (hd0,0)
126    grub> kernel /boot/grub/core.img
127    grub> boot
129    At this point the GRUB2 prompt will appear (very similar to GRUB Legacy) and
130    you can explore the interface or boot to one of the systems in the grub.cfg 
131    file.
133    Step 4.  As root, update the Master Boot Record
135    grub-setup
137    This program uses the following defaults:
138    boot image  - boot.img
139    core image  - core.img
140    directory   - /boot/grub
141    device map  - device.map
142    root device - guessed
144    The defaults are generally OK for an LFS sytem.
146 CHANGELOG:
147    [2009-09-12]
148       Initial Release
149    [2009-09-13]
150       Update to beta3