diff mbox series

[v2] build: Revive and update LDR format support

Message ID 20240320021607.9518-1-greg.malysa@timesys.com
State Accepted
Commit bcdd02328e65130915965fdc378c89bb8e2c08bc
Delegated to: Tom Rini
Headers show
Series [v2] build: Revive and update LDR format support | expand

Commit Message

Greg Malysa March 20, 2024, 2:16 a.m. UTC
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 created.

Co-developed-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
Signed-off-by: Ian Roberts <ian.roberts@timesys.com>
Signed-off-by: Greg Malysa <greg.malysa@timesys.com>

---

Changes in v2:
 - Add HAS_LDR prerequisite to avoid prompting for LDR_CPU on unrelated
   platforms
 - Fixed accidentally moving 'source "api/Kconfig"' which is unrelated
   to this patch


---
 Kconfig              | 14 ++++++++++++++
 Makefile             |  2 +-
 scripts/Makefile.spl |  5 +++++
 3 files changed, 20 insertions(+), 1 deletion(-)

Comments

Tom Rini April 10, 2024, 5:43 p.m. UTC | #1
On Tue, 19 Mar 2024 22:16:07 -0400, Greg Malysa wrote:

> 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
> 
> [...]

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/Kconfig b/Kconfig
index 5710934000..bccacb773a 100644
--- a/Kconfig
+++ b/Kconfig
@@ -715,6 +715,20 @@  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.
 
+config HAS_LDR
+	bool
+	help
+	  Enables building .ldr targets for U-Boot and SPL. This does not
+	  automatically build any additional targets with make or buildman.
+
+config LDR_CPU
+	string "CPU name to be passed to LDR utility."
+	depends on HAS_LDR
+	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.
+
 source "api/Kconfig"
 
 endmenu		# General setup
diff --git a/Makefile b/Makefile
index a2bc9d5903..db3272a439 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 407fc52376..58d6a452e5 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -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)) $< $@