summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-bsp/u-boot/files/0001-Makefile-add-dependency-from-lib-to-arch-ARCH-lib.patch81
-rw-r--r--meta/recipes-bsp/u-boot/files/v3-0001-Makefile-scripts-Makefile.lib-fix-_efi.so-depende.patch136
-rw-r--r--meta/recipes-bsp/u-boot/files/v3-0002-efi_loader-Makefile-change-apps-from-always-to-ta.patch57
-rw-r--r--meta/recipes-bsp/u-boot/u-boot-common.inc3
4 files changed, 82 insertions, 195 deletions
diff --git a/meta/recipes-bsp/u-boot/files/0001-Makefile-add-dependency-from-lib-to-arch-ARCH-lib.patch b/meta/recipes-bsp/u-boot/files/0001-Makefile-add-dependency-from-lib-to-arch-ARCH-lib.patch
new file mode 100644
index 0000000000..06fdaf5b0a
--- /dev/null
+++ b/meta/recipes-bsp/u-boot/files/0001-Makefile-add-dependency-from-lib-to-arch-ARCH-lib.patch
@@ -0,0 +1,81 @@
1From d0075e2d730a4fa48aa763a669e5edbc02c33a22 Mon Sep 17 00:00:00 2001
2From: Mikko Rapeli <mikko.rapeli@linaro.org>
3Date: Thu, 31 Jul 2025 14:52:48 +0300
4Subject: [PATCH] Makefile: add dependency from lib to arch/$(ARCH)/lib
5
6Top level Makefile starts separate "make" processes for each each
7subdirectory. lib/efi_loader apps now depend on lib.a from
8arch/$(ARCH)/lib if CONFIG_USE_PRIVATE_LIBGCC is enabled which creates
9a race conditions since dependency from lib/efi_loader EFI apps to
10arch/$(ARCH)/lib/lib.a is not explicit:
11
12arm-poky-linux-gnueabi-ld.bfd: cannot find arch/arm/lib/lib.a: No such file or directory
13make[3]: *** [scripts/Makefile.lib:512: lib/efi_loader/testapp_efi.so] Error 1
14
15This error was seen on yocto/OE-core CI builds after u-boot 2025.07 update:
16
17https://lists.openembedded.org/g/openembedded-core/message/220004
18
19https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/2914600/raw_inline
20
21 | rm -f lib/efi_loader/built-in.o; arm-poky-linux-gnueabi-ar cDPrsT lib/efi_loader/built-in.o lib/efi_loader/efi_bootmgr.o lib/efi_loader/efi_bootbin.o lib/efi_loader
22/efi_boottime.o lib/efi_loader/efi_helper.o lib/efi_loader/efi_console.o lib/efi_loader/efi_device_path.o lib/efi_loader/efi_device_path_to_text.o lib/efi_loader/efi_device_
23path_utilities.o lib/efi_loader/efi_dt_fixup.o lib/efi_loader/efi_fdt.o lib/efi_loader/efi_file.o lib/efi_loader/efi_hii.o lib/efi_loader/efi_hii_config.o lib/efi_loader/efi
24_image_loader.o lib/efi_loader/efi_load_options.o lib/efi_loader/efi_memory.o lib/efi_loader/efi_root_node.o lib/efi_loader/efi_runtime.o lib/efi_loader/efi_setup.o lib/efi_
25loader/efi_string.o lib/efi_loader/efi_unicode_collation.o lib/efi_loader/efi_var_common.o lib/efi_loader/efi_var_mem.o lib/efi_loader/efi_variable.o lib/efi_loader/efi_var_
26file.o lib/efi_loader/efi_watchdog.o lib/efi_loader/efi_disk.o lib/efi_loader/efi_net.o lib/efi_loader/efi_smbios.o lib/efi_loader/efi_load_initrd.o lib/efi_loader/efi_confo
27rmance.o
28 | arm-poky-linux-gnueabi-ld.bfd -nostdlib -zexecstack -znocombreloc -znorelro --no-warn-rwx-segments -L /srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-
293119200/tmp/work/beaglebone_yocto-poky-linux-gnueabi/u-boot/2025.07/sources/u-boot-2025.07 -T arch/arm/lib/elf_arm_efi.lds -shared -Bsymbolic -s lib/efi_loader/helloworld.o
30lib/efi_loader/efi_crt0.o lib/efi_loader/efi_reloc.o lib/efi_loader/efi_freestanding.o arch/arm/lib/lib.a -o lib/efi_loader/helloworld_efi.so
31 | arm-poky-linux-gnueabi-ld.bfd: cannot find arch/arm/lib/lib.a: No such file or directory
32 | make[3]: *** [scripts/Makefile.lib:512: lib/efi_loader/helloworld_efi.so] Error 1
33
34The different "make" processes share common scripts/Makefile.build
35and scripts/Makefile.libs but since they are separate processes
36the Makefile rules can't add a dependency from lib/uefi_loader targets
37to arch/$(ARCH)/lib/lib.a. Or the file level dependency can be added but
38then "make" produces a too sparse error message which does not mention
39that one of the dependencies like arch/$(ARCH)/lib/lib.a was not found:
40
41make[3]: *** No rule to make target 'lib/efi_loader/helloworld.efi', needed by '__build'. Stop.
42
43Fix this dependency problem by building arch/$(ARCH)/lib before lib
44if CONFIG_USE_PRIVATE_LIBGCC was enabled.
45
46To reproduce the race condition more reliably, add a "sleep 10" delay
47before linker command cmd_link_l_target with 2025.07
48or to $(lib-target): target in scripts/Makefile.build with master branch
49after Kbuild update.
50
51Fixes: 43d43241d1c9 ("scripts/Makefile.lib: add PLATFORM_LIBGCC to efi linking")
52
53Cc: Adriano Cordova <adrianox@gmail.com>
54Cc: Fabio Estevam <festevam@gmail.com>
55Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
56Reviewed-by: Fabio Estevam <festevam@gmail.com>
57---
58 Makefile | 5 +++++
59 1 file changed, 5 insertions(+)
60
61Upstream-Status: Backport
62
63diff --git a/Makefile b/Makefile
64index c31bf7ecea97..b03f87a93fb9 100644
65--- a/Makefile
66+++ b/Makefile
67@@ -2131,6 +2131,11 @@ $(filter-out tools, $(u-boot-dirs)): tools
68 # is "yes"), so compile examples after U-Boot is compiled.
69 examples: $(filter-out examples, $(u-boot-dirs))
70
71+ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
72+# lib/efi_loader apps depend on arch/$(ARCH)/lib for lib.a
73+lib: $(filter arch/$(ARCH)/lib, $(u-boot-dirs))
74+endif
75+
76 # The setlocalversion script comes from linux and expects a
77 # KERNELVERSION variable in the environment for figuring out which
78 # annotated tags are relevant. Pass UBOOTVERSION.
79--
802.43.0
81
diff --git a/meta/recipes-bsp/u-boot/files/v3-0001-Makefile-scripts-Makefile.lib-fix-_efi.so-depende.patch b/meta/recipes-bsp/u-boot/files/v3-0001-Makefile-scripts-Makefile.lib-fix-_efi.so-depende.patch
deleted file mode 100644
index e8253a67b2..0000000000
--- a/meta/recipes-bsp/u-boot/files/v3-0001-Makefile-scripts-Makefile.lib-fix-_efi.so-depende.patch
+++ /dev/null
@@ -1,136 +0,0 @@
1From 2e7c1321bb44cc6af4ee4b1026a52e1a0aa7e336 Mon Sep 17 00:00:00 2001
2From: Mikko Rapeli <mikko.rapeli@linaro.org>
3Date: Thu, 10 Jul 2025 14:24:07 +0000
4Subject: [PATCH v3 1/2] Makefile scripts/Makefile.lib: fix *_efi.so dependency
5 to PLATFORM_LIBGCC
6
7When PLATFORM_LIBGCC was added to linker command it was not
8added to the dependency of the .so and other rules. Thus a build can
9try to link *_efi.so files before lib.a from PLATFORM_LIBGCC is available.
10This was seen in yocto autobuilder builds with u-boot 2025.07
11update, see https://lists.openembedded.org/g/openembedded-core/message/220004
12
13https://autobuilder.yoctoproject.org/valkyrie/api/v2/logs/2914600/raw_inline
14
15| rm -f lib/efi_loader/built-in.o; arm-poky-linux-gnueabi-ar cDPrsT lib/efi_loader/built-in.o lib/efi_loader/efi_bootmgr.o lib/efi_loader/efi_bootbin.o lib/efi_loader/efi_boottime.o lib/efi_loader/efi_helper.o lib/efi_loader/efi_console.o lib/efi_loader/efi_device_path.o lib/efi_loader/efi_device_path_to_text.o lib/efi_loader/efi_device_path_utilities.o lib/efi_loader/efi_dt_fixup.o lib/efi_loader/efi_fdt.o lib/efi_loader/efi_file.o lib/efi_loader/efi_hii.o lib/efi_loader/efi_hii_config.o lib/efi_loader/efi_image_loader.o lib/efi_loader/efi_load_options.o lib/efi_loader/efi_memory.o lib/efi_loader/efi_root_node.o lib/efi_loader/efi_runtime.o lib/efi_loader/efi_setup.o lib/efi_loader/efi_string.o lib/efi_loader/efi_unicode_collation.o lib/efi_loader/efi_var_common.o lib/efi_loader/efi_var_mem.o lib/efi_loader/efi_variable.o lib/efi_loader/efi_var_file.o lib/efi_loader/efi_watchdog.o lib/efi_loader/efi_disk.o lib/efi_loader/efi_net.o lib/efi_loader/efi_smbios.o lib/efi_loader/efi_load_initrd.o lib/efi_loader/efi_conformance.o
16| arm-poky-linux-gnueabi-ld.bfd -nostdlib -zexecstack -znocombreloc -znorelro --no-warn-rwx-segments -L /srv/pokybuild/yocto-worker/oe-selftest-armhost/build/build-st-3119200/tmp/work/beaglebone_yocto-poky-linux-gnueabi/u-boot/2025.07/sources/u-boot-2025.07 -T arch/arm/lib/elf_arm_efi.lds -shared -Bsymbolic -s lib/efi_loader/helloworld.o lib/efi_loader/efi_crt0.o lib/efi_loader/efi_reloc.o lib/efi_loader/efi_freestanding.o arch/arm/lib/lib.a -o lib/efi_loader/helloworld_efi.so
17| arm-poky-linux-gnueabi-ld.bfd: cannot find arch/arm/lib/lib.a: No such file or directory
18| make[3]: *** [scripts/Makefile.lib:512: lib/efi_loader/helloworld_efi.so] Error 1
19
20The issue is hard to reproduce but this change can artificially trigger it:
21
22 a/scripts/Makefile.build
23 b/scripts/Makefile.build
24@@ -353,7 +353,7 @@ $(modorder-target): $(subdir-ym) FORCE
25 #
26 ifdef lib-target
27 quiet_cmd_link_l_target = AR $@
28-cmd_link_l_target = rm -f $@; $(AR) cDPrsT$(KBUILD_ARFLAGS) $@ $(lib-y)
29+cmd_link_l_target = rm -f $@ && echo "HACK, delaying build!" && sleep 60 && $(AR) cDPrsT$(KBUILD_ARFLAGS) $@ $(lib-y)
30
31 $(lib-target): $(lib-y) FORCE
32 $(call if_changed,link_l_target)
33
34Then run a rebuild with:
35
36$ rm -f $( find build/ -name lib.a -or -name helloworld_efi.so ) && \
37 make
38...
39 arm-poky-linux-gnueabi-ld.bfd -nostdlib -zexecstack -znocombreloc -znorelro --no-warn-rwx-segments -L /home/mcfrisk/src/base/repo/poky/build_bea
40glebone/tmp/work/beaglebone_yocto-poky-linux-gnueabi/u-boot/2025.07/sources/u-boot-2025.07 -T arch/arm/lib/elf_arm_efi.lds -shared -Bsymbolic -s lib/efi_loader/helloworld.o lib/efi_loader/efi_crt0.o lib/efi_loader/efi_reloc.o lib/efi_loader/efi_freestanding.o arch/arm/lib/lib.a -o lib/efi_loader/helloworld_efi.so
41arm-poky-linux-gnueabi-ld.bfd: cannot find arch/arm/lib/lib.a: No such file or directory
42make[3]: *** [scripts/Makefile.lib:512: lib/efi_loader/helloworld_efi.so] Error 1
43
44Fix by introducing PLATFORM_LIBGCC_LIBA variable with only lib.a
45filename which is then used to add the dependency in rules which use
46PLATFORM_LIBGCC. This should not impact builds which don't set
47PLATFORM_LIBGCC_LIBA and PLATFORM_LIBGCC usage stays as is.
48
49Fixes: 43d43241d1c9 ("scripts/Makefile.lib: add PLATFORM_LIBGCC to efi linking")
50
51Cc: Adriano Cordova <adrianox@gmail.com>
52Cc: Fabio Estevam <festevam@gmail.com>
53Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
54---
55 Makefile | 4 +++-
56 examples/standalone/Makefile | 2 +-
57 scripts/Makefile.lib | 2 +-
58 scripts/Makefile.xpl | 3 ++-
59 4 files changed, 7 insertions(+), 4 deletions(-)
60
61Upstream-Status: Submitted [https://lists.denx.de/pipermail/u-boot/2025-July/594581.html]
62
63v3: added "export PLATFORM_LIBGCC_LIBA" like PLATFORM_LIBGCC, not sure
64 how testing worked without this before
65
66v2: introduced PLATFORM_LIBGCC_LIBA variable with just lib.a filename,
67 PLATFORM_LIBGCC can have other flags too
68 https://lists.denx.de/pipermail/u-boot/2025-July/594034.html
69
70v1: https://lists.denx.de/pipermail/u-boot/2025-July/593982.html
71
72diff --git a/Makefile b/Makefile
73index 1a5c77d7caf0..a0797f36f7f6 100644
74--- a/Makefile
75+++ b/Makefile
76@@ -911,7 +911,8 @@ u-boot-main := $(libs-y)
77
78 # Add GCC lib
79 ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
80-PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
81+PLATFORM_LIBGCC_LIBA = arch/$(ARCH)/lib/lib.a
82+PLATFORM_LIBGCC = $(PLATFORM_LIBGCC_LIBA)
83 else
84 ifndef CONFIG_CC_IS_CLANG
85 PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
86@@ -926,6 +927,7 @@ endif
87
88 export PLATFORM_LIBS
89 export PLATFORM_LIBGCC
90+export PLATFORM_LIBGCC_LIBA
91
92 # Special flags for CPP when processing the linker script.
93 # Pass the version down so we can handle backwards compatibility
94diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
95index 9b57f1c0c66c..aa9e3121cf9a 100644
96--- a/examples/standalone/Makefile
97+++ b/examples/standalone/Makefile
98@@ -64,7 +64,7 @@ quiet_cmd_link_elf = LD $@
99 cmd_link_elf = $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_STANDALONE) -g \
100 -o $@ -e $(SYM_PREFIX)$(@F) $< $(LIB) $(PLATFORM_LIBGCC)
101
102-$(ELF): $(obj)/%: $(obj)/%.o $(LIB) FORCE
103+$(ELF): $(obj)/%: $(obj)/%.o $(LIB) $(PLATFORM_LIBGCC_LIBA) FORCE
104 $(call if_changed,link_elf)
105
106 $(obj)/%.srec: OBJCOPYFLAGS += -O srec
107diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
108index e89a4a51b74d..cef3863dfdc4 100644
109--- a/scripts/Makefile.lib
110+++ b/scripts/Makefile.lib
111@@ -508,7 +508,7 @@ $(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcoun
112 $(call cmd,force_checksrc)
113 $(call if_changed_rule,cc_o_c)
114
115-$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
116+$(obj)/%_efi.so: $(PLATFORM_LIBGCC_LIBA) $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
117 $(call cmd,efi_ld)
118
119 targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
120diff --git a/scripts/Makefile.xpl b/scripts/Makefile.xpl
121index 43f27874f9fe..68c88293f0d9 100644
122--- a/scripts/Makefile.xpl
123+++ b/scripts/Makefile.xpl
124@@ -139,7 +139,8 @@ libs-y := $(patsubst %/, %/built-in.o, $(libs-y))
125
126 # Add GCC lib
127 ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
128-PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
129+PLATFORM_LIBGCC_LIBA = arch/$(ARCH)/lib/lib.a
130+PLATFORM_LIBGCC = $(PLATFORM_LIBGCC_LIBA)
131 PLATFORM_LIBS := $(filter-out %/lib.a, $(filter-out -lgcc, $(PLATFORM_LIBS))) $(PLATFORM_LIBGCC)
132 endif
133
134--
1352.43.0
136
diff --git a/meta/recipes-bsp/u-boot/files/v3-0002-efi_loader-Makefile-change-apps-from-always-to-ta.patch b/meta/recipes-bsp/u-boot/files/v3-0002-efi_loader-Makefile-change-apps-from-always-to-ta.patch
deleted file mode 100644
index 6b68f74724..0000000000
--- a/meta/recipes-bsp/u-boot/files/v3-0002-efi_loader-Makefile-change-apps-from-always-to-ta.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From d207ec22429adc94f9e173971e30c675d2ab3de4 Mon Sep 17 00:00:00 2001
2From: Mikko Rapeli <mikko.rapeli@linaro.org>
3Date: Fri, 18 Jul 2025 08:15:25 +0000
4Subject: [PATCH v3 2/2] efi_loader Makefile: change apps from "always" to
5 "targets"
6
7Adding delay to link commands in scripts/Makefile.build
8
9@@ -353,7 +353,7 @@ $(modorder-target): $(subdir-ym) FORCE
10 #
11 ifdef lib-target
12 quiet_cmd_link_l_target = AR $@
13-cmd_link_l_target = rm -f $@; $(AR) cDPrsT$(KBUILD_ARFLAGS) $@ $(lib-y)
14+cmd_link_l_target = rm -f $@; echo "HACK delaying lib-target"; sleep 10; $(AR) cDPrsT$(KBUILD_ARFLAGS) $@ $(lib-y)
15
16 $(lib-target): $(lib-y) FORCE
17 $(call if_changed,link_l_target)
18(1/2) Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? n
19@@ -362,7 +362,7 @@ targets += $(lib-target)
20 endif
21
22 quiet_cmd_link_multi-y = AR $@
23-cmd_link_multi-y = rm -f $@; $(AR) cDPrsT$(KBUILD_ARFLAGS) $@ $(filter %.o,$^)
24+cmd_link_multi-y = rm -f $@; echo "HACK delaying cmd_link_multi-y"; sleep 10; $(AR) cDPrsT$(KBUILD_ARFLAGS) $@ $(filter %.o,$^)
25
26 quiet_cmd_link_multi-m = AR [M] $@
27 cmd_link_multi-m = $(cmd_link_multi-y)
28
29exposes a build failure:
30
31make[3]: *** No rule to make target 'lib/efi_loader/helloworld.efi', needed by '__build'. Stop.
32make[3]: *** Waiting for unfinished jobs....
33
34This if fixed by using normal targets for .efi apps. The rules
35in scripts/Makefile.lib handle the dependencies correctly.
36
37Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
38---
39 lib/efi_loader/Makefile | 2 +-
40 1 file changed, 1 insertion(+), 1 deletion(-)
41
42Upstream-Status: Submitted [https://lists.denx.de/pipermail/u-boot/2025-July/594583.html]
43
44diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
45index cf050e5385dd..e929c23b1cb1 100644
46--- a/lib/efi_loader/Makefile
47+++ b/lib/efi_loader/Makefile
48@@ -96,5 +96,5 @@ $(foreach f,$(apps-y),\
49 $(eval CFLAGS_$(f).o := $(CFLAGS_EFI) -Os -ffreestanding)\
50 $(eval CFLAGS_REMOVE_$(f).o := $(CFLAGS_NON_EFI)))
51
52-always += $(foreach f,$(apps-y),$(f).efi)
53+targets += $(foreach f,$(apps-y),$(f).efi)
54 targets += $(foreach f,$(apps-y),$(f).o)
55--
562.43.0
57
diff --git a/meta/recipes-bsp/u-boot/u-boot-common.inc b/meta/recipes-bsp/u-boot/u-boot-common.inc
index 053e686354..ea55545db3 100644
--- a/meta/recipes-bsp/u-boot/u-boot-common.inc
+++ b/meta/recipes-bsp/u-boot/u-boot-common.inc
@@ -16,8 +16,7 @@ SRCREV = "e37de002fac3895e8d0b60ae2015e17bb33e2b5b"
16 16
17SRC_URI = "\ 17SRC_URI = "\
18 git://source.denx.de/u-boot/u-boot.git;protocol=https;branch=master;tag=v${PV} \ 18 git://source.denx.de/u-boot/u-boot.git;protocol=https;branch=master;tag=v${PV} \
19 file://v3-0001-Makefile-scripts-Makefile.lib-fix-_efi.so-depende.patch \ 19 file://0001-Makefile-add-dependency-from-lib-to-arch-ARCH-lib.patch \
20 file://v3-0002-efi_loader-Makefile-change-apps-from-always-to-ta.patch \
21 file://0001-nxp-Prepare-macros-for-KVM-changes.patch \ 20 file://0001-nxp-Prepare-macros-for-KVM-changes.patch \
22 file://0002-arm-io.h-Fix-io-accessors-for-KVM.patch \ 21 file://0002-arm-io.h-Fix-io-accessors-for-KVM.patch \
23 file://0003-qemu-arm-Enable-virtualizable-IO-accessors.patch \ 22 file://0003-qemu-arm-Enable-virtualizable-IO-accessors.patch \