I know I'm top-posting and ask for forgiveness. Please consider this a
preface to my responses to what Bruce offered. And thanks, Bruce, for
your thoughts. I am frustrated by not being able to find documentation
about what the grub modules do--and now for many of the variables grub
uses. A simple "this does that" would suffice. But I digress.
I have so many things ricocheting around the "grey cells" that I may
have unwittingly supplied muddied water in my original request. I need
to focus right now on only one thing--getting LFS-7.4 to boot only once
in an uefi environment. That means I do not want to use "legacy" in my
firmware and I do not want grub to write to the "Protected MBR Layer" of
my GPT partition.
Just for the sake of clarity, and at the risk of pedantry and
obtuseness, let me demonstrate the "old" vs "new" scheme.
"OLD" = one bootloader ---> OS
"NEW" = Boot Manager ----> bootloader1, bootloader2....bootloader128
--->OS(1),OS(2).....OS(n)
To get LFS-7.4 to boot just once I need
Boot Manager--->grub(ubuntu) or grub(LFS-7.4) ----> LFS-7.4
For the Boot Manager to "see" the different bootloaders, the bootloaders
reside on the EFI partition. On my setup this is /dev/sda2/ or in
current grub-speak (hd0,gpt2). My LFS partition is /dev/sda6 or (hd0,gpt6).
The grub images, named grub.efi, reside in /dev/sda2/EFI/{ubuntu,LFS-7.4}
That's the preface for my responses to Bruce's questions. I have a few
more of my own.
On 11/08/2013 07:48 PM, Bruce Dubbs wrote:
> Dan McGhee wrote:
> <snipped some great analysis of grub.cfg lines> GRUB modules. They can be
> here or global (my preference).
Mine too with the addition of "as few as is needed." In this case, since
I've copied "what works," I have "shot gunned" the approach and more
than likely have loaded more modules than I actually need.
>>> set root='hd0,gpt6'
> Where to search for grub.cfg, kernel, and initrd.
I can parrot your statement and I think it's precisely the issue that
causes me not even to be able to load grub. If grub.efi exists on
/dev/sda2/EFI/LFS-7.4 how do I get grub to look at /dev/sda6/boot/ for
vmlinuz and /grub/grub.cfg? I need to keep it this way so that if my
Boot Manager goes to ubuntu's version of grub.cfg I can boot LFS-7.4
from that grub menu. I'm not familiar enough with manipulating the Boot
Manager yet and want to keep this option open. I'll snip the part about
ubuntu's grub.cfg, it has two, one in EFI/ubuntu and one in /boot/grub,
and include it here.
> search.fs_uuid 0ef1c9a3-59ad-4637-be37-72ebcc07d660 root hd0,gpt10
> set prefix=($root)/boot/grub
> configfile $prefix/grub.cfg
Bruce indicated that the "search stuff" was for times when the hard
drive got re-partitioned. My goal is to get this to work only once right
now, so I think that to get grub.efi to look into my LFS partition to
see the "real" grub.cfg there I can change the first line to
set root=hd0,gpt6
Does not grub also have to know where its modules are? If it does need
to know, does it look in /boot/grub by default or does it know somehow
that, on my setup, they are in /usr/lib/grub/x86_64-efi/ ?
> <snipped more good analysis>
>
>>> echo 'Loading Linux 3.10.10-lfs-7.4 ...'
>>> linux /boot/vmlinuz-3.10.10-lfs-7.4 root=/dev/sda6 ro
> Looks right.
And just to make sure--this is right *after* grub knows to look in
(hd0,gpt6)? Right? Does "root" here refer to grub or the mount point for
the kernel?
>> 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?
I hope I have cleared that up.
> <snipped the rest of the message because it's beryond the focus of what I
> want to do right now>
>
>
> 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.
Occcam's razor again, Bruce. "The simplest solution is, invariably, the
best" I must confess though that I am, right now, limited by my
ignorance and frustrated that I'm having trouble resolving it.
The next thing I want to resolve is generation of the grub-image. As a
guide, I'm using an article that I've referenced in other messages, to
get this uefi stuff to work. ( In it the author would have one work in
the grub-core directory of the compiled source. In this article, which
is ubuntu based, the author does not install the grub binaries and
modules as we do in LFS. Maybe he's assuming that these already exist on
the system. But that doesn't seem logical when he goes to the compiled
source directories. Oh well.) I mention that because I've been doing
things manually and have not used <grub-install>. I've sifted through
that script quite a few times in the last few days and have run
<grub-install --help> I don't know how many times. I'm absolutely
paranoid that grub will write to the first sector on my hard drive and I
haven't convinced myself that it won't do that even though there are
options to it that would probably work. I wish there were a DESTDIR type
of thing that I could test it with. Anyway---
I've tried some different options that haven't worked and I want things
really, really simple. I'm going to rebuild the image using this command:
<grub-mkimage -O x86_64-efi -o grub.efi part_gpt fat ext2 normal chain
boot configfile linux multiboot>
If I keep things as they are now, like we're used to, in /boot and
/boot/grub I don't think I have to set the -d or -p options.
The article I'm using doesn't reference any more than copying grub.efi
to the EFI partition. Since I'm doing this by hand, is there anything
else that grub-install does that I'm overlooking?
As I explained in my original post, I've not been successful yet. I
cannot even get LFS-7.4 to boot from Ubuntu's grub menu. I'm sure that's
definitely a problem with the way I had things set up originally. So,
I'm gonna work on that one too.
I really appreciate any responses, challenges and thoughts any one may
have. I think this research is going to be quite useful, because of
what's happening in the OEM world with Microsoft and UEFI, in the future
for LFS.
Thanks,
Dan
--
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page