meta: Remove overrides from kernel filename selection

Message ID 20260528135624.3411792-1-amikan@ilbers.de
State New
Headers show
Series meta: Remove overrides from kernel filename selection | expand

Commit Message

Anton Mikanovich May 28, 2026, 1:56 p.m. UTC
Because of the override processing logic values set by overrides can be
changed only by overrides. It makes redifinition of KERNEL_FILE value
made by simple assignment be ignored, which was already broken for the
rpi-arm64-v8 machine.

Rebuild selection logic to be done in bitbake.conf without overrides.
Keep KERNEL_FILE redifinition for the rpi targets as an example of its
usage for the downstreams.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes-recipe/linux-kernel.bbclass | 3 ---
 meta/conf/bitbake.conf                   | 5 +----
 2 files changed, 1 insertion(+), 7 deletions(-)

Comments

MOESSBAUER, Felix May 28, 2026, 2:20 p.m. UTC | #1
On Thu, 2026-05-28 at 16:56 +0300, Anton Mikanovich wrote:
> Because of the override processing logic values set by overrides can be
> changed only by overrides. It makes redifinition of KERNEL_FILE value
> made by simple assignment be ignored, which was already broken for the
> rpi-arm64-v8 machine.
> 
> Rebuild selection logic to be done in bitbake.conf without overrides.
> Keep KERNEL_FILE redifinition for the rpi targets as an example of its
> usage for the downstreams.
> 
> Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta/classes-recipe/linux-kernel.bbclass | 3 ---
>  meta/conf/bitbake.conf                   | 5 +----
>  2 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/meta/classes-recipe/linux-kernel.bbclass b/meta/classes-recipe/linux-kernel.bbclass
> index 55ea6d63..e4ae356d 100644
> --- a/meta/classes-recipe/linux-kernel.bbclass
> +++ b/meta/classes-recipe/linux-kernel.bbclass
> @@ -211,9 +211,6 @@ def get_kernel_arch(d):
>  
>  KERNEL_ARCH ??= "${@get_kernel_arch(d)}"
>  
> -# set KERNEL_FILE without depending on package arch used in bitbake.conf
> -KERNEL_FILE:forcevariable = "${@ 'vmlinux' if d.getVar('KERNEL_ARCH') in ['mipsel', 'riscv', 'arm64'] else 'vmlinuz'}"

Shall we remove the forcevariable override as well? At least in isar
this was the last remaining user.

> -
>  KERNEL_CONFIG_FRAGMENTS ?= ""
>  
>  def config_fragments(d):
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 08c525d9..6db10eb3 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -65,10 +65,7 @@ SCHROOT_HOST_DIR = "${DEPLOY_DIR}/schroot-host/${HOST_DISTRO}-${HOST_ARCH}_${DIS
>  SCHROOT_TARGET_DIR = "${DEPLOY_DIR}/schroot-target/${DISTRO}-${DISTRO_ARCH}"
>  SDKCHROOT_DIR = "${DEPLOY_DIR_SDKCHROOT}/${BPN}-${DISTRO}-${MACHINE}"
>  CACHE = "${TMPDIR}/cache"
> -KERNEL_FILE ?= "vmlinuz"
> -KERNEL_FILE:mipsel ?= "vmlinux"
> -KERNEL_FILE:riscv64 ?= "vmlinux"
> -KERNEL_FILE:arm64 ?= "vmlinux"
> +KERNEL_FILE ?= "${@ 'vmlinux' if d.getVar('DISTRO_ARCH') in ['mipsel', 'riscv64', 'arm64'] else 'vmlinuz'}"

Thanks, that's how I envisioned it.

Felix

>  
>  MACHINEOVERRIDES ?= "${MACHINE}"
>  DISTROOVERRIDES ?= "${DISTRO}"
> -- 
> 2.34.1
Anton Mikanovich May 28, 2026, 2:23 p.m. UTC | #2
28.05.2026 17:20, MOESSBAUER, Felix wrote:
> On Thu, 2026-05-28 at 16:56 +0300, Anton Mikanovich wrote:
>> Because of the override processing logic values set by overrides can be
>> changed only by overrides. It makes redifinition of KERNEL_FILE value
>> made by simple assignment be ignored, which was already broken for the
>> rpi-arm64-v8 machine.
>>
>> Rebuild selection logic to be done in bitbake.conf without overrides.
>> Keep KERNEL_FILE redifinition for the rpi targets as an example of its
>> usage for the downstreams.
>>
>> Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
>> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
>> ---
>>   meta/classes-recipe/linux-kernel.bbclass | 3 ---
>>   meta/conf/bitbake.conf                   | 5 +----
>>   2 files changed, 1 insertion(+), 7 deletions(-)
>>
>> diff --git a/meta/classes-recipe/linux-kernel.bbclass b/meta/classes-recipe/linux-kernel.bbclass
>> index 55ea6d63..e4ae356d 100644
>> --- a/meta/classes-recipe/linux-kernel.bbclass
>> +++ b/meta/classes-recipe/linux-kernel.bbclass
>> @@ -211,9 +211,6 @@ def get_kernel_arch(d):
>>   
>>   KERNEL_ARCH ??= "${@get_kernel_arch(d)}"
>>   
>> -# set KERNEL_FILE without depending on package arch used in bitbake.conf
>> -KERNEL_FILE:forcevariable = "${@ 'vmlinux' if d.getVar('KERNEL_ARCH') in ['mipsel', 'riscv', 'arm64'] else 'vmlinuz'}"
> Shall we remove the forcevariable override as well? At least in isar
> this was the last remaining user.
It looks like something already existing when it's usage was added here.
That's why I didn't delete the override itself.
>
>> -
>>   KERNEL_CONFIG_FRAGMENTS ?= ""
>>   
>>   def config_fragments(d):
>> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
>> index 08c525d9..6db10eb3 100644
>> --- a/meta/conf/bitbake.conf
>> +++ b/meta/conf/bitbake.conf
>> @@ -65,10 +65,7 @@ SCHROOT_HOST_DIR = "${DEPLOY_DIR}/schroot-host/${HOST_DISTRO}-${HOST_ARCH}_${DIS
>>   SCHROOT_TARGET_DIR = "${DEPLOY_DIR}/schroot-target/${DISTRO}-${DISTRO_ARCH}"
>>   SDKCHROOT_DIR = "${DEPLOY_DIR_SDKCHROOT}/${BPN}-${DISTRO}-${MACHINE}"
>>   CACHE = "${TMPDIR}/cache"
>> -KERNEL_FILE ?= "vmlinuz"
>> -KERNEL_FILE:mipsel ?= "vmlinux"
>> -KERNEL_FILE:riscv64 ?= "vmlinux"
>> -KERNEL_FILE:arm64 ?= "vmlinux"
>> +KERNEL_FILE ?= "${@ 'vmlinux' if d.getVar('DISTRO_ARCH') in ['mipsel', 'riscv64', 'arm64'] else 'vmlinuz'}"
> Thanks, that's how I envisioned it.
>
> Felix
>
>>   
>>   MACHINEOVERRIDES ?= "${MACHINE}"
>>   DISTROOVERRIDES ?= "${DISTRO}"
>> -- 
>> 2.34.1

Patch

diff --git a/meta/classes-recipe/linux-kernel.bbclass b/meta/classes-recipe/linux-kernel.bbclass
index 55ea6d63..e4ae356d 100644
--- a/meta/classes-recipe/linux-kernel.bbclass
+++ b/meta/classes-recipe/linux-kernel.bbclass
@@ -211,9 +211,6 @@  def get_kernel_arch(d):
 
 KERNEL_ARCH ??= "${@get_kernel_arch(d)}"
 
-# set KERNEL_FILE without depending on package arch used in bitbake.conf
-KERNEL_FILE:forcevariable = "${@ 'vmlinux' if d.getVar('KERNEL_ARCH') in ['mipsel', 'riscv', 'arm64'] else 'vmlinuz'}"
-
 KERNEL_CONFIG_FRAGMENTS ?= ""
 
 def config_fragments(d):
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 08c525d9..6db10eb3 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -65,10 +65,7 @@  SCHROOT_HOST_DIR = "${DEPLOY_DIR}/schroot-host/${HOST_DISTRO}-${HOST_ARCH}_${DIS
 SCHROOT_TARGET_DIR = "${DEPLOY_DIR}/schroot-target/${DISTRO}-${DISTRO_ARCH}"
 SDKCHROOT_DIR = "${DEPLOY_DIR_SDKCHROOT}/${BPN}-${DISTRO}-${MACHINE}"
 CACHE = "${TMPDIR}/cache"
-KERNEL_FILE ?= "vmlinuz"
-KERNEL_FILE:mipsel ?= "vmlinux"
-KERNEL_FILE:riscv64 ?= "vmlinux"
-KERNEL_FILE:arm64 ?= "vmlinux"
+KERNEL_FILE ?= "${@ 'vmlinux' if d.getVar('DISTRO_ARCH') in ['mipsel', 'riscv64', 'arm64'] else 'vmlinuz'}"
 
 MACHINEOVERRIDES ?= "${MACHINE}"
 DISTROOVERRIDES ?= "${DISTRO}"