Browse Source

MSYS and WSL installation improvements (#10593)

pull/10678/head 0.10.37
Ryan 3 years ago
committed by GitHub
parent
commit
f0a1ab5488
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 187 deletions
  1. +1
    -1
      docs/driver_installation_zadig.md
  2. +0
    -8
      util/activate_msys2.sh
  3. +0
    -8
      util/activate_wsl.sh
  4. +14
    -0
      util/linux_install.sh
  5. +8
    -23
      util/msys2_install.sh
  6. +6
    -4
      util/qmk_install.sh
  7. +0
    -63
      util/win_shared_install.sh
  8. +0
    -80
      util/wsl_install.sh

+ 1
- 1
docs/driver_installation_zadig.md View File

@ -4,7 +4,7 @@ QMK presents itself to the host as a regular HID keyboard device, and as such re
There are two notable exceptions: the Caterina bootloader, usually seen on Pro Micros, and the HalfKay bootloader shipped with PJRC Teensys, appear as a serial port and a generic HID device respectively, and so do not require a driver.
We recommend the use of the [Zadig](https://zadig.akeo.ie/) utility. If you have set up the development environment with MSYS2 or WSL, the `qmk_install.sh` script will have asked if you want it to install the drivers for you.
We recommend the use of the [Zadig](https://zadig.akeo.ie/) utility. If you have set up the development environment with MSYS2, the `qmk_install.sh` script will have already installed the drivers for you.
## Installation


+ 0
- 8
util/activate_msys2.sh View File

@ -1,8 +0,0 @@
#!/bin/bash
function export_variables {
local util_dir=~/qmk_utils
export PATH=$PATH:$util_dir
}
export_variables

+ 0
- 8
util/activate_wsl.sh View File

@ -1,8 +0,0 @@
#!/bin/bash
function export_variables {
local util_dir=~/qmk_utils
local download_dir=$util_dir/wsl_downloaded
}
export_variables

+ 14
- 0
util/linux_install.sh View File

@ -235,3 +235,17 @@ fi
# Global install tasks
install_bootloadhid
pip3 install --user -r ${util_dir}/../requirements.txt
if uname -a | grep -qi microsoft; then
echo "********************************************************************************"
echo "* Detected Windows Subsystem for Linux. *"
echo "* Currently, WSL has no access to USB devices and so flashing from within the *"
echo "* WSL terminal will not work. *"
echo "* *"
echo "* Please install the QMK Toolbox instead: *"
echo "* https://github.com/qmk/qmk_toolbox/releases *"
echo "* Then, map your WSL filesystem as a network drive: *"
echo "* \\\\\\\\wsl$\\<distro> *"
echo "********************************************************************************"
echo
fi

+ 8
- 23
util/msys2_install.sh View File

@ -1,7 +1,5 @@
#!/bin/bash
dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
download_dir=~/qmk_utils
util_dir=$(dirname "$0")
echo "Installing dependencies needed for the installation"
@ -12,26 +10,13 @@ pacman --needed --noconfirm --disable-download-timeout -Sy \
mingw-w64-x86_64-arm-none-eabi-binutils mingw-w64-x86_64-arm-none-eabi-gcc mingw-w64-x86_64-arm-none-eabi-newlib \
mingw-w64-x86_64-avrdude mingw-w64-x86_64-bootloadhid mingw-w64-x86_64-dfu-programmer mingw-w64-x86_64-dfu-util mingw-w64-x86_64-teensy-loader-cli
source "$dir/win_shared_install.sh"
echo "Installing drivers"
tmpdir=$(mktemp -d)
cp "${util_dir}/drivers.txt" $tmpdir
pushd $tmpdir > /dev/null
wget "https://github.com/qmk/qmk_driver_installer/releases/download/v1.01/qmk_driver_installer.exe"
cmd.exe //c "qmk_driver_installer.exe --all --force drivers.txt"
popd > /dev/null
rm -r $tmpdir
pip3 install -r "${util_dir}/../requirements.txt"
cp -f "$dir/activate_msys2.sh" "$download_dir/"
if grep "^source ~/qmk_utils/activate_msys2.sh$" ~/.bashrc
then
echo
echo "The line source ~/qmk_utils/activate_msys2.sh is already added to your /.bashrc"
echo "Not adding it twice!"
else
echo
echo "Adding 'source ~/qmk_utils/activate_msys2.sh' to the end of your"
echo ".bashrc file. Without this make won't find the needed utils."
echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc;
fi
echo
echo "******************************************************************************"
echo "Installation completed!"
echo "Please close this Window and restart MSYS2 MinGW"
echo "******************************************************************************"

+ 6
- 4
util/qmk_install.sh View File

@ -7,19 +7,21 @@ case $(uname -a) in
*Darwin*)
exec "${util_dir}/macos_install.sh"
;;
*Linux*Microsoft*)
exec "${util_dir}/wsl_install.sh"
;;
*FreeBSD*)
exec "${util_dir}/freebsd_install.sh"
;;
*Linux*)
exec "${util_dir}/linux_install.sh"
;;
MSYS_NT*|MINGW64_NT*|MINGW32_NT*)
MINGW64_NT*)
exec "${util_dir}/msys2_install.sh"
;;
MSYS_NT*|MINGW32_NT*)
echo "Please open a MinGW 64-bit terminal window and re-run this script."
exit 1
;;
*)
echo "Environment not supported. Please see https://docs.qmk.fm for details on how to configure the QMK Firmware build tools manually."
exit 1
;;
esac

+ 0
- 63
util/win_shared_install.sh View File

@ -1,63 +0,0 @@
#!/bin/bash
function install_utils {
rm -f -r "$download_dir"
mkdir "$download_dir"
pushd "$download_dir"
echo "Downloading the QMK driver installer"
wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i -
rm -f *.zip
popd > /dev/null
}
function install_drivers {
pushd "$download_dir"
cp -f "$dir/drivers.txt" .
echo
cmd.exe //c "qmk_driver_installer.exe $1 $2 drivers.txt"
popd > /dev/null
}
pushd "$dir"
if [ ! -d "$download_dir" ]; then
install_utils
else
while true; do
echo
echo "The utils seem to already be downloaded."
read -p "Do you want to re-download them and update to the newest version (Y/N) " res
case $res in
[Yy]* ) install_utils; break;;
[Nn]* ) break;;
* ) echo "Invalid answer";;
esac
done
fi
while true; do
echo
echo "Which USB drivers do you want to install?"
echo "(A)ll - All supported drivers will be installed"
echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode)"
echo " will be installed"
echo "(F)orce - Like all, but will also override existing drivers for connected"
echo " keyboards"
echo "(N)one - No drivers will be installed,"
echo " flashing your keyboard will most likely not work"
read -p "(a/c/f/N)? " res
case $res in
[AaYy]* ) install_drivers --all; break;;
[Cc]* ) install_drivers; break;;
[Ff]* ) install_drivers --all --force; break;;
[Nn]* | "" ) break;;
* ) echo "Invalid answer";;
esac
done
popd > /dev/null

+ 0
- 80
util/wsl_install.sh View File

@ -1,80 +0,0 @@
#!/bin/bash
util_dir=$(dirname "$0")
dir=$(cd -P -- "$util_dir" && pwd -P)
pushd "$dir";
if [[ $dir != /mnt/* ]];
then
echo
echo "You need to clone the qmk_firmware repository outside the linux filesystem."
echo "Otherwise the windows executables can't be run."
exit 1
fi
while true; do
echo
echo "Do you want to install all toolchain dependencies needed for compiling QMK?"
echo "If you don't want that, you can install the dependencies manually."
read -p "(Y/N) " res
case $res in
[Yy]* ) ./linux_install.sh; break;;
[Nn]* ) break;;
* ) echo "Invalid answer";;
esac
done
download_dir=wsl_downloaded
source "$dir/win_shared_install.sh"
pip3 install -r ${util_dir}/../requirements.txt
echo
echo "Creating a softlink to the utils directory as ~/qmk_utils."
echo "This is needed so that the the make system can find all utils it need."
read -p "Press enter to continue (ctrl-c to abort)"
ln -sfn "$dir" ~/qmk_utils
if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc
then
echo
echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc"
echo "Not adding it twice"
else
while true; do
echo
echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of your"
echo ".bashrc file? Without this make won't find the needed utils, so if you don't"
echo "want to do it automatically, then you have to do it manually later."
read -p "(Y/N)? " res
case $res in
[Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;;
[Nn]* ) break;;
* ) echo "Invalid answer";;
esac
done
fi
while true; do
echo
echo "Do you want to add a symlink to the QMK repository in your home directory for"
echo "convenience? This will create a folder 'qmk_firmware' in your home directory."
echo "In the future you can use this folder instead of the full path on your Windows"
echo "file system."
read -p "(Y/N)? " res
case $res in
[Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;;
[Nn]* ) break;;
* ) echo "Invalid answer";;
esac
done
echo
echo "******************************************************************************"
echo "Installation completed!"
echo "You need to open a new bash command prompt for all the utils to work properly"
echo "******************************************************************************"
popd > /dev/null

Loading…
Cancel
Save