Skip to contentSkip to conversation

bootimg-efi.py: Skip installing kernel-image into boot partition for rootfs-reliant systems.

PATCH In review Kareem Zarka 2 participants 2 messages Jan 31, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bootimg-efi.py: Skip installing kernel-image into boot partition for rootfs-reliant systems.

From: Kareem Zarka <[email protected]>

The issue with installing the kernel-image to both rootfs and boot partition is that some systems rely on the kernel-image in rootfs and not in the boot partition.
This leads to duplication of the kernel-image, which can cause unnecessary storage usage and potential compatibility issues.

This patch provides a solution to this problem by adding a new parameter "skip-kernel-install" to the wic kickstart file, which can be passed to the plugin.
If the parameter is provided, the plugin will skip installing the kernel-image to the boot partition, avoiding duplication and potential issues.

By adding this new parameter, we give the users the option to install the kernel-image only in rootfs, or to install it in both rootfs and boot partition, depending on their needs and preferences. This will help to improve the system's storage usage and compatibility.

---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
scripts/lib/wic/plugins/source/bootimg-efi.py +7 -3
index 4b00913a70..e04d49abe6 100644
@@ -363,9 +363,13 @@ class BootimgEFIPlugin(SourcePlugin):
                 objcopy_cmd += " %s %s/EFI/Linux/linux.efi" % (efi_stub, hdddir)
                 exec_native_cmd(objcopy_cmd, native_sysroot)
         else:
-            install_cmd = "install -m 0644 %s/%s %s/%s" % \
-                (staging_kernel_dir, kernel, hdddir, kernel)
-            exec_cmd(install_cmd)
+            # skip_kernal_install was added to source_params to conifgure installing the kernel-image.
+            # set skip_kernal_install in the kickstart file to skip installing it into hdddir.
+            # if not set then the kernel-image will be installed.
+            if not  source_params.get('skip_kernal_install'):
+                install_cmd = "install -m 0644 %s/%s %s/%s" % \
+                    (staging_kernel_dir, kernel, hdddir, kernel)
+                exec_cmd(install_cmd)
 
         if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
             for src_path, dst_path in cls.install_task:
Signature · 1 line
2.25.1
#1 lore raw
Quoted 36 lines · Kareem Zarka

From: Kareem Zarka <[email protected]>

The issue with installing the kernel-image to both rootfs and boot partition is that some systems rely on the kernel-image in rootfs and not in the boot partition.
This leads to duplication of the kernel-image, which can cause unnecessary storage usage and potential compatibility issues.

This patch provides a solution to this problem by adding a new parameter "skip-kernel-install" to the wic kickstart file, which can be passed to the plugin.
If the parameter is provided, the plugin will skip installing the kernel-image to the boot partition, avoiding duplication and potential issues.

By adding this new parameter, we give the users the option to install the kernel-image only in rootfs, or to install it in both rootfs and boot partition, depending on their needs and preferences. This will help to improve the system's storage usage and compatibility.

---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
scripts/lib/wic/plugins/source/bootimg-efi.py +0 -3
index 4b00913a70..e04d49abe6 100644
@@ -363,9 +363,13 @@ class BootimgEFIPlugin(SourcePlugin):
                 objcopy_cmd += " %s %s/EFI/Linux/linux.efi" % (efi_stub, hdddir)
                 exec_native_cmd(objcopy_cmd, native_sysroot)
         else:
-            install_cmd = "install -m 0644 %s/%s %s/%s" % \
-                (staging_kernel_dir, kernel, hdddir, kernel)
-            exec_cmd(install_cmd)

scripts/lib/wic/plugins/source/bootimg-efi.py class BootimgEFIPlugin(SourcePlugin): · line 375

Quoted 10 lines
scripts/lib/wic/plugins/source/bootimg-efi.py +7 -0
+            # skip_kernal_install was added to source_params to conifgure installing the kernel-image.
+            # set skip_kernal_install in the kickstart file to skip installing it into hdddir.
+            # if not set then the kernel-image will be installed.
+            if not  source_params.get('skip_kernal_install'):
+                install_cmd = "install -m 0644 %s/%s %s/%s" % \
+                    (staging_kernel_dir, kernel, hdddir, kernel)
+                exec_cmd(install_cmd)
 
         if get_bitbake_var("IMAGE_EFI_BOOT_FILES"):
             for src_path, dst_path in cls.install_task:

I'm fine with adding such an option but could you also add a test for it please? wic has good test coverage and I'd like to keep that. You can run the tests with:

oe-selftest -r wic

Cheers,

Richard