[U-Boot] [PATCH 3/6] efi_loader: Search .dtb on non-EFI partitions

Andreas Färber
2016-07-12T04:21:44Z

A UEFI setup will typically have an EFI FAT partition, but device trees
are more likely to be located on, e.g., Linux volumes. By convention the
EFI partition will usually be placed first, so that we would find the
EFI removable media binary and enter it without device tree from disk.

Therefore after finding an EFI removable media binary, probe other
partitions on the same device for .dtb files.

In the default case the behavior will be unchanged in that only the
first partition is searched.
In the case that there are two partitions marked bootable and the first
being EFI, we will first check the first partition, then the second
partition for the .dtb.
Duplicate loading will only result from non-first EFI partition order.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas F?rber <afaerber@suse.de>
---
include/config_distro_bootcmd.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 087f576..eadec2e 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -124,8 +124,7 @@
"fi\0" \
\
"load_efi_dtb=" \
- "load ${devtype} ${devnum}:${distro_bootpart} " \
- "${fdt_addr_r} " \
+ "load ${devtype} ${devnum}:${efi_bootpart} ${fdt_addr_r} "\
"${prefix}${dtb_prefix}${efi_fdtfile}\0" \
\
"efi_dtb_prefixes=\"\" dtb/ dtb/current/\0" \
@@ -133,7 +132,7 @@
"for prefix in ${boot_prefixes}; do " \
"for dtb_prefix in ${efi_dtb_prefixes}; do " \
"if test -e ${devtype} " \
- "${devnum}:${distro_bootpart} " \
+ "${devnum}:${efi_bootpart} " \
"${prefix}${dtb_prefix}" \
"${efi_fdtfile}; then " \
"run load_efi_dtb; " \
@@ -143,13 +142,22 @@
"scan_dev_for_efi=" \
"setenv efi_fdtfile ${fdtfile}; " \
BOOTENV_EFI_SET_FDTFILE_FALLBACK \
- "run scan_dev_for_efi_fdt; " \
"if test -e ${devtype} ${devnum}:${distro_bootpart} " \
"efi/boot/"BOOTEFI_NAME"; then " \
"echo Found EFI removable media binary " \
"efi/boot/"BOOTEFI_NAME"; " \
+ "for efi_bootpart in ${devplist}; do " \
+ "echo Scanning for device tree " \
+ "on ${devtype} ${devnum}" \
+ ":${efi_bootpart}...; " \
+ "run scan_dev_for_efi_fdt; " \
+ "done; " \
"run boot_efi_binary; " \
"echo EFI LOAD FAILED: continuing...; " \
+ "else " \
+ "setenv efi_bootpart ${distro_bootpart}; " \
+ "run scan_dev_for_efi_fdt; " \
+ "setenv efi_bootpart; " \
"fi; " \
"setenv efi_fdtfile\0"
#define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
--
2.6.6