* [PATCH] wic: bootimg-efi: add label source parameter
@ 2019-05-27 1:26 chee.yang.lee
2019-05-27 16:15 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: chee.yang.lee @ 2019-05-27 1:26 UTC (permalink / raw)
To: openembedded-core
From: Chee Yang Lee <chee.yang.lee@intel.com>
Add new source parameter label to allow boot.conf/grub.cfg label option
to set as "install-efi", so far it's hardcoded to "Boot".
The label remain to "Boot" for systemd-boot or blank for grub-efi whenever
label are not "install-efi".
when label set to "install-efi" the image can boot into image installation.
Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
---
scripts/lib/wic/plugins/source/bootimg-efi.py | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
index 652323f..9b324d3 100644
--- a/scripts/lib/wic/plugins/source/bootimg-efi.py
+++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
@@ -72,9 +72,14 @@ class BootimgEFIPlugin(SourcePlugin):
grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot")
kernel = "/bzImage"
+ label = source_params.get('label')
- grubefi_conf += "linux %s root=%s rootwait %s\n" \
- % (kernel, creator.rootdev, bootloader.append)
+ if label == "install-efi":
+ grubefi_conf += "linux %s LABEL=%s rootwait %s\n" \
+ % (kernel, label, bootloader.append)
+ else:
+ grubefi_conf += "linux %s root=%s rootwait %s\n" \
+ % (kernel, creator.rootdev, bootloader.append)
if initrd:
grubefi_conf += "initrd /%s\n" % initrd
@@ -140,12 +145,17 @@ class BootimgEFIPlugin(SourcePlugin):
# Create systemd-boot configuration using parameters from wks file
kernel = "/bzImage"
title = source_params.get('title')
-
+ label = source_params.get('label')
boot_conf = ""
boot_conf += "title %s\n" % (title if title else "boot")
boot_conf += "linux %s\n" % kernel
- boot_conf += "options LABEL=Boot root=%s %s\n" % \
- (creator.rootdev, bootloader.append)
+
+ if label == "install-efi":
+ boot_conf += "options LABEL=%s %s\n" % \
+ (label, bootloader.append)
+ else:
+ boot_conf += "options LABEL=Boot root=%s %s\n" % \
+ (creator.rootdev, bootloader.append)
if initrd:
boot_conf += "initrd /%s\n" % initrd
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wic: bootimg-efi: add label source parameter
2019-05-27 1:26 [PATCH] wic: bootimg-efi: add label source parameter chee.yang.lee
@ 2019-05-27 16:15 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2019-05-27 16:15 UTC (permalink / raw)
To: chee.yang.lee, openembedded-core
On Mon, 2019-05-27 at 09:26 +0800, chee.yang.lee@intel.com wrote:
> From: Chee Yang Lee <chee.yang.lee@intel.com>
>
> Add new source parameter label to allow boot.conf/grub.cfg label option
> to set as "install-efi", so far it's hardcoded to "Boot".
>
> The label remain to "Boot" for systemd-boot or blank for grub-efi whenever
> label are not "install-efi".
>
> when label set to "install-efi" the image can boot into image installation.
>
> Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
> ---
> scripts/lib/wic/plugins/source/bootimg-efi.py | 20 +++++++++++++++-----
> 1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py
> index 652323f..9b324d3 100644
> --- a/scripts/lib/wic/plugins/source/bootimg-efi.py
> +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py
> @@ -72,9 +72,14 @@ class BootimgEFIPlugin(SourcePlugin):
> grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot")
>
> kernel = "/bzImage"
> + label = source_params.get('label')
>
> - grubefi_conf += "linux %s root=%s rootwait %s\n" \
> - % (kernel, creator.rootdev, bootloader.append)
> + if label == "install-efi":
> + grubefi_conf += "linux %s LABEL=%s rootwait %s\n" \
> + % (kernel, label, bootloader.append)
> + else:
> + grubefi_conf += "linux %s root=%s rootwait %s\n" \
> + % (kernel, creator.rootdev, bootloader.append)
I could be missing something as I don't know the wider code but
wouldn't it make more sense to have:
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" \
% (kernel, label_conf,
bootloader.append)
Which would then allow custom labels rather than a special case magic
value? (and also reduce code duplication)
Cheers,
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-27 16:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27 1:26 [PATCH] wic: bootimg-efi: add label source parameter chee.yang.lee
2019-05-27 16:15 ` Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.