|
@@ -9,7 +9,7 @@ flash_arduino="u2" # u2 or ftdi
|
|
arduino_device="ttyACM0" # ls /dev/tty* and find your arduino
|
|
arduino_device="ttyACM0" # ls /dev/tty* and find your arduino
|
|
mega=2560 #2560 or 1280
|
|
mega=2560 #2560 or 1280
|
|
|
|
|
|
-script_version="2.0.0"
|
|
|
|
|
|
+script_version="2.2.0"
|
|
rdate="13/01/2022"
|
|
rdate="13/01/2022"
|
|
|
|
|
|
################
|
|
################
|
|
@@ -55,7 +55,7 @@ then
|
|
rm -r -f frser-duino
|
|
rm -r -f frser-duino
|
|
fi
|
|
fi
|
|
echo -e "\n\e[93mDownload frser-duino :\e[0m"
|
|
echo -e "\n\e[93mDownload frser-duino :\e[0m"
|
|
-git clone --recursive git://github.com/urjaman/frser-duino frser-duino
|
|
|
|
|
|
+git clone --recursive https://github.com/urjaman/frser-duino frser-duino
|
|
cd frser-duino
|
|
cd frser-duino
|
|
if [ $arduino_device = "ttyUSB0" ]
|
|
if [ $arduino_device = "ttyUSB0" ]
|
|
then
|
|
then
|
|
@@ -94,7 +94,7 @@ then
|
|
rm -r -f frser-duino
|
|
rm -r -f frser-duino
|
|
fi
|
|
fi
|
|
echo -e "\n\e[93mDownload frser-mega :\e[0m"
|
|
echo -e "\n\e[93mDownload frser-mega :\e[0m"
|
|
-git clone --recursive git://github.com/urjaman/frser-duino frser-duino
|
|
|
|
|
|
+git clone --recursive https://github.com/urjaman/frser-duino frser-duino
|
|
cd frser-duino
|
|
cd frser-duino
|
|
if [ $arduino_device = "ttyUSB0" ]
|
|
if [ $arduino_device = "ttyUSB0" ]
|
|
then
|
|
then
|
|
@@ -121,9 +121,34 @@ sudo apt-get install build-essential pciutils usbutils libpci-dev libusb-dev lib
|
|
sudo modprobe spi_bcm2708
|
|
sudo modprobe spi_bcm2708
|
|
sudo modprobe spi_bcm2835
|
|
sudo modprobe spi_bcm2835
|
|
sudo modprobe spidev
|
|
sudo modprobe spidev
|
|
|
|
+if [ -f /boot/config.txt ]
|
|
|
|
+then
|
|
sudo sed -i -e "s/\#dtparam=spi=on/dtparam=spi=on/g" /boot/config.txt
|
|
sudo sed -i -e "s/\#dtparam=spi=on/dtparam=spi=on/g" /boot/config.txt
|
|
|
|
+fi
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function ch341_ {
|
|
|
|
+cat <<'EOF'>> .lastbuild
|
|
|
|
+Mode=ch341
|
|
|
|
+Device=ch341
|
|
|
|
+EOF
|
|
|
|
+echo -e ""
|
|
|
|
+echo -e "\n\e[93mBuild CH341 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 libusb-1.0-0-dev libftdi-dev libftdi1-dev libjaylink-dev -y
|
|
|
|
+cat <<'EOF'>>02-ch341a.rules
|
|
|
|
+# Ch341A
|
|
|
|
+# Ch341A
|
|
|
|
+SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="5512", MODE:="0666"
|
|
|
|
+EOF
|
|
|
|
+sudo usermod -a -G dialout,plugdev $USER
|
|
|
|
+sudo cp 02-ch341a.rules /etc/udev/rules.d/
|
|
|
|
+rm 02-ch341a.rules
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
function flashrom_ {
|
|
function flashrom_ {
|
|
if ! [ -x "$(command -v flashrom)" ]
|
|
if ! [ -x "$(command -v flashrom)" ]
|
|
then
|
|
then
|
|
@@ -131,7 +156,7 @@ cd $CWD
|
|
if [ ! -d flashrom ]
|
|
if [ ! -d flashrom ]
|
|
then
|
|
then
|
|
echo -e "\n\e[93mDownload flashrom :\e[0m"
|
|
echo -e "\n\e[93mDownload flashrom :\e[0m"
|
|
-git clone git://github.com/flashrom/flashrom.git
|
|
|
|
|
|
+git clone https://github.com/flashrom/flashrom.git
|
|
fi
|
|
fi
|
|
cd flashrom
|
|
cd flashrom
|
|
sed -i -e "s/WARNERROR ?= yes/WARNERROR ?= no/g" Makefile
|
|
sed -i -e "s/WARNERROR ?= yes/WARNERROR ?= no/g" Makefile
|
|
@@ -185,6 +210,11 @@ echo -e "\n\e[93mCheck flashrom :\e[0m"
|
|
flashrom -p serprog:dev=/dev/$arduino_device:115200 || :
|
|
flashrom -p serprog:dev=/dev/$arduino_device:115200 || :
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function flashrom_ch341_check_ {
|
|
|
|
+echo -e "\n\e[93mCheck flashrom :\e[0m"
|
|
|
|
+flashrom -p ch341a_spi || :
|
|
|
|
+}
|
|
|
|
+
|
|
function footer_ {
|
|
function footer_ {
|
|
echo ""
|
|
echo ""
|
|
echo -e "\e[92m\e[21mMemo Command line: \e[0m"
|
|
echo -e "\e[92m\e[21mMemo Command line: \e[0m"
|
|
@@ -216,7 +246,8 @@ Usage: $0 [--arduino] [--mega] [--raspberry] [--clean] [--help]
|
|
--help Display extended help message
|
|
--help Display extended help message
|
|
--arduino Build Serial SPI flashrom tools for arduino328
|
|
--arduino Build Serial SPI flashrom tools for arduino328
|
|
--mega Build Serial SPI flashrom tools for arduinoMega
|
|
--mega Build Serial SPI flashrom tools for arduinoMega
|
|
- --raspberry Build Serial SPI flashrom tools for raspberryPI/ch341
|
|
|
|
|
|
+ --raspberry Build Serial SPI flashrom tools for raspberryPI
|
|
|
|
+ --ch341 Build Serial SPI flashrom tools for CH341 USB
|
|
--clean Clean all build files
|
|
--clean Clean all build files
|
|
|
|
|
|
Install script Written by: wareck <wareck@gmail.com>
|
|
Install script Written by: wareck <wareck@gmail.com>
|
|
@@ -244,6 +275,9 @@ do
|
|
--raspberry)
|
|
--raspberry)
|
|
raspberry_ && flashrom_ && flashrom_raspberry_check_ && footer_
|
|
raspberry_ && flashrom_ && flashrom_raspberry_check_ && footer_
|
|
;;
|
|
;;
|
|
|
|
+ --ch341)
|
|
|
|
+ ch341_ && flashrom_ && flashrom_ch341_check_ && footer_
|
|
|
|
+ ;;
|
|
--clean)
|
|
--clean)
|
|
clean_
|
|
clean_
|
|
;;
|
|
;;
|