summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2022-03-02 20:21:54 -0300
committerOtavio Salvador <otavio@ossystems.com.br>2022-03-03 10:41:35 -0300
commitbfa2a3b98dde2a664615fe4a2527fd89b0c8dfbe (patch)
tree3609de3cd02c929e329f875cf42d433e3be6febb
parent286385e3b2b6d6b4c60faf14fd3170ec2279139e (diff)
downloadmeta-freescale-bfa2a3b98dde2a664615fe4a2527fd89b0c8dfbe.tar.gz
Ensure we fail if old SoC overrides are in usetopic/warn-old-overrides
To assist existing layers to convert to the new BSP-specific overrides. Besides failing the parsing of the recipes where it is in use, we provide a script to automate most of it. Fixes: #990. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
-rw-r--r--classes/machine-overrides-extender.bbclass19
-rw-r--r--conf/machine/include/imx-base.inc2
-rwxr-xr-xscripts/convert-bsp-specific-overrides87
3 files changed, 108 insertions, 0 deletions
diff --git a/classes/machine-overrides-extender.bbclass b/classes/machine-overrides-extender.bbclass
index b9b00ebe..58cb45b1 100644
--- a/classes/machine-overrides-extender.bbclass
+++ b/classes/machine-overrides-extender.bbclass
@@ -55,3 +55,22 @@ python machine_overrides_extender_handler() {
55 55
56machine_overrides_extender_handler[eventmask] = "bb.event.ConfigParsed" 56machine_overrides_extender_handler[eventmask] = "bb.event.ConfigParsed"
57addhandler machine_overrides_extender_handler 57addhandler machine_overrides_extender_handler
58
59python machineoverrides_filtered_out_qa_handler() {
60 filtered_out = (d.getVar('MACHINEOVERRIDES_EXTENDER_FILTER_OUT') or "").split()
61 qa_error = d.getVar('MACHINEOVERRIDES_FILTERED_OUT_QA_ERROR')
62
63 for var in d.overridedata:
64 # We need to allow the overrides being used in the extender
65 # so avoid processing it.
66 if 'MACHINEOVERRIDES_EXTENDER' in var:
67 continue
68
69 for (r, o) in d.overridedata[var]:
70 common = list(set(o.split(":")).intersection(filtered_out))
71 if len(common) > 0:
72 raise bb.parse.SkipRecipe(qa_error % common)
73}
74
75machineoverrides_filtered_out_qa_handler[eventmask] = "bb.event.RecipeParsed"
76addhandler machineoverrides_filtered_out_qa_handler
diff --git a/conf/machine/include/imx-base.inc b/conf/machine/include/imx-base.inc
index fff3c56d..ba43d76e 100644
--- a/conf/machine/include/imx-base.inc
+++ b/conf/machine/include/imx-base.inc
@@ -224,6 +224,8 @@ MACHINEOVERRIDES_EXTENDER_FILTER_OUT = " \
224 mx8dxl \ 224 mx8dxl \
225" 225"
226 226
227MACHINEOVERRIDES_FILTERED_OUT_QA_ERROR = "%s overrides cannot be used and need conversion to use the new BSP-specific overrides. Check 'meta-freescale/scripts/convert-bsp-specific-overrides'."
228
227# Sub-architecture support 229# Sub-architecture support
228MACHINE_SOCARCH_SUFFIX ?= "" 230MACHINE_SOCARCH_SUFFIX ?= ""
229MACHINE_SOCARCH_SUFFIX:mx6q-nxp-bsp = "-mx6qdl" 231MACHINE_SOCARCH_SUFFIX:mx6q-nxp-bsp = "-mx6qdl"
diff --git a/scripts/convert-bsp-specific-overrides b/scripts/convert-bsp-specific-overrides
new file mode 100755
index 00000000..d2160888
--- /dev/null
+++ b/scripts/convert-bsp-specific-overrides
@@ -0,0 +1,87 @@
1#!/bin/sh
2# Convert old-style NXP overrides to new style BSP overides
3#
4# Essentially, we extend the overrides to a generic-bsp, nxp-bsp, and mainline-bsp.
5#
6# So, for example, the mx8mq override is split into:
7#
8# - imx-generic-bsp: compatible with every i.MX SoC and both BSP variants
9# - imx-nxp-bsp: compatible with every i.MX SoC but specific to NXP BSP
10# - imx-mainline-bsp: compatible with every i.MX SoC but specific to Mainline BSP
11#
12# - mx8-generic-bsp: compatible with every i.MX8 SoC and both BSP variants
13# - mx8-nxp-bsp: compatible with every i.MX8 SoC but specific to NXP BSP
14# - mx8-mainline-bsp: compatible with every i.MX8 SoC but specific to Mainline BSP
15#
16# - mx8m-generic-bsp: compatible with every i.MX8M SoC and both BSP variants
17# - mx8m-nxp-bsp: compatible with every i.MX8M SoC but specific to NXP BSP
18# - mx8m-mainline-bsp: compatible with every i.MX8M SoC but specific to Mainline BSP
19#
20# - mx8mq-generic-bsp: compatible with every i.MX8MQ SoC and both BSP variants
21# - mx8mq-nxp-bsp: compatible with every i.MX8MQ SoC8 but specific to NXP BSP
22# - mx8mq-mainline-bsp: compatible with every i.MX8MQ SoC but specific to Mainline BSP
23#
24# The extender mechanism is responsible for extending the override list to include the generic
25# overrides. We can then use the three different variants to handle the metadata correctly.
26#
27# WARN: This script is intended to be run only once in a layer.
28#
29# Copyright 2022 (C) O.S. Systems Software LTDA.
30
31# Error out if the layer looks as already converted.
32if git ls-files \
33 | grep -v 'conf/machine/' \
34 | xargs egrep -q '(mx[5-8s]|vf\w+)-(nxp|generic|mainline)-bsp'; then
35 echo "ERROR: The $0 should be used once in a layer. The layer seems already converted."
36 exit 1
37fi
38
39# Convert the recipes to use the new BSP-specific overrides.
40git ls-files \
41 | grep -v 'conf/machine/' \
42 | xargs sed -i \
43 -e 's,:\(mx[6-8]\w*\),:\1-nxp-bsp,g' \
44 -e 's,(\(mx[6-8]\w*\)),(\1-nxp-bsp),g' \
45 -e 's,\(mx[6-8]\w*\)|,\1-nxp-bsp|,g' \
46 -e 's,|\(mx[6-8]\w*\)),|\1-nxp-bsp),g' \
47 \
48 -e 's,:\(mx[5s]\w*\),:\1-generic-bsp,g' \
49 -e 's,(\(mx[5s]\w*\)),(\1-generic-bsp),g' \
50 -e 's,\(mx[5s]\w*\)|,\1-generic-bsp|,g' \
51 -e 's,|\(mx[5s]\w*\)),|\1-generic-bsp),g' \
52 \
53 -e 's,:\(vf\w*\),:\1-generic-bsp,g' \
54 -e 's,:\(vf[56]0\w*\),:\1-generic-bsp,g' \
55 -e 's,\(vf\w*\)|,\1-generic-bsp|,g' \
56 -e 's,|\(vf\w*\)),|\1-generic-bsp),g' \
57 -e 's,\(vf[56]0\w*\)|,\1-generic-bsp|,g' \
58 -e 's,|\(vf[56]0\w*\)),|\1-generic-bsp),g' \
59 \
60 -e 's,:\(imx\) ,:\1-nxp-bsp ,g' \
61 -e 's,(\(imx\)),(\1-nxp-bsp),g' \
62 -e 's,\(imx\)|,\1-nxp-bsp|,g' \
63 -e 's,|\(imx\)),|\1-nxp-bsp),g'
64
65# Convert the folders old overrides to the new BSP-specific overrides.
66for d in $(find -type d | egrep '/mx[6-8]w*'); do
67 git mv $d $d-nxp-bsp
68done
69
70for d in $(find -type d | egrep '/imx$'); do
71 git mv $d $d-nxp-bsp
72done
73
74for d in $(find -type d | egrep '/mx[5s]w*'); do
75 git mv $d $d-generic-bsp
76done
77
78# Rework machine overrides to simplify them.
79git ls-files conf \
80 | xargs sed -i \
81 -e 's,mx6:mx6,mx6,g' \
82 -e 's,mx6ul:mx6ull:,mx6ull:,g' \
83 -e 's,mx6dl:mx6q:,mx6q:mx6dl:,g' \
84 \
85 -e 's,mx8:mx8m,mx8m,g' \
86 -e 's,mx8m:mx8m,mx8m,g' \
87 -e 's,mx8:mx8x:mx8,mx8,g'