linux_install.sh 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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 \
  99. app-arch/unzip \
  100. app-arch/zip \
  101. app-mobilephone/dfu-util \
  102. dev-embedded/avrdude \
  103. dev-lang/python:3.5 \
  104. net-misc/wget \
  105. sys-devel/clang \
  106. sys-devel/gcc \
  107. sys-devel/crossdev
  108. sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr
  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 =4.9.4 --portage --verbose --target avr
  125. echo "Done!"
  126. elif grep ID /etc/os-release | grep -qE "opensuse|tumbleweed"; then
  127. CROSS_AVR_GCC=cross-avr-gcc8
  128. CROSS_ARM_GCC=cross-arm-none-gcc8
  129. if grep ID /etc/os-release | grep -q "15."; then
  130. CROSS_AVR_GCC=cross-avr-gcc7
  131. CROSS_ARM_GCC=cross-arm-none-gcc7
  132. fi
  133. sudo zypper install \
  134. avr-libc \
  135. clang \
  136. $CROSS_AVR_GCC \
  137. $CROSS_ARM_GCC \
  138. cross-avr-binutils \
  139. cross-arm-none-newlib-devel \
  140. cross-arm-binutils cross-arm-none-newlib-devel \
  141. dfu-tool \
  142. dfu-programmer \
  143. gcc \
  144. libusb-devel \
  145. python3 \
  146. unzip \
  147. wget \
  148. zip
  149. elif grep ID /etc/os-release | grep -q slackware; then
  150. printf "$SLACKWARE_WARNING\n"
  151. printf "\nProceed (y/N)? "
  152. read -r answer
  153. if echo "$answer" | grep -iq "^y" ;then
  154. sudo sboinstall \
  155. avr-binutils \
  156. avr-gcc \
  157. avr-libc \
  158. avrdude \
  159. dfu-programmer \
  160. dfu-util \
  161. arm-binutils \
  162. arm-gcc \
  163. newlib \
  164. python3
  165. echo "Done!"
  166. else
  167. echo "Quitting..."
  168. fi
  169. elif grep ID /etc/os-release | grep -q solus; then
  170. sudo eopkg ur
  171. sudo eopkg it \
  172. -c system.devel \
  173. arm-none-eabi-gcc \
  174. arm-none-eabi-binutils \
  175. arm-none-eabi-newlib \
  176. avr-libc \
  177. avr-binutils \
  178. avr-gcc \
  179. avrdude \
  180. dfu-util \
  181. dfu-programmer \
  182. libusb-devel \
  183. python3 \
  184. git \
  185. wget \
  186. zip \
  187. unzip
  188. printf "\n$SOLUS_INFO\n"
  189. elif grep ID /etc/os-release | grep -q void; then
  190. # musl Void systems don't have glibc cross compilers avaliable in their repos.
  191. # glibc Void systems do have musl cross compilers though, for some reason.
  192. # So, default to musl, and switch to glibc if it is installed.
  193. CROSS_ARM=cross-arm-linux-musleabi
  194. if xbps-query glibc > /dev/null; then # Check is glibc if installed
  195. CROSS_ARM=cross-arm-linux-gnueabi
  196. fi
  197. sudo xbps-install \
  198. avr-binutils \
  199. avr-gcc \
  200. avr-libc \
  201. $CROSS_ARM \
  202. dfu-programmer \
  203. dfu-util \
  204. gcc \
  205. git \
  206. make \
  207. wget \
  208. unzip \
  209. zip
  210. else
  211. echo "Sorry, we don't recognize your OS. Help us by contributing support!"
  212. echo
  213. echo "https://docs.qmk.fm/#/contributing"
  214. fi
  215. # Global install tasks
  216. install_bootloadhid
  217. pip3 install --user -r ${util_dir}/../requirements.txt