Skip to contentSkip to conversation

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

PATCH RESEND New Dalon Westergreen 3 participants 9 messages Sep 27, 2019 – Oct 9, 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 1d9ade948b..0bc9d1589f 100644
@@ -1152,11 +1152,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 | \
@@ -1756,6 +1751,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.

---
 configs/socfpga_stratix10_defconfig       | 1 -
 include/configs/socfpga_stratix10_socdk.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
configs/socfpga_stratix10_defconfig +0 -1
index 5ae53a4db9..ae1b9bead1 100644
@@ -27,7 +27,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
include/configs/socfpga_stratix10_socdk.h +1 -1
index 7b55dd14da..f9ecf9d2df 100644
@@ -204,6 +204,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 */
Signature · 1 line
2.21.0
#2 lore raw

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

Am 27.09.2019 um 20:27 schrieb Dalon Westergreen:

Quoted 30 lines

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.

---
  configs/socfpga_stratix10_defconfig       | 1 -
  include/configs/socfpga_stratix10_socdk.h | 2 +-
  2 files changed, 1 insertion(+), 2 deletions(-)
configs/socfpga_stratix10_defconfig +0 -1
index 5ae53a4db9..ae1b9bead1 100644
@@ -27,7 +27,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
include/configs/socfpga_stratix10_socdk.h +0 -0
index 7b55dd14da..f9ecf9d2df 100644

include/configs/socfpga_stratix10_socdk.h unsigned int cm_get_l4_sys_free_clk_hz(void); · line 207

Quoted 5 lines
include/configs/socfpga_stratix10_socdk.h +1 -1
@@ -204,6 +204,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"

Didn't we have this before? The payload name "u-boot.img" is correct for all configurations. Without CONFIG_OF_EMBED the two above are the same, but changing the name should not be necessary.

Regards,
Simon

Quoted 3 lines
include/configs/socfpga_stratix10_socdk.h +0 -0
  #endif	/* __CONFIG_H */
 
#3 lore raw

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

Quoted 23 lines · Simon Goldschmidt

Am 27.09.2019 um 20:27 schrieb Dalon Westergreen:

Quoted 22 lines

From: Dalon Westergreen <[email protected]> CONFIG_OF_EMBED was primarily enabled to support the stratix10spl hex file requirements. Since this option now produces awarning during build, and the spl hex can be created usingalternate methods, CONFIG_OF_EMBED is no longer needed.

--- configs/socfpga_stratix10_defconfig | 1
- include/configs/socfpga_stratix10_socdk.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)

(quoted diff) +0 -0

b/configs/socfpga_stratix10_defconfigindex 5ae53a4db9..ae1b9bead1 100644--- a/configs/socfpga_stratix10_defconfig+++ b/configs/socfpga_stratix10_defconfig@@ -27,7 +27,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENER IC=y-
CONFIG_OF_EMBED=y CONFIG_DEFAULT_DEVICE_TREE="socfpga_stratix10_socdk" CON FIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=ydiff --git a/include/configs/socfpga_stratix10_socdk.h b/include/configs/socfpga_stratix10_socdk.hindex 7b55dd14da..f9ecf9d2df 100644--- a/include/configs/socfpga_stratix10_socdk.h+++ b/include/configs/socfpga_stratix10_socdk.h@@ -204,6 +204,6 @@ unsigned int
cm_get_l4_sys_free_clk_hz(void); /* SPL SDMMC boot support */ #define

Quoted 8 lines
Quoted 3 lines

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"

Didn't we have this before? The payload name "u-boot.img" is correct for all configurations. Without CONFIG_OF_EMBED the two above are the same, but changing the name should not be necessary.
Regards,Simon

Correct, but it seems convention is to just use u-boot.img and i would like all the socfpga devicesto do the same thing.
--dalon

Quoted 1 line
Quoted 1 line
    #endif	/* __CONFIG_H */
#4 lore raw

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

Quoted 88 lines · Dalon L Westergreen

On Sat, 2019-10-05 at 21:41 +0200, Simon Goldschmidt wrote:

Am 27.09.2019 um 20:27 schrieb Dalon Westergreen:

From: Dalon Westergreen <

dalon.westergreen at intel.com

Quoted 1 line

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 at intel.com

Quoted 1 line

---

  configs/socfpga_stratix10_defconfig       | 1 -
  include/configs/socfpga_stratix10_socdk.h | 2 +-
  2 files changed, 1 insertion(+), 2 deletions(-)
configs/socfpga_stratix10_defconfig +0 -0

index 5ae53a4db9..ae1b9bead1 100644

--- a/configs/socfpga_stratix10_defconfig

+++ b/configs/socfpga_stratix10_defconfig

configs/socfpga_stratix10_defconfig +0 -1
@@ -27,7 +27,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
include/configs/socfpga_stratix10_socdk.h +0 -0

index 7b55dd14da..f9ecf9d2df 100644

--- a/include/configs/socfpga_stratix10_socdk.h

+++ b/include/configs/socfpga_stratix10_socdk.h

include/configs/socfpga_stratix10_socdk.h +1 -1
@@ -204,6 +204,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"

Didn't we have this before? The payload name "u-boot.img" is correct for

all configurations. Without CONFIG_OF_EMBED the two above are the same,

but changing the name should not be necessary.

Quoted 7 lines

Regards,

Simon

Correct, but it seems convention is to just use u-boot.img and i would like all the socfpga devices to do the same thing.

Right. 'u-boot.img' is the one to use. Why do you change it to 'u-boot-dtb.img' then in this patch?

Regards,
Simon

Quoted 10 lines

--dalon

  #endif /* __CONFIG_H */
#5 lore raw

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

In reply to Dalon Westergreen
Quoted 70 lines · Dalon Westergreen

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 1d9ade948b..0bc9d1589f 100644
@@ -1152,11 +1152,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 | \
@@ -1756,6 +1751,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 +2 -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

scripts/Makefile.spl endif · line 375

Quoted 10 lines
scripts/Makefile.spl +5 -0
 	$(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) $< $@

SoCFPGA folks? This has been posted a few times, is this OK for the next release? Thanks

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191004/6cd33708/attachment.sig>
#6 lore raw

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

In reply to Dalon Westergreen

Am 27.09.2019 um 20:27 schrieb Dalon Westergreen:

Quoted 69 lines

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 1d9ade948b..0bc9d1589f 100644
@@ -1152,11 +1152,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 | \
@@ -1756,6 +1751,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 +2 -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
 

scripts/Makefile.spl endif · line 372

Quoted 8 lines
scripts/Makefile.spl +5 -0
@@ -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)
+

While I like the idea of this patch, and I *think* that this is what an SPL hex should look like for all platforms, I'm not 100% sure that globally changing the rule and objcopy flags for u-boot-spl.hex is OK for all architectures?

Let's try to apply this at the start of next merge window, then we'll hopefully see if this does break any board.

Regards,
Simon

Quoted 4 lines
scripts/Makefile.spl +0 -0
  quiet_cmd_mksunxiboot = MKSUNXI $@
  cmd_mksunxiboot = $(objtree)/tools/mksunxiboot \
  			--default-dt $(CONFIG_DEFAULT_DEVICE_TREE) $< $@
#7 lore raw

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

Quoted 50 lines · Simon Goldschmidt

Am 27.09.2019 um 20:27 schrieb Dalon Westergreen:

Quoted 35 lines

From: Dalon Westergreen <[email protected]>
Stratix10 requires a hex image of the spl plus spl devicetree offset tothe Stratix10 onchip memory located at SPL_TEXT_BASE. This patch addsa target to generate a hex file from the u-boot-spl binary including thedtb offset at SPL_TEST_BASE.
Objcopy is used to convert the $(SPL_BIN).bin, which includes the spldtb, to a hex file. the --change-address option is used to offset thehex to SPL_TEXT_BASE as objcopy on the spl binary will not result ina 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-splChanges 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(-)

Makefileindex 1d9ade948b..0bc9d1589f 100644--- renamed from Makefile +0 -0

a/Makefile+++ b/Makefile@@ -1152,11 +1152,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_si
ze=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \ map_size
=$(shell cat u-boot.map | \@@ -1756,6 +1751,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.splindex renamed from scripts/Makefile.spl +0 -0

7af6b120b6..551002194e 100644--- a/scripts/Makefile.spl+++ b/scripts/Makefile.spl@@ -216,6 +216,8 @@ ifneq ($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),) ALL-y

Quoted 7 lines
+= $(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)+

While I like the idea of this patch, and I *think* that this is what an SPL hex should look like for all platforms, I'm not 100% sure that globally changing the rule and objcopy flags for u-boot-spl.hex is OK for all architectures?
Let's try to apply this at the start of next merge window, then we'll hopefully see if this does break any board.

Quoted 2 lines

Regards,Simon

sounds good, i dont believe there are other boards with SPL hex as atarget, at least none that i found.
--dalon

Quoted 3 lines
Quoted 3 lines

quiet_cmd_mksunxiboot = MKSUNXI $@ cmd_mksunxiboot =
$(objtree)/tools/mksunxiboot \ --default-dt
$(CONFIG_DEFAULT_DEVICE_TREE) $< $@

#8 lore raw

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

Quoted 184 lines · Dalon L Westergreen

On Sat, 2019-10-05 at 21:40 +0200, Simon Goldschmidt wrote:

Am 27.09.2019 um 20:27 schrieb Dalon Westergreen:

From: Dalon Westergreen <

dalon.westergreen at intel.com

Quoted 1 line

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.

Signed-off-by Dalon Westergreen <

dalon.westergreen at intel.com

Quoted 1 line

---

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 +0 -0

index 1d9ade948b..0bc9d1589f 100644

--- a/Makefile

+++ b/Makefile

Makefile +3 -5
@@ -1152,11 +1152,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 | \
@@ -1756,6 +1751,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 +0 -0

index 7af6b120b6..551002194e 100644

--- a/scripts/Makefile.spl

+++ b/scripts/Makefile.spl

scripts/Makefile.spl +7 -0
@@ -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)
 
+

While I like the idea of this patch, and I *think* that this is what an

SPL hex should look like for all platforms, I'm not 100% sure that

globally changing the rule and objcopy flags for u-boot-spl.hex is OK

for all architectures?

Let's try to apply this at the start of next merge window, then we'll

hopefully see if this does break any board.

Reviewed-by Simon Goldschmidt <

simon.k.r.goldschmidt at gmail.com

Quoted 1 line
Quoted 8 lines

Regards,

Simon

sounds good, i dont believe there are other boards with SPL hex as a

target, at least none that i found.

Even better. Sadly, the Quartus gen5 tools require the HEX to be at offset 0 to create a 'boot-from-FPGA' image, but since that one is easy enough to create without Makefile help, I think this patch is still ok.

Regards,
Simon

Quoted 13 lines

--dalon

quiet_cmd_mksunxiboot = MKSUNXI $@

  cmd_mksunxiboot = $(objtree)/tools/mksunxiboot \

  --default-dt $(CONFIG_DEFAULT_DEVICE_TREE) $< $@