Browse Source

x230: rename scripts and prepare to support more hardware flashers

Now our scripts start with _where_ it should be run. x230_*.sh should
be run on the x230 where Skulls should be installed. external_*.sh
obviously not.

This also adds the -f <flasher> option and an interactive menu if not
specified.
pull/35/head
Martin Kepplinger 6 years ago
parent
commit
6600121ed3
6 changed files with 129 additions and 22 deletions
  1. +9
    -9
      x230/README.md
  2. +56
    -5
      x230/external_install_bottom.sh
  3. +49
    -2
      x230/external_install_top.sh
  4. +4
    -4
      x230/release.sh
  5. +6
    -2
      x230/x230_before_first_install.sh
  6. +5
    -0
      x230/x230_update.sh

+ 9
- 9
x230/README.md View File

@ -25,17 +25,17 @@ That's the preferred way to use coreboot. The git revision we use is always incl
## TL;DR ## TL;DR
For first-time flashing, remove the keyboard and palmrest, and (using a For first-time flashing, remove the keyboard and palmrest, and (using a
Raspberry Pi with a SPI 8-pin chip clip connected), run Raspberry Pi with a SPI 8-pin chip clip connected), run
`flashrom_rpi_bottom_unlock.sh` on the lower chip
and `flashrom_rpi_top_write.sh` on the top chip of the two.
`external_install_bottom.sh` on the lower chip
and `external_install_top.sh` on the top chip of the two.
For updating later, run `prepare_internal_flashing.sh`. No need to disassemble.
For updating later, run `x230_update.sh`. No need to disassemble.
And always use the latest [released](https://github.com/merge/coreboot-x230/releases) And always use the latest [released](https://github.com/merge/coreboot-x230/releases)
package. This will be tested. The git master package. This will be tested. The git master
branch is _not_ meant to be stable. Use it for testing only. branch is _not_ meant to be stable. Use it for testing only.
## Flashing for the first time ## Flashing for the first time
* Before doing anything, run Linux, install `dmidecode` and run `prepare_before_installation.sh`
* Before doing anything, run Linux, install `dmidecode` and run `x230_before_first_install.sh`
It simply prints valuable system information. It simply prints valuable system information.
* Make sure you have RAM that uses 1,5V, not 1,35V. Check the specification of * Make sure you have RAM that uses 1,5V, not 1,35V. Check the specification of
your RAM module(s). your RAM module(s).
@ -112,7 +112,7 @@ And finally unlock the 8M chip by using the included script (be patient). Again,
this doesn't replace much; it reads the original, unlocks and flashes back: this doesn't replace much; it reads the original, unlocks and flashes back:
sudo ./flashrom_rpi_bottom_unlock.sh -m -k <backup.bin>
sudo ./external_install_bottom.sh -m -k <backup.bin>
That's it. Keep the backup safe. That's it. Keep the backup safe.
@ -159,7 +159,7 @@ here. We assume you have the unpacked release tarball ready, see above. Use
the following included script: the following included script:
sudo ./flashrom_rpi_top_write.sh -i x230_coreboot_seabios_<hash>_top.rom -k <backup>
sudo ./external_install_top.sh -i x230_coreboot_seabios_<hash>_top.rom -k <backup>
That's it. Keep the backup safe. That's it. Keep the backup safe.
@ -172,13 +172,13 @@ and any of the following examples are possible. Otherwise you cannot use
### Example: internal ### Example: internal
* Only for _updating_! You have to have your 8MB chip flashed externally using * Only for _updating_! You have to have your 8MB chip flashed externally using
our `flashrom_rpi_bottom_unlock.sh` script (`ifdtool -u`) before this, once
our `external_install_bottom.sh` script (`ifdtool -u`) before this, once
* very convenient: just install flashrom on your X230 but according to the * very convenient: just install flashrom on your X230 but according to the
[flashrom manpage](https://manpages.debian.org/stretch/flashrom/flashrom.8.en.html) [flashrom manpage](https://manpages.debian.org/stretch/flashrom/flashrom.8.en.html)
this is very dangerous! this is very dangerous!
* Boot Linux with the `iomem=relaxed` boot parameter (for example set in /etc/default/grub) * Boot Linux with the `iomem=relaxed` boot parameter (for example set in /etc/default/grub)
* download the latest release tarball (4MB "top" BIOS image is included) and extract it * download the latest release tarball (4MB "top" BIOS image is included) and extract it
* run `prepare_internal_flashing.sh` for generating all necessary files and instructions
* run `x230_update.sh` for generating all necessary files and instructions
### Example: Raspberry Pi 3 ### Example: Raspberry Pi 3
@ -259,7 +259,7 @@ Unpack it:
Connect the SPI clip to the "top" chip, and run: Connect the SPI clip to the "top" chip, and run:
sudo ./flashrom_rpi_top_write.sh -i x230_coreboot_seabios_<hash>_top.rom
sudo ./external_install_top.sh -f rpi -i x230_coreboot_seabios_<hash>_top.rom
That's it. That's it.


x230/flashrom_rpi_bottom_unlock.sh → x230/external_install_bottom.sh View File

@ -13,18 +13,27 @@ have_chipname=0
have_backupname=0 have_backupname=0
me_clean=0 me_clean=0
lock=0 lock=0
have_flasher=0
usage() usage()
{ {
echo "Skulls for the X230"
echo " Run this script on an external computer with a flasher"
echo " connected to the X230's bottom chip (farther away from"
echo " the display, closer to you)."
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 "-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>"
echo " supported flashers: rpi"
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>"
} }
args=$(getopt -o mlc:k:h -- "$@")
args=$(getopt -o f:mlc:k:h -- "$@")
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
usage usage
exit 1 exit 1
@ -34,6 +43,11 @@ eval set -- "$args"
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
case "$1" in case "$1" in
-f)
FLASHER=$2
have_flasher=1
shift
;;
-m) -m)
me_clean=1 me_clean=1
;; ;;
@ -60,12 +74,47 @@ do
;; ;;
*) *)
echo "Invalid option: $1" echo "Invalid option: $1"
usage
exit 1 exit 1
;; ;;
esac esac
shift shift
done done
if [ ! "$have_flasher" -gt 0 ] ; then
echo "Skulls for the X230"
echo ""
echo "Please select the hardware you use:"
PS3='Please select the hardware flasher: '
options=("Raspberry Pi" "CH341A" "Exit")
select opt in "${options[@]}"
do
case $opt in
"Raspberry Pi")
FLASHER="rpi"
break
;;
"CH341A")
FLASHER="ch341a"
break
;;
"Exit")
exit 0
;;
*) echo invalid option;;
esac
done
fi
if [ "${FLASHER}" = "rpi" ] ; then
echo "Ok. Run this on a Rasperry Pi."
elif [ "${FLASHER}" = "ch341a" ] ; then
echo "The CH341A is not yet supported"
exit 0
else
exit 1
fi
TEMP_DIR=`mktemp -d` TEMP_DIR=`mktemp -d`
if [ ! "$have_chipname" -gt 0 ] ; then if [ ! "$have_chipname" -gt 0 ] ; then
echo "trying to detect the chip..." echo "trying to detect the chip..."
@ -73,6 +122,8 @@ if [ ! "$have_chipname" -gt 0 ] ; then
flashrom_error="" flashrom_error=""
flashrom_error=$(cat ${TEMP_DIR}/chips | grep -i error || true) flashrom_error=$(cat ${TEMP_DIR}/chips | grep -i error || true)
if [ ! -z "${flashrom_error}" ] ; then if [ ! -z "${flashrom_error}" ] ; then
usage
echo "-------------- flashrom error: ---------------"
cat ${TEMP_DIR}/chips cat ${TEMP_DIR}/chips
rm -rf ${TEMP_DIR} rm -rf ${TEMP_DIR}
exit 1 exit 1

x230/flashrom_rpi_top_write.sh → x230/external_install_top.sh View File

@ -10,17 +10,26 @@ set -e
have_input_image=0 have_input_image=0
have_chipname=0 have_chipname=0
have_backupname=0 have_backupname=0
have_flasher=0
usage() usage()
{ {
echo "Skulls for the X230"
echo " Run this script on an external computer with a flasher"
echo " connected to the X230's top chip (closer to the display"
echo " and farther from you)"
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"
echo ""
echo " -i <path to image to flash>" echo " -i <path to image to flash>"
echo " -c <chipname> to use for flashrom" echo " -c <chipname> to use for flashrom"
echo " -k <path to backup to save>" echo " -k <path to backup to save>"
} }
args=$(getopt -o i:c:k:h -- "$@")
args=$(getopt -o f:i:c:k:h -- "$@")
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
usage usage
exit 1 exit 1
@ -30,6 +39,11 @@ eval set -- "$args"
while [ $# -gt 0 ] while [ $# -gt 0 ]
do do
case "$1" in case "$1" in
-f)
FLASHER=$2
have_flasher=1
shift
;;
-i) -i)
INPUT_IMAGE_PATH=$2 INPUT_IMAGE_PATH=$2
have_input_image=1 have_input_image=1
@ -62,11 +76,44 @@ do
done done
if [ ! "$have_input_image" -gt 0 ] ; then if [ ! "$have_input_image" -gt 0 ] ; then
echo "no input image provided"
echo "Image file to flash is needed. Please add -i <file>"
echo ""
usage usage
exit 1 exit 1
fi fi
if [ ! "$have_flasher" -gt 0 ] ; then
echo "Please select the hardware you use:"
PS3='Please select the hardware flasher: '
options=("Raspberry Pi" "CH341A" "Quit")
select opt in "${options[@]}"
do
case $opt in
"Raspberry Pi")
FLASHER="rpi"
break
;;
"CH341A")
FLASHER="ch341a"
break
;;
"Quit")
exit 0
;;
*) echo invalid option;;
esac
done
fi
if [ "${FLASHER}" = "rpi" ] ; then
echo "Ok. Run this on a Rasperry Pi."
elif [ "${FLASHER}" = "ch341a" ] ; then
echo "The CH341A is not yet supported"
exit 0
else
exit 1
fi
TEMP_DIR=`mktemp -d` TEMP_DIR=`mktemp -d`
if [ ! "$have_chipname" -gt 0 ] ; then if [ ! "$have_chipname" -gt 0 ] ; then
echo "trying to detect the chip..." echo "trying to detect the chip..."

+ 4
- 4
x230/release.sh View File

@ -104,10 +104,10 @@ tar -cJf skulls-x230-${version}.tar.xz \
NEWS \ NEWS \
util \ util \
LICENSE* \ LICENSE* \
prepare_internal_flashing.sh \
prepare_before_intallation.sh \
flashrom_rpi_bottom_unlock.sh \
flashrom_rpi_top_write.sh \
x230_update.sh \
x230_before_first_install.sh \
external_install_bottom.sh \
external_install_top.sh \
sources \ sources \
${RELEASE_IMAGE_FILE} ${RELEASE_IMAGE_FILE}


x230/prepare_before_installation.sh → x230/x230_before_first_install.sh View File

@ -9,9 +9,13 @@ set -e
usage() usage()
{ {
echo "Usage: $0"
echo "Skulls for the X230"
echo " Run this script on the X230 directly."
echo " It checks BIOS and hardware for relevant"
echo " things if you plan to install Skulls"
echo " please make sure dmidecode is installed"
echo "" echo ""
echo "please make sure dmidecode is installed"
echo "Usage: $0"
} }
args=$(getopt -o h -- "$@") args=$(getopt -o h -- "$@")

x230/prepare_internal_flashing.sh → x230/x230_update.sh View File

@ -10,6 +10,11 @@ have_input_image=0
usage() usage()
{ {
echo "Skulls for the X230"
echo " Run this script on the X230 directly."
echo " It updates Skulls to the image you want."
echo " Make sure you booted Linux with iomem=relaxed"
echo ""
echo "Usage: $0 -i <4mb_top_image>.rom" echo "Usage: $0 -i <4mb_top_image>.rom"
} }

Loading…
Cancel
Save