* [PATCH] wic/plugins: kernel image refer to KERNEL_IMAGETYPE
@ 2019-06-11 6:31 chee.yang.lee
2019-06-11 13:20 ` Tom Rini
2019-06-11 18:41 ` Andre McCurdy
0 siblings, 2 replies; 3+ messages in thread
From: chee.yang.lee @ 2019-06-11 6:31 UTC (permalink / raw)
To: openembedded-core
From: Chee Yang Lee <chee.yang.lee@intel.com>
replaced hardcoded kernel image with KERNEL_IMAGETYPE.
set kernel image to "bzImage" incase KERNEL_IMAGETYPE not set.
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
---
scripts/lib/wic/plugins/source/bootimg-efi.py | 21 +++++++++++++++------
scripts/lib/wic/plugins/source/bootimg-pcbios.py | 8 ++++++--
.../lib/wic/plugins/source/isoimage-isohybrid.py | 21 ++++++++++++++-------
3 files changed, 35 insertions(+), 15 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 70cc1b0..d87db1f 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -71,14 +71,16 @@ class BootimgEFIPlugin(SourcePlugin):
grubefi_conf += "timeout=%s\n" % bootloader.timeout
grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot")
- kernel = "/bzImage"
+ kernel = get_bitbake_var("KERNEL_IMAGETYPE")
+ if not kernel:
+ kernel = "bzImage"
label = source_params.get('label')
label_conf = "root=%s" % creator.rootdev
if label:
label_conf = "LABEL=%s" % label
- grubefi_conf += "linux %s %s rootwait %s\n" \
+ grubefi_conf += "linux /%s %s rootwait %s\n" \
% (kernel, label_conf, bootloader.append)
if initrd:
@@ -143,12 +145,15 @@ class BootimgEFIPlugin(SourcePlugin):
if not custom_cfg:
# Create systemd-boot configuration using parameters from wks file
- kernel = "/bzImage"
+ kernel = get_bitbake_var("KERNEL_IMAGETYPE")
+ if not kernel:
+ kernel = "bzImage"
+
title = source_params.get('title')
boot_conf = ""
boot_conf += "title %s\n" % (title if title else "boot")
- boot_conf += "linux %s\n" % kernel
+ boot_conf += "linux /%s\n" % kernel
label = source_params.get('label')
label_conf = "LABEL=Boot root=%s" % creator.rootdev
@@ -209,8 +214,12 @@ class BootimgEFIPlugin(SourcePlugin):
hdddir = "%s/hdd/boot" % cr_workdir
- install_cmd = "install -m 0644 %s/bzImage %s/bzImage" % \
- (staging_kernel_dir, hdddir)
+ kernel = get_bitbake_var("KERNEL_IMAGETYPE")
+ if not kernel:
+ kernel = "bzImage"
+
+ install_cmd = "install -m 0644 %s/%s %s/%s" % \
+ (staging_kernel_dir, kernel, hdddir, kernel)
exec_cmd(install_cmd)
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 6c9f54a..670d347 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -149,8 +149,12 @@ class BootimgPcbiosPlugin(SourcePlugin):
hdddir = "%s/hdd/boot" % cr_workdir
- cmds = ("install -m 0644 %s/bzImage %s/vmlinuz" %
- (staging_kernel_dir, hdddir),
+ kernel = get_bitbake_var("KERNEL_IMAGETYPE")
+ if not kernel:
+ kernel = "bzImage"
+
+ cmds = ("install -m 0644 %s/%s %s/vmlinuz" %
+ (staging_kernel_dir, kernel, hdddir),
"install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" %
(bootimg_dir, hdddir),
"install -m 0644 %s/syslinux/vesamenu.c32 %s/vesamenu.c32" %
diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
index 96d07ff..74d6f14 100644
--- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
+++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
@@ -70,8 +70,10 @@ class IsoImagePlugin(SourcePlugin):
syslinux_conf += "DEFAULT boot\n"
syslinux_conf += "LABEL boot\n"
- kernel = "/bzImage"
- syslinux_conf += "KERNEL " + kernel + "\n"
+ kernel = get_bitbake_var("KERNEL_IMAGETYPE")
+ if not kernel:
+ kernel = "bzImage"
+ syslinux_conf += "KERNEL /" + kernel + "\n"
syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" \
% bootloader.append
@@ -114,9 +116,11 @@ class IsoImagePlugin(SourcePlugin):
grubefi_conf += "\n"
grubefi_conf += "menuentry 'boot'{\n"
- kernel = "/bzImage"
+ kernel = get_bitbake_var("KERNEL_IMAGETYPE")
+ if not kernel:
+ kernel = "bzImage"
- grubefi_conf += "linux %s rootwait %s\n" \
+ grubefi_conf += "linux /%s rootwait %s\n" \
% (kernel, bootloader.append)
grubefi_conf += "initrd /initrd \n"
grubefi_conf += "}\n"
@@ -268,9 +272,12 @@ class IsoImagePlugin(SourcePlugin):
if os.path.isfile("%s/initrd.cpio.gz" % cr_workdir):
os.remove("%s/initrd.cpio.gz" % cr_workdir)
- # Install bzImage
- install_cmd = "install -m 0644 %s/bzImage %s/bzImage" % \
- (kernel_dir, isodir)
+ kernel = get_bitbake_var("KERNEL_IMAGETYPE")
+ if not kernel:
+ kernel = "bzImage"
+
+ install_cmd = "install -m 0644 %s/%s %s/%s" % \
+ (kernel_dir, kernel, isodir, kernel)
exec_cmd(install_cmd)
#Create bootloader for efi boot
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] wic/plugins: kernel image refer to KERNEL_IMAGETYPE
2019-06-11 6:31 [PATCH] wic/plugins: kernel image refer to KERNEL_IMAGETYPE chee.yang.lee
@ 2019-06-11 13:20 ` Tom Rini
2019-06-11 18:41 ` Andre McCurdy
1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2019-06-11 13:20 UTC (permalink / raw)
To: chee.yang.lee; +Cc: openembedded-core
On Tue, Jun 11, 2019 at 02:31:37PM +0800, chee.yang.lee@intel.com wrote:
> From: Chee Yang Lee <chee.yang.lee@intel.com>
>
> replaced hardcoded kernel image with KERNEL_IMAGETYPE.
> set kernel image to "bzImage" incase KERNEL_IMAGETYPE not set.
>
> Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
I could see this being useful down the line (if not now..) for UEFI
images, but aarch64, so a good idea.
Reviewed-by: Tom Rini <trini@konsulko.com>
--
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] wic/plugins: kernel image refer to KERNEL_IMAGETYPE
2019-06-11 6:31 [PATCH] wic/plugins: kernel image refer to KERNEL_IMAGETYPE chee.yang.lee
2019-06-11 13:20 ` Tom Rini
@ 2019-06-11 18:41 ` Andre McCurdy
1 sibling, 0 replies; 3+ messages in thread
From: Andre McCurdy @ 2019-06-11 18:41 UTC (permalink / raw)
To: chee.yang.lee; +Cc: OE Core mailing list
On Mon, Jun 10, 2019 at 11:31 PM <chee.yang.lee@intel.com> wrote:
> From: Chee Yang Lee <chee.yang.lee@intel.com>
>
> replaced hardcoded kernel image with KERNEL_IMAGETYPE.
> set kernel image to "bzImage" incase KERNEL_IMAGETYPE not set.
A default value for KERNEL_IMAGETYPE is set by default-distrovars.inc,
so if it's not set here then something is mis-configured. Better to
exit with an error in that case rather than try to carry on.
> Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
> ---
> scripts/lib/wic/plugins/source/bootimg-efi.py | 21 +++++++++++++++------
> scripts/lib/wic/plugins/source/bootimg-pcbios.py | 8 ++++++--
> .../lib/wic/plugins/source/isoimage-isohybrid.py | 21 ++++++++++++++-------
> 3 files changed, 35 insertions(+), 15 deletions(-)
>
> diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
> index 70cc1b0..d87db1f 100644
> --- a/scripts/lib/wic/plugins/source/bootimg-efi.py
> +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
> @@ -71,14 +71,16 @@ class BootimgEFIPlugin(SourcePlugin):
> grubefi_conf += "timeout=%s\n" % bootloader.timeout
> grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot")
>
> - kernel = "/bzImage"
> + kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> + if not kernel:
> + kernel = "bzImage"
>
> label = source_params.get('label')
> label_conf = "root=%s" % creator.rootdev
> if label:
> label_conf = "LABEL=%s" % label
>
> - grubefi_conf += "linux %s %s rootwait %s\n" \
> + grubefi_conf += "linux /%s %s rootwait %s\n" \
> % (kernel, label_conf, bootloader.append)
>
> if initrd:
> @@ -143,12 +145,15 @@ class BootimgEFIPlugin(SourcePlugin):
>
> if not custom_cfg:
> # Create systemd-boot configuration using parameters from wks file
> - kernel = "/bzImage"
> + kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> + if not kernel:
> + kernel = "bzImage"
> +
> title = source_params.get('title')
>
> boot_conf = ""
> boot_conf += "title %s\n" % (title if title else "boot")
> - boot_conf += "linux %s\n" % kernel
> + boot_conf += "linux /%s\n" % kernel
>
> label = source_params.get('label')
> label_conf = "LABEL=Boot root=%s" % creator.rootdev
> @@ -209,8 +214,12 @@ class BootimgEFIPlugin(SourcePlugin):
>
> hdddir = "%s/hdd/boot" % cr_workdir
>
> - install_cmd = "install -m 0644 %s/bzImage %s/bzImage" % \
> - (staging_kernel_dir, hdddir)
> + kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> + if not kernel:
> + kernel = "bzImage"
> +
> + install_cmd = "install -m 0644 %s/%s %s/%s" % \
> + (staging_kernel_dir, kernel, hdddir, kernel)
> exec_cmd(install_cmd)
>
>
> diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
> index 6c9f54a..670d347 100644
> --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
> +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
> @@ -149,8 +149,12 @@ class BootimgPcbiosPlugin(SourcePlugin):
>
> hdddir = "%s/hdd/boot" % cr_workdir
>
> - cmds = ("install -m 0644 %s/bzImage %s/vmlinuz" %
> - (staging_kernel_dir, hdddir),
> + kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> + if not kernel:
> + kernel = "bzImage"
> +
> + cmds = ("install -m 0644 %s/%s %s/vmlinuz" %
> + (staging_kernel_dir, kernel, hdddir),
> "install -m 444 %s/syslinux/ldlinux.sys %s/ldlinux.sys" %
> (bootimg_dir, hdddir),
> "install -m 0644 %s/syslinux/vesamenu.c32 %s/vesamenu.c32" %
> diff --git a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> index 96d07ff..74d6f14 100644
> --- a/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> +++ b/scripts/lib/wic/plugins/source/isoimage-isohybrid.py
> @@ -70,8 +70,10 @@ class IsoImagePlugin(SourcePlugin):
> syslinux_conf += "DEFAULT boot\n"
> syslinux_conf += "LABEL boot\n"
>
> - kernel = "/bzImage"
> - syslinux_conf += "KERNEL " + kernel + "\n"
> + kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> + if not kernel:
> + kernel = "bzImage"
> + syslinux_conf += "KERNEL /" + kernel + "\n"
> syslinux_conf += "APPEND initrd=/initrd LABEL=boot %s\n" \
> % bootloader.append
>
> @@ -114,9 +116,11 @@ class IsoImagePlugin(SourcePlugin):
> grubefi_conf += "\n"
> grubefi_conf += "menuentry 'boot'{\n"
>
> - kernel = "/bzImage"
> + kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> + if not kernel:
> + kernel = "bzImage"
>
> - grubefi_conf += "linux %s rootwait %s\n" \
> + grubefi_conf += "linux /%s rootwait %s\n" \
> % (kernel, bootloader.append)
> grubefi_conf += "initrd /initrd \n"
> grubefi_conf += "}\n"
> @@ -268,9 +272,12 @@ class IsoImagePlugin(SourcePlugin):
> if os.path.isfile("%s/initrd.cpio.gz" % cr_workdir):
> os.remove("%s/initrd.cpio.gz" % cr_workdir)
>
> - # Install bzImage
> - install_cmd = "install -m 0644 %s/bzImage %s/bzImage" % \
> - (kernel_dir, isodir)
> + kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> + if not kernel:
> + kernel = "bzImage"
> +
> + install_cmd = "install -m 0644 %s/%s %s/%s" % \
> + (kernel_dir, kernel, isodir, kernel)
> exec_cmd(install_cmd)
>
> #Create bootloader for efi boot
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-11 18:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-11 6:31 [PATCH] wic/plugins: kernel image refer to KERNEL_IMAGETYPE chee.yang.lee
2019-06-11 13:20 ` Tom Rini
2019-06-11 18:41 ` Andre McCurdy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox