Skip to contentSkip to conversation

build: Revive and update LDR format support

PATCH Superseded Greg Malysa 2 participants 2 messages Mar 20, 2024 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: Revive and update LDR format support

LDR format files are used primarily by Analog Devices processors but may be of interest to other vendors. Previously support existed for this format as part of the U-Boot build, but it has been unmaintained and unused for a long time. In preparation for adding support for modern ADI processors that use LDR, modernize the LDR support:

- Introduce CONFIG_LDR_CPU as the CPU string recognized by the LDR tool may not be the same as CONFIG_CPU
- Add an SPL target that repackages u-boot-spl inside an LDR file

An almost identical target for packaging u-boot into an LDR file already exists and did not need to be updated

---

 Kconfig              | 9 ++++++++-
 Makefile             | 2 +-
 scripts/Makefile.spl | 5 +++++
 3 files changed, 14 insertions(+), 2 deletions(-)
Kconfig +8 -1
index 5710934000..3f3ce6054e 100644
@@ -715,10 +715,17 @@ config SYS_CLK_FREQ
 	  A static value for the CPU frequency.  Note that if not required
 	  for a given SoC, this can be left at 0.
 
-source "api/Kconfig"
+config LDR_CPU
+	string "CPU name to be passed to LDR utility."
+	help
+	  Set the CPU name for the -T parameter in the LDR utility.  This is
+	  generally used on processors from Analog Devices, but may be also
+	  be useful for other vendors.
 
 endmenu		# General setup
 
+source "api/Kconfig"
+
 source "boot/Kconfig"
 
 source "common/Kconfig"
Makefile +1 -1
index a2bc9d5903..db3272a439 100644
@@ -1328,7 +1328,7 @@ u-boot-nodtb.bin: u-boot FORCE
 
 u-boot.ldr:	u-boot
 		$(CREATE_LDR_ENV)
-		$(LDR) -T $(CONFIG_CPU) -c $@ $< $(LDR_FLAGS)
+		$(LDR) -T $(CONFIG_LDR_CPU) -c $@ $< $(LDR_FLAGS)
 		$(BOARD_SIZE_CHECK)
 
 # binman
scripts/Makefile.spl +5 -0
index 407fc52376..58d6a452e5 100644
@@ -381,6 +381,11 @@ $(obj)/$(BOARD)-spl.bin: $(obj)/u-boot-spl.bin
 	$(objtree)/tools/mkexynosspl) $(VAR_SIZE_PARAM) $< $@
 endif
 
+$(obj)/u-boot-spl.ldr: $(obj)/u-boot-spl
+	$(CREATE_LDR_ENV)
+	$(LDR) -T $(CONFIG_LDR_CPU) -c $@ $< $(LDR_FLAGS)
+	$(BOARD_SIZE_CHECK)
+
 quiet_cmd_objcopy = OBJCOPY $@
 cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
 
Signature · 1 line
2.38.2
#1 lore raw
Quoted 32 lines · Greg Malysa

LDR format files are used primarily by Analog Devices processors but may be of interest to other vendors. Previously support existed for this format as part of the U-Boot build, but it has been unmaintained and unused for a long time. In preparation for adding support for modern ADI processors that use LDR, modernize the LDR support:

- Introduce CONFIG_LDR_CPU as the CPU string recognized by the LDR tool may not be the same as CONFIG_CPU
- Add an SPL target that repackages u-boot-spl inside an LDR file

An almost identical target for packaging u-boot into an LDR file already exists and did not need to be updated

---

 Kconfig              | 9 ++++++++-
 Makefile             | 2 +-
 scripts/Makefile.spl | 5 +++++
 3 files changed, 14 insertions(+), 2 deletions(-)
Kconfig +0 -0
index 5710934000..3f3ce6054e 100644
@@ -715,10 +715,17 @@ config SYS_CLK_FREQ
 	  A static value for the CPU frequency.  Note that if not required
 	  for a given SoC, this can be left at 0.

Kconfig config SYS_CLK_FREQ · line 725

Quoted 10 lines
Kconfig +6 -1
 
-source "api/Kconfig"
+config LDR_CPU
+	string "CPU name to be passed to LDR utility."
+	help
+	  Set the CPU name for the -T parameter in the LDR utility.  This is
+	  generally used on processors from Analog Devices, but may be also
+	  be useful for other vendors.
 
 endmenu		# General setup

This looks like a new prompted option, without a default, for every platform. If so, as is it will cause everything in CI to fail to build. This should "depend on" some relevant LDR symbol, once that's been added, rather than as a ground-work patch. This rest seems fine, FWIW.

Signature · 1 line
Tom