From 3a59e865de62ab0f9127ca5af2847d2b0a60224d Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Wed, 1 Sep 2010 00:47:25 +0200 Subject: [PATCH] installer: add bios update functions, set to version 0.2.3, cleanups and cosmetics Signed-off-by: Stephan Raue --- .../tools/installer/config/installer.conf | 9 +++ packages/tools/installer/scripts/installer | 57 +++++++++++++++---- 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/packages/tools/installer/config/installer.conf b/packages/tools/installer/config/installer.conf index 8ade18bc10..4c12eff9e4 100644 --- a/packages/tools/installer/config/installer.conf +++ b/packages/tools/installer/config/installer.conf @@ -7,3 +7,12 @@ # additional parameters to extlinux EXTLINUX_PARAMETERS="" + +# enable BIOS update function + BIOS_UPDATE="no" + +# BIOS file to program + BIOS_FILE="" + +# location for BIOS backup (with filename) + BIOS_FILE="" diff --git a/packages/tools/installer/scripts/installer b/packages/tools/installer/scripts/installer index eb82ac53e1..533d4909e4 100755 --- a/packages/tools/installer/scripts/installer +++ b/packages/tools/installer/scripts/installer @@ -280,7 +280,7 @@ function msg_not_implemented() { function msg_oem_only() { # show an dialog that this function is only implemented on special builds MSG_TITLE="\Z2[ FOR OEM ONLY ]\Zn" - MSG_INFOBOX=" OEM only feature, this function is not implemented in this build! \n if you have questions about this feature visit http://www.openelec.tv!!!" + MSG_INFOBOX=" OEM only feature, this function is not implemented in this build! \n if you have questions about this feature \n visit http://www.openelec.tv!!!" dialog --colors --backtitle "$BACKTITLE" --title "$MSG_TITLE" --msgbox "$MSG_INFOBOX" 7 70 } @@ -374,7 +374,7 @@ function menu_bios() { MSG_CANCEL="Back" dialog --colors --backtitle "$BACKTITLE" --cancel-label "$MSG_CANCEL" \ - --title "$MSG_TITLE" --menu "$MSG_MENU" 25 70 5 \ + --title "$MSG_TITLE" --menu "$MSG_MENU" 20 70 5 \ 1 "Backup installed BIOS" \ 2 "Update BIOS" \ 3 "Erase BIOS (not recommended)" 2> $TMPDIR/biosmenu @@ -385,7 +385,7 @@ function menu_bios() { case $ITEM_BIOSMENU in 1) bios_backup; break;; 2) bios_update; break;; - 2) bios_erase; break;; + 3) bios_erase; break;; esac ;; 1) @@ -404,20 +404,57 @@ function menu_custom() { } function bios_backup() { - # TODO: create an backup from installed bios - msg_not_implemented + # create an backup from installed bios + if [ "$BIOS_UPDATE" = "yes" -a -f "$BIOS_FILE" ]; then + + echo "##### backup old BIOS to $BIOS_BACKUP #####" + usleep 1000000 + flashrom --read "$BIOS_BACKUP" + + echo "##### Please control the output and press any key to continue #####" + read -sn1 + + else + msg_oem_only + fi menu_bios } function bios_update() { - # TODO: update the bios - msg_not_implemented + # update the bios + if [ "$BIOS_UPDATE" = "yes" -a -f "$BIOS_FILE" ]; then + + echo "##### erasing BIOS #####" + usleep 1000000 + flashrom --erase + + echo "##### writing new BIOS from $BIOS_FILE #####" + usleep 1000000 + flashrom --write "$BIOS_FILE" + + echo "##### Please control the output and press any key to continue #####" + read -sn1 + + else + msg_oem_only + fi menu_bios } function bios_erase() { - # TODO: update the bios - msg_not_implemented + # erase the bios + if [ "$BIOS_UPDATE" = "yes" -a -f "$BIOS_FILE" ]; then + + echo "##### erasing BIOS #####" + usleep 1000000 + flashrom --erase + + echo "##### Please control the output and press any key to continue #####" + read -sn1 + + else + msg_oem_only + fi menu_bios } @@ -443,7 +480,7 @@ function do_poweroff() { # setup needed variables BETA="yes" - VERSION="0.2.2" + VERSION="0.2.3" BACKTITLE="OpenELEC.tv Installer $VERSION" TMPDIR="/tmp/installer"