[U-Boot] [PATCH 1/2] Makefile: Add target to generate hex output for combined spl and dtb

From: Dalon Westergreen dalon.westergreen@intel.com
Some architectures, Stratix10, require a hex formatted spl that combines the spl image and dtb. This adds a target to create said hex file with and offset of SPL_TEXT_BASE.
Signed-off-by: Dalon Westergreen dalon.westergreen@intel.com --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/Makefile b/Makefile index c52a33b403..ecba06ffce 100644 --- a/Makefile +++ b/Makefile @@ -1074,6 +1074,11 @@ OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex) spl/u-boot-spl.hex: spl/u-boot-spl FORCE $(call if_changed,objcopy)
+OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex --change-address=$(CONFIG_SPL_TEXT_BASE) + +spl/u-boot-spl-dtb.hex: spl/u-boot-spl-dtb.bin FORCE + $(call if_changed,objcopy) + binary_size_check: u-boot-nodtb.bin FORCE @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ map_size=$(shell cat u-boot.map | \ @@ -1643,6 +1648,10 @@ u-boot.lds: $(LDSCRIPT) prepare FORCE
spl/u-boot-spl.bin: spl/u-boot-spl @: + +spl/u-boot-spl-dtb.bin: spl/u-boot-spl + @: + spl/u-boot-spl: tools prepare \ $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \ $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)

From: Dalon Westergreen dalon.westergreen@intel.com
CONFIG_OF_EMBED was primarily enabled to support the stratix10 spl hex file requirements. Since this option now produces a warning during build, and the spl hex can be created using alternate methods, CONFIG_OF_EMBED is no longer needed.
Signed-off-by: Dalon Westergreen dalon.westergreen@intel.com --- configs/socfpga_stratix10_defconfig | 1 - include/configs/socfpga_stratix10_socdk.h | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/configs/socfpga_stratix10_defconfig b/configs/socfpga_stratix10_defconfig index 9e6d582ee3..346175fd7a 100644 --- a/configs/socfpga_stratix10_defconfig +++ b/configs/socfpga_stratix10_defconfig @@ -26,7 +26,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y -CONFIG_OF_EMBED=y CONFIG_DEFAULT_DEVICE_TREE="socfpga_stratix10_socdk" CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y diff --git a/include/configs/socfpga_stratix10_socdk.h b/include/configs/socfpga_stratix10_socdk.h index 0e73239f56..813b96b028 100644 --- a/include/configs/socfpga_stratix10_socdk.h +++ b/include/configs/socfpga_stratix10_socdk.h @@ -200,7 +200,7 @@ unsigned int cm_get_l4_sys_free_clk_hz(void); * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB) * */ -#define CONFIG_SPL_TARGET "spl/u-boot-spl.hex" +#define CONFIG_SPL_TARGET "spl/u-boot-spl-dtb.hex" #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE #define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR @@ -214,6 +214,6 @@ unsigned int cm_get_l4_sys_free_clk_hz(void);
/* SPL SDMMC boot support */ #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 -#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" +#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot-dtb.img"
#endif /* __CONFIG_H */

On Fri, 22 Mar 2019 at 09:32, Dalon Westergreen dalon.westergreen@linux.intel.com wrote:
From: Dalon Westergreen dalon.westergreen@intel.com
CONFIG_OF_EMBED was primarily enabled to support the stratix10 spl hex file requirements. Since this option now produces a warning during build, and the spl hex can be created using alternate methods, CONFIG_OF_EMBED is no longer needed.
Signed-off-by: Dalon Westergreen dalon.westergreen@intel.com
configs/socfpga_stratix10_defconfig | 1 - include/configs/socfpga_stratix10_socdk.h | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

Hi,
On Fri, 22 Mar 2019 at 09:32, Dalon Westergreen dalon.westergreen@linux.intel.com wrote:
From: Dalon Westergreen dalon.westergreen@intel.com
Some architectures, Stratix10, require a hex formatted spl that combines the spl image and dtb. This adds a target to create said hex file with and offset of SPL_TEXT_BASE.
Signed-off-by: Dalon Westergreen dalon.westergreen@intel.com
Makefile | 9 +++++++++ 1 file changed, 9 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
Please see below.
diff --git a/Makefile b/Makefile index c52a33b403..ecba06ffce 100644 --- a/Makefile +++ b/Makefile @@ -1074,6 +1074,11 @@ OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex) spl/u-boot-spl.hex: spl/u-boot-spl FORCE $(call if_changed,objcopy)
+OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex --change-address=$(CONFIG_SPL_TEXT_BASE)
Can we drop the -dtb part here? u-boot-spl includes the DTB anyway. It is the -nodtb version which does not.
+spl/u-boot-spl-dtb.hex: spl/u-boot-spl-dtb.bin FORCE
$(call if_changed,objcopy)
binary_size_check: u-boot-nodtb.bin FORCE @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ map_size=$(shell cat u-boot.map | \ @@ -1643,6 +1648,10 @@ u-boot.lds: $(LDSCRIPT) prepare FORCE
spl/u-boot-spl.bin: spl/u-boot-spl @:
+spl/u-boot-spl-dtb.bin: spl/u-boot-spl
@:
spl/u-boot-spl: tools prepare \ $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \ $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb) -- 2.20.1
Regards, Simon

On Sat, 2019-03-30 at 15:18 -0600, Simon Glass wrote:
Hi, On Fri, 22 Mar 2019 at 09:32, Dalon Westergreen< dalon.westergreen@linux.intel.com> wrote:
From: Dalon Westergreen dalon.westergreen@intel.com Some architectures, Stratix10, require a hex formatted spl that combinesthe spl image and dtb. This adds a target to create said hex file withand offset of SPL_TEXT_BASE. Signed-off-by: Dalon Westergreen dalon.westergreen@intel.com--- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org Please see below.
diff --git a/Makefile b/Makefileindex c52a33b403..ecba06ffce 100644--- a/Makefile+++ b/Makefile@@ -1074,6 +1074,11 @@ OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex) spl/u-boot-spl.hex: spl/u-boot-spl FORCE $(call if_changed,objcopy) +OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex --change- address=$(CONFIG_SPL_TEXT_BASE)
Can we drop the -dtb part here? u-boot-spl includes the DTB anyway. Itis the -nodtb version which does not.
sure thing.
+spl/u-boot-spl-dtb.hex: spl/u-boot-spl-dtb.bin FORCE
$(call if_changed,objcopy)
binary_size_check: u-boot-nodtb.bin FORCE @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ map_size=$(shell cat u-boot.map | \ @@ -1643,6 +1648,10 @@ u-boot.lds: $(LDSCRIPT) prepare FORCE
spl/u-boot-spl.bin: spl/u-boot-spl @:
+spl/u-boot-spl-dtb.bin: spl/u-boot-spl
@:
spl/u-boot-spl: tools prepare \ $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \ $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb) -- 2.20.1
Regards, Simon
participants (3)
-
Dalon L Westergreen
-
Dalon Westergreen
-
Simon Glass