Commit ff2545ab78212717b5d81bc0fb6a91fd393f3cb1

Authored by Alexander Graf
Committed by Tom Rini
1 parent 1c39809b92

efi_loader: Fall back to fdtfile naming convention

When there is no $fdtfile variable set, we still have a good chance
that on 32bit arm the fdtfile really is just called $soc-$board.dtb.

Enable the exports for $soc and $board in our distr defaults and make
use of them in the efi boot script.

Reported-by: Andreas Faerber <afaerber@suse.de>
Reported-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>

Showing 2 changed files with 22 additions and 3 deletions Side-by-side Diff

include/config_distro_bootcmd.h
... ... @@ -99,6 +99,21 @@
99 99 #endif
100 100  
101 101 #ifdef BOOTEFI_NAME
  102 +#if defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
  103 +/*
  104 + * On 32bit ARM systems there is a reasonable number of systems that follow
  105 + * the $soc-$board$boardver.dtb name scheme for their device trees. Use that
  106 + * scheme if we don't have an explicit fdtfile variable.
  107 + */
  108 +#define BOOTENV_EFI_SET_FDTFILE_FALLBACK \
  109 + "if test -z \"${fdtfile}\" -a -n \"${soc}\"; then " \
  110 + "setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; " \
  111 + "fi; "
  112 +#else
  113 +#define BOOTENV_EFI_SET_FDTFILE_FALLBACK
  114 +#endif
  115 +
  116 +
102 117 #define BOOTENV_SHARED_EFI \
103 118 "boot_efi_binary=" \
104 119 "load ${devtype} ${devnum}:${distro_bootpart} " \
105 120  
106 121  
... ... @@ -111,14 +126,16 @@
111 126 \
112 127 "load_efi_dtb=" \
113 128 "load ${devtype} ${devnum}:${distro_bootpart} " \
114   - "${fdt_addr_r} ${prefix}${fdtfile}\0" \
  129 + "${fdt_addr_r} ${prefix}${efi_fdtfile}\0" \
115 130 \
116 131 "efi_dtb_prefixes=/ /dtb/ /dtb/current/\0" \
117 132 "scan_dev_for_efi=" \
  133 + "setenv efi_fdtfile ${fdtfile}; " \
  134 + BOOTENV_EFI_SET_FDTFILE_FALLBACK \
118 135 "for prefix in ${efi_dtb_prefixes}; do " \
119 136 "if test -e ${devtype} " \
120 137 "${devnum}:${distro_bootpart} " \
121   - "${prefix}${fdtfile}; then " \
  138 + "${prefix}${efi_fdtfile}; then " \
122 139 "run load_efi_dtb; " \
123 140 "fi;" \
124 141 "done;" \
... ... @@ -128,7 +145,8 @@
128 145 "efi/boot/"BOOTEFI_NAME"; " \
129 146 "run boot_efi_binary; " \
130 147 "echo EFI LOAD FAILED: continuing...; " \
131   - "fi; \0"
  148 + "fi; " \
  149 + "setenv efi_fdtfile\0"
132 150 #define SCAN_DEV_FOR_EFI "run scan_dev_for_efi;"
133 151 #else
134 152 #define BOOTENV_SHARED_EFI
include/config_distro_defaults.h
... ... @@ -65,6 +65,7 @@
65 65 #define CONFIG_ISO_PARTITION
66 66 #define CONFIG_SUPPORT_RAW_INITRD
67 67 #define CONFIG_SYS_HUSH_PARSER
  68 +#define CONFIG_ENV_VARS_UBOOT_CONFIG
68 69  
69 70 #endif /* _CONFIG_CMD_DISTRO_DEFAULTS_H */