[yocto] Kernel patches pulled from BSP definition file are not applied

Bruce Ashfield bruce.ashfield at gmail.com
Fri Oct 11 19:49:59 PDT 2019


On Fri, Oct 11, 2019 at 1:11 PM Diego Santa Cruz
<Diego.SantaCruz at spinetix.com> wrote:
>
> Hi,
>
>
>
> I have not received any feedback on the below email and I am not sure I am doing the right thing.
>
>
>
> Can anyone provide some advice as to what would be the recommended way to apply kernel patches listed in a mybsp-patches.scc file for a BSP?
>

The way to do this, is to put your BSP definition file on the SRC_URI,
and if you are including the standard/ktype or any of the other common
kernel meta data files, you need to inhibit any included meta data
from adding patches to the patch queue (since they are already applied
to the kernel).

As an example, here's a 'myqemux86-64.scc' file that I use as a test:

---------------
define KMACHINE myqemux86-64
define KARCH x86
define KTYPE standard

include ktypes/standard.scc nopatch

patch foo.patch
-------------

When that is on the SRC_URI, it will be found as the BSP definition,
and you'll get "foo.patch" in the patch queue .. but importantly *not*
all of the patches that make up the ktypes/standard.scc (and
includes). If you aren't using linux-yocto, or you aren't building on
top of a kernel repository with integrated patches, then don't add the
'nopatch', since you'd want any found patches to be applied at build
time.

I thought we had documented the nopatch directive in the yocto mega
manual, but I just checked the kernel meta data section and I don't
see it. I'll follow up and try to figure out where that documentation
went ... and get it added if it is missing.

Out of curiosity, how were you getting your BSP definition to be
located by the do_metadata function (there are a few different ways) ?
(since you need at least one .scc file or kernel-meta structure on the
SRC_URI to get it added to the search path).  If you were adding it to
the SRC_URI directly and the patches weren't being applied, then
that's a bug.

A short description of what is happening behind the scenes. The kernel
meta-data is used in two ways: to construct a new kernel repo from
scratch (i.e. when I start a new reference kernel version, or when
building on top of a non integrated repository) and to construct a
configuration for the kernel. Patches and config data are kept
together, so everything you need for a feature is in one place. When
you are building, the meta data gathering routine is running in that
2nd mode. Hence why the BSP definition is not used for patching, but
is only used to generate the configuration queue. Only elements on the
SRC_URI are always added to the patch queue .. since those patches are
not already applied to the base repo (and if they are, you shouldn't
have them on the SRC_URI and you'll get a patch error) .. There's even
a longer winded explanation about how the original build processing
attempted to detected which patches weren't already applied ... and
was horribly complex and fragile, hence why the simpler/split
processing I described is used.

Let me know if that tweak doesn't work (and if you can, supply your
BSP definition / layer) .. since there may be a bug (see my comment on
what you had on your SRC_URI above and how your bsp definition was
being located).

Cheers,

Bruce

>
>
> Adding the “mybsp-patches.scc” file to KERNEL_FEATURES works for me, but seems a bit awkward given that there is a BSP definition scc file. It feels more natural to include the mybsp-patches.scc from the BSP definition scc file, but  that does not work for me, the patches are ignored.
>
>
>
> Thanks,
>
>
>
> Diego
>
> --
> Diego Santa Cruz, PhD
> Technology Architect
> T +41 21 341 15 50
> diego.santacruz at spinetix.com
> spinetix.com
>
>
>
> From: yocto-bounces at yoctoproject.org <yocto-bounces at yoctoproject.org> On Behalf Of Diego Santa Cruz
> Sent: 09 October 2019 23:58
> To: yocto at yoctoproject.org
> Subject: [yocto] Kernel patches pulled from BSP definition file are not applied
>
>
>
> Hello there,
>
>
>
> I am trying to add a few BSP specific kernel patches for my BSP and I wanted to pull them from the BSP definition scc file. However, I cannot get those patches applied (I am using thud). After looking around the kernel-yocto.bbclass it seems that patches which get pulled from the BSP definition file are ignored. What is the rationale behind that behavior? How should I go about it?
>
>
>
> To be more specific I have the following structure within my (recipe-space) kernel metadata.
>
>
>
> bsp
>
> `-- mybsp
>
>     |-- mypatch.patch
>
>     |-- mybsp.cfg
>
>     |-- msbsp.scc
>
>     `-- mybsp-standard.scc
>
>
>
> The mybsp-standard.scc is the BSP definition file, which includes mybsp.scc (among other things). The mybsp.scc file looks as follows
>
>
>
> kconf hardware mybsp.cfg
>
> patch mypatch.patch
>
>
>
> The mypatch.patch file does not get applied when building the kernel, I checked and it is not added to the patch.queue file. But if I add the following to the recipe
>
>
>
> KERNEL_FEATURES += " bsp/mybsp/mybsp.scc"
>
>
>
> Then the patch is added to patch.queue and is applied.
>
>
>
> Looking into do_kernel_metadata in kernel-yocto.bbclass it parses the scc files in two steps, run1 and run2.
>
>
>
> The run1 step uses elements="`echo -n ${bsp_definition} ${sccs} ${patches} ${KERNEL_FEATURES}`" and generates cfg, merge and meta, so that picks up the mybsp.scc file contents, but this step does not generate the patch queue.
>
>
>
> The run2 step uses elements="`echo -n ${sccs} ${patches} ${KERNEL_FEATURES}`" and generates the patch queue, but this only includes the scc files in SRC_URI and KERNEL_FEATURES, but specifically leaves out the BSP definition file.
>
>
>
> Adding the mybsp.scc file to KERNEL_FEATURES to get this to work seems a bit odd. What is the recommended way of applying BSP specific kernel patches?
>
>
>
> Thanks,
>
>
>
> Diego
>
> --
> Diego Santa Cruz, PhD
> Technology Architect
> spinetix.com
>
>
>
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


More information about the yocto mailing list