linux_install.sh 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. #!/bin/sh
  2. # Note: This file uses tabs to indent. Please don't mix tabs and spaces.
  3. GENTOO_WARNING="This script will make a USE change in order to ensure that that QMK works on your system. All changes will be sent to the the file /etc/portage/package.use/qmkfirmware -- please review it, and read Portage's output carefully before installing any packages on your system. You will also need to ensure that your kernel is compiled with support for the keyboard chip that you are using (e.g. enable Arduino for the Pro Micro). Further information can be found on the Gentoo wiki."
  4. SLACKWARE_WARNING="You will need the following packages from slackbuilds.org:\n\tarm-binutils\n\tarm-gcc\n\tavr-binutils\n\tavr-gcc\n\tavr-libc\n\tavrdude\n\tdfu-programmer\n\tdfu-util\n\tnewlib\nThese packages will be installed with sudo and sboinstall, so ensure that your user is added to sudoers and that sboinstall is configured."
  5. SOLUS_INFO="Your tools are now installed. To start using them, open new terminal or source these scripts:\n\t/usr/share/defaults/etc/profile.d/50-arm-toolchain-path.sh\n\t/usr/share/defaults/etc/profile.d/50-avr-toolchain-path.sh"
  6. util_dir=$(dirname "$0")
  7. # For those distros that do not package bootloadHID
  8. install_bootloadhid() {
  9. if ! command -v bootloadHID >/dev/null; then
  10. wget https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.tar.gz -O - | tar -xz -C /tmp
  11. cd /tmp/bootloadHID.2012-12-08/commandline/
  12. if make; then
  13. sudo cp bootloadHID /usr/local/bin
  14. fi
  15. cd -
  16. fi
  17. }
  18. if grep ID /etc/os-release | grep -qE "fedora"; then
  19. sudo dnf install \
  20. arm-none-eabi-binutils-cs \
  21. arm-none-eabi-gcc-cs \
  22. arm-none-eabi-newlib \
  23. avr-binutils \
  24. avr-gcc \
  25. avr-libc \
  26. binutils-avr32-linux-gnu \
  27. clang \
  28. dfu-util \
  29. dfu-programmer \
  30. diffutils \
  31. git \
  32. gcc \
  33. glibc-headers \
  34. kernel-devel \
  35. kernel-headers \
  36. libusb-devel \
  37. make \
  38. perl \
  39. python3 \
  40. unzip \
  41. wget \
  42. zip
  43. elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then
  44. DEBIAN_FRONTEND=noninteractive
  45. DEBCONF_NONINTERACTIVE_SEEN=true
  46. export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
  47. sudo apt-get update
  48. sudo apt-get -yq install \
  49. build-essential \
  50. avr-libc \
  51. binutils-arm-none-eabi \
  52. binutils-avr \
  53. clang-format \
  54. dfu-programmer \
  55. dfu-util \
  56. diffutils \
  57. gcc \
  58. gcc-arm-none-eabi \
  59. gcc-avr \
  60. git \
  61. libnewlib-arm-none-eabi \
  62. libusb-dev \
  63. python3 \
  64. python3-pip \
  65. unzip \
  66. wget \
  67. zip
  68. elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then
  69. sudo pacman --needed -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.3.0-1-x86_64.pkg.tar.xz
  70. sudo pacman -S --needed \
  71. arm-none-eabi-binutils \
  72. arm-none-eabi-gcc \
  73. arm-none-eabi-newlib \
  74. avrdude \
  75. avr-binutils \
  76. avr-libc \
  77. base-devel \
  78. clang \
  79. dfu-programmer \
  80. dfu-util \
  81. diffutils \
  82. gcc \
  83. git \
  84. libusb-compat \
  85. python \
  86. python-pip \
  87. unzip \
  88. wget \
  89. zip
  90. elif grep ID /etc/os-release | grep -q gentoo; then
  91. echo "$GENTOO_WARNING" | fmt
  92. printf "\nProceed (y/N)? "
  93. read -r answer
  94. if echo "$answer" | grep -iq "^y"; then
  95. sudo touch /etc/portage/package.use/qmkfirmware
  96. # tee is used here since sudo doesn't apply to >>
  97. echo "sys-devel/gcc multilib" | sudo tee --append /etc/portage/package.use/qmkfirmware >/dev/null
  98. sudo emerge -auN sys-devel/gcc
  99. sudo emerge -au --noreplace \
  100. app-arch/unzip \
  101. app-arch/zip \
  102. app-mobilephone/dfu-util \
  103. dev-embedded/avrdude \
  104. net-misc/wget \
  105. sys-devel/clang \
  106. sys-devel/crossdev
  107. sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr
  108. sudo crossdev -s4 --stable --g \<9 --portage --verbose --target arm-none-eabi
  109. echo "Done!"
  110. else
  111. echo "Quitting..."
  112. fi
  113. elif grep ID /etc/os-release | grep -q sabayon; then
  114. sudo equo install \
  115. app-arch/unzip \
  116. app-arch/zip \
  117. app-mobilephone/dfu-util \
  118. dev-embedded/avrdude \
  119. dev-lang/python \
  120. net-misc/wget \
  121. sys-devel/clang \
  122. sys-devel/gcc \
  123. sys-devel/crossdev
  124. sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr
  125. sudo crossdev -s4 --stable --g \<9 --portage --verbose --target arm-none-eabi
  126. echo "Done!"
  127. elif grep ID /etc/os-release | grep -qE "opensuse|tumbleweed"; then
  128. CROSS_AVR_GCC=cross-avr-gcc8
  129. CROSS_ARM_GCC=cross-arm-none-gcc8
  130. if grep ID /etc/os-release | grep -q "15."; then
  131. CROSS_AVR_GCC=cross-avr-gcc7
  132. CROSS_ARM_GCC=cross-arm-none-gcc7
  133. fi
  134. sudo zypper install \
  135. avr-libc \
  136. clang \
  137. $CROSS_AVR_GCC \
  138. $CROSS_ARM_GCC \
  139. cross-avr-binutils \
  140. cross-arm-none-newlib-devel \
  141. cross-arm-binutils cross-arm-none-newlib-devel \
  142. dfu-tool \
  143. dfu-programmer \
  144. gcc \
  145. libusb-devel \
  146. python3 \
  147. unzip \
  148. wget \
  149. zip
  150. elif grep ID /etc/os-release | grep -q slackware; then
  151. printf "$SLACKWARE_WARNING\n"
  152. printf "\nProceed (y/N)? "
  153. read -r answer
  154. if echo "$answer" | grep -iq "^y" ;then
  155. sudo sboinstall \
  156. avr-binutils \
  157. avr-gcc \
  158. avr-libc \
  159. avrdude \
  160. dfu-programmer \
  161. dfu-util \
  162. arm-binutils \
  163. arm-gcc \
  164. newlib \
  165. python3
  166. echo "Done!"
  167. else
  168. echo "Quitting..."
  169. fi
  170. elif grep ID /etc/os-release | grep -q solus; then
  171. sudo eopkg ur
  172. sudo eopkg it \
  173. -c system.devel \
  174. arm-none-eabi-gcc \
  175. arm-none-eabi-binutils \
  176. arm-none-eabi-newlib \
  177. avr-libc \
  178. avr-binutils \
  179. avr-gcc \
  180. avrdude \
  181. dfu-util \
  182. dfu-programmer \
  183. libusb-devel \
  184. python3 \
  185. git \
  186. wget \
  187. zip \
  188. unzip
  189. printf "\n$SOLUS_INFO\n"
  190. elif grep ID /etc/os-release | grep -q void; then
  191. # musl Void systems don't have glibc cross compilers avaliable in their repos.
  192. # glibc Void systems do have musl cross compilers though, for some reason.
  193. # So, default to musl, and switch to glibc if it is installed.
  194. CROSS_ARM=cross-arm-linux-musleabi
  195. if xbps-query glibc > /dev/null; then # Check is glibc if installed
  196. CROSS_ARM=cross-arm-linux-gnueabi
  197. fi
  198. sudo xbps-install \
  199. avr-binutils \
  200. avr-gcc \
  201. avr-libc \
  202. $CROSS_ARM \
  203. dfu-programmer \
  204. dfu-util \
  205. gcc \
  206. git \
  207. make \
  208. wget \
  209. unzip \
  210. zip
  211. else
  212. echo "Sorry, we don't recognize your OS. Help us by contributing support!"
  213. echo
  214. echo "https://docs.qmk.fm/#/contributing"
  215. fi
  216. # Global install tasks
  217. install_bootloadhid
  218. pip3 install --user -r ${util_dir}/../requirements.txt