Skip to contentSkip to conversation

kernel-metadata: KMETA_EXTERNAL_BSP(S), tree preparation, and scc semantics

DISCUSSION Dawid Bijak 1 participant 1 message May 1

lore
Share & tools
lore
#0 lore raw

Hi,

I have a few questions about "linux-yocto-style" kernel recipes and the kernel-metadata machinery.

I've read the advanced kernel-metadata documentation [0], the previous discussion at [1][2], and the patch that introduced "KMETA_EXTERNAL_BSP(S)" [3], but few things still aren't clear to me.

My current understanding of do_kernel_metadata() is:
1.

    The BSP description '.scc' is located with the (KMACHINE,LINUX_KERNEL_TYPE) tuple via 'spp --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE}'.

2.
In the default flow, that BSP definition is fed to 'scc' only for the config run. The patch run operates on '${sccs} ${patches} $KERNEL_FEATURES_FINAL' from 'SRC_URI' and explicitly omitting '$bsp_definition'. Any 'patch' directives reached from the BSP '.scc' are therefore skipped, on the assumption that those patches are already committed to the kernel branch being checked out (as is the case of the 'linux-yocto' git tree).
3.
Setting 'KMETA_EXTERNAL_BSPS = "t"' in the recipe, or 'define KMETA_EXTERNAL_BSP t' inside the BSP '.scc', add '${bsp_definition}' to '${sccs}' for the patch run, so that the BSP-referenced patches do get applied.

Assuming my understanding is correct, I have a couple of questions:

1.
Neither 'KMETA_EXTERNAL_BSP' / 'KMETA_EXTERNAL_BSPS' variable appears in [0] or in the variable glossary,
but both are part of the public contract of 'kernel-yocto.bbclass' to opt out of the "patches are pre-applied" assumption. Are they undocumented on purpose? Or would you accept a small docs patch adding them to the advanced kernel-metadata page or variable glossary?

2.
The Kernel Maintenance appendix mentions that 'kgit-scc' in 'yocto-kernel-tools' is what the yocto-team uses to construct the 'linux-yocto' git tree from 'yocto-kernel-cache', and that "the steps used to construct the full kernel tree are the same steps that BitBake uses."
For a downstream user with a vanilla kernel tree and a kernel-cache that defines a BSP, what's the recommended way to generate the equivalent branched tree (so the default, non-'KMETA_EXTERNAL_BSP' flow works)?
Is 'kgit-scc' intended to be invoked directly for this purpose, or is 'KMETA_EXTERNAL_BSP' the expected path? If you could point to a concrete kgit-scc invocation for this case, that would clear it up.

3.
Section 3.6 of [0] documents the the branch directive as "branch [ref] - creates a new branch relative to the current branch"

With 'KMETA_EXTERNAL_BSP' set, the 'patch' directives are applied as expected,
but the 'branch branchnaem' directive appears to have no effect - patches are applied on the existing branch rather than on a newly created 'branchname'. Am I misreading the intended semantics of 'branch' here?

Thanks, and again I'd be happy to turn whatever clarifications into doc patches.

Best regards,
Dawid

[0] https://docs.yoctoproject.org/kernel-dev/advanced.html
[1] https://lore.kernel.org/all/CA+4=imafR6ncjuC9UOgR3PBPS7MR7H5fo42vn0M9tk7=GSFUoA@mail.gmail.com/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/