Skip to contentSkip to conversation

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

PATCH Superseded Dalon Westergreen 2 participants 5 messages Mar 22, 2019 – Apr 2, 2019 Kbuild

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

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

From: Dalon Westergreen <[email protected]>

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.

---
 Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)
Makefile +9 -0
index c52a33b403..ecba06ffce 100644
@@ -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)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 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 | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)
configs/socfpga_stratix10_defconfig +0 -1
index 9e6d582ee3..346175fd7a 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
include/configs/socfpga_stratix10_socdk.h +2 -2
index 0e73239f56..813b96b028 100644
@@ -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 */
Signature · 1 line
2.20.1
#2 lore raw

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

Quoted 8 lines · Dalon Westergreen

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.

Quoted 5 lines
---
 configs/socfpga_stratix10_defconfig       | 1 -
 include/configs/socfpga_stratix10_socdk.h | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)
#3 lore raw

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

In reply to Dalon Westergreen

Hi,

Quoted 11 lines · Dalon Westergreen

From: Dalon Westergreen <[email protected]>

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.

---
 Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)

Please see below.

Makefile OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex) · line 1077

Quoted 10 lines
Makefile +1 -0
index c52a33b403..ecba06ffce 100644
@@ -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.

Quoted 19 lines
Makefile +8 -1
+
+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)
--
Quoted 2 lines

2.20.1

Regards,
Simon

#4 lore raw

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

Quoted 12 lines · Simon Glass

Hi,

Quoted 6 lines · Dalon Westergreen

From: Dalon Westergreen <[email protected]>
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.

9 +++++++++ 1 file changed, 9 insertions(+)

Please see below.

Quoted 9 lines
Quoted 6 lines
Makefileindex c52a33b403..ecba06ffce 100644--- renamed from Makefile +0 -0

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.

Quoted 25 lines
Quoted 20 lines
Makefileindex c52a33b403..ecba06ffce 100644--- renamed from Makefile +8 -1
+
+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)
--
Quoted 2 lines

2.20.1

Regards,
Simon