[OE-core] [PATCH] wic/bootimg-efi.py: add new source parameter "initrd_rename"

Yongxin Liu yongxin.liu at windriver.com
Wed Mar 27 10:37:42 UTC 2019


When using initrd in bootloader configuration file, we may want
the name of initrd to be fixed. However, the actual name of initrd
may change and depend on distro/machine's name. "initrd_rename"
gives user a chance to rename initrd in final wic image.

Signed-off-by: Yongxin Liu <yongxin.liu at windriver.com>
---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 83a7e18..852ed88 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -69,7 +69,11 @@ class BootimgEFIPlugin(SourcePlugin):
             if not bootimg_dir:
                 raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
 
-            cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir)
+            initrd_rename = source_params.get('initrd_rename')
+            if initrd_rename:
+                cp_cmd = "cp %s/%s %s/%s" % (bootimg_dir, initrd, hdddir, initrd_rename)
+            else:
+                cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir)
             exec_cmd(cp_cmd, True)
         else:
             logger.debug("Ignoring missing initrd")
@@ -126,7 +130,11 @@ class BootimgEFIPlugin(SourcePlugin):
             if not bootimg_dir:
                 raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
 
-            cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir)
+            initrd_rename = source_params.get('initrd_rename')
+            if initrd_rename:
+                cp_cmd = "cp %s/%s %s/%s" % (bootimg_dir, initrd, hdddir, initrd_rename)
+            else:
+                cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir)
             exec_cmd(cp_cmd, True)
         else:
             logger.debug("Ignoring missing initrd")
-- 
1.8.3.1



More information about the Openembedded-core mailing list