3 then echo "Please run as root using 'sudo bash'"
7 # change into $SUDO_USER home directory
9 mkdir
-p src
/fpga-boot-load-prog
10 cd src
/fpga-boot-load-prog
12 apt-get
install -y libcurl3-gnutls git git-man
14 git clone https
://git.code.sf.net
/p
/dfu-util
/dfu-util
15 git clone https
://github.com
/trabucayre
/openFPGALoader.git
16 git clone https
://github.com
/f32c
/tools.git
17 git clone https
://github.com
/kost
/fujprog.git
18 git clone https
://github.com
/xtrx-sdr
/xc3sprog.git
19 git clone https
://github.com
/gregdavill
/ecpprog.git
21 # Steps to compile dfu-util
23 ## Necessary software to install
25 apt-get
install -y build-essential
make autoconf libusb-dev \
26 libusb-1.0
-0-dev pkg-config
38 # Steps to compile openFPGALoader
40 ## Necessary software to install
42 apt-get
install -y cmake libftdi1-2 libftdi1-dev libhidapi-hidraw0 \
43 libhidapi-dev libudev-dev zlib1g-dev
45 ## Build openFPGALoader
54 cp 99-openfpgaloader.rules
/etc
/udev
/rules.d
57 # Steps to compile ujprog
62 git checkout
0698352b0e912caa9b8371b8f692e19aac547a69
64 cp Makefile.linux Makefile
65 sed -i -e 's@ -static@@g' \
66 -e 's@/usr/lib/${ARCHNAME}/libftdi.a@$(shell pkg-config --cflags --libs libftdi1)@g' \
67 -e 's@^USBLIB@#USBLIB@' Makefile
68 sed -i -e 's@usb_reset@ftdi_usb_reset@g' ujprog.c
70 install -v -m 4755 ujprog
/usr
/local
/bin
72 cat > /etc
/udev
/rules.d
/80-fpga-ulx3s.rules
<< EOF
73 # this is for usb-serial tty device
74 SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", \
75 MODE="664", GROUP="dialout"
76 # this is for ujprog libusb access
77 ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", \
78 GROUP="dialout", MODE="666"
82 # Steps to compile fujprog
94 # Steps to compile xc3sprog
99 git checkout
99e7de20aa8323712e5f70ff74d2079d5fb45bc7
100 sed -i -e 's@^if(NOT LIBUSB3380_FOUND)@if(NOT LIBUSB3380_FOUND)\n include(FindPkgConfig)@' Findlibusb3380.cmake
101 mkdir build
; cd build
102 cmake
-DLIBFTDI_FOUND=YES
-DLIBFTDI_INCLUDE_DIR="/usr/include/libftdi1" \
103 -DLIBFTDI_LIBRARIES="ftdi1" -DLIBUSB_FOUND=YES \
104 -DLIBUSB_INCLUDE_DIR="/usr/include" -DLIBUSB_LIBRARIES="usb" \
105 -DUSE_FTD2XX=OFF
-DUSE_LIBUSB3380=OFF ..
110 # Steps to compile ecpprog
115 git checkout
7212b56a9d2fc6de534e06636a1c6d8b0c6f80ab
121 # Install udev rules for boards
123 cat > /etc
/udev
/rules.d
/90-ecp5.rules
<< EOF
124 SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6020", \
125 GROUP="users", MODE="0666"
128 cat > /etc
/udev
/rules.d
/90-ftdi-orangecrab.rules
<< EOF
129 SUBSYSTEM=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="5af0", \
130 GROUP="users", MODE="0666"
133 cat > /etc
/udev
/rules.d
/90-arty7-100t.rules
<< EOF
134 SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", \
135 GROUP="users", MODE="0666"
138 # Run finally this to update udev
139 # udevadm control --reload-rules && udevadm trigger
140 # usermod -a $USER -G plugdev
142 cd /home
/$SUDO_USER/src
/fpga-boot-load-prog
143 chown
-R $SUDO_USER .
144 chgrp
-R $SUDO_USER .