meta-freescale/classes/use-imx-headers.bbclass
Otavio Salvador 30f5ce1d21 Generalize overrides subsystem for NXP and Mainline support
Essentially, we extend the overrides to a generic-bsp, nxp-bsp, and
mainline-bsp.

So, for example, the mx8mq override is split into:

- imx-generic-bsp: compatible with every i.MX SoC and both BSP variants
- imx-nxp-bsp: compatible with every i.MX SoC but specific to NXP BSP
- imx-mainline-bsp: compatible with every i.MX SoC but specific to Mainline BSP

- mx8-generic-bsp: compatible with every i.MX8 SoC and both BSP variants
- mx8-nxp-bsp: compatible with every i.MX8 SoC but specific to NXP BSP
- mx8-mainline-bsp: compatible with every i.MX8 SoC but specific to Mainline BSP

- mx8m-generic-bsp: compatible with every i.MX8M SoC and both BSP variants
- mx8m-nxp-bsp: compatible with every i.MX8M SoC but specific to NXP BSP
- mx8m-mainline-bsp: compatible with every i.MX8M SoC but specific to Mainline BSP

- mx8mq-generic-bsp: compatible with every i.MX8MQ SoC and both BSP variants
- mx8mq-nxp-bsp: compatible with every i.MX8MQ SoC8 but specific to NXP BSP
- mx8mq-mainline-bsp: compatible with every i.MX8MQ SoC but specific to Mainline BSP

The extender mechanism is responsible for extending the override list to
include the generic overrides. We can then use the three different
variants to handle the metadata correctly.

Generically speaking, the conversion mainly was automated (with a lot of
back and forth until getting it right).

To convert an existing layer, the following script can be used:

```sh
  git ls-files classes recipes-* \
      | xargs sed -i \
              -e 's,:\(mx[6-8]\w*\),:\1-nxp-bsp,g' \
              -e 's,(\(mx[6-8]\w*\)),(\1-nxp-bsp),g' \
              -e 's,\(mx[6-8]\w*\)|,\1-nxp-bsp|,g' \
              -e 's,|\(mx[6-8]\w*\)),|\1-nxp-bsp),g' \
              \
              -e 's,:\(mx[5s]\w*\),:\1-generic-bsp,g' \
              -e 's,(\(mx[5s]\w*\)),(\1-generic-bsp),g' \
              -e 's,\(mx[5s]\w*\)|,\1-generic-bsp|,g' \
              -e 's,|\(mx[5s]\w*\)),|\1-generic-bsp),g' \
              \
              -e 's,:\(vf\w*\),:\1-generic-bsp,g' \
              -e 's,:\(vf[56]0\w*\),:\1-generic-bsp,g' \
              -e 's,\(vf\w*\)|,\1-generic-bsp|,g' \
              -e 's,|\(vf\w*\)),|\1-generic-bsp),g' \
              -e 's,\(vf[56]0\w*\)|,\1-generic-bsp|,g' \
              -e 's,|\(vf[56]0\w*\)),|\1-generic-bsp),g' \
              \
              -e 's,:\(imx\) ,:\1-nxp-bsp ,g' \
              -e 's,(\(imx\)),(\1-nxp-bsp),g' \
              -e 's,\(imx\)|,\1-nxp-bsp|,g' \
              -e 's,|\(imx\)),|\1-nxp-bsp),g'

  for d in $(find -type d | egrep '/mx[6-8]w*'); do
      git mv $d $d-nxp-bsp
  done

  for d in $(find -type d | egrep '/imx$'); do
      git mv $d $d-nxp-bsp
  done

  for d in $(find -type d | egrep '/mx[5s]w*'); do
      git mv $d $d-generic-bsp
  done
```

Fixes: #791.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
2022-02-21 20:06:28 -03:00

38 lines
1.5 KiB
Plaintext

# Easy use of linux-imx-headers by packages
#
# This allow to easy reuse of binary packages among similar SoCs. The
# usual use for this is to share SoC specific packages among different
# boards independently of the kernel version it is using, as far it is
# ABI compatible with the official version it will just work.
#
# All recipes using this class ought to depend on linux-imx-headers
# and by default to use MACHINE_SOCARCH.
#
# Please use the STAGING_INCDIR_IMX variable to refer to the installed
# headers.
#
# Copyright 2018 (C) O.S. Systems Software LTDA.
DEPENDS:append:imx-nxp-bsp = " linux-imx-headers"
# Set runtime dependency of -dev for package inheriting this class to
# linux-imx-headers-dev package. This is required in order to propagate
# headers into the SDK
RDEPENDS:${PN}-dev += "linux-imx-headers-dev"
PACKAGE_ARCH:imx-nxp-bsp ?= "${MACHINE_SOCARCH}"
STAGING_INCDIR_IMX = "${STAGING_INCDIR}/imx"
# Recipes that inherit this class are contracted to use NXP BSP only.
# This is done by overriding the COMPATIBLE_HOST, as this would effectively
# cause recipes to be skipped in case if 'use-nxp-bsp' override is not
# defined for them. This effectively marks recipes that should only be
# built using NXP BSP, and gives an indication to mainline BSP creators
# that recipe is not compatible with mainline.
#
# Typical example here would be imx-vpu-hantro recipe, which requires NXP
# BSP and is not compatible with mainline.
COMPATIBLE_HOST = '(null)'
COMPATIBLE_HOST:use-nxp-bsp = '.*'