From b36e532b5e0eef219f33075e6e60b68d104484ee Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Sat, 4 Jun 2016 00:10:47 -0400 Subject: cleans up folder structure * consolidates docs * deletes converter/ * updates .md references (most) --- util/1-setup-path-win.bat | 61 ++++++++++++++++++++++++++++ util/2-setup-environment-win.bat | 63 ++++++++++++++++++++++++++++ util/Vagrantfile | 88 ++++++++++++++++++++++++++++++++++++++++ util/avr_setup.sh | 72 ++++++++++++++++++++++++++++++++ util/new_project.sh | 26 ++++++++++++ 5 files changed, 310 insertions(+) create mode 100644 util/1-setup-path-win.bat create mode 100644 util/2-setup-environment-win.bat create mode 100644 util/Vagrantfile create mode 100644 util/avr_setup.sh create mode 100755 util/new_project.sh (limited to 'util') diff --git a/util/1-setup-path-win.bat b/util/1-setup-path-win.bat new file mode 100644 index 000000000..92e91be3e --- /dev/null +++ b/util/1-setup-path-win.bat @@ -0,0 +1,61 @@ +@SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION +@ECHO OFF +SET CMDLINERUNSTR=%SystemRoot%\system32\cmd.exe + +CD UTIL +DEL add-paths.log > NUL 2>&1 +DEL add-paths-detail.log > NUL 2>&1 +DEL UPDATE > NUL 2>&1 + +ELEVATE -wait %cd%\add-paths.bat > NUL 2>&1 + +IF ERRORLEVEL 1 ( + ECHO You denied admin access. Rerun the script, and be sure to press the yes button this time. +) ELSE ( + TYPE add-paths.log 2> NUL +) +ECHO. + +:: Branch to UpdateEnv if we need to update +IF EXIST UPDATE ( + DEL UPDATE + GOTO UpdateEnv +) + +GOTO ExitBatch + +:: ----------------------------------------------------------------------------- + +:UpdateEnv +ECHO Making updated PATH go live . . . +REG delete HKCU\Environment /F /V TEMPVAR > NUL 2>&1 +setx TEMPVAR 1 > NUL +REG delete HKCU\Environment /F /V TEMPVAR > NUL 2>&1 +IF NOT !cmdcmdline! == !CMDLINERUNSTR! (CALL :KillExplorer) +GOTO ExitBatch + +:: ----------------------------------------------------------------------------- + +:ExitBatch +ENDLOCAL +PAUSE +EXIT /b + +:: ----------------------------------------------------------------------------- + +:KillExplorer +ECHO Your desktop will be restarted. +ECHO All file explorer windows except for the one you launched this script from WILL BE CLOSED. +ECHO Press enter when ready, or close this window if you would rather do a full restart of your computer at a later time. +PAUSE +ping -n 5 127.0.0.1 > NUL 2>&1 +ECHO Killing process Explorer.exe. . . +ECHO. +taskkill /f /im explorer.exe > NUL +ECHO. +ECHO Your desktop is now loading. . . +ECHO. +ping -n 5 127.0.0.1 > NUL 2>&1 +START explorer.exe +START explorer.exe %CD%\.. +EXIT /b \ No newline at end of file diff --git a/util/2-setup-environment-win.bat b/util/2-setup-environment-win.bat new file mode 100644 index 000000000..905338087 --- /dev/null +++ b/util/2-setup-environment-win.bat @@ -0,0 +1,63 @@ +@SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION +@ECHO OFF + +SET STARTINGDIR=%CD% + +:: Check for admin privilages +SETX /M test test > nul 2>&1 +IF NOT ["%ERRORLEVEL%"]==["0"] ( + ECHO FAILED. Rerun with administrator privileges. + GOTO ExitBatch +) + +:: Make sure path to MinGW exists - if so, CD to it +SET MINGWPATH="C:\MinGW\bin" +IF NOT EXIST !MINGWPATH! (ECHO Path not found: %MINGWPATH% && GOTO ExitBatch) +CD /D %MINGWPATH% + + +ECHO ------------------------------------------ +ECHO Installing wget and unzip +ECHO ------------------------------------------ +mingw-get install msys-wget-bin msys-unzip-bin + +MKDIR temp +CD temp + +ECHO ------------------------------------------ +ECHO Installing dfu-programmer. +ECHO ------------------------------------------ +wget http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip +unzip dfu-programmer-win-0.7.2.zip +COPY dfu-programmer.exe .. + +ECHO ------------------------------------------ +ECHO Downloading driver +ECHO ------------------------------------------ +wget http://iweb.dl.sourceforge.net/project/libusb-win32/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip +unzip libusb-win32-bin-1.2.6.0.zip +COPY libusb-win32-bin-1.2.6.0\bin\x86\libusb0_x86.dll ../libusb0.dll + +ECHO ------------------------------------------ +ECHO Installing driver. Accept prompt. +ECHO ------------------------------------------ +IF EXIST "%WinDir%\System32\PnPUtil.exe" (%WinDir%\System32\PnPUtil.exe -i -a dfu-prog-usb-1.2.2\atmel_usb_dfu.inf && GOTO PNPUTILFOUND) +IF EXIST "%WinDir%\Sysnative\PnPUtil.exe" (%WinDir%\Sysnative\PnPUtil.exe -i -a dfu-prog-usb-1.2.2\atmel_usb_dfu.inf && GOTO PNPUTILFOUND) + +ECHO FAILED. Could not find PnPUtil.exe in "%WinDir%\System32" or "%WinDir%\Sysnative". + +:PNPUTILFOUND + +:: Wait then delete directory +ping -n 5 127.0.0.1 > NUL 2>&1 +CD .. +RD /s /q temp + +ECHO ------------------------------------------ +ECHO Finished! + +:ExitBatch +CD /D %STARTINGDIR% +ENDLOCAL +PAUSE +EXIT /b \ No newline at end of file diff --git a/util/Vagrantfile b/util/Vagrantfile new file mode 100644 index 000000000..1abe8ff3b --- /dev/null +++ b/util/Vagrantfile @@ -0,0 +1,88 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + # You can only have one config.vm.box uncommented at a time + + # Comment this and uncomment another if you don't want to use the minimal Arch box + config.vm.box = "dragon788/arch-ala-elasticdog" + + # VMware/Virtualbox 64 bit + # config.vm.box = "phusion/ubuntu-14.04-amd64" + # + # VMware/Virtualbox 64 bit + #config.vm.box = "puphpet/centos65-x64" + # + # The opensuse boxes don't have dfu-util in their default repositories + # + # The virtualbox version has tools issues + # VMware/Virtualbox 64 bit + #config.vm.box = "bento/opensuse-13.2-x86_64" + # + # Virtualbox only + #config.vm.box = "bento/opensuse-13.2-i386" + # config.vm.box = "" + # config.vm.box = "" + + # This section allows you to customize the Virtualbox VM + # settings, ie showing the GUI or upping the memory + # or cores if desired + config.vm.provider "virtualbox" do |vb| + # Hide the VirtualBox GUI when booting the machine + vb.gui = false + # Uncomment the below lines if you want to program + # your Teensy via the VM rather than your host OS + #vb.customize ['modifyvm', :id, '--usb', 'on'] + #vb.customize ['usbfilter', 'add', '0', + # '--target', :id, + # '--name', 'teensy', + # '--vendorid', '0x16c0', + # '--productid','0x0478' + # ] + # Customize the amount of memory on the VM: + vb.memory = "512" + end + + # This section allows you to customize the VMware VM + # settings, ie showing the GUI or upping the memory + # or cores if desired + config.vm.provider "vmware_workstation" do |vmw| + # Hide the VMware GUI when booting the machine + vmw.gui = false + + # Customize the amount of memory on the VM: + vmw.memory = "512" + end + + config.vm.provider "vmware_fusion" do |vmf| + # Hide the vmfare GUI when booting the machine + vmf.gui = false + + # Customize the amount of memory on the VM: + vmf.memory = "512" + end + + # This script ensures the required packages for AVR programming are installed + # It also ensures the system always gets the latest updates when powered on + # If this causes issues you can run a 'vagrant destroy' and then + # add a # before ,args: and run 'vagrant up' to get a working + # non-updated box and then attempt to troubleshoot or open a Github issue + + config.vm.provision "shell", run: "always", path: "avr_setup.sh", args: "-update" + + config.vm.post_up_message = """ + Log into the VM using 'vagrant ssh' on OSX or from Git Bash (Win) + or 'vagrant ssh-config' and Putty or Bitvise SSH or another SSH tool + + Change directory (cd) to the keyboard you wish to program + (Optionally) modify your layout, + then run 'make clean' + and then 'make' to compile the .eep and .hex files. + + Or you can copy and paste the example line below. + + cd /vagrant; cd keyboard; cd ergodox_ez; make clean; make + + + """ +end diff --git a/util/avr_setup.sh b/util/avr_setup.sh new file mode 100644 index 000000000..34a8a3281 --- /dev/null +++ b/util/avr_setup.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +# This script will attempt to setup the Linux dependencies for compiling QMK/TMK + +# This could probably go much lower, but since we are including an Arch vagrant, +# making it the first match makes sense + +if [[ -n "$(type -P pacman )" ]]; then + # Arch linux and derivatives like Apricity + # Future improvements: + # Allow user to speed up package installs using powerpill/wget tweaks + # Always run the pacman mirror update script if possible when vagrant comes up + # This will ensure that users never get stalled on a horribly slow mirror + pacman -Syyu --needed --noconfirm + pacman -S --needed --noconfirm \ + base-devel \ + avr-gcc \ + avr-binutils \ + avr-libc \ + dfu-util + +elif [[ -n "$(type -P apt-get)" ]]; then + # Debian and derivatives + # This block performs completely non-interactive updates {{ + export DEBIAN_FRONTEND=noninteractive + export DEBCONF_NONINTERACTIVE_SEEN=true + echo "grub-pc hold" | dpkg --set-selections + apt-get -y update + apt-get -y --allow-unauthenticated upgrade \ + -o Dpkg::Options::="--force-confdef" \ + -o Dpkg::Options::="--force-confold" + # }} + apt-get install -y \ + build-essential \ + gcc \ + unzip \ + wget \ + zip \ + gcc-avr \ + binutils-avr \ + avr-libc \ + dfu-util + +elif [[ -n "$(type -P yum)" ]]; then + # Fedora, CentOS or RHEL and derivatives + yum -y makecache && yum -y update + yum -y install \ + gcc \ + glibc-headers \ + kernel-devel \ + kernel-headers \ + make \ + perl \ + git \ + wget \ + avr-binutils \ + avr-gcc \ + avr-libc \ + dfu-util + +elif [[ -n "$(type -P zypper)" ]]; then + # openSUSE + zypper --non-interactive refresh && zypper --non-interactive update + zypper --non-interactive install \ + git \ + make \ + gcc \ + kernel-devel \ + patch \ + wget \ + dfu-programmer + +fi diff --git a/util/new_project.sh b/util/new_project.sh new file mode 100755 index 000000000..7def54318 --- /dev/null +++ b/util/new_project.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Script to make a new quantum project +# Jack Humbert 2015 + +if [ -z "$1" ]; then + echo "Usage: $0 " + exit 1 +fi + +KEYBOARD=$1 +KEYBOARD_UPPERCASE=$(echo $1 | awk '{print toupper($0)}') + +mkdir keyboard/$1 +mkdir keyboard/$1/keymaps +sed -e "s;%KEYBOARD%;$KEYBOARD;g" -e "s;%KEYBOARD_UPPERCASE%;$KEYBOARD_UPPERCASE;g" quantum/template/template.h > keyboard/$KEYBOARD/$KEYBOARD.h +sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/template.c > keyboard/$KEYBOARD/$KEYBOARD.c +sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/config.h > keyboard/$KEYBOARD/config.h +sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/README.md > keyboard/$KEYBOARD/README.md +sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/Makefile > keyboard/$KEYBOARD/Makefile +sed -e "s;%KEYBOARD%;$KEYBOARD;g" quantum/template/keymaps/default.c > keyboard/$KEYBOARD/keymaps/default.c + +echo "######################################################" +echo "# keyboard/$KEYBOARD project created. To start" +echo "# working on things, use the following command:" +echo "# cd keyboard/$KEYBOARD" +echo "######################################################" -- cgit v1.2.3