[meta-xilinx] [meta-xilinx-bsp][PATCH v2 3/3] linux-xlnx.inc: Support simpleImage.mb support for MB

Nathan Rossi nathan at nathanrossi.com
Sun Jan 28 05:29:22 PST 2018


On 23 January 2018 at 10:55, Manjukumar Matha
<manjukumar.harthikote-matha at xilinx.com> wrote:
> Support simpleImage.mb for MB machines. simpleImage.mb depends on dts to
> be included while kernel is being compiled. This patch enables copying
> the dts from device-tree recipe to kernel work area so that
> simpleImage.mb can be built
>
> Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha at xilinx.com>
> ---
>  meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx.inc | 18 ++++++++++++++++++

This should be implemented in a kernel-simpleimage.bbclass, so that is
can be also used for linux-yocto and even contributed upstream (since
powerpc also supports simpleimage).

>  1 file changed, 18 insertions(+)
>
> diff --git a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx.inc b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx.inc
> index 7b4f9ac..e05890c 100644
> --- a/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx.inc
> +++ b/meta-xilinx-bsp/recipes-kernel/linux/linux-xlnx.inc
> @@ -23,6 +23,24 @@ do_kernel_metadata_prepend () {
>         [ -n "${KBUILD_DEFCONFIG}" ] && [ -e ${WORKDIR}/defconfig ] && rm ${WORKDIR}/defconfig
>  }
>
> +python __anonymous () {
> +   kerneltypes = d.getVar('KERNEL_IMAGETYPES') or ""

This should take KERNEL_IMAGETYPE into account as well, in case a user
only wants simpleImage and is using the KERNEL_IMAGETYPE variable
which should work.

Something like this gets a unique list to check against:

kerneltypes = set((d.getVar("KERNEL_IMAGETYPE") or "").strip())
kerneltypes |= set((d.getVar("KERNEL_IMAGETYPES") or "").split())

> +   if 'simpleImage.mb' in kerneltypes.split():

The simpleImage.<foo> targets can work for any dtb, this check can
instead something like:

if any(t.startswith("simpleImage.") for t in kerneltypes):
...

Though you will need to update the copying steps below to handle multiple dtbs.

> +      providerdtb = d.getVar("PREFERRED_PROVIDER_virtual/dtb") or ""
> +      if providerdtb:

Its not worth doing this check, since "" is a valid provider which is
used to automatically select based on available providers. And this
will force bitbake to fail if it cant find a provider which will list
possible options/etc, and most usefully why they were skipped.

> +         d.appendVarFlag('do_compile', 'depends', ' virtual/dtb:do_populate_sysroot')
> +      else:
> +         bb.error("For MB dts/dtb provider needs to be set")
> +}
> +
> +do_compile_prepend_microblaze () {
> +       if (echo "${KERNEL_IMAGETYPES}" | grep -wq "simpleImage.mb"); then

I would suggest doing this as a separate task that do_compile becomes
dependent on if simpleImage is enabled. That also means you can make
the separate task dependent on the virtual/dtb instead of do_compile.
Which might likely speed up some parallelism of tasks.

> +               install -d ${B}/arch/microblaze/boot/dts
> +               cp ${RECIPE_SYSROOT}/boot/devicetree/*.dts ${B}/arch/microblaze/boot/dts/mb.dts

It is possible to build the simpleImage targets without needing the
dts, populating the <dt>.dtb into the build/..boot/dts/ directory and
then calling the make simpleImage.<dt> target works as intended.

That also means you wont need the disassembled version of the dtb from
device-tree.bb (thus making that patch unnecessary). And prevents any
issues caused by rebuilding the dtb (e.g. differing pad size).

Regards,
Nathan


More information about the meta-xilinx mailing list