diff options
-rw-r--r-- | classes/machine-overrides-extender.bbclass | 19 | ||||
-rw-r--r-- | conf/machine/include/imx-base.inc | 2 | ||||
-rwxr-xr-x | scripts/convert-bsp-specific-overrides | 87 |
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 | ||
56 | machine_overrides_extender_handler[eventmask] = "bb.event.ConfigParsed" | 56 | machine_overrides_extender_handler[eventmask] = "bb.event.ConfigParsed" |
57 | addhandler machine_overrides_extender_handler | 57 | addhandler machine_overrides_extender_handler |
58 | |||
59 | python 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 | |||
75 | machineoverrides_filtered_out_qa_handler[eventmask] = "bb.event.RecipeParsed" | ||
76 | addhandler 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 | ||
227 | MACHINEOVERRIDES_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 |
228 | MACHINE_SOCARCH_SUFFIX ?= "" | 230 | MACHINE_SOCARCH_SUFFIX ?= "" |
229 | MACHINE_SOCARCH_SUFFIX:mx6q-nxp-bsp = "-mx6qdl" | 231 | MACHINE_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. | ||
32 | if 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 | ||
37 | fi | ||
38 | |||
39 | # Convert the recipes to use the new BSP-specific overrides. | ||
40 | git 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. | ||
66 | for d in $(find -type d | egrep '/mx[6-8]w*'); do | ||
67 | git mv $d $d-nxp-bsp | ||
68 | done | ||
69 | |||
70 | for d in $(find -type d | egrep '/imx$'); do | ||
71 | git mv $d $d-nxp-bsp | ||
72 | done | ||
73 | |||
74 | for d in $(find -type d | egrep '/mx[5s]w*'); do | ||
75 | git mv $d $d-generic-bsp | ||
76 | done | ||
77 | |||
78 | # Rework machine overrides to simplify them. | ||
79 | git 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' | ||