Browse Source

x230: external scripts: add -b option for rpi spi speed

pull/48/head
Martin Kepplinger 6 years ago
parent
commit
7ef03bf804
2 changed files with 34 additions and 19 deletions
  1. +17
    -9
      x230/external_install_bottom.sh
  2. +17
    -10
      x230/external_install_top.sh

+ 17
- 9
x230/external_install_bottom.sh View File

@ -14,6 +14,7 @@ have_backupname=0
me_clean=0 me_clean=0
lock=0 lock=0
have_flasher=0 have_flasher=0
rpi_frequency=0
usage() usage()
{ {
@ -24,16 +25,15 @@ usage()
echo "" echo ""
echo "Usage: $0 [-c <chipname>] [-a] [-m] [-k <backup_filename>] [-l]" echo "Usage: $0 [-c <chipname>] [-a] [-m] [-k <backup_filename>] [-l]"
echo "" echo ""
echo " -f <hardware_flasher>"
echo " supported flashers: rpi, ch341a"
echo ""
echo " -c <chipname> flashrom chip description to use"
echo " -m apply me_cleaner -S"
echo " -l lock the flash instead of unlocking it"
echo " -k <file> save the read image as <file>"
echo " -f <hardware_flasher> supported flashers: rpi, ch341a"
echo " -c <chipname> flashrom chip description to use"
echo " -m apply me_cleaner -S"
echo " -l lock the flash instead of unlocking it"
echo " -k <backup> save the current image as"
echo " -b <spi frequency> frequency of the RPi SPI bus in Hz. default: 128"
} }
args=$(getopt -o f:mlc:k:h -- "$@")
args=$(getopt -o f:mlc:k:hb: -- "$@")
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
usage usage
exit 1 exit 1
@ -64,6 +64,10 @@ do
have_backupname=1 have_backupname=1
shift shift
;; ;;
-b)
rpi_frequency=$2
shift
;;
-h) -h)
usage usage
exit 1 exit 1
@ -110,10 +114,14 @@ if [ ! "$have_flasher" -gt 0 ] ; then
done done
fi fi
if [ ! "${rpi_frequency}" -gt 0 ] ; then
rpi_frequency=128
fi
programmer="" programmer=""
if [ "${FLASHER}" = "rpi" ] ; then if [ "${FLASHER}" = "rpi" ] ; then
echo "Ok. Run this on a Rasperry Pi." echo "Ok. Run this on a Rasperry Pi."
programmer="linux_spi:dev=/dev/spidev0.0,spispeed=128"
programmer="linux_spi:dev=/dev/spidev0.0,spispeed=${rpi_frequency}"
elif [ "${FLASHER}" = "ch341a" ] ; then elif [ "${FLASHER}" = "ch341a" ] ; then
echo "Ok. Connect a CH341A programmer" echo "Ok. Connect a CH341A programmer"
programmer="ch341a_spi" programmer="ch341a_spi"


+ 17
- 10
x230/external_install_top.sh View File

@ -11,6 +11,7 @@ have_input_image=0
have_chipname=0 have_chipname=0
have_backupname=0 have_backupname=0
have_flasher=0 have_flasher=0
rpi_frequency=0
usage() usage()
{ {
@ -21,15 +22,14 @@ usage()
echo "" echo ""
echo "Usage: $0 -i <image.rom> [-c <chipname>] [-k <backup_filename>]" echo "Usage: $0 -i <image.rom> [-c <chipname>] [-k <backup_filename>]"
echo "" echo ""
echo " -f <hardware_flasher>"
echo " supported flashers: rpi, ch341a"
echo ""
echo " -i <path to image to flash>"
echo " -c <chipname> to use for flashrom"
echo " -k <path to backup to save>"
echo " -f <hardware_flasher> supported flashers: rpi, ch341a"
echo " -i <image> path to image to flash"
echo " -c <chipname> to use for flashrom"
echo " -k <backup> save the current image as"
echo " -b <spi frequency> frequency of the RPi SPI bus in Hz. default: 128"
} }
args=$(getopt -o f:i:c:k:h -- "$@")
args=$(getopt -o f:i:c:k:hb: -- "$@")
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
usage usage
exit 1 exit 1
@ -59,6 +59,10 @@ do
have_backupname=1 have_backupname=1
shift shift
;; ;;
-b)
rpi_frequency=$2
shift
;;
-h) -h)
usage usage
exit 1 exit 1
@ -87,7 +91,7 @@ if [ ! "$have_input_image" -gt 0 ] ; then
exit 1 exit 1
fi fi
prompt="file not specified. Please select a file to flash:"
prompt="Please select a file to flash or start with the -i option to use a different one:"
options=( $(find -maxdepth 1 -name "x230_coreboot_seabios*rom" -print0 | xargs -0) ) options=( $(find -maxdepth 1 -name "x230_coreboot_seabios*rom" -print0 | xargs -0) )
PS3="$prompt " PS3="$prompt "
@ -128,10 +132,13 @@ if [ ! "$have_flasher" -gt 0 ] ; then
done done
fi fi
if [ ! "${rpi_frequency}" -gt 0 ] ; then
rpi_frequency=128
fi
programmer="" programmer=""
if [ "${FLASHER}" = "rpi" ] ; then if [ "${FLASHER}" = "rpi" ] ; then
echo "Ok. Run this on a Rasperry Pi."
programmer="linux_spi:dev=/dev/spidev0.0,spispeed=128"
programmer="linux_spi:dev=/dev/spidev0.0,spispeed=${rpi_frequency}"
elif [ "${FLASHER}" = "ch341a" ] ; then elif [ "${FLASHER}" = "ch341a" ] ; then
echo "Ok. Connect a CH341A programmer" echo "Ok. Connect a CH341A programmer"
programmer="ch341a_spi" programmer="ch341a_spi"


Loading…
Cancel
Save