[OE-core] [PATCH] wic: bootimg-efi: add label source parameter

Richard Purdie richard.purdie at linuxfoundation.org
Mon May 27 16:15:21 UTC 2019


On Mon, 2019-05-27 at 09:26 +0800, chee.yang.lee at intel.com wrote:
> From: Chee Yang Lee <chee.yang.lee at 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 at 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



More information about the Openembedded-core mailing list