[U-Boot,1/1] distro_bootcmd: Switch bootefi to use loadaddr by default.

Message ID 1531229342-21401-2-git-send-email-kristian.amlie@northern.tech
State New
Delegated to: Tom Rini
Headers show
Series
  • distro_bootcmd: Switch bootefi to use loadaddr by default.
Related show

Commit Message

Kristian Amlie July 10, 2018, 1:29 p.m.
loadaddr is configurable in Kconfig using CONFIG_LOADADDR, while
kernel_addr_r is not. Hence, loadaddr is the future. Provide the
existing kernel_addr_r as a fallback if loadaddr is not set.

Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
---
 include/config_distro_bootcmd.h | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Patch

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index d672e8e..839afcc 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -129,12 +129,15 @@ 
 		"else "                                                   \
 			"bootefi bootmgr ${fdtcontroladdr};"              \
 		"fi;"                                                     \
+		"if test -z \"${loadaddr}\"; then "                       \
+			"setenv loadaddr ${kernel_addr_r};"               \
+		"fi;"                                                     \
 		"load ${devtype} ${devnum}:${distro_bootpart} "           \
-			"${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; "      \
+			"${loadaddr} efi/boot/"BOOTEFI_NAME"; "           \
 		"if fdt addr ${fdt_addr_r}; then "                        \
-			"bootefi ${kernel_addr_r} ${fdt_addr_r};"         \
+			"bootefi ${loadaddr} ${fdt_addr_r};"              \
 		"else "                                                   \
-			"bootefi ${kernel_addr_r} ${fdtcontroladdr};"     \
+			"bootefi ${loadaddr} ${fdtcontroladdr};"          \
 		"fi\0"                                                    \
 	\
 	"load_efi_dtb="                                                   \
@@ -277,12 +280,15 @@ 
 	"setenv efi_old_arch ${bootp_arch};"                              \
 	"setenv bootp_vci " BOOTENV_EFI_PXE_VCI ";"                       \
 	"setenv bootp_arch " BOOTENV_EFI_PXE_ARCH ";"                     \
-	"if dhcp ${kernel_addr_r}; then "                                 \
+	"if test -z \"${loadaddr}\"; then "                               \
+		"setenv loadaddr ${kernel_addr_r};"                       \
+	"fi;"                                                             \
+	"if dhcp ${loadaddr}; then "                                      \
 		"tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};"              \
 		"if fdt addr ${fdt_addr_r}; then "                        \
-			"bootefi ${kernel_addr_r} ${fdt_addr_r}; "        \
+			"bootefi ${loadaddr} ${fdt_addr_r}; "             \
 		"else "                                                   \
-			"bootefi ${kernel_addr_r} ${fdtcontroladdr};"     \
+			"bootefi ${loadaddr} ${fdtcontroladdr};"          \
 		"fi;"                                                     \
 	"fi;"                                                             \
 	"setenv bootp_vci ${efi_old_vci};"                                \