Date: Sat, 2 Sep 2017 16:43:11 +0900 From: Tomoaki AOKI <junchoon@dec.sakura.ne.jp> To: svn-src-head@freebsd.org Cc: imp@FreeBSD.org, smh@FreeBSD.org Subject: Re: svn commit: r322941 - head/sys/boot/efi/boot1 Message-ID: <20170902164311.eb7e5d2fa0e40f3b4e5e6142@dec.sakura.ne.jp>
next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--Multipart=_Sat__2_Sep_2017_16_43_11_+0900_W1ASR33dgVQfcCm7
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Hi.
This broke boot drive selection functionality by smh@ at r295320 on
Feb.5, 2016. [1]
Now, even if I forcibly select 2nd HDD via UEFI firmware, boot1.efi
(as bootx64.efi) selects /boot/loader.efi on 1st HDD. Each boot
partition are ZFS pools. Confirmed previous rev was OK.
Attached is the boot log (with EFI_DEBUG). Pool zsysS02 should be
selected there instead of zsysS01. As I have no serial console, there
can be some typos. (Took video and hand-typed.)
The boot order should be as below (what smh@ implemented).
1. ZFS pool on which drive boot1.efi is read from.
2. UFS partition on which drive boot1.efi is read from.
3. If both 1 and 2 are missed, try from UEFI 1st drive and later.
P.S. Another possibility (not tested yet):
Not forcibly prefer 1st drive, but reversed selection.
(If boot1.efi is on 1st drive, loader.efi on 2nd drive is read.)
[1]
https://lists.freebsd.org/pipermail/svn-src-head/2016-February/082215.html
> Author: imp
> Date: Sun Aug 27 03:10:16 2017
> New Revision: 322941
> URL: https://svnweb.freebsd.org/changeset/base/322941
>
> Log:
> Eliminate redunant device path matching.
>
> Use efi_devpath_match instead of device_paths_match. They are
> functionally the same. Remove device_paths_match from boot1.c and call
> efi_devpath_match instead.
>
> Sponsored by: Netflix
>
> Modified:
> head/sys/boot/efi/boot1/boot1.c
>
> Modified: head/sys/boot/efi/boot1/boot1.c
> ==============================================================================
> --- head/sys/boot/efi/boot1/boot1.c Sat Aug 26 23:13:18 2017 (r322940)
> +++ head/sys/boot/efi/boot1/boot1.c Sun Aug 27 03:10:16 2017 (r322941)
> @@ -76,53 +76,6 @@ Free(void *buf, const char *file __unused, int line __ }
>
> /*
> - * nodes_match returns TRUE if the imgpath isn't NULL and the nodes
match,
> - * FALSE otherwise.
> - */
> -static BOOLEAN
> -nodes_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath)
> -{
> - size_t len;
> -
> - if (imgpath == NULL || imgpath->Type != devpath->Type ||
> - imgpath->SubType != devpath->SubType)
> - return (FALSE);
> -
> - len = DevicePathNodeLength(imgpath);
> - if (len != DevicePathNodeLength(devpath))
> - return (FALSE);
> -
> - return (memcmp(imgpath, devpath, (size_t)len) == 0);
> -}
> -
> -/*
> - * device_paths_match returns TRUE if the imgpath isn't NULL and all
nodes
> - * in imgpath and devpath match up to their respective occurrences of a
> - * media node, FALSE otherwise.
> - */
> -static BOOLEAN
> -device_paths_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath)
> -{
> -
> - if (imgpath == NULL)
> - return (FALSE);
> -
> - while (!IsDevicePathEnd(imgpath) && !IsDevicePathEnd(devpath))
{
> - if (IsDevicePathType(imgpath, MEDIA_DEVICE_PATH) &&
> - IsDevicePathType(devpath, MEDIA_DEVICE_PATH))
> - return (TRUE);
> -
> - if (!nodes_match(imgpath, devpath))
> - return (FALSE);
> -
> - imgpath = NextDevicePathNode(imgpath);
> - devpath = NextDevicePathNode(devpath);
> - }
> -
> - return (FALSE);
> -}
> -
> -/*
> * devpath_last returns the last non-path end node in devpath.
> */
> static EFI_DEVICE_PATH *
> @@ -318,7 +271,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH
*imgpath, B
> if (!blkio->Media->LogicalPartition)
> return (EFI_UNSUPPORTED);
>
> - *preferred = device_paths_match(imgpath, devpath);
> + *preferred = efi_devpath_match(imgpath, devpath);
>
> /* Run through each module, see if it can load this partition
*/
> for (i = 0; i < NUM_BOOT_MODULES; i++) {
--
Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
--Multipart=_Sat__2_Sep_2017_16_43_11_+0900_W1ASR33dgVQfcCm7
Content-Type: text/plain;
name="bootfail.head.20170902-001.txt"
Content-Disposition: attachment;
filename="bootfail.head.20170902-001.txt"
Content-Transfer-Encoding: 7bit
Loader path: /boot/loader.efi
Initializing modules: ZFS UFS
Load Path: \EFI\BOOT\BOOTX64.EFI
Load Device: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x1,0x0,0x0)/HD(1,GPT,38D03E6E-5609-11E5-81A0-0021CC6F1820,0x800,0x32000)
Probing 12 block devices...
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0x0,0x0)
probe: . not supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x1,0x0,0x0)
probe: . not supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0x0,0x0)/HD(1,GPT,66922244-636E-11E5-8AD1-0021CC6F1820,0x800,0x64000)
probe: . not supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0x0,0x0)/HD(2,GPT,AEF62820-636E-11E5-8AD1-0021CC6F1820,0x64800,0x400)
probe: . not supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0x0,0x0)/HD(3,GPT,E7579EDA-636F-11E5-8AD1-0021CC6F1820,0x65000,0x1400000)
probe: . not supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0x0,0x0)/HD(4,GPT,5E4A8AD5-6370-11E5-8AD1-0021CC6F1820,0x1465000,0xA00000)
probe: + supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0x0,0x0)/HD(5,GPT,6D6A5FE8-6370-11E5-8AD1-0021CC6F1820,0x1E65000,0x75558000)
probe: + supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x1,0x0,0x0)/HD(1,GPT,38D03E6E-5609-11E5-81A0-0021CC6F1820,0x800,0x32000)
probe: . not supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x1,0x0,0x0)/HD(2,GPT,74813357-5609-11E5-81A0-0021CC6F1820,0x32800,0x400)
probe: . not supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x1,0x0,0x0)/HD(3,GPT,C76C2650-5609-11E5-81A0-0021CC6F1820,0x33000,0x1400000)
probe: . not supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x1,0x0,0x0)/HD(4,GPT,729E2585-560A-11E5-81A0-0021CC6F1820,0x1433000,0x1000000)
probe: + supported
probing: PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x1,0x0,0x0)/HD(5,GPT,B620A3CE-560A-11E5-81A0-0021CC6F1820,0x2433000,0x1AD92800)
probe: + supported
done
ZFS found the following pools: zsysS01 zsysS02
UFS found 2 partitions
load: '/boot/loader.efi' spa: 'zsysS01', devpathPciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0x0,0x0)/HD(5,GPT,6D6A5FE8-6370-11E5-8AD1-0021CC6F1820,0x1E65000,0x75558000)
load: '/boot.config' spa: 'zsysS01', devpathPciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0x0,0x0)/HD(5,GPT,6D6A5FE8-6370-11E5-8AD1-0021CC6F1820,0x1E65000,0x75558000)
Failed to find '/boot.config' on pool 'zsysS01' (2)
load: '/boot/config' spa: 'zsysS01', devpathPciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0x0,0x0)/HD(5,GPT,6D6A5FE8-6370-11E5-8AD1-0021CC6F1820,0x1E65000,0x75558000)
Failed to find '/boot/config' on pool 'zsysS01' (2)
Starting '/boot/loader.efi' in 5 seconds......
--Multipart=_Sat__2_Sep_2017_16_43_11_+0900_W1ASR33dgVQfcCm7--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170902164311.eb7e5d2fa0e40f3b4e5e6142>
