|
@@ -31,7 +31,7 @@ echo
|
|
|
|
|
|
function arduino_ {
|
|
|
echo -e ""
|
|
|
-echo -e "\e[92m\e[4mBuild Arduino SPIFlash tools:\e[0m\e[24m"
|
|
|
+echo -e "\e[97mBuild Arduino SPIFlash tools:\e[0m\e[24m"
|
|
|
if [ -a /dev/ttyACM0 ]
|
|
|
then
|
|
|
arduino_device="ttyACM0"
|
|
@@ -40,25 +40,17 @@ if [ -a /dev/ttyUSB0 ]
|
|
|
then
|
|
|
arduino_device="ttyUSB0"
|
|
|
fi
|
|
|
-
|
|
|
echo "Arduino device found at: $arduino_device"
|
|
|
-echo ""
|
|
|
-
|
|
|
echo -e "\n\e[93mPerforming Update :\e[0m"
|
|
|
-sudo apt-get update
|
|
|
-sudo apt-get install flashrom gcc-avr binutils-avr gdb-avr avr-libc avrdude libpci-dev git libusb-1.0-0-dev libftdi-dev -y
|
|
|
+#sudo apt-get update
|
|
|
+#sudo apt-get install flashrom gcc-avr binutils-avr gdb-avr avr-libc avrdude libpci-dev git libusb-1.0-0-dev libftdi-dev libftdi1-dev -y
|
|
|
|
|
|
-if [ ! -d frser-duino ]
|
|
|
+if [ -d frser-duino ]
|
|
|
then
|
|
|
+rm -r -f frser-duino
|
|
|
+fi
|
|
|
echo -e "\n\e[93mDownload frser-duino :\e[0m"
|
|
|
git clone --recursive git://github.com/urjaman/frser-duino frser-duino
|
|
|
-else
|
|
|
-cd frser-duino
|
|
|
-git reset --hard
|
|
|
-git pull
|
|
|
-cd ..
|
|
|
-fi
|
|
|
-
|
|
|
cd frser-duino
|
|
|
if [ $arduino_device = "ttyUSB0" ]
|
|
|
then
|
|
@@ -73,22 +65,16 @@ make flash-$flash_arduino
|
|
|
function mega_ {
|
|
|
echo -e ""
|
|
|
echo -e "\e[92m\e[4mBuild ATMEGA$mega SPIFlash tools:\e[0m\e[24m"
|
|
|
-
|
|
|
echo -e "\n\e[93mPerforming Update :\e[0m"
|
|
|
-sudo apt-get install flashrom gcc-avr binutils-avr gdb-avr avr-libc avrdude libpci-dev git -y
|
|
|
-
|
|
|
-if [ ! -d frser-duino ]
|
|
|
+sudo apt-get install flashrom gcc-avr binutils-avr gdb-avr avr-libc avrdude libpci-dev git libusb-1.0-0-dev libftdi-dev libftdi1-dev -y
|
|
|
+if [ -d frser-duino ]
|
|
|
then
|
|
|
+rm -r -f frser-duino
|
|
|
+fi
|
|
|
echo -e "\n\e[93mDownload frser-mega :\e[0m"
|
|
|
git clone --recursive git://github.com/urjaman/frser-duino frser-duino
|
|
|
-else
|
|
|
cd frser-duino
|
|
|
-git reset --hard
|
|
|
-git pull
|
|
|
-cd ..
|
|
|
-fi
|
|
|
|
|
|
-cd frser-duino
|
|
|
if [ $arduino_device = "ttyUSB0" ]
|
|
|
then
|
|
|
sed -e "s/dev\/dev/ttyACM0/dev\/$arduino_device/g" Makefile
|
|
@@ -97,40 +83,41 @@ echo -e "\n\e[93mBuild frser-duino :\e[0m"
|
|
|
make mega$mega -j$((`nproc`+1))
|
|
|
echo -e "\n\e[93mFlash ATMega$mega :\e[0m"
|
|
|
make flash-mega$mega
|
|
|
-
|
|
|
}
|
|
|
|
|
|
function raspberry_ {
|
|
|
echo -e ""
|
|
|
-echo -e "\e[92m\e[4mBuild Raspberry SPIFlash tools:\e[0m\e[24m"
|
|
|
+echo -e "\n\e[93mBuild Raspberry SPIFlash tools:\e[0m\e[24m"
|
|
|
echo -e "\n\e[93mPerforming Update :\e[0m"
|
|
|
sudo apt-get update
|
|
|
sudo apt-get upgrade -y
|
|
|
-sudo apt-get install build-essential pciutils usbutils libpci-dev libusb-dev libusb-1.0-0 libusb-1.0-0-dev libftdi1 libftdi-dev zlib1g-dev subversion git ghex -y
|
|
|
+sudo apt-get install build-essential pciutils usbutils libpci-dev libusb-dev libusb-1.0-0 libusb-1.0-0-dev libftdi1 libftdi-dev zlib1g-dev subversion git ghex libusb-1.0-0-dev libftdi-dev libftdi1-dev libjaylink-dev -y
|
|
|
sudo modprobe spi_bcm2708
|
|
|
+sudo modprobe spi_bcm2835
|
|
|
sudo modprobe spidev
|
|
|
sudo sed -i -e "s/\#dtparam=spi=on/dtparam=spi=on/g" /boot/config.txt
|
|
|
}
|
|
|
|
|
|
function flashrom_ {
|
|
|
+if ! [ -x "$(command -v flashrom)" ]
|
|
|
+then
|
|
|
cd $CWD
|
|
|
-
|
|
|
if [ ! -d flashrom ]
|
|
|
then
|
|
|
echo -e "\n\e[93mDownload flashrom :\e[0m"
|
|
|
git clone git://github.com/flashrom/flashrom.git
|
|
|
fi
|
|
|
-
|
|
|
cd flashrom
|
|
|
sed -i -e "s/WARNERROR ?= yes/WARNERROR ?= no/g" Makefile
|
|
|
echo -e "\n\e[93mBuild and install flashrom:\e[0m"
|
|
|
-make -j$((`nproc`+1))
|
|
|
+make -j$(nproc)
|
|
|
sudo make install
|
|
|
+fi
|
|
|
}
|
|
|
|
|
|
function clean_ {
|
|
|
echo -e ""
|
|
|
-echo -e "\e[93m\e[4mCleaning:\e[0m\e[24m"
|
|
|
+echo -e "\e[97mCleaning:\e[0m\e[24m"
|
|
|
if [ -d flashrom ]; then rm -r -f flashrom; fi
|
|
|
if [ -d frser-duino ]; then rm -r -f frser-duino; fi
|
|
|
echo -e "\n\e[95mCleaning...Done !\e[0m"
|
|
@@ -161,7 +148,7 @@ echo -e "\e[93m\e[21mArduino/Mega2560/Mega1280: \e[0m"
|
|
|
echo -e "flashrom -p serprog:dev=/dev/$arduino_device:115200"
|
|
|
echo -e ""
|
|
|
echo -e "\e[93m\e[21mRaspberryPI/beagleBone: \e[0m"
|
|
|
-echo -e "flashrom -p linux_spi:dev=/dev/spidev0.0"
|
|
|
+echo -e "flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=2000"
|
|
|
echo -e ""
|
|
|
if ! [ -x "$(command -v flashrom)" ]
|
|
|
then
|