summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChee Yang Lee <chee.yang.lee@intel.com>2019-07-17 10:02:42 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-17 19:25:02 +0100
commitb697aba61e55b93aa1ebf59a369d182c7a14c313 (patch)
tree3571d932f7001b5a27be66e1a59d8f112aaed359
parent28688a277050f248d6cee73e3b77f791606e59b3 (diff)
downloadpoky-b697aba61e55b93aa1ebf59a369d182c7a14c313.tar.gz
wic: add support for kernel with initramfs bundled
when INITRAMFS_IMAGE_BUNDLE and INITRAMFS_IMAGE are set, wic should look for kernel with initramfs image bundled. Include required variable MACHINE, INITRAMFS_IMAGE_BUNDLE, INITRAMFS_IMAGE, INITRAMFS_LINK_NAME and KERNEL_IMAGETYPE in WICVARS. No longer require default value for variable kernel as KERNEL_IMAGETYPE is not optional variable and included in WICVARS. image_types_wic to inherit kernel-artifact-names to obtain default INITRAMFS_LINK_NAME when INITRAMFS_IMAGE_BUNDLE are set. update wic.Wic2.test_image_env test case to filter optional variable INITRAMFS_LINK_NAME, INITRAMFS_IMAGE and INITRAMFS_IMAGE_BUNDLE. (From OE-Core rev: bac984fbb2d5ad5d13ba3275c8a3e878d8753c58) Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/image_types_wic.bbclass5
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py3
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-efi.py18
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-pcbios.py6
-rw-r--r--scripts/lib/wic/plugins/source/isoimage-isohybrid.py19
5 files changed, 35 insertions, 16 deletions
diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass
index 5b40a9e919..97d681b1b3 100644
--- a/meta/classes/image_types_wic.bbclass
+++ b/meta/classes/image_types_wic.bbclass
@@ -3,7 +3,10 @@
3WICVARS ?= "\ 3WICVARS ?= "\
4 BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD IMAGE_BASENAME IMAGE_BOOT_FILES \ 4 BBLAYERS IMGDEPLOYDIR DEPLOY_DIR_IMAGE FAKEROOTCMD IMAGE_BASENAME IMAGE_BOOT_FILES \
5 IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR RECIPE_SYSROOT_NATIVE \ 5 IMAGE_LINK_NAME IMAGE_ROOTFS INITRAMFS_FSTYPES INITRD INITRD_LIVE ISODIR RECIPE_SYSROOT_NATIVE \
6 ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS" 6 ROOTFS_SIZE STAGING_DATADIR STAGING_DIR STAGING_LIBDIR TARGET_SYS \
7 KERNEL_IMAGETYPE MACHINE INITRAMFS_IMAGE INITRAMFS_IMAGE_BUNDLE INITRAMFS_LINK_NAME"
8
9inherit ${@bb.utils.contains('INITRAMFS_IMAGE_BUNDLE', '1', 'kernel-artifact-names', '', d)}
7 10
8WKS_FILE ??= "${IMAGE_BASENAME}.${MACHINE}.wks" 11WKS_FILE ??= "${IMAGE_BASENAME}.${MACHINE}.wks"
9WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks" 12WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks"
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index f1c6f390c5..c390749401 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -499,7 +499,8 @@ class Wic2(WicTestCase):
499 wicvars = set(bb_vars['WICVARS'].split()) 499 wicvars = set(bb_vars['WICVARS'].split())
500 # filter out optional variables 500 # filter out optional variables
501 wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES', 501 wicvars = wicvars.difference(('DEPLOY_DIR_IMAGE', 'IMAGE_BOOT_FILES',
502 'INITRD', 'INITRD_LIVE', 'ISODIR')) 502 'INITRD', 'INITRD_LIVE', 'ISODIR','INITRAMFS_IMAGE',
503 'INITRAMFS_IMAGE_BUNDLE', 'INITRAMFS_LINK_NAME'))
503 with open(path) as envfile: 504 with open(path) as envfile:
504 content = dict(line.split("=", 1) for line in envfile) 505 content = dict(line.split("=", 1) for line in envfile)
505 # test if variables used by wic present in the .env file 506 # test if variables used by wic present in the .env file
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 5cc5c8a6b8..2cfdc10ecd 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -74,8 +74,10 @@ class BootimgEFIPlugin(SourcePlugin):
74 grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot") 74 grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot")
75 75
76 kernel = get_bitbake_var("KERNEL_IMAGETYPE") 76 kernel = get_bitbake_var("KERNEL_IMAGETYPE")
77 if not kernel: 77 if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
78 kernel = "bzImage" 78 if get_bitbake_var("INITRAMFS_IMAGE"):
79 kernel = "%s-%s.bin" % \
80 (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
79 81
80 label = source_params.get('label') 82 label = source_params.get('label')
81 label_conf = "root=%s" % creator.rootdev 83 label_conf = "root=%s" % creator.rootdev
@@ -154,8 +156,10 @@ class BootimgEFIPlugin(SourcePlugin):
154 if not custom_cfg: 156 if not custom_cfg:
155 # Create systemd-boot configuration using parameters from wks file 157 # Create systemd-boot configuration using parameters from wks file
156 kernel = get_bitbake_var("KERNEL_IMAGETYPE") 158 kernel = get_bitbake_var("KERNEL_IMAGETYPE")
157 if not kernel: 159 if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
158 kernel = "bzImage" 160 if get_bitbake_var("INITRAMFS_IMAGE"):
161 kernel = "%s-%s.bin" % \
162 (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
159 163
160 title = source_params.get('title') 164 title = source_params.get('title')
161 165
@@ -225,8 +229,10 @@ class BootimgEFIPlugin(SourcePlugin):
225 hdddir = "%s/hdd/boot" % cr_workdir 229 hdddir = "%s/hdd/boot" % cr_workdir
226 230
227 kernel = get_bitbake_var("KERNEL_IMAGETYPE") 231 kernel = get_bitbake_var("KERNEL_IMAGETYPE")
228 if not kernel: 232 if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
229 kernel = "bzImage" 233 if get_bitbake_var("INITRAMFS_IMAGE"):
234 kernel = "%s-%s.bin" % \
235 (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
230 236
231 install_cmd = "install -m 0644 %s/%s %s/%s" % \ 237 install_cmd = "install -m 0644 %s/%s %s/%s" % \
232 (staging_kernel_dir, kernel, hdddir, kernel) 238 (staging_kernel_dir, kernel, hdddir, kernel)
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 670d347747..f2639e7004 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -150,8 +150,10 @@ class BootimgPcbiosPlugin(SourcePlugin):
150 hdddir = "%s/hdd/boot" % cr_workdir 150 hdddir = "%s/hdd/boot" % cr_workdir
151 151
152 kernel = get_bitbake_var("KERNEL_IMAGETYPE") 152 kernel = get_bitbake_var("KERNEL_IMAGETYPE")
153 if not kernel: 153 if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
154 kernel = "bzImage" 154 if get_bitbake_var("INITRAMFS_IMAGE"):
155 kernel = "%s-%s.bin" % \
156 (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
155 157
156 cmds = ("install -m 0644 %s/%s %s/vmlinuz" % 158 cmds = ("install -m 0644 %s/%s %s/vmlinuz" %
157 (staging_kernel_dir, kernel, hdddir), 159 (staging_kernel_dir, kernel, hdddir),
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index 74d6f14519..24299c1ece 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -71,8 +71,11 @@ class IsoImagePlugin(SourcePlugin):
71 syslinux_conf += "LABEL boot\n" 71 syslinux_conf += "LABEL boot\n"
72 72
73 kernel = get_bitbake_var("KERNEL_IMAGETYPE") 73 kernel = get_bitbake_var("KERNEL_IMAGETYPE")
74 if not kernel: 74 if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
75 kernel = "bzImage" 75 if get_bitbake_var("INITRAMFS_IMAGE"):
76 kernel = "%s-%s.bin" % \
77 (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
78
76 syslinux_conf += "KERNEL /" + kernel + "\n" 79 syslinux_conf += "KERNEL /" + kernel + "\n"
77 syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" \ 80 syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" \
78 % bootloader.append 81 % bootloader.append
@@ -117,8 +120,10 @@ class IsoImagePlugin(SourcePlugin):
117 grubefi_conf += "menuentry 'boot'{\n" 120 grubefi_conf += "menuentry 'boot'{\n"
118 121
119 kernel = get_bitbake_var("KERNEL_IMAGETYPE") 122 kernel = get_bitbake_var("KERNEL_IMAGETYPE")
120 if not kernel: 123 if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
121 kernel = "bzImage" 124 if get_bitbake_var("INITRAMFS_IMAGE"):
125 kernel = "%s-%s.bin" % \
126 (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
122 127
123 grubefi_conf += "linux /%s rootwait %s\n" \ 128 grubefi_conf += "linux /%s rootwait %s\n" \
124 % (kernel, bootloader.append) 129 % (kernel, bootloader.append)
@@ -273,8 +278,10 @@ class IsoImagePlugin(SourcePlugin):
273 os.remove("%s/initrd.cpio.gz" % cr_workdir) 278 os.remove("%s/initrd.cpio.gz" % cr_workdir)
274 279
275 kernel = get_bitbake_var("KERNEL_IMAGETYPE") 280 kernel = get_bitbake_var("KERNEL_IMAGETYPE")
276 if not kernel: 281 if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
277 kernel = "bzImage" 282 if get_bitbake_var("INITRAMFS_IMAGE"):
283 kernel = "%s-%s.bin" % \
284 (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
278 285
279 install_cmd = "install -m 0644 %s/%s %s/%s" % \ 286 install_cmd = "install -m 0644 %s/%s %s/%s" % \
280 (kernel_dir, kernel, isodir, kernel) 287 (kernel_dir, kernel, isodir, kernel)