[2/2] wic: Set default WKS_FILE for non efi targets

Message ID 20241114134829.1466035-3-amikan@ilbers.de
State Accepted, archived
Headers show
Series Set reasonable defaults for WKS_FILE value | expand

Commit Message

Anton Mikanovich Nov. 14, 2024, 1:48 p.m. UTC
As riscv64 and mipsel are not supported by grub-efi set other default
WKS_FILE values for them.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 meta-isar/scripts/lib/wic/canned-wks/qemudefault.wks | 5 +++++
 meta/classes/imagetypes_wic.bbclass                  | 3 +++
 2 files changed, 8 insertions(+)
 create mode 100644 meta-isar/scripts/lib/wic/canned-wks/qemudefault.wks

Comments

Jan Kiszka Jan. 17, 2025, 1:05 p.m. UTC | #1
On 14.11.24 14:48, Anton Mikanovich wrote:
> As riscv64 and mipsel are not supported by grub-efi set other default
> WKS_FILE values for them.
> 
> Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
> ---
>  meta-isar/scripts/lib/wic/canned-wks/qemudefault.wks | 5 +++++
>  meta/classes/imagetypes_wic.bbclass                  | 3 +++
>  2 files changed, 8 insertions(+)
>  create mode 100644 meta-isar/scripts/lib/wic/canned-wks/qemudefault.wks
> 
> diff --git a/meta-isar/scripts/lib/wic/canned-wks/qemudefault.wks b/meta-isar/scripts/lib/wic/canned-wks/qemudefault.wks
> new file mode 100644
> index 00000000..02a9fdf2
> --- /dev/null
> +++ b/meta-isar/scripts/lib/wic/canned-wks/qemudefault.wks
> @@ -0,0 +1,5 @@
> +# short-description: Create qcow2 image for QEMU machines
> +
> +part / --source rootfs --fstype=ext4 --label root --align 4096 --size 4G
> +
> +bootloader
> diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass
> index 3b697cdd..0a8d4b4d 100644
> --- a/meta/classes/imagetypes_wic.bbclass
> +++ b/meta/classes/imagetypes_wic.bbclass
> @@ -8,6 +8,9 @@ USING_WIC = "${@bb.utils.contains('IMAGE_BASETYPES', 'wic', '1', '0', d)}"
>  WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if bb.utils.to_boolean(d.getVar('USING_WIC')) else ''}"
>  
>  WKS_FILE ??= "sdimage-efi"
> +# grub-efi is incompatible with targets riscv64 and mipsel
> +WKS_FILE:riscv64 ??= "qemuriscv"
> +WKS_FILE:mipsel ??= "qemudefault"

This part was wrong, breaking downstream layers: overrides win over
normal assignments. So,

WKS_FILE = "my-file"

will lose in the face of the above. Fixing...

Jan
Anton Mikanovich Jan. 17, 2025, 1:45 p.m. UTC | #2
17/01/2025 15:05, Jan Kiszka wrote:
> On 14.11.24 14:48, Anton Mikanovich wrote:
>> diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass
>> index 3b697cdd..0a8d4b4d 100644
>> --- a/meta/classes/imagetypes_wic.bbclass
>> +++ b/meta/classes/imagetypes_wic.bbclass
>> @@ -8,6 +8,9 @@ USING_WIC = "${@bb.utils.contains('IMAGE_BASETYPES', 'wic', '1', '0', d)}"
>>   WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if bb.utils.to_boolean(d.getVar('USING_WIC')) else ''}"
>>   
>>   WKS_FILE ??= "sdimage-efi"
>> +# grub-efi is incompatible with targets riscv64 and mipsel
>> +WKS_FILE:riscv64 ??= "qemuriscv"
>> +WKS_FILE:mipsel ??= "qemudefault"
> This part was wrong, breaking downstream layers: overrides win over
> normal assignments. So,
>
> WKS_FILE = "my-file"
>
> will lose in the face of the above. Fixing...
>
> Jan
>
Hello Jan,

Thanks for checking. This change was introduced as a hotfix for the 
installer
image creation of riscv64 and mipsel targets with no WKS_FILE provided in
machine config (to make it works just like any other arch). As this 
syntax is
wrong we need to find some other style for the fix.

Patch

diff --git a/meta-isar/scripts/lib/wic/canned-wks/qemudefault.wks b/meta-isar/scripts/lib/wic/canned-wks/qemudefault.wks
new file mode 100644
index 00000000..02a9fdf2
--- /dev/null
+++ b/meta-isar/scripts/lib/wic/canned-wks/qemudefault.wks
@@ -0,0 +1,5 @@ 
+# short-description: Create qcow2 image for QEMU machines
+
+part / --source rootfs --fstype=ext4 --label root --align 4096 --size 4G
+
+bootloader
diff --git a/meta/classes/imagetypes_wic.bbclass b/meta/classes/imagetypes_wic.bbclass
index 3b697cdd..0a8d4b4d 100644
--- a/meta/classes/imagetypes_wic.bbclass
+++ b/meta/classes/imagetypes_wic.bbclass
@@ -8,6 +8,9 @@  USING_WIC = "${@bb.utils.contains('IMAGE_BASETYPES', 'wic', '1', '0', d)}"
 WKS_FILE_CHECKSUM = "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if bb.utils.to_boolean(d.getVar('USING_WIC')) else ''}"
 
 WKS_FILE ??= "sdimage-efi"
+# grub-efi is incompatible with targets riscv64 and mipsel
+WKS_FILE:riscv64 ??= "qemuriscv"
+WKS_FILE:mipsel ??= "qemudefault"
 
 do_copy_wks_template[file-checksums] += "${WKS_FILE_CHECKSUM}"
 do_copy_wks_template[vardepsexclude] += "WKS_TEMPLATE_PATH"