summaryrefslogtreecommitdiffstats
path: root/scripts/convert-bsp-specific-overrides
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/convert-bsp-specific-overrides')
-rwxr-xr-xscripts/convert-bsp-specific-overrides87
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.
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'