Skip to contentSkip to conversation

Makefile: Add target to generate hex output for combined spl and dtb

PATCH RESEND Superseded Dalon Westergreen 1 participant 2 messages Aug 7, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v3 1/2 Makefile: Add target to generate hex output for combined spl and dtb

From: Dalon Westergreen <[email protected]>

Stratix10 requires a hex image of the spl plus spl devicetree offset to the Stratix10 onchip memory located at SPL_TEXT_BASE. This patch adds a target to generate a hex file from the u-boot-spl binary including the dtb offset at SPL_TEST_BASE.

Objcopy is used to convert the $(SPL_BIN).bin, which includes the spl dtb, to a hex file. the --change-address option is used to offset the hex to SPL_TEXT_BASE as objcopy on the spl binary will not result in a hex file appropriately offset at SPL_TEXT_BASE.

---
Changes in v3:
-> Cleanup commit message and better describe the problem being
resolved
-> Remove extraneous hunk
-> use SPL_BIN instead of u-boot-spl
Changes in v2:
-> Move spl hex file generation to SPL Makefile
-> Create hexfile from $(SPL_BIN).bin which will include the dtb
ifneq(build_dtb,)

---
 Makefile             | 8 +++-----
 scripts/Makefile.spl | 7 +++++++
 2 files changed, 10 insertions(+), 5 deletions(-)
Makefile +3 -5
index 8513db94e3..aa5c0746f0 100644
@@ -1129,11 +1129,6 @@ OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
 		$(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
 		$(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -R .resetvec)
 
-OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex)
-
-spl/u-boot-spl.hex: spl/u-boot-spl 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 | \
@@ -1715,6 +1710,9 @@ spl/u-boot-spl.bin: spl/u-boot-spl
 	@:
 	$(SPL_SIZE_CHECK)
 
+spl/u-boot-spl.hex: 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)
scripts/Makefile.spl +7 -0
index 7af6b120b6..551002194e 100644
@@ -216,6 +216,8 @@ ifneq ($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),)
 ALL-y	+= $(obj)/$(SPL_BIN).sfp
 endif
 
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex
+
 ifdef CONFIG_ARCH_SUNXI
 ALL-y	+= $(obj)/sunxi-spl.bin
 
@@ -363,6 +365,11 @@ endif
 $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
 	$(call if_changed,mkimage)
 
+OBJCOPYFLAGS_$(SPL_BIN).hex := -I binary -O ihex --change-address=$(CONFIG_SPL_TEXT_BASE)
+
+$(obj)/$(SPL_BIN).hex: $(obj)/$(SPL_BIN).bin FORCE
+	$(call if_changed,objcopy)
+
 quiet_cmd_mksunxiboot = MKSUNXI $@
 cmd_mksunxiboot = $(objtree)/tools/mksunxiboot \
 			--default-dt $(CONFIG_DEFAULT_DEVICE_TREE) $< $@
Signature · 1 line
2.21.0
#1 lore raw

PATCH RESEND v3 2/2 ARM: socfpga: stratix10: Remove CONFIG_OF_EMBED

From: Dalon Westergreen <[email protected]>

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.

---
Changes in v3:
-> Revert to u-boot.img for SPL payload name
Changes in v2:
-> Change CONFIG_SPL_TARGET back to u-boot-spl.hex

---
 configs/socfpga_stratix10_defconfig | 1 -
 1 file changed, 1 deletion(-)
configs/socfpga_stratix10_defconfig +0 -1
index fbab388b43..f27180385d 100644
@@ -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
Signature · 1 line
2.21.0