[lfs-support] Configuring GRUB2--Request for a Logic Check

Bruce Dubbs bruce.dubbs at gmail.com
Fri Nov 8 17:48:31 PST 2013


Dan McGhee wrote:

>> menuentry 'LFS-7.4' --class gnu-linux --class gnu --class os
>> $menuentry_id_option

Those class things are for the display.  They are not needed foar a 
basic system.

>> 'gnulinux-simple-d52e1640-9ac4-4c5d-aad1-9c79ff1f0bbd' {

This is what is displayed as the boot option.

>>          load_video
>>          insmod gzio
>>          insmod part_gpt
>>          insmod ext2

GRUB modules.  They can be here or global (my preference).

>>          set root='hd0,gpt6'

Where to search for grub.cfg, kernel, and initrd.

>>          if [ x$feature_platform_search_hint = xy ]; then
>>            search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt6
>> --hint-efi=hd0,gpt6 --hint-baremetal=ahci0,gpt6
>> d52e1640-9ac4-4c5d-aad1-9c79ff1f0bbd
>>          else
>>            search --no-floppy --fs-uuid --set=root
>> d52e1640-9ac4-4c5d-aad1-9c79ff1f0bbd
>>          fi

The if statement is not needed.

>>          echo    'Loading Linux 3.10.10-lfs-7.4 ...'
>>          linux   /boot/vmlinuz-3.10.10-lfs-7.4 root=/dev/sda6 ro

Looks right.

>> }

> That long UUID stands for /dev/sda6 or hd0,gpt6 and is my LFS
> partition.  All of a sudden it occurred to me that 'root' is the place
> where GRUB2 looks for its files and since they're not on /dev/sda6 it's
> looking in the wrong place.

Where are they?

My logic check consists of this question.
> Should I change every reference to gpt6 to gpt2 (this is sda2)?  If
> that's the case then I'm confused on the 'linux' line.  Should that
> remain the same or does it need to say:
>
> linux (hd0,gpt6)/boot/vmlinuz-3.10*7.4 root=/dev/sda2 ro

Is that where the kernel is?

> I think I could put /dev/sda6 in the path to the image.

No, GRUB doesn't understand that.

> I'm trying to do this like Fedora does and put all the grub stuff on the
> EFI partition.  I don't know if Fedora puts the kernel image there or not.
>
> I could also do it like Ubuntu does, which is a little closer to the way
> LFS does it.  In Ubuntu there is /boot/grub which contains the grub.cfg
> and the directory x86_64-efi that holds all the modules. But in this
> case there's a grub.cfg that exists on the EFI partition with the grub
> image.  It's contents are:
>
>> search.fs_uuid 0ef1c9a3-59ad-4637-be37-72ebcc07d660 root hd0,gpt10
>> set prefix=($root)/boot/grub
>> configfile $prefix/grub.cfg
> That UUID is for /dev/sda10, or (hd0,gpt10).  In this case the grub.cfg
> that holds the commands for booting is in the place we're used to and
> there would be no changes to the generated grub.cfg.

All that search stuff is for the case when the disk is repartitioned and 
some partitions deleted or inserted.

> Since I want to share all of this with the LFS world, I'd like to get
> both methods to boot, so I'd still be grateful for thoughts on my LFS
> menuentry and the root stuff.

I'll bet that if the above works, than the following will too:

menuentry 'LFS-7.4' {
           load_video
           insmod gzio
           insmod part_gpt
           insmod ext2
           set root='hd0,gpt6'
           linux   /boot/vmlinuz-3.10.10-lfs-7.4 root=/dev/sda6 ro
}

The last two lines could be:

linux   (hd0,gpt6)/boot/vmlinuz-3.10.10-lfs-7.4 root=/dev/sda6 ro

You might not need the load_video or insmod gzio either.  The gzio is 
for an initrd and you the default video is good enough.  That would make it:

menuentry 'LFS-7.4' {
    insmod part_gpt
    insmod ext2
    (hd0,gpt6)/linux /boot/vmlinuz-3.10.10-lfs-7.4 root=/dev/sda6 ro
}

Which is pretty close to what's in the book.

   -- Bruce



More information about the lfs-support mailing list