5786 Fast reboot broken on EFI formatted drives

Review Request #20 - Created April 3, 2015 and submitted

Information
Toomas Soome
illumos-gate
5786
cae583f...
Reviewers
general

5786 Fast reboot broken on EFI formatted drives

the problem is correctly diagnosed by submitter, current code expects findroot device specification in form (id, partition, slice) where partition is MBR partition number and slice is VTOC slice. However, in case of GPT label, the device specification for findroot is (id, partition), where partition is EFI partition and there is no slice, for illumos, in this case slice is same as partition. The fix is using the fact that default slice number is set to whole device (slice value "q"), if findroot device has no slice defined, the default value is preserved.

now while searching for bootsign, slice_match() is allowed to match any slice for slice value "q" and get_sol_prtnum() will get EFI partition number to implement partition number check.

for test purposes, I used reboot command and simple test program:

#include <libgrubmgmt.h>

int main(int argc, char **argv)
{
  grub_boot_args_t fbarg;
  char *fbstr;
  int rc;

  rc = grub_get_boot_args(&fbarg, NULL, atoi(argv[1]));
  printf("%d: fbarg %s\n", rc, fbarg.gba_bootargs);
  grub_cleanup_boot_args(&fbarg);
  return rc;
}

sample menu.lst file (the first 2 entries are actually incorrect for booting, but syntax is correct):

title openindiana-1
findroot (pool_rpool,0,a)
bootfs rpool/ROOT/openindiana-1
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS
module$ /platform/i86pc/$ISADIR/boot_archive
#============ End of LIBBE entry =============
title openindiana-2
findroot (pool_rpool,0,a)
bootfs rpool/ROOT/openindiana-2
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS
module$ /platform/i86pc/$ISADIR/boot_archive
#============ End of LIBBE entry =============
title openindiana-3
findroot (pool_rpool,0)
bootfs rpool/ROOT/openindiana-3
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS
module$ /platform/i86pc/$ISADIR/boot_archive
#============ End of LIBBE entry =============
title openindiana-4
findroot (pool_rpool,0)
bootfs rpool/ROOT/openindiana-4
kernel$ /platform/i86pc/kernel/$ISADIR/unix -B $ZFS-BOOTFS
module$ /platform/i86pc/$ISADIR/boot_archive
#============ End of LIBBE entry =============

output from test program:

root@gpt:/home/tsoome#  ./fbargs 0
0: fbarg /tmp/.libgrubmgmt.openindiana-1.r6a4Yb /platform/i86pc/kernel/amd64/unix -B zfs-bootfs=rpool/ROOT/openindiana-1,bootpath="/pci@0,0/pci15ad,1976@10/sd@1,0:a"
root@gpt:/home/tsoome#  ./fbargs 1
0: fbarg /tmp/.libgrubmgmt.openindiana-2.ynaqZb /platform/i86pc/kernel/amd64/unix -B zfs-bootfs=rpool/ROOT/openindiana-2,bootpath="/pci@0,0/pci15ad,1976@10/sd@1,0:a"
root@gpt:/home/tsoome#  ./fbargs 2
0: fbarg / /platform/i86pc/kernel/amd64/unix -B zfs-bootfs=rpool/ROOT/openindiana-3,bootpath="/pci@0,0/pci15ad,1976@10/sd@1,0:a"
root@gpt:/home/tsoome#  ./fbargs 3
0: fbarg /tmp/.libgrubmgmt.openindiana-4.4Haa0b /platform/i86pc/kernel/amd64/unix -B zfs-bootfs=rpool/ROOT/openindiana-4,bootpath="/pci@0,0/pci15ad,1976@10/sd@1,0:a"

So the fastboot bootargs strings are correct for both types of entries.

Also reboot -f command was correctly booting and using indicated menu entry, confirmed by:

tsoome@gpt:~$ eeprom bootcmd
bootcmd=/platform/i86pc/kernel/amd64/unix -B zfs-bootfs=rpool/ROOT/openindiana-4,bootpath="/pci@0,0/pci15ad,1976@10/sd@1,0:a"

and from booting via grub:

tsoome@gpt:~$ eeprom bootcmd
bootcmd=/platform/i86pc/kernel/amd64/unix -B zfs-bootfs=rpool/140,bootpath="/pci@0,0/pci15ad,1976@10/sd@0,0:a",diskdevid="id1,sd@n6000c2969ea1ab7d25ed261fa77f3007/a"

Issues

  • 0
  • 3
  • 0
  • 3
Description From Last Updated
Josef Sipek
Toomas Soome
Richard PALO
Richard PALO
Toomas Soome
Toomas Soome
Josef Sipek
Josef Sipek
Josef Sipek
Hans Rosenfeld
Toomas Soome
Review request changed

Status: Closed (submitted)

Loading...