[lfs-support] Help with Installing to UEFI Motherboard

Geoff Swan gswan3 at bigpond.net.au
Sat Nov 16 17:56:33 PST 2013

On 17/11/2013 11:26 AM, Dan McGhee wrote:
> On 11/16/2013 05:44 PM, Geoff Swan wrote:
>> On 17/11/2013 10:10 AM, Dan McGhee wrote:
>>> On 11/16/2013 03:40 PM, Ken Moffat wrote:
>>>> On Sat, Nov 16, 2013 at 02:04:31PM -0500, Alan Feuerbacher wrote:
>>>>> Hi,
>>>>> After getting the stock LFS system installed, with an MBR type boot
>>>>> installation, I'm experimenting with installing to a UEFI type boot
>>>>> location on a brand new hard drive. I've been reading a lot of online
>>>>> documentation, and have tried a first-cut installation, but am not
>>>>> having success in installing. While I can install the entire set of LFS
>>>>> programs, and a lot of BLFS programs, when I try to boot up, Linux fires
>>>>> up but quickly generates a fatal error.
>>>>> Is there any possibility of advice from the LFS staff?
>>>> http://www.mail-archive.com/lfs-support@linuxfromscratch.org/
>>>>   See the posts from Dan McGhee - most recently on 13th November, but
>>>> starting on 28th October.  Four threads, titles mentioning GRUB
>>>> or EFI.  At the moment they are all on the first page at that link,
>>>> at least in firefox.
>>>>   Our best advice / guesses is in those threads.  Dan hasn't cracked
>>>> it yet, but your hardware might be different.
>>>> ?en
>>> I thought I was going to be able to report success this afternoon, but 
>>> as yet "no joy."  My efforts so far have resulted in the following 
>>> conclusions:
>>> 1.  There is something wrong in my grub set-up.
>>> 2.  My kernel is not bootable.
>>> 3.  I have missed something in the EFI info.
>>> At this point, all I want is some indication that my kernel is booting.  
>>> As long as I get only one message from the kernel and the system freezes 
>>> I can conclude that all else is fine except my kernel.
>>> I'm writing this e-mail "on the fly" and don't have my EFI sources at 
>>> hand.  I read last night that from the EFI partition the bootloader--in 
>>> this case GRUB--doesn't know where the file system is even though it can 
>>> read the partition table.  Therefore, and initramfs is called for.  I 
>>> know nothing about these.  I've read what the BLFS book has and have 
>>> tried it with no success.  At this point, I don't know enough to solve 
>>> any "gotcha's" that the initramfs hint gives.  Gonna try dracut.
>>> If I can't make any head-way in the next few days, I'm going to install 
>>> a minimal ArchLinux system and try the various GRUB options.  I don't 
>>> think they sign their kernels--see last paragraph--and that will test 
>>> the GRUB stuff.
>>> I cannot verify this in any documentation.  It's just a hunch I have.  
>>> When it comes to booting using an EFI partition, we must ignore 
>>> everything we've learned about booting and using GRUB.  It may be that 
>>> using GRUB in a multiboot environment we cannot use the "linux 
>>> /boot/vmliz* root=/dev/xxx ro" to get to another distro.  We may have to 
>>> use grub's chainloader to do that.  I say this because, I have not been 
>>> able to get Ubuntu to boot from my LFS-7.4 system in the "old" way.  I 
>>> was successful using the chainloader.  If all this is true, then the 
>>> "easiest" way to accomplish this is to use 'efibootmgr' or 'gummiboot' 
>>> and boot everything thing we have from the EFI partition.
>>> My goal is to be able to be able to answer these questions when my 
>>> testing is over.
>>> @Alan
>>> Did you remove GRUB from your MBR Protected Layer or are you still using 
>>> it?  Do you use an initrd or initramfs?  Did you boot your kernel 
>>> successfully before you started these EFI experiments?  Does your 
>>> failure message come from the kernel or from the LFS bootscripts?  What 
>>> does it say?  Must you do a "hard" reset to start over or can you use 
>>> There is only one other option that's keeping me from booting in this 
>>> environment.  It's so distasteful that I don't even want to write it.  
>>> But, at least in my firmware, it may be necessary for me to "sign" my 
>>> kernel.  That's not even for "secure" boot.  I hope that's not true.
>>> Dan
>> Dan,
>> I could not get EFI and Grub2 to co-operate so I went for the Linux
>> EFI image route instead and eliminated the boot manager. It is not
>> really necessary unless you want to select from different kernels on
>> the system.
>> The kernel must be compiled with the EFI settings:
>> and also the kernel parameters built-in:
>> CONFIG_CMDLINE="root=/dev/sda3 ro --verbose"
>> then use efibootmgr to register the new kernel image with the BIOS,
>> so it can be selected at boot time.
>> Geoff
> Geoff, your comments are giving me a break from answering questions in
> "make oldconfig"  :)
> Just so I understand.  You got your kernel--3.10.10 (?)--to boot from
> the EFI partition?  And without initrd or initramfs?  The answer to
> this question is important to me.

Yes. 3.10.10. Selectable in the BIOS efi boot manager and boots
directly, fast.
No initrd or initramfs is needed, I built all the drivers required for
the server hardware into the kernel. If you build modules required for
boot then you have to make them available in the EFI partition too. I
found it easier to build everything into the kernel.

> As I said before, I don't have my references close right now, but you
> may want to consider reconfiguring your kernel with
> "CONFIG_EFI_VARS=n" and enabling evifarfs.  efivars is going away. 
> I'll check my references and post later with the appropriate one.  I
> have been using efivarfs mounted at /sys/firmware/efi/efivars with
> great success.  Otherwise, I have been configuring my kernels the same
> with the exception that I have been trying to pass the kernel
> parameters with GRUB2.
> I have gotten GRUB2 to cooperate in a minimal way so far.  Ultimately,
> I'm going to go to the situation you have with all the stuff, in the
> form of their individual bootloaders, on the EFI partition and use
> efibootmgr to have the system Boot Manager present me my options.

I started with grub2 and had trouble getting it to work properly. Since
it was an unnecessary additonal stage in my system, I eliminated it

> I'm doing all this testing so that I can write everything up and
> present it to LFS so that individuals can choose whether they will use
> grub or not and where to put it.  Of course, if someone wants to boot
> with grub in the BIOS mode that is already well documented in LFS.
> Thanks for your post.
> Dan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-support/attachments/20131117/84adf611/attachment.html>

More information about the lfs-support mailing list