Skip to content

Commit d61b831

Browse files
committed
build.sh/patch_osbuild: extend to find EFI under usr/lib/efi
Because of the change [1], the EFI files will not be copied to usr/lib/bootupd/updates/EFI, extend support for usr/lib/efi/. See tracker issue [2]. [1] coreos/bootupd@123a0cd [2] coreos/bootupd#926
1 parent bf8b944 commit d61b831

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ patch_osbuild() {
206206
# shellcheck disable=SC2002
207207
cat \
208208
/usr/lib/coreos-assembler/0001-stages-mkfs.xfs-support-setting-agcount.patch \
209+
/usr/lib/coreos-assembler/0002-stages-extend-to-find-EFI-under-usr-lib-efi.patch \
209210
| patch -d /usr/lib/osbuild -p1
210211
# And then move the files back; supermin appliance creation will need it back
211212
# in the places delivered by the RPM.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
From b4ad46c87e7b2623c8fd6ffbd571143e1f6a5434 Mon Sep 17 00:00:00 2001
2+
From: Huijing Hei <[email protected]>
3+
Date: Wed, 3 Dec 2025 13:24:00 +0800
4+
Subject: [PATCH] stages: extend to find EFI under `usr/lib/efi`
5+
6+
Because of the change [1], the EFI files will not be copied to
7+
`usr/lib/bootupd/updates/EFI`, extend support to find EFI files
8+
from `usr/lib/efi/`.
9+
See tracker issue [2].
10+
11+
[1] https://github.com/coreos/bootupd/commit/123a0cd364e89e02b52fb51a53e991c15ada02b7
12+
[2] https://github.com/coreos/bootupd/issues/926
13+
14+
Fixes: https://github.com/osbuild/osbuild/issues/2263
15+
16+
Co-worked-by: Dusty Mabe <[email protected]>
17+
Signed-off-by: Huijing Hei <[email protected]>
18+
---
19+
stages/org.osbuild.coreos.live-artifacts.mono | 28 +++++++++++++++++--
20+
1 file changed, 26 insertions(+), 2 deletions(-)
21+
22+
diff --git a/stages/org.osbuild.coreos.live-artifacts.mono b/stages/org.osbuild.coreos.live-artifacts.mono
23+
index 35ecac4e..46d809e7 100755
24+
--- a/stages/org.osbuild.coreos.live-artifacts.mono
25+
+++ b/stages/org.osbuild.coreos.live-artifacts.mono
26+
@@ -143,6 +143,25 @@ def ensure_glob(pathname, n="", **kwargs):
27+
return ret
28+
29+
30+
+# This function finds the source EFI paths to copy from /usr/ to the EFI/
31+
+# directory. Historically this was just the usr/lib/bootupd/updates/EFI/
32+
+# directory (populated by bootupd), but as part of BootLoaderUpdatesPhase1 [1]
33+
+# the shim and grub packages started delivering files in
34+
+# /usr/lib/efi/(grub|shim)/<version>/EFI/ directly. Lets prefer the
35+
+# new paths and fallback to the legacy path if those don't exist.
36+
+#
37+
+# [1] https://fedoraproject.org/wiki/Changes/BootLoaderUpdatesPhase1
38+
+def find_efi_source_paths(tree):
39+
+ if glob.glob(os.path.join(tree, 'usr/lib/efi/*/*/EFI')):
40+
+ # BootLoaderUpdatesPhase1 has been implemented and we should
41+
+ # be able to pick up files from usr/lib/efi/(grub|shim)/<version>/EFI/
42+
+ # Let's ensure there's only 2 dirs that match (i.e. one for grub
43+
+ # one for shim) and return that list.
44+
+ return ensure_glob(os.path.join(tree, 'usr/lib/efi/*/*/EFI'), n=2)
45+
+ # Legacy path. Just return a single entry list with the old path.
46+
+ return [os.path.join(tree, 'usr/lib/bootupd/updates/EFI')]
47+
+
48+
+
49+
def find_efi_vendor_dir_name(efidir):
50+
# Find name of vendor directory for this distro. i.e. "fedora" or "redhat".
51+
dirs = [n for n in os.listdir(efidir) if n != "BOOT"]
52+
@@ -485,7 +504,9 @@ def mkefiboot(paths, deployed_tree, volid, loop_client):
53+
return tarinfo
54+
55+
efidir = paths["efi"]
56+
- shutil.copytree(os.path.join(deployed_tree, 'usr/lib/bootupd/updates/EFI'), efidir)
57+
+ for path in find_efi_source_paths(deployed_tree):
58+
+ shutil.copytree(path, efidir)
59+
+
60+
vendor_id = find_efi_vendor_dir_name(efidir)
61+
62+
# Delete fallback and its CSV file. Its purpose is to create
63+
@@ -711,7 +732,10 @@ def copy_configs_and_init_kargs_json(deployed_tree, paths, blsentry_kargs, volid
64+
# [1] https://github.com/coreos/fedora-coreos-config/tree/testing-devel/live/EFI/fedora
65+
# [2] https://github.com/openshift/os/tree/master/live/EFI/vendor
66+
# [3] https://github.com/openshift/os/issues/954
67+
- efidir = os.path.join(deployed_tree, 'usr/lib/bootupd/updates/EFI')
68+
+ #
69+
+ # To find the string for the vendor ID we only need to inspect one
70+
+ # of the source EFI directories. Grab one here.
71+
+ efidir = find_efi_source_paths(deployed_tree)[0]
72+
if os.path.exists(efidir):
73+
vendor_id = find_efi_vendor_dir_name(efidir)
74+
grubfilepath = ensure_glob(os.path.join(paths["iso"], 'EFI/*/grub.cfg'), n=1)[0]
75+
--
76+
2.51.0
77+

0 commit comments

Comments
 (0)