linux_install.sh 5.9 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. wget https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.tar.gz -O - | tar -xz -C /tmp
  10. cd /tmp/bootloadHID.2012-12-08/commandline/
  11. if make; then
  12. sudo cp bootloadHID /usr/local/bin
  13. fi
  14. cd -
  15. }
  16. if grep ID /etc/os-release | grep -qE "fedora"; then
  17. sudo dnf install \
  18. arm-none-eabi-binutils-cs \
  19. arm-none-eabi-gcc-cs \
  20. arm-none-eabi-newlib \
  21. avr-binutils \
  22. avr-gcc \
  23. avr-libc \
  24. binutils-avr32-linux-gnu \
  25. clang \
  26. dfu-util \
  27. dfu-programmer \
  28. diffutils \
  29. git \
  30. gcc \
  31. glibc-headers \
  32. kernel-devel \
  33. kernel-headers \
  34. libusb-devel \
  35. make \
  36. perl \
  37. python3 \
  38. unzip \
  39. wget \
  40. zip
  41. elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then
  42. DEBIAN_FRONTEND=noninteractive
  43. DEBCONF_NONINTERACTIVE_SEEN=true
  44. export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
  45. sudo apt-get update
  46. sudo apt-get -yq install \
  47. build-essential \
  48. avr-libc \
  49. binutils-arm-none-eabi \
  50. binutils-avr \
  51. clang-format \
  52. dfu-programmer \
  53. dfu-util \
  54. diffutils \
  55. gcc \
  56. gcc-arm-none-eabi \
  57. gcc-avr \
  58. git \
  59. libnewlib-arm-none-eabi \
  60. libusb-dev \
  61. python3 \
  62. python3-pip \
  63. unzip \
  64. wget \
  65. zip
  66. elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then
  67. sudo pacman -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.3.0-1-x86_64.pkg.tar.xz
  68. sudo pacman -S --needed \
  69. arm-none-eabi-binutils \
  70. arm-none-eabi-gcc \
  71. arm-none-eabi-newlib \
  72. avrdude \
  73. avr-binutils \
  74. avr-libc \
  75. avr-gcc \
  76. base-devel \
  77. bootloadhid \
  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