diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2022-03-02 20:21:54 -0300 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2022-03-03 10:41:35 -0300 |
commit | bfa2a3b98dde2a664615fe4a2527fd89b0c8dfbe (patch) | |
tree | 3609de3cd02c929e329f875cf42d433e3be6febb /scripts | |
parent | 286385e3b2b6d6b4c60faf14fd3170ec2279139e (diff) | |
download | meta-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>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/convert-bsp-specific-overrides | 87 |
1 files changed, 87 insertions, 0 deletions
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' | ||