On Sun, 10 Jun 2018 07:27:53 -0500
"Rob" <[email protected]> wrote:

> I just want to make sure this partition layout is correct before
> doing grub.
.
.
> Device        Start      End  Sectors  Size Type
> /dev/sdb1      2048  1050623  1048576  512M EFI System
> /dev/sdb2   1050624 32507903 31457280   15G Linux filesystem
> /dev/sdb3  32507904 66062335 33554432   16G Linux swap


  Rob,

With grub, you should have a grub, aka BIOS boot, partition of about
128.0 MiB, code EF02, after the first, EFI (code EF00) partition. It
is always a good idea to have the BIOS boot partition in case you
ever need grub. IIRC, the grub partition does not need to be
formatted.

The EFI partition, the very first one, is FAT32 and is usually mounted
on /boot/efi when servicing. 

Your kernel will have to be compiled with an EFI stub. Under the kernel
menuconfig setup, in "Processor type and features" enable:

 [*] EFI runtime service support 
 [*] EFI stub support

You should not enable mixed mode support:

 [ ]  EFI mixed-mode support


For the Built-in kernel command line (also under "Processor type and
features", you should specify the PARTUUID of your linux filesystem
that is to become /root when booted,
e.g., 
  root=PARTUUID=1234567a-af67-4c97-8154-438376dc7113 ro log_buf_len=262144 
video=DVI-I-1:1024x768-16@60 fbcon=font:VGA8x16

You can get the PARTUUID of the target partition via blkid, e.g.,

blkid /dev/sdb1

The kernel builtin settings can be overridden at load time by another
specification of these kernel parameters, say, from the boot loader
or loader command prompt. This is helpful in emergencies when the
kernel has to be told to use a different partition for /root.

To allow such an override, do not select the kernel config option
[ ]   Built-in command line overrides boot loader arguments 
under "Processor type and features"


In the kernel config under "Firmware Drivers", enable:
 EFI (Extensible Firmware Interface) Support 
 <*> EFI Variable Support via sysfs  
 <*> Register efivars backend for pstore   

Note, you may also need a kernel with EFI variable support on the
*host* system to be able to run efibootmgr to configure the EFI
setup - there is a potential catch-22 here.

After compilation, copy your new kernel arch/x86/boot/bzImage
to the EFI partition, e.g.,  (I use some additional subdirs here)

cp arch/x86/boot/bzImage /boot/efi/EFI/Linux/linux-x86_64.efi

Now use efibootmgr 

https://github.com/rhboot/efibootmgr

to create an EFI entry to your boot kernel which has an EFI stub loader:

efibootmgr --create --disk /dev/sdb --part 1 --label "UEFI: Linux-x86_64.efi" 
--loader '\EFI\Linux\linux-x86_64.efi'

beware that the --loader option (that points to a kernel with EFI stub
loader) uses the \ as a dir separator as it is on a FAT32 filesystem.
You can use the -u option to add/override kernel command line arguments.
e.g., (here I use the short form of the options, -c = --create,
-d = --disk, -p = --partition,  -L = --label, -l = --loader, etc.)

efibootmgr -c -d /dev/sda -p 1 -L "Mylabel" -l \vmlinuz-linux -u 
"root=PARTUUID=1234567a-af67-4c97-8154-438376dc7113 rw 
initrd=\initramfs-linux.img"

Now call

efibootmgr

to see the list of boot entries. The

BootOrder: 0003,0000,0001,0002,0005

line shows their order. Careful, the order is as shown on the
BootOrder line, *not* the order the entries appear later below
it. You can use the --bootorder (-o) option to change their order:

efibootmgr -o 2,0,1,5,3

Your EFI stub kernel should be the first one listed if you want
that to be the default. Of course, you will also want an entry
for the current host/alternate system. Your EFI system is supposed
to have a boot menu that can be accessed by pressing a certain
function key (usually its F11) at boot. That will allow you to
select something other than the default as needed.

If you get a kernel panic:

"Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)"

there is a problem with the root= setting. You have to use the
PARTUUID form and any boot loader root= specification that overrides
the specification that is builtin the kernel must also be correct.

For more info, see:
https://wiki.gentoo.org/wiki/EFI_stub_kernel#Configuration
https://wiki.gentoo.org/wiki/Efibootmgr


Using the EFI stub approach, any BIOS compatibility modes can be
disabled in the EFI/BIOS (making the system a pure EFI-only system)
and no other boot loaders whatsoever are required, other than the
EFI boot loader provided by the EFI/BIOS. efibootmgr is used to
manage these EFI/BIOS boot loader settings and pressing F11 on
boot can allow you to make a manual boot selection.



   Cheers,

   Mike Shell





-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to