diff options
author | Nick Brassel <nick@tzarc.org> | 2021-11-03 08:26:40 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-03 08:26:40 +1100 |
commit | 5da04fb45b0d5cddc6f49f88ea9c6a4037ef82ce (patch) | |
tree | 6fb7eafbbbef1278200421290659a13d208d7c31 /util | |
parent | 387edab52b1c1ab7585c4c1a11d997a6a90a505c (diff) | |
download | qmk_firmware-5da04fb45b0d5cddc6f49f88ea9c6a4037ef82ce.tar.gz qmk_firmware-5da04fb45b0d5cddc6f49f88ea9c6a4037ef82ce.zip |
Update to ChibiOS 20.3.4, support builds against trunk (#14208)
* Add support for building against ChibiOS svn/trunk.
* Swap to 21.6.x
* Update to latest branch revision as released version is broken.
* Updated configs.
* Conf updates.
* Updated ChibiOS
* Convert STM32L422 to actual L422 ChibiOS platform.
* Downgrade to 20.3.4 as ChibiOS 21.6.x is being aborted.
* Rollback L422-based boards.
Diffstat (limited to 'util')
-rwxr-xr-x | util/chibios_conf_updater.sh | 101 | ||||
-rwxr-xr-x | util/update_chibios_mirror.sh | 4 |
2 files changed, 13 insertions, 92 deletions
diff --git a/util/chibios_conf_updater.sh b/util/chibios_conf_updater.sh index d1640b672..a5699ca3c 100755 --- a/util/chibios_conf_updater.sh +++ b/util/chibios_conf_updater.sh | |||
@@ -3,6 +3,17 @@ | |||
3 | set -eEuo pipefail | 3 | set -eEuo pipefail |
4 | umask 022 | 4 | umask 022 |
5 | 5 | ||
6 | ##################### | ||
7 | # You will need to get an older JDK -- JDK 8 | ||
8 | # | ||
9 | # !!!!!!!! DO NOT INSTALL THIS IF YOU HAVE AN EXISTING JDK OR JRE INSTALLED !!!!!!!! | ||
10 | # | ||
11 | # For Debian 10-ish distro's: | ||
12 | # wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add - | ||
13 | # sudo add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/ | ||
14 | # sudo apt-get update && sudo apt-get install adoptopenjdk-8-hotspot | ||
15 | |||
16 | |||
6 | sinfo() { echo "$@" >&2 ; } | 17 | sinfo() { echo "$@" >&2 ; } |
7 | shead() { sinfo "" ; sinfo "---------------------------------" ; sinfo "-- $@" ; sinfo "---------------------------------" ; } | 18 | shead() { sinfo "" ; sinfo "---------------------------------" ; sinfo "-- $@" ; sinfo "---------------------------------" ; } |
8 | havecmd() { command command type "${1}" >/dev/null 2>&1 || return 1 ; } | 19 | havecmd() { command command type "${1}" >/dev/null 2>&1 || return 1 ; } |
@@ -11,8 +22,6 @@ this_script="$(realpath "${BASH_SOURCE[0]}")" | |||
11 | script_dir="$(realpath "$(dirname "$this_script")")" | 22 | script_dir="$(realpath "$(dirname "$this_script")")" |
12 | qmk_firmware_dir="$(realpath "$script_dir/../")" | 23 | qmk_firmware_dir="$(realpath "$script_dir/../")" |
13 | 24 | ||
14 | declare -A file_hashes | ||
15 | |||
16 | export PATH="$PATH:$script_dir/fmpp/bin" | 25 | export PATH="$PATH:$script_dir/fmpp/bin" |
17 | 26 | ||
18 | build_fmpp() { | 27 | build_fmpp() { |
@@ -45,67 +54,6 @@ find_chibi_files() { | |||
45 | done | 54 | done |
46 | } | 55 | } |
47 | 56 | ||
48 | revert_chibi_files() { | ||
49 | local search_path="$1" | ||
50 | shead "Reverting ChibiOS config/board files..." | ||
51 | for file in $(find_chibi_files "$search_path" -name chconf.h -or -name halconf.h -or -name mcuconf.h -or -name board.c -or -name board.h -or -name board.mk -or -name board.chcfg) ; do | ||
52 | pushd "$search_path" >/dev/null 2>&1 | ||
53 | local relpath=$(realpath --relative-to="$search_path" "$file") | ||
54 | git checkout upstream/develop -- "$relpath" || git checkout origin/develop -- "$relpath" || true | ||
55 | popd >/dev/null 2>&1 | ||
56 | done | ||
57 | } | ||
58 | |||
59 | populate_file_hashes() { | ||
60 | local search_path="$1" | ||
61 | shead "Determining duplicate config/board files..." | ||
62 | for file in $(find_chibi_files "$search_path" -name chconf.h -or -name halconf.h -or -name mcuconf.h -or -name board.c -or -name board.h) ; do | ||
63 | local key="file_$(clang-format "$file" | sha1sum | cut -d' ' -f1)" | ||
64 | local relpath=$(realpath --relative-to="$search_path" "$file") | ||
65 | file_hashes[$key]="${file_hashes[$key]:-} $relpath" | ||
66 | done | ||
67 | for file in $(find_chibi_files "$search_path" -name board.mk -or -name board.chcfg) ; do | ||
68 | local key="file_$(cat "$file" | sha1sum | cut -d' ' -f1)" | ||
69 | local relpath=$(realpath --relative-to="$search_path" "$file") | ||
70 | file_hashes[$key]="${file_hashes[$key]:-} $relpath" | ||
71 | done | ||
72 | } | ||
73 | |||
74 | determine_equivalent_files() { | ||
75 | local search_file="$1" | ||
76 | for K in "${!file_hashes[@]}"; do | ||
77 | for V in ${file_hashes[$K]}; do | ||
78 | if [[ "$V" == "$search_file" ]] ; then | ||
79 | for V in ${file_hashes[$K]}; do | ||
80 | echo "$V" | ||
81 | done | ||
82 | return 0 | ||
83 | fi | ||
84 | done | ||
85 | done | ||
86 | return 1 | ||
87 | } | ||
88 | |||
89 | deploy_staged_files() { | ||
90 | shead "Deploying staged files..." | ||
91 | for file in $(find "$qmk_firmware_dir/util/chibios-upgrade-staging" -type f) ; do | ||
92 | local relpath=$(realpath --relative-to="$qmk_firmware_dir/util/chibios-upgrade-staging" "$file") | ||
93 | sinfo "Deploying staged file: $relpath" | ||
94 | for other in $(determine_equivalent_files "$relpath") ; do | ||
95 | sinfo " => $other" | ||
96 | cp "$qmk_firmware_dir/util/chibios-upgrade-staging/$relpath" "$qmk_firmware_dir/$other" | ||
97 | done | ||
98 | done | ||
99 | } | ||
100 | |||
101 | swap_mcuconf_f3xx_f303() { | ||
102 | shead "Swapping STM32F3xx_MCUCONF -> STM32F303_MCUCONF..." | ||
103 | for file in $(find_chibi_files "$qmk_firmware_dir" -name mcuconf.h) ; do | ||
104 | sed -i 's#STM32F3xx_MCUCONF#STM32F303_MCUCONF#g' "$file" | ||
105 | dos2unix "$file" >/dev/null 2>&1 | ||
106 | done | ||
107 | } | ||
108 | |||
109 | upgrade_conf_files_generic() { | 57 | upgrade_conf_files_generic() { |
110 | local search_filename="$1" | 58 | local search_filename="$1" |
111 | local update_script="$2" | 59 | local update_script="$2" |
@@ -150,35 +98,8 @@ upgrade_mcuconf_files() { | |||
150 | popd >/dev/null 2>&1 | 98 | popd >/dev/null 2>&1 |
151 | } | 99 | } |
152 | 100 | ||
153 | update_staged_files() { | ||
154 | shead "Updating staged files with ChibiOS upgraded versions..." | ||
155 | for file in $(find "$qmk_firmware_dir/util/chibios-upgrade-staging" -type f) ; do | ||
156 | local relpath=$(realpath --relative-to="$qmk_firmware_dir/util/chibios-upgrade-staging" "$file") | ||
157 | sinfo "Updating staged file: $relpath" | ||
158 | cp "$qmk_firmware_dir/$relpath" "$qmk_firmware_dir/util/chibios-upgrade-staging/$relpath" | ||
159 | done | ||
160 | } | ||
161 | |||
162 | havecmd fmpp || build_fmpp | 101 | havecmd fmpp || build_fmpp |
163 | revert_chibi_files "$qmk_firmware_dir" | ||
164 | populate_file_hashes "$qmk_firmware_dir" | ||
165 | |||
166 | shead "Showing duplicate ChibiOS files..." | ||
167 | for K in "${!file_hashes[@]}"; do | ||
168 | sinfo ${K#file_}: | ||
169 | for V in ${file_hashes[$K]}; do | ||
170 | sinfo " $V" | ||
171 | done | ||
172 | done | ||
173 | |||
174 | if [ "${1:-}" == "-r" ] ; then | ||
175 | exit 0 | ||
176 | fi | ||
177 | |||
178 | swap_mcuconf_f3xx_f303 | ||
179 | 102 | ||
180 | deploy_staged_files | ||
181 | upgrade_mcuconf_files | 103 | upgrade_mcuconf_files |
182 | upgrade_chconf_files | 104 | upgrade_chconf_files |
183 | upgrade_halconf_files | 105 | upgrade_halconf_files |
184 | update_staged_files | ||
diff --git a/util/update_chibios_mirror.sh b/util/update_chibios_mirror.sh index 83aee2281..0bf648ebf 100755 --- a/util/update_chibios_mirror.sh +++ b/util/update_chibios_mirror.sh | |||
@@ -7,10 +7,10 @@ | |||
7 | chibios_branches="trunk stable_20.3.x stable_21.6.x" | 7 | chibios_branches="trunk stable_20.3.x stable_21.6.x" |
8 | 8 | ||
9 | # The ChibiOS tags to mirror | 9 | # The ChibiOS tags to mirror |
10 | chibios_tags="ver20.3.1 ver20.3.2 ver20.3.3 ver21.6.0" | 10 | chibios_tags="ver20.3.1 ver20.3.2 ver20.3.3 ver20.3.4 ver21.6.0" |
11 | 11 | ||
12 | # The ChibiOS-Contrib branches to mirror | 12 | # The ChibiOS-Contrib branches to mirror |
13 | contrib_branches="chibios-20.3.x" | 13 | contrib_branches="chibios-20.3.x chibios-21.6.x" |
14 | 14 | ||
15 | ################################ | 15 | ################################ |
16 | # Actions | 16 | # Actions |