coreboot: Multiple programmers support in install script
authorPaul Kocialkowski <contact@paulk.fr>
Fri, 22 Apr 2016 09:27:20 +0000 (11:27 +0200)
committerPaul Kocialkowski <contact@paulk.fr>
Fri, 22 Apr 2016 09:27:20 +0000 (11:27 +0200)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
coreboot/coreboot-install.sh

index f3103b0..271d280 100755 (executable)
@@ -1,10 +1,23 @@
 #!/bin/sh
 
+. ./coreboot.sh
+
 SERIAL="/dev/ttyUSB1"
+COREBOOT_ROM="$DST/coreboot.rom"
+
+programmer=$1
 
-if [ "$1" = "buspirate" ]
-then
-       sudo flashrom -p buspirate_spi:dev=$SERIAL,spispeed=8M -w coreboot-out/coreboot.rom
-else
-       sudo flashrom -p ft2232_spi:type=openmoko -w coreboot-out/coreboot.rom
-fi
+case $programmer in
+       "buspirate")
+               sudo flashrom -p buspirate_spi:dev=$SERIAL,spispeed=8M -w $COREBOOT_ROM
+               ;;
+       "openmoko")
+               sudo flashrom -p ft2232_spi:type=openmoko -w $COREBOOT_ROM
+               ;;
+       "ch341a")
+               sudo flashrom -p ch341a_spi -w $COREBOOT_ROM
+               ;;
+       *)
+               echo "Unsupported programmer: $programmer"
+               ;;
+esac