[PATCH] Copy only the efibootguard bootloader to the EFI partition properly.

4 views
Skip to first unread message

Farhat

unread,
Feb 20, 2018, 9:53:33 PM2/20/18
to efibootg...@googlegroups.com, Farhat-Abbas
From: Farhat-Abbas <Farhat...@mentor.com>

There isn't any EFI/BOOT directory in the 'DEPLOY_DIR_IMAGE'
directory & efibootguard is present at top level in it, possibly alongwith
other *efi bootloaders like grub-efi. Only efibootguard bootloader should be
copied to the image from here, in the required architecture specific naming
convention. This patch updates the script to the latest OE-Core tree with
file 'oe-core/scripts/lib/wic/plugins/source/bootimg-efi.py' as reference.

Signed-off-by: Farhat-Abbas <Farhat...@mentor.com>
---
scripts/lib/wic/plugins/source/efibootguard-efi.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/efibootguard-efi.py b/scripts/lib/wic/plugins/source/efibootguard-efi.py
index b5a8f83..77d39bc 100644
--- a/scripts/lib/wic/plugins/source/efibootguard-efi.py
+++ b/scripts/lib/wic/plugins/source/efibootguard-efi.py
@@ -66,8 +66,15 @@ class EfibootguardEFIPlugin(SourcePlugin):
install_cmd = "install -d %s/EFI/BOOT" % hdddir
exec_cmd(install_cmd)

- cp_cmd = "cp %s/EFI/BOOT/* %s/EFI/BOOT" % (kernel_dir, hdddir)
- exec_cmd(cp_cmd, True)
+ # Locate & install the efibootguard bootloader properly to the EFI partition
+ # i586 ARCH: efibootguardia32.efi ---> bootia32.efi
+ # x86_64 ARCH: efibootguardx64.efi ---> bootx64.efi
+ for mod in [x for x in os.listdir(kernel_dir) if x.startswith("efibootguard")]:
+ # mod = efibootguardia32.efi or efibootguardx64.efi
+ # efi_image = bootia32.efi or bootx64.efi
+ efi_image = mod.replace('efibootguard', 'boot')
+ cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (kernel_dir, mod, hdddir, efi_image)
+ exec_cmd(cp_cmd, True)

# Calculate the number of extra blocks to be sure that the
# resulting partition image is of the wanted size
--
2.7.4

Reply all
Reply to author
Forward
0 new messages