public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* GRUB issue on device priority
@ 2017-11-07 14:02 Haojian Zhuang
       [not found] ` <CAEaD8JPD1qPot_GMzJ02-=8WyTiwfnEmhmHmEq+Y=wKDB95DDQ@mail.gmail.com>
  2017-11-08 13:53 ` Leif Lindholm
  0 siblings, 2 replies; 6+ messages in thread
From: Haojian Zhuang @ 2017-11-07 14:02 UTC (permalink / raw)
  To: edk2-devel@lists.01.org, Fathi Boudra, Leif Lindholm, phcoder,
	okuji

Hi all,

It seems there's a device priority issue in GRUB.

All block io handles are linked into the list in edk2, and GRUB could 
fetch it. Then GRUB creates its own ascending on HD priority.
add_device():
   for (p = devices; *p; p = &((*p)->next)) {
     ret = grub_efi_compare_device_paths (grub_efi_find_last_device_path 
((*p->device_path),
                          grub_efi_find_last_device_path->device_path));
     if (ret == 0) {
       ret = grub_efi_compare_device_paths ((*p)->device_path,
                                            d->device_path);
     }
     if (ret == 0) {
       return;
     } else if (ret > 0) {
       break;
     }
   }
   ...

In the HiKey platform, I prepared the same driver for both eMMC and SD. 
So the device paths are in below.
SD: /HardwareVendor(0d51905b-b77e-452a-a2c0-eca0
cc8d514a)[9: 00 e0 23 f7 00 00 00 00 00 ]/UnknownMessaging(1a)/EndEntire
eMMC: /HardwareVendor(0d51905b-b77e-452a-a2c0-eca0
cc8d514a)[9: 00 d0 23 f7 00 00 00 00 00 
]/UnknownMessaging(1d)/Ctrl(0)/EndEntire

#define MSG_SD_DP                   0x1A
#define MSG_EMMC_DP                 0x1D

In the second level, the device paths are different.

And GRUB resort the sequence by ascending order (with above code). So SD 
device always gets higher priority than eMMC device.

If we always use installer to install OS, it may not an issue. Since 
installer could create grub.cfg by itself. But it imports another issue 
on lacking of persistent variable storage. And we need to deploy system 
without installer on embedded device.

How to fix the priority issue? Fix in GRUB or something else?

Best Regards
Haojian


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-11-16 16:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-07 14:02 GRUB issue on device priority Haojian Zhuang
     [not found] ` <CAEaD8JPD1qPot_GMzJ02-=8WyTiwfnEmhmHmEq+Y=wKDB95DDQ@mail.gmail.com>
2017-11-08  5:46   ` Haojian Zhuang
2017-11-08 13:44     ` Leif Lindholm
2017-11-08 13:53 ` Leif Lindholm
2017-11-09  8:41   ` Haojian Zhuang
2017-11-16 16:08     ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox