diff mbox series

qemuboot.bbclass: Fix QB_DEFAULT_KERNEL expansion

Message ID 1738604640-31507-1-git-send-email-mark.hatle@kernel.crashing.org
State New
Headers show
Series qemuboot.bbclass: Fix QB_DEFAULT_KERNEL expansion | expand

Commit Message

Mark Hatle Feb. 3, 2025, 5:44 p.m. UTC
QB_DEFAULT_KERNEL was not being expanded unless INITRAMFS_LINK_NAME
was defined.  This only happens when building a kernel with an
integrated (bundled) initramfs.

Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
---
 meta/classes-recipe/qemuboot.bbclass | 3 +++
 1 file changed, 3 insertions(+)

Comments

Richard Purdie Feb. 3, 2025, 5:48 p.m. UTC | #1
On Mon, 2025-02-03 at 11:44 -0600, Mark Hatle via lists.openembedded.org wrote:
> QB_DEFAULT_KERNEL was not being expanded unless INITRAMFS_LINK_NAME
> was defined.  This only happens when building a kernel with an
> integrated (bundled) initramfs.
> 
> Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
> ---
>  meta/classes-recipe/qemuboot.bbclass | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/classes-recipe/qemuboot.bbclass b/meta/classes-recipe/qemuboot.bbclass
> index 0f80c60..ee71a2f 100644
> --- a/meta/classes-recipe/qemuboot.bbclass
> +++ b/meta/classes-recipe/qemuboot.bbclass
> @@ -96,6 +96,9 @@
>  QB_MEM ?= "-m 256"
>  QB_SMP ?= ""
>  QB_SERIAL_OPT ?= "-serial mon:stdio -serial null"
> +# Define INITRAMFS_LINK_NAME to ensure that QB_DEFAULT_KERNEL expands,
> +# even when INITRAMFS_LINK_NAME would not otherwise be defined.
> +INITRAMFS_LINK_NAME ??= ""
>  QB_DEFAULT_KERNEL ?= "${@bb.utils.contains("INITRAMFS_IMAGE_BUNDLE", "1", "${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin", "${KERNEL_IMAGETYPE}", d)}"
>  QB_DEFAULT_FSTYPE ?= "ext4"
>  QB_RNG ?= "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0"

Is the kernel really called ${KERNEL_IMAGETYPE}-.bin in that scenario?
That looks a bit odd :/

It feels like a situation we shouldn't be getting into in the first place somehow.

Cheers,

Richard
Mark Hatle Feb. 3, 2025, 5:51 p.m. UTC | #2
On 2/3/25 11:48 AM, Richard Purdie wrote:
> On Mon, 2025-02-03 at 11:44 -0600, Mark Hatle via lists.openembedded.org wrote:
>> QB_DEFAULT_KERNEL was not being expanded unless INITRAMFS_LINK_NAME
>> was defined.  This only happens when building a kernel with an
>> integrated (bundled) initramfs.
>>
>> Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
>> ---
>>   meta/classes-recipe/qemuboot.bbclass | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/meta/classes-recipe/qemuboot.bbclass b/meta/classes-recipe/qemuboot.bbclass
>> index 0f80c60..ee71a2f 100644
>> --- a/meta/classes-recipe/qemuboot.bbclass
>> +++ b/meta/classes-recipe/qemuboot.bbclass
>> @@ -96,6 +96,9 @@
>>   QB_MEM ?= "-m 256"
>>   QB_SMP ?= ""
>>   QB_SERIAL_OPT ?= "-serial mon:stdio -serial null"
>> +# Define INITRAMFS_LINK_NAME to ensure that QB_DEFAULT_KERNEL expands,
>> +# even when INITRAMFS_LINK_NAME would not otherwise be defined.
>> +INITRAMFS_LINK_NAME ??= ""
>>   QB_DEFAULT_KERNEL ?= "${@bb.utils.contains("INITRAMFS_IMAGE_BUNDLE", "1", "${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin", "${KERNEL_IMAGETYPE}", d)}"
>>   QB_DEFAULT_FSTYPE ?= "ext4"
>>   QB_RNG ?= "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0"
> 
> Is the kernel really called ${KERNEL_IMAGETYPE}-.bin in that scenario?
> That looks a bit odd :/

I assume the "kernel-artifact-names" (where this is defined) is set when 
building a bundled image with the kernel.

So if INITRAMFS_IMAGE_BUNDLE is 1, then kernel-artifacts-name should be set.  If 
it's NOT 1, then it will be built as a regular image recipe and 
INITRAMFS_LINK_NAME is not set, causing QB_DEFAULT_KERNEL to not expand.  (but 
the value should default to KERNEL_IMAGETYPE)

--Mark

> It feels like a situation we shouldn't be getting into in the first place somehow.
> 
> Cheers,
> 
> Richard
diff mbox series

Patch

diff --git a/meta/classes-recipe/qemuboot.bbclass b/meta/classes-recipe/qemuboot.bbclass
index 0f80c60..ee71a2f 100644
--- a/meta/classes-recipe/qemuboot.bbclass
+++ b/meta/classes-recipe/qemuboot.bbclass
@@ -96,6 +96,9 @@ 
 QB_MEM ?= "-m 256"
 QB_SMP ?= ""
 QB_SERIAL_OPT ?= "-serial mon:stdio -serial null"
+# Define INITRAMFS_LINK_NAME to ensure that QB_DEFAULT_KERNEL expands,
+# even when INITRAMFS_LINK_NAME would not otherwise be defined.
+INITRAMFS_LINK_NAME ??= ""
 QB_DEFAULT_KERNEL ?= "${@bb.utils.contains("INITRAMFS_IMAGE_BUNDLE", "1", "${KERNEL_IMAGETYPE}-${INITRAMFS_LINK_NAME}.bin", "${KERNEL_IMAGETYPE}", d)}"
 QB_DEFAULT_FSTYPE ?= "ext4"
 QB_RNG ?= "-object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0"