diff options
Diffstat (limited to 'util')
| -rwxr-xr-x | util/chibios_conf_updater.sh | 103 | ||||
| -rwxr-xr-x | util/install/arch.sh | 3 | ||||
| -rwxr-xr-x | util/install/debian.sh | 11 | ||||
| -rwxr-xr-x | util/update_chibios_mirror.sh | 4 |
4 files changed, 25 insertions, 96 deletions
diff --git a/util/chibios_conf_updater.sh b/util/chibios_conf_updater.sh index 5ba8aa677..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() { |
| @@ -38,74 +47,13 @@ find_chibi_files() { | |||
| 38 | local search_path="$1" | 47 | local search_path="$1" |
| 39 | shift | 48 | shift |
| 40 | local conditions=( "$@" ) | 49 | local conditions=( "$@" ) |
| 41 | for file in $(find -L "$search_path" -not -path '*/lib/chibios*' -and -not -path '*/lib/ugfx*' -and -not -path '*/util/*' -and \( "${conditions[@]}" \) | sort) ; do | 50 | for file in $(find -L "$search_path" -not -path '*/lib/chibios*' -and -not -path '*/util/*' -and \( "${conditions[@]}" \) | sort) ; do |
| 42 | if [ -z "$(grep 'include_next' "$file")" ] ; then | 51 | if [ -z "$(grep 'include_next' "$file")" ] ; then |
| 43 | echo $file | 52 | echo $file |
| 44 | fi | 53 | fi |
| 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/install/arch.sh b/util/install/arch.sh index bef98ac37..33c39212d 100755 --- a/util/install/arch.sh +++ b/util/install/arch.sh | |||
| @@ -6,7 +6,8 @@ _qmk_install() { | |||
| 6 | sudo pacman --needed --noconfirm -S \ | 6 | sudo pacman --needed --noconfirm -S \ |
| 7 | base-devel clang diffutils gcc git unzip wget zip python-pip \ | 7 | base-devel clang diffutils gcc git unzip wget zip python-pip \ |
| 8 | avr-binutils arm-none-eabi-binutils arm-none-eabi-gcc \ | 8 | avr-binutils arm-none-eabi-binutils arm-none-eabi-gcc \ |
| 9 | arm-none-eabi-newlib avrdude dfu-programmer dfu-util | 9 | arm-none-eabi-newlib avrdude dfu-programmer dfu-util \ |
| 10 | riscv64-elf-binutils riscv64-elf-gcc riscv64-elf-newlib | ||
| 10 | sudo pacman --needed --noconfirm -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.3.0-1-x86_64.pkg.tar.xz | 11 | sudo pacman --needed --noconfirm -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.3.0-1-x86_64.pkg.tar.xz |
| 11 | sudo pacman --needed --noconfirm -S avr-libc # Must be installed after the above, or it will bring in the latest avr-gcc instead | 12 | sudo pacman --needed --noconfirm -S avr-libc # Must be installed after the above, or it will bring in the latest avr-gcc instead |
| 12 | 13 | ||
diff --git a/util/install/debian.sh b/util/install/debian.sh index 57588e371..3e02919bd 100755 --- a/util/install/debian.sh +++ b/util/install/debian.sh | |||
| @@ -11,11 +11,18 @@ _qmk_install_prepare() { | |||
| 11 | _qmk_install() { | 11 | _qmk_install() { |
| 12 | echo "Installing dependencies" | 12 | echo "Installing dependencies" |
| 13 | 13 | ||
| 14 | sudo apt-get -yq install \ | 14 | sudo apt-get --quiet --yes install \ |
| 15 | build-essential clang-format diffutils gcc git unzip wget zip \ | 15 | build-essential clang-format diffutils gcc git unzip wget zip \ |
| 16 | python3-pip binutils-avr gcc-avr avr-libc binutils-arm-none-eabi \ | 16 | python3-pip binutils-avr gcc-avr avr-libc binutils-arm-none-eabi \ |
| 17 | gcc-arm-none-eabi libnewlib-arm-none-eabi avrdude dfu-programmer \ | 17 | gcc-arm-none-eabi libnewlib-arm-none-eabi avrdude dfu-programmer \ |
| 18 | dfu-util teensy-loader-cli libhidapi-hidraw0 libusb-dev | 18 | dfu-util teensy-loader-cli libhidapi-hidraw0 libusb-dev |
| 19 | 19 | ||
| 20 | python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt | 20 | # RISC-V toolchains with picolibc support are only available for distributions based on Debian 11+. |
| 21 | if sudo apt-get install --simulate --quiet --yes picolibc-riscv64-unknown-elf gcc-riscv64-unknown-elf binutils-riscv64-unknown-elf > /dev/null 2>&1; then | ||
| 22 | sudo apt-get --quiet --yes install picolibc-riscv64-unknown-elf \ | ||
| 23 | gcc-riscv64-unknown-elf \ | ||
| 24 | binutils-riscv64-unknown-elf | ||
| 25 | fi | ||
| 26 | |||
| 27 | python3 -m pip install --user -r "$QMK_FIRMWARE_DIR"/requirements.txt | ||
| 21 | } | 28 | } |
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 |
