Skip to contentSkip to conversation

efi_loader: move efi_var_seed.o to objtree

PATCH In review Jon Mason 4 participants 6 messages Jun 19 – Jun 25

lore
Share & tools
lore

Jon Mason

author
#0 lore raw

PATCH 1/1 efi_loader: move efi_var_seed.o to objtree

With commit bd3f9ee679b4d1456d0d3c261ab76788950e6096 (kbuild: Bump the build system to 6.1), there is an issue when trying to build out of tree, where efi_var_seed.S wants ubootefi.var to be in the object tree, but lib/efi_loader/efi_var_seed.o wants ubootefi.var to be in the source tree.

If we change efi_var_seed.o to look in the objtree, then it should work in both local and out-of-tree. However, it would require anything previously working to put ubootefi.vars to the objtree, but it's broken now anyway.

---
 lib/efi_loader/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/Makefile +1 -1
index f490081f6542..9c836f6ee237 100644
@@ -74,7 +74,7 @@ obj-$(CONFIG_EFI_ECPT) += efi_conformance.o
 obj-$(CONFIG_EFI_DEBUG_SUPPORT) += efi_debug_support.o
 
 EFI_VAR_SEED_FILE := $(subst $\",,$(CONFIG_EFI_VAR_SEED_FILE))
-$(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE)
+$(obj)/efi_var_seed.o: $(objtree)/$(EFI_VAR_SEED_FILE)
 
 ifeq ($(CONFIG_EFI_CAPSULE_AUTHENTICATE),y)
 capsule_crt_path=($(subst $(quote),,$(CONFIG_EFI_CAPSULE_CRT_FILE)))
#1 lore raw

Am 19. Juni 2026 17:58:57 MESZ schrieb Jon Mason <[email protected]>:

Quoted 5 lines

With commit bd3f9ee679b4d1456d0d3c261ab76788950e6096 (kbuild: Bump the build system to 6.1), there is an issue when trying to build out of tree, where efi_var_seed.S wants ubootefi.var to be in the object tree, but lib/efi_loader/efi_var_seed.o wants ubootefi.var to be in the source tree.

Ubootefi.var is an optional file with the EFI security database. Why would you ever put it into the build directory?

Heinrich

Quoted 24 lines

If we change efi_var_seed.o to look in the objtree, then it should work in both local and out-of-tree. However, it would require anything previously working to put ubootefi.vars to the objtree, but it's broken now anyway.

---
lib/efi_loader/Makefile | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/Makefile +0 -0
index f490081f6542..9c836f6ee237 100644
@@ -74,7 +74,7 @@ obj-$(CONFIG_EFI_ECPT) += efi_conformance.o

obj-$(CONFIG_EFI_DEBUG_SUPPORT) += efi_debug_support.o

EFI_VAR_SEED_FILE := $(subst $\",,$(CONFIG_EFI_VAR_SEED_FILE)) -$(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE) +$(obj)/efi_var_seed.o: $(objtree)/$(EFI_VAR_SEED_FILE)

ifeq ($(CONFIG_EFI_CAPSULE_AUTHENTICATE),y) capsule_crt_path=($(subst $(quote),,$(CONFIG_EFI_CAPSULE_CRT_FILE)))

#2 lore raw
Quoted 9 lines · Heinrich Schuchardt

Am 19. Juni 2026 17:58:57 MESZ schrieb Jon Mason <[email protected]>:

Quoted 5 lines

With commit bd3f9ee679b4d1456d0d3c261ab76788950e6096 (kbuild: Bump the build system to 6.1), there is an issue when trying to build out of tree, where efi_var_seed.S wants ubootefi.var to be in the object tree, but lib/efi_loader/efi_var_seed.o wants ubootefi.var to be in the source tree.

Ubootefi.var is an optional file with the EFI security database. Why would you ever put it into the build directory?

I didn't know that was a limitation.

Would you prefer that I make a change like:
-$(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE) +$(obj)/efi_var_seed.o: $(srctree)/lib/efi_loader/$(EFI_VAR_SEED_FILE)

This seems to work for my use case, and still keeps it in the src directory.

Thanks,
Jon

Quoted 28 lines

Heinrich

Quoted 24 lines

If we change efi_var_seed.o to look in the objtree, then it should work in both local and out-of-tree. However, it would require anything previously working to put ubootefi.vars to the objtree, but it's broken now anyway.

---
lib/efi_loader/Makefile | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/Makefile +0 -0
index f490081f6542..9c836f6ee237 100644
@@ -74,7 +74,7 @@ obj-$(CONFIG_EFI_ECPT) += efi_conformance.o

obj-$(CONFIG_EFI_DEBUG_SUPPORT) += efi_debug_support.o

EFI_VAR_SEED_FILE := $(subst $\",,$(CONFIG_EFI_VAR_SEED_FILE)) -$(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE) +$(obj)/efi_var_seed.o: $(objtree)/$(EFI_VAR_SEED_FILE)

ifeq ($(CONFIG_EFI_CAPSULE_AUTHENTICATE),y) capsule_crt_path=($(subst $(quote),,$(CONFIG_EFI_CAPSULE_CRT_FILE)))

#3 lore raw

Am 23. Juni 2026 21:03:38 MESZ schrieb Jon Mason <[email protected]>:

Quoted 9 lines · Heinrich Schuchardt
Quoted 8 lines

Am 19. Juni 2026 17:58:57 MESZ schrieb Jon Mason <[email protected]>:

Quoted 5 lines

With commit bd3f9ee679b4d1456d0d3c261ab76788950e6096 (kbuild: Bump the build system to 6.1), there is an issue when trying to build out of tree, where efi_var_seed.S wants ubootefi.var to be in the object tree, but lib/efi_loader/efi_var_seed.o wants ubootefi.var to be in the source tree.

Quoted 7 lines
Quoted 1 line

Ubootefi.var is an optional file with the EFI security database. Why would you ever put it into the build directory?

I didn't know that was a limitation.

Would you prefer that I make a change like:
-$(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE) +$(obj)/efi_var_seed.o: $(srctree)/lib/efi_loader/$(EFI_VAR_SEED_FILE)

Hello Jon,

It is still not clear to me why you want to change this.

If you don't like the current default, why wouldn't you change CONFIG_EFI_VAR_SEED_FILE in your local .config file to match the storage location of your seed file?

Best regards

Heinrich

Quoted 34 lines

This seems to work for my use case, and still keeps it in the src directory.

Thanks,
Jon

Quoted 28 lines

Heinrich

Quoted 24 lines

If we change efi_var_seed.o to look in the objtree, then it should work in both local and out-of-tree. However, it would require anything previously working to put ubootefi.vars to the objtree, but it's broken now anyway.

---
lib/efi_loader/Makefile | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/Makefile +0 -0
index f490081f6542..9c836f6ee237 100644
@@ -74,7 +74,7 @@ obj-$(CONFIG_EFI_ECPT) += efi_conformance.o

obj-$(CONFIG_EFI_DEBUG_SUPPORT) += efi_debug_support.o

EFI_VAR_SEED_FILE := $(subst $\",,$(CONFIG_EFI_VAR_SEED_FILE)) -$(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE) +$(obj)/efi_var_seed.o: $(objtree)/$(EFI_VAR_SEED_FILE)

ifeq ($(CONFIG_EFI_CAPSULE_AUTHENTICATE),y) capsule_crt_path=($(subst $(quote),,$(CONFIG_EFI_CAPSULE_CRT_FILE)))

#4 lore raw
Quoted 19 lines · Heinrich Schuchardt

Am 23. Juni 2026 21:03:38 MESZ schrieb Jon Mason <[email protected]>:

Quoted 9 lines · Heinrich Schuchardt
Quoted 8 lines

Am 19. Juni 2026 17:58:57 MESZ schrieb Jon Mason <[email protected]>:

Quoted 5 lines

With commit bd3f9ee679b4d1456d0d3c261ab76788950e6096 (kbuild: Bump the build system to 6.1), there is an issue when trying to build out of tree, where efi_var_seed.S wants ubootefi.var to be in the object tree, but lib/efi_loader/efi_var_seed.o wants ubootefi.var to be in the source tree.

Quoted 7 lines
Quoted 1 line

Ubootefi.var is an optional file with the EFI security database. Why would you ever put it into the build directory?

I didn't know that was a limitation.

Would you prefer that I make a change like:
-$(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE) +$(obj)/efi_var_seed.o: $(srctree)/lib/efi_loader/$(EFI_VAR_SEED_FILE)

Quoted 5 lines

Hello Jon,

It is still not clear to me why you want to change this.

If you don't like the current default, why wouldn't you change CONFIG_EFI_VAR_SEED_FILE in your local .config file to match the storage location of your seed file?

Sorry, I think I've not been clear. I have a previously working setup in my Yocto layer for ~2 years.
After u-boot commit bd3f9ee679b4d1456d0d3c261ab76788950e6096 (kbuild:
Bump the build system to 6.1), it no longer works.
I'm only seeing this now because Yocto recently updated u-boot to v2026.04

I'm seeing the following error:
<snip>
| aarch64-poky-linux-gcc
--sysroot=/builder/meta-arm/build/tmp/work/qemuarm64_secureboot-poky-linux/u-boot/2026.04/recipe-sysroot
-fcanon-prefix-map
-ffile-prefix-map=/builder/meta-arm/build/workspace/sources/u-boot=/usr/src/debug/u-boot/2026.04
-ffile-prefix-map=/builder/meta-arm/build/tmp/work/qemuarm64_secureboot-poky-linux/u-boot/2026.04/u-boot-2026.04=/usr/src/debug/u-boot/2026.04 -ffile-prefix-map=/builder/meta-arm/build/tmp/work/qemuarm64_secureboot-poky-linux/u-boot/2026.04/recipe-sysroot= -ffile-prefix-map=/builder/meta-arm/build/tmp/work/qemuarm64_secureboot-poky-linux/u-boot/2026.04/recipe-sysroot-native=
-Wp,-MMD,lib/efi_loader/.efi_var_seed.o.d -nostdinc -isystem
/builder/meta-arm/build/tmp/work/qemuarm64_secureboot-poky-linux/u-boot/2026.04/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../lib/aarch64-poky-linux/gcc/aarch64-poky-linux/16.1.0/include -Iinclude -I/builder/meta-arm/build/workspace/sources/u-boot/include
"-DMBEDTLS_CONFIG_FILE=\"mbedtls_def_config.h\""
-I/builder/meta-arm/build/workspace/sources/u-boot/lib/mbedtls
-I/builder/meta-arm/build/workspace/sources/u-boot/lib/mbedtls/port
-I/builder/meta-arm/build/workspace/sources/u-boot/lib/mbedtls/external/mbedtls -I/builder/meta-arm/build/workspace/sources/u-boot/lib/mbedtls/external/mbedtls/include
-I/builder/meta-arm/build/workspace/sources/u-boot/arch/arm/include
-include /builder/meta-arm/build/workspace/sources/u-boot/include/linux/kconfig.h
-I/builder/meta-arm/build/workspace/sources/u-boot/dts/upstream/include
-D__KERNEL__ -D__UBOOT__ -D__ASSEMBLY__ -fno-PIE -gdwarf-4 -I.
-D__ARM__ -fno-pic -mstrict-align -ffunction-sections -fdata-sections
-fno-common -ffixed-x18 -mgeneral-regs-only -mbranch-protection=none
-pipe -march=armv8-a+crc -D__LINUX_ARM_ARCH__=8 -I
/builder/meta-arm/build/workspace/sources/u-boot/lib/efi_loader -I
./lib/efi_loader -c -o lib/efi_loader/efi_var_seed.o
/builder/meta-arm/build/workspace/sources/u-boot/lib/efi_loader/efi_var_seed.S
| Assembler messages:
| /builder/meta-arm/build/workspace/sources/u-boot/lib/efi_loader/efi_var_seed.S:14:
Error: file not found: ubootefi.var
| make[3]: *** [/builder/meta-arm/build/workspace/sources/u-boot/scripts/Makefile.build:344:
lib/efi_loader/efi_var_seed.o] Error 1
</snip>

My ubootefi.var is in the root of the u-boot source when building (where it has always been), but it is no longer being found.

Something is broken, and I _think_ it is not being seen by others because they build in their source tree (whereas my obj tree is in another location in my file system, due to how yocto works). That is assuming that this is being tested, otherwise it is broken for everyone and not just me.

With the patch in my first email, and some changes to my yocto recipes, it is working again.
With the changes I suggested in my previous email, and some changes to my yocto recipes, it is working again.

I understand your first point that the ubootefi.var file is coming from outside, and thus doesn't belong in obj. This is why I did some more ugly hacking today to find the changes I suggested earlier today. It seems like the S file is looking in the local directory, lib/efi_loader.

I am more than happy to test out any patches, if you come up with one that addresses the issue.

Thanks,
Jon

Quoted 41 lines

Best regards

Heinrich

Quoted 34 lines

This seems to work for my use case, and still keeps it in the src directory.

Thanks,
Jon

Quoted 28 lines

Heinrich

Quoted 24 lines

If we change efi_var_seed.o to look in the objtree, then it should work in both local and out-of-tree. However, it would require anything previously working to put ubootefi.vars to the objtree, but it's broken now anyway.

---
lib/efi_loader/Makefile | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/Makefile +0 -0
index f490081f6542..9c836f6ee237 100644
@@ -74,7 +74,7 @@ obj-$(CONFIG_EFI_ECPT) += efi_conformance.o

obj-$(CONFIG_EFI_DEBUG_SUPPORT) += efi_debug_support.o

EFI_VAR_SEED_FILE := $(subst $\",,$(CONFIG_EFI_VAR_SEED_FILE)) -$(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE) +$(obj)/efi_var_seed.o: $(objtree)/$(EFI_VAR_SEED_FILE)

ifeq ($(CONFIG_EFI_CAPSULE_AUTHENTICATE),y) capsule_crt_path=($(subst $(quote),,$(CONFIG_EFI_CAPSULE_CRT_FILE)))

#5 lore raw
In reply to Jon Mason

Hi Jon,

Quoted 20 lines · Jon Mason

efi_loader: move efi_var_seed.o to objtree

With commit bd3f9ee679b4d1456d0d3c261ab76788950e6096 (kbuild: Bump the build system to 6.1), there is an issue when trying to build out of tree, where efi_var_seed.S wants ubootefi.var to be in the object tree, but lib/efi_loader/efi_var_seed.o wants ubootefi.var to be in the source tree.

If we change efi_var_seed.o to look in the objtree, then it should work in both local and out-of-tree. However, it would require anything previously working to put ubootefi.vars to the objtree, but it's broken now anyway.

lib/efi_loader/Makefile | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)

lib/efi_loader/Makefile obj-$(CONFIG_EFI_ECPT) += efi_conformance.o · line 78

Quoted 5 lines
lib/efi_loader/Makefile +1 -1
@@ -75,7 +75,7 @@ obj-$(CONFIG_EFI_ECPT) += efi_conformance.o
 obj-$(CONFIG_EFI_DEBUG_SUPPORT) += efi_debug_support.o
 
 EFI_VAR_SEED_FILE := $(subst $\",,$(CONFIG_EFI_VAR_SEED_FILE))
-$(obj)/efi_var_seed.o: $(srctree)/$(EFI_VAR_SEED_FILE)
+$(obj)/efi_var_seed.o: $(objtree)/$(EFI_VAR_SEED_FILE)

A couple of things beyond Heinrich's objection.

This only changes the make-level prerequisite. The actual lookup happens inside efi_var_seed.S via .incbin, which resolves through the assembler's -I search paths. In your failing log the assembler is invoked with -I. (the objtree root) and -I ./lib/efi_loader, but no -I pointing at $(srctree), so the file is only found if it sits in the objtree. Flipping the make dep to $(objtree) papers over the symptom but doesn't wire the search path to anything new - the build works for you because -I. was already resolving there.

If the intent is to keep the file in $(srctree) (which is what the Kconfig help promises - 'If a relative file path is used, it is relative to the source directory'), the real fix is probably to add -I $(srctree) to the asflags for this object, e.g.

    AFLAGS_efi_var_seed.o := -I $(srctree)

and leave the prerequisite pointing at $(srctree). Otherwise the Kconfig help in lib/efi_loader/Kconfig needs updating in the same patch, since this silently inverts the documented behaviour.

Commit-message nits: 'efi_var_seed.S wants ubootefi.var to be in the object tree' isn't quite right - it wants it on the assembler include path, which today happens to be the objtree; and 'ubootefi.vars' should be 'ubootefi.var'.

Regards,
Simon