mach-sc5xx: Generate LDR artifacts only if ldr tool is available
Subsystems (3)
cover mach-sc5xx: Generate LDR artifacts only if ldr tool is available
The ldr tool, used to package artifacts in LDR format, is neither part of toolchains nor available as a utility in common host distributions. When missing, all of the builds of Analog Devices SC5XX SoC defconfigs fail, including buildman ones when testing these platforms.
Indeed, the LDR format artifacts (u-boot.ldr and spl/u-boot-spl.ldr) are final ones and not prerequisites for other targets. Therefore, consider them optional and generate only if the ldr tool is available, silently skipping if it is not, without raising any errors.
Align the CI Dockerfile, too.
Note: the only targets using the LDR boot stream format are the Analog Device SC5XX ones, therefore the *.ldr make targets could maybe be moved from common Makefiles to arch/arm/mach-sc5xx/config.mk. I do not know if others have used the LDR format in the past.
Currently, the ldr tool sources can be downloaded from [1] and built as done by the CI Docker image (tools/docker/Dockerfile). Alternatively, install the adsp-ldr package from ADI repository as described in [1].
[1] https://github.com/analogdevicesinc/adsp-ldr
---
Massimo Pegorer (4):
Makefile: Drop $(CROSS_COMPILE) prefix from LDR variable definition
CI: Dockerfile: Drop $(CROSS_COMPILE) prefixed symlinks to ldr
CI: Dockerfile: Install ldr and clean instead of just build
mach-sc5xx: Generate LDR artifacts only if ldr is available
Makefile | 2 +- arch/arm/mach-sc5xx/config.mk | 9 +++++++++ tools/docker/Dockerfile | 17 ++++++----------- 3 files changed, 16 insertions(+), 12 deletions(-)
---
base-commit: 6201222134cd704b5717211fc917e2ca6263577a
change-id: 20261116-ldr3-25540c4e1c14
Best regards,
Signature · 1 line
Massimo Pegorer <[email protected]>
PATCH 1/4 Makefile: Drop $(CROSS_COMPILE) prefix from LDR variable definition
The ldr tool is neither a utility part of cross-compiling toolchains, nor is it a cross-tool in the sense that different versions of the tool exist to generate different LDR format artifacts specific to different targets.
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -459,7 +459,7 @@ CC = $(CROSS_COMPILE)gcc CPP = $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm -LDR = $(CROSS_COMPILE)ldr +LDR = ldr STRIP = $(CROSS_COMPILE)strip OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump
Signature · 1 line
2.34.1
PATCH 2/4 CI: Dockerfile: Drop $(CROSS_COMPILE) prefixed symlinks to ldr
In reply to Massimo PegorerOnce the $(CROSS_COMPILE) prefix has been removed from the definition of LDR variable in the Makefile, these symlinks are no longer useful.
--- tools/docker/Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tools/docker/Dockerfile +1 -4
@@ -350,8 +350,7 @@ RUN wget -O - https://coreboot.org/releases/coreboot-25.03.tar.xz | tar -C /tmp sudo cp build/coreboot.rom build/cbfstool /opt/coreboot/ && \ rm -rf /tmp/coreboot-25.03 -# Build ldr tool for Analog Devices boards and create prefixed symlinks to match -# $(CROSS_COMPILE) as used by different supported platforms +# Build ldr tool for Analog Devices boards RUN git clone --depth=1 -b v1.0.2 https://github.com/analogdevicesinc/adsp-ldr.git /opt/adi-adsp-ldr && \ cd /opt/adi-adsp-ldr && \ python3 -m venv venv && \
@@ -361,8 +360,6 @@ RUN git clone --depth=1 -b v1.0.2 https://github.com/analogdevicesinc/adsp-ldr.g cd build && \ meson compile && \ cd .. && \ - ln -s build/ldr arm-linux-gnueabi-ldr && \ - ln -s build/ldr aarch64-linux-ldr && \ deactivate ENV PATH="${PATH}:/opt/adi-adsp-ldr"
Signature · 1 line
2.34.1
PATCH 3/4 CI: Dockerfile: Install ldr and clean instead of just build
In reply to Massimo PegorerClone the sources and build the ldr tool in /tmp/adi-adsp-ldr, then install it and remove the /tmp/adi-adsp-ldr directory, as already done for other tools, instead of cloning and building in /opt/adi-adsp-ldr keeping all the sources and build outputs in the Docker image. This also avoids the need to tweak the PATH environment variable.
--- tools/docker/Dockerfile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
tools/docker/Dockerfile +5 -7
@@ -351,17 +351,15 @@ RUN wget -O - https://coreboot.org/releases/coreboot-25.03.tar.xz | tar -C /tmp rm -rf /tmp/coreboot-25.03 # Build ldr tool for Analog Devices boards -RUN git clone --depth=1 -b v1.0.2 https://github.com/analogdevicesinc/adsp-ldr.git /opt/adi-adsp-ldr && \ - cd /opt/adi-adsp-ldr && \ +RUN git clone --depth=1 -b v1.0.2 https://github.com/analogdevicesinc/adsp-ldr.git /tmp/adi-adsp-ldr && \ + cd /tmp/adi-adsp-ldr && \ python3 -m venv venv && \ . venv/bin/activate && \ pip install meson && \ meson setup build && \ - cd build && \ - meson compile && \ - cd .. && \ - deactivate -ENV PATH="${PATH}:/opt/adi-adsp-ldr" + meson install -C build && \ + deactivate && \ + rm -rf /tmp/adi-adsp-ldr # Create our user/group RUN echo uboot ALL=NOPASSWD: ALL > /etc/sudoers.d/uboot
Signature · 1 line
2.34.1
PATCH 4/4 mach-sc5xx: Generate LDR artifacts only if ldr is available
In reply to Massimo PegorerThe ldr tool, used to package artifacts in LDR format, is neither part of toolchains nor available as a utility in common host distributions. When missing, all of the builds of Analog Devices SC5XX SoC defconfigs fail, including buildman ones when testing these platforms. Indeed, the LDR format artifacts (u-boot.ldr and spl/u-boot-spl.ldr) are final ones and not prerequisites for other targets. Therefore, consider them optional and generate only if the ldr tool is available, silently skipping if it is not, without raising any error.
--- arch/arm/mach-sc5xx/config.mk | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/mach-sc5xx/config.mk +9 -0
@@ -5,6 +5,13 @@ # Written by Timesys Corporation # +# Note: '2>/dev/null' is here to force Make to invoke a shell instead of +# trying to directly execute any utility named 'command' - following the +# fast path - which will cause it to fail with 'command: Command not found'. +# This workaround should be kept until support for GNU Make 4.2.1 and +# previous versions is dropped. +ifneq ($(shell command -v -- $(LDR) 2>/dev/null),) + ifdef CONFIG_XPL_BUILD INPUTS-y += $(obj)/u-boot-spl.ldr endif
@@ -13,3 +20,5 @@ INPUTS-y += u-boot.ldr LDR_FLAGS += --bcode=$(CONFIG_SC_BCODE) LDR_FLAGS += --use-vmas + +endif
Signature · 1 line
2.34.1
Hi Massimo,
Quoted 36 lines · Massimo Pegorer
The ldr tool, used to package artifacts in LDR format, is neither part of toolchains nor available as a utility in common host distributions. When missing, all of the builds of Analog Devices SC5XX SoC defconfigs fail, including buildman ones when testing these platforms.
Indeed, the LDR format artifacts (u-boot.ldr and spl/u-boot-spl.ldr) are final ones and not prerequisites for other targets. Therefore, consider them optional and generate only if the ldr tool is available, silently skipping if it is not, without raising any errors.
Align the CI Dockerfile, too.
Note: the only targets using the LDR boot stream format are the Analog Device SC5XX ones, therefore the *.ldr make targets could maybe be moved from common Makefiles to
arch/arm/mach-sc5xx/config.mk. I do not know if others have used the LDR format in the past.Currently, the ldr tool sources can be downloaded from [1] and built as done by the CI Docker image (
tools/docker/Dockerfile). Alternatively, install the adsp-ldr package from ADI repository as described in [1].[1] https://github.com/analogdevicesinc/adsp-ldr
Signed-off-by Massimo Pegorer <[email protected]>---
Massimo Pegorer (4):
Makefile: Drop $(CROSS_COMPILE) prefix from LDR variable definition
CI: Dockerfile: Drop $(CROSS_COMPILE) prefixed symlinks to ldr
CI: Dockerfile: Install ldr and clean instead of just build
mach-sc5xx: Generate LDR artifacts only if ldr is availableMakefile | 2 +- arch/arm/mach-sc5xx/config.mk | 9 +++++++++ tools/docker/Dockerfile | 17 ++++++----------- 3 files changed, 16 insertions(+), 12 deletions(-)
Quoted 8 lines
---
base-commit:6201222134cd704b5717211fc917e2ca6263577a
change-id: 20261116-ldr3-25540c4e1c14Best regards,
--
Massimo Pegorer <[email protected]>
Looks good to me. Same caveat as the other thread that I don't have the resources for CI locally right now, but the changes look good and it works the same as before for me.
Thanks,
Greg