Issues with kernel.bbclass default "S" value
Hello Bruce,
Quoted 44 lines · On Fri, 19 May 2023 09:24:21 +0200 "Luca Ceresoli via lists.openembedded.org"…
Hello,
I have been facing some troubles while writing a very simple recipe inheriting kernel.bbclass to build a mainline kernel.
The error message is:
...
do_populate_lic: QA Issue: ...LIC_FILES_CHKSUMpoints to an invalid file: .../work-shared/.../kernel-source/COPYING [license-checksum]After my investigation, this turned out to happen when not setting S in the recipe, which results in an empty work-shared/.../kernel-source directory.
If S in not set in the recipe, kernel.bbclass sets it to ${STAGING_KERNEL_DIR} (${TMPDIR}/work-shared/${MACHINE}/kernel-source). This means that in
do_symlink_kernsrc(), the 'if s != kernsrc' never triggers. By reading the code under that if, it appears to assume thatSTAGING_KERNEL_DIRsomehow contains the kernel sources already, however I haven't found any code that is supposed to unpack it there. Also, in all my tests with S not set in the recipe I had the kernel expanded inside the WORKDIR, never inSTAGING_KERNEL_DIR.I have considered two use cases:
* When fetching from git, setting S is mandatory, thus one shouldn't expect things to work without setting it. However the error message is totally misleading
* When fetching a tarball and without setting S, the same misleading error message appears. However not setting S is totally normal for regular recipes fetching a tarball, thus it's hard to blame the recipe developer for not setting S. It would be even more nice to produce an explanatory error message such as "Please set S when using kernel.bbclass".
However I am most likely missing other relevant use cases.
I started writing a patch to add such an error message, but I soon realized that writing the most appropriate 'if' to trigger the message would require me to understand something:
* In which use cases does it make sense to have S ==
STAGING_KERNEL_DIR?
Quoted 8 lines
* How is the kernel expected to be unpacked in
STAGING_KERNEL_DIRwhen S ==STAGING_KERNEL_DIR?Another, related question: are non-core layers expected to set
STAGING_KERNEL_DIR? My understanding is that it is set in kernel.bbclass (and a few other oe-core classes) for others to read, never to be modified elsewhere. The ref manual is vague about this, I'd be glad to clarify it.
Do you have an opinion about these question?
Best regards,
Luca
Signature · 3 lines
Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com