Skip to contentSkip to conversation

kernel-yocto, devtool-source.bbclass: fix 'devtool modify' for kernels

PATCH [email protected] 2 participants 4 messages Oct 18, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 18 lines

From: Chris Laplante <[email protected]>

Fixes a couple of different issues that all conspired to break 'devtool modify' for many use cases with kernel-yocto recipes.

To explain, we need to consider the basic flow of how 'devtool modify' works for a recipe using kernel-yocto.bbclass:

     ┌──────────────────┐
     │do_kernel_checkout│
     ├──────────────────┘
     │ Sets up ${S}
     │ devtool_post_unpack: sets up 'devtool' branch
     ▼
     ┌────────────────────┐
     │do_validate_branches│
     ├────────────────────┘
     │ Checks out the machine branch (derived from ${KBRANCH}) and performs
Quoted 12 lines

validation
▼
┌──────────────────┐
│do_kernel_metadata│
├──────────────────┘
│ Generates the config and patch series.
│
▼
┌────────┐
│do_patch│
└────────┘
Applies patches from patch series.

Ugh, actually this needs more work. If a recipe sets KBUILD_DEFCONFIG based on MACHINE overrides, then the no-override case will explode when we call 'kernel_pre_patch(localdata)'. Since in that case, KBUILD_DEFCONFIG will be unset.

If anyone has ideas I'm all ears.

Thanks,
Chris

#2 lore raw
Quoted 4 lines

Ugh, actually this needs more work. If a recipe sets KBUILD_DEFCONFIG based on MACHINE overrides, then the no-override case will explode when we call 'kernel_pre_patch(localdata)'. Since in that case, KBUILD_DEFCONFIG will be unset.

Actually, this approach is problematic in general because calling do_kernel_metadata with the overrides changed isn't enough - we'd also have to change MACHINE. E.g.:

machine-a.conf:
KBUILD_DEFCONFIG:machine-a = "<blah>"

machine-b.conf:
KBUILD_DEFCONFIG:machine-b = "<blah 2>"

kernel-recipe.bb:
SRC_URI = "<kernel src>" SRC_URI:append:machine-a = " <patches>" SRC_URI:append:machine-b = " <different patches>"

Assuming MACHINE=machine-a in local.conf, then 'devtool modify <kernel-recipe>' will fail to setup kernel metadata for 'machine-b'.

Is setting up MACHINE too invasive? Or do we come up with a way of only setting up override branches for overrides that are valid for the given local.conf? I lean towards the latter approach for simplicity.

Thanks,
Chris

#3 lore raw
Quoted 20 lines · On Wed, Oct 18, 2023 at 1:49 PM [email protected]…
Quoted 5 lines

Ugh, actually this needs more work. If a recipe sets KBUILD_DEFCONFIG based on MACHINE overrides, then the no-override case will explode when we call 'kernel_pre_patch(localdata)'. Since in that case, KBUILD_DEFCONFIG will be unset.

Actually, this approach is problematic in general because calling do_kernel_metadata with the overrides changed isn't enough - we'd also have to change MACHINE. E.g.:

machine-a.conf:
KBUILD_DEFCONFIG:machine-a = "<blah>"

machine-b.conf:
KBUILD_DEFCONFIG:machine-b = "<blah 2>"

kernel-recipe.bb:
SRC_URI = "<kernel src>" SRC_URI:append:machine-a = " <patches>" SRC_URI:append:machine-b = " <different patches>"

Quoted 4 lines

Assuming MACHINE=machine-a in local.conf, then 'devtool modify <kernel-recipe>' will fail to setup kernel metadata for 'machine-b'.

Is setting up MACHINE too invasive? Or do we come up with a way of only setting up override branches for overrides that are valid for the given local.conf? I lean towards the latter approach for simplicity.

I admit to not using devtool, and not following much of what has been going on in the series.

But unless we are changing the machine for other devtool modify workflows, I wouldn't' see why we'd want to do that in the kernel either.

Any type of valid override should work, as long as you get all the required variables setup for that override.

To the error you mentioned in the original email, what exactly is blowing up ? KBUILD_DEFCONFIG is completely optional, and not used in most builds, so the empty / unset case shouldn't have any issues.

Bruce

Quoted 2 lines

Thanks,
Chris

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#4 lore raw

Hi Bruce,

Quoted 11 lines
Quoted 1 line

Is setting up MACHINE too invasive? Or do we come up with a way of only

setting up override branches for overrides that are valid for the given local.conf? I lean towards the latter approach for simplicity.

Quoted 1 line

I admit to not using devtool, and not following much of what has been going on in the series.

But unless we are changing the machine for other devtool modify workflows, I wouldn't' see why we'd want to do that in the kernel either.

Quoted 6 lines

Any type of valid override should work, as long as you get all the required variables setup for that override.

To the error you mentioned in the original email, what exactly is blowing up ? KBUILD_DEFCONFIG is completely optional, and not used in most builds, so the empty / unset case shouldn't have any issues.

This is specifically for the case of in-tree defconfig, in which case KBUILD_DEFCONFIG is required. I'm working with meta-xilinx which AFAIK uses this exclusively for its kernel (https://github.com/Xilinx/meta-xilinx/blob/1a2cb511ff20c9de24e973df3b556febb9659df4/meta-xilinx-core/recipes-kernel/linux/linux-xlnx.inc#L30).

I guess the workaround for now is to switch to using a out-of-tree defconfig.

We are not setting MACHINE for other 'devtool modify' workflows, which makes me hesitant to add it here.

Thanks,
Chris