|
|
56a26f9 |
From 4306c538d4a00dd1aa46c55c3c4005c2b0bf7cd5 Mon Sep 17 00:00:00 2001
|
|
|
262b414 |
From: Peter Robinson <pbrobinson@gmail.com>
|
|
|
56a26f9 |
Date: Thu, 24 Nov 2022 12:57:55 +0000
|
|
|
060f78f |
Subject: [PATCH] distro: load FDT from any partition on boot device
|
|
|
262b414 |
|
|
|
262b414 |
In the EFI_LOADER boot path, we were only checking the FAT partition
|
|
|
262b414 |
containing the EFI payload for dtb files. But this is somewhat of a
|
|
|
262b414 |
fiction. In reality there will be one small (V)FAT partition containing
|
|
|
262b414 |
grub (or whatever the payload may be), and a second boot partition
|
|
|
262b414 |
containing kernel/initrd/fdt (typically ext4). It is this second
|
|
|
262b414 |
partition where we should be looking for a FDT to load.
|
|
|
262b414 |
|
|
|
262b414 |
So instead scan all the partitions of the disk containing the EFI
|
|
|
262b414 |
payload. This matches where grub looks for kernel/initrd (barring
|
|
|
262b414 |
custom grub.cfg, in which case the user can use grub's 'devicetree'
|
|
|
262b414 |
command to load the correct FDT).
|
|
|
262b414 |
|
|
|
262b414 |
The other option is somehow passing the ${fdtfile} to grub so that it
|
|
|
262b414 |
can load the FDT based on selected kernel version location (which grub
|
|
|
262b414 |
knows) and SoC/board specific ${fdtfile} (which grub does not know).
|
|
|
262b414 |
|
|
|
262b414 |
Signed-off-by: Rob Clark <robdclark@gmail.com>
|
|
|
ad36d48 |
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
|
|
|
262b414 |
---
|
|
|
56a26f9 |
include/config_distro_bootcmd.h | 37 +++++++++++++++++++++------------
|
|
|
56a26f9 |
1 file changed, 24 insertions(+), 13 deletions(-)
|
|
|
262b414 |
|
|
|
262b414 |
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
|
|
|
56a26f9 |
index fcb319a20ae..e71004fad9c 100644
|
|
|
262b414 |
--- a/include/config_distro_bootcmd.h
|
|
|
262b414 |
+++ b/include/config_distro_bootcmd.h
|
|
|
56a26f9 |
@@ -155,28 +155,39 @@
|
|
|
060f78f |
"fi\0" \
|
|
|
060f78f |
\
|
|
|
262b414 |
"load_efi_dtb=" \
|
|
|
060f78f |
- "load ${devtype} ${devnum}:${distro_bootpart} " \
|
|
|
060f78f |
- "${fdt_addr_r} ${prefix}${efi_fdtfile}\0" \
|
|
|
262b414 |
+ "load ${devtype} ${devnum}:${dtb_devp} " \
|
|
|
262b414 |
+ "${fdt_addr_r} ${prefix}${efi_fdtfile} && " \
|
|
|
262b414 |
+ "run boot_efi_binary\0" \
|
|
|
262b414 |
\
|
|
|
262b414 |
"efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \
|
|
|
262b414 |
- "scan_dev_for_efi=" \
|
|
|
262b414 |
+ "scan_dev_for_dtb=" \
|
|
|
262b414 |
"setenv efi_fdtfile ${fdtfile}; " \
|
|
|
262b414 |
BOOTENV_EFI_SET_FDTFILE_FALLBACK \
|
|
|
56a26f9 |
BOOTENV_RUN_EXTENSION_INIT \
|
|
|
262b414 |
- "for prefix in ${efi_dtb_prefixes}; do " \
|
|
|
262b414 |
- "if test -e ${devtype} " \
|
|
|
262b414 |
- "${devnum}:${distro_bootpart} " \
|
|
|
262b414 |
- "${prefix}${efi_fdtfile}; then " \
|
|
|
262b414 |
- "run load_efi_dtb; " \
|
|
|
56a26f9 |
- BOOTENV_RUN_EXTENSION_APPLY \
|
|
|
262b414 |
- "fi;" \
|
|
|
262b414 |
- "done;" \
|
|
|
5fa2e92 |
- "run boot_efi_bootmgr;" \
|
|
|
262b414 |
+ "part list ${devtype} ${devnum} dtb_devplist; " \
|
|
|
262b414 |
+ "env exists dtb_devplist || setenv dtb_devplist " \
|
|
|
262b414 |
+ "${distro_bootpart}; " \
|
|
|
262b414 |
+ "for dtb_devp in ${dtb_devplist}; do " \
|
|
|
262b414 |
+ "for prefix in ${efi_dtb_prefixes}; do " \
|
|
|
262b414 |
+ "if test -e ${devtype} " \
|
|
|
262b414 |
+ "${devnum}:${dtb_devp} " \
|
|
|
262b414 |
+ "${prefix}${efi_fdtfile};"\
|
|
|
262b414 |
+ " then " \
|
|
|
262b414 |
+ "echo Found DTB ${devtype} " \
|
|
|
262b414 |
+ "${devnum}:${dtb_devp} " \
|
|
|
262b414 |
+ "${prefix}${efi_fdtfile};"\
|
|
|
262b414 |
+ "run load_efi_dtb; " \
|
|
|
56a26f9 |
+ BOOTENV_RUN_EXTENSION_APPLY
|
|
|
262b414 |
+ "fi;" \
|
|
|
262b414 |
+ "done; " \
|
|
|
262b414 |
+ "done; " \
|
|
|
74de6cf |
+ "run boot_efi_binary\0" \
|
|
|
262b414 |
+ "scan_dev_for_efi=" \
|
|
|
262b414 |
"if test -e ${devtype} ${devnum}:${distro_bootpart} " \
|
|
|
c529a6c |
"efi/boot/"BOOTEFI_NAME"; then " \
|
|
|
262b414 |
"echo Found EFI removable media binary " \
|
|
|
c529a6c |
"efi/boot/"BOOTEFI_NAME"; " \
|
|
|
262b414 |
- "run boot_efi_binary; " \
|
|
|
262b414 |
+ "run scan_dev_for_dtb; " \
|
|
|
262b414 |
"echo EFI LOAD FAILED: continuing...; " \
|
|
|
262b414 |
"fi; " \
|
|
|
262b414 |
"setenv efi_fdtfile\0"
|
|
|
262b414 |
--
|
|
|
56a26f9 |
2.38.1
|
|
|
262b414 |
|