From 5bfb363761ef6f49d4c44528ee98120cc0d941ce Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Mon, 6 Mar 2017 21:26:28 +0200 Subject: [PATCH] fwupdate: odroidc1 support should now be complete --- board/common/overlay/sbin/fwupdate | 40 ++++++------------- board/odroidc1/usr/libexec/fw-prepare-boot | 4 ++ .../overlay/usr/libexec/fw-prepare-boot | 4 ++ .../overlay/usr/libexec/fw-restore-boot-cfg | 10 +++++ .../overlay/usr/libexec/fw-prepare-boot | 4 ++ .../overlay/usr/libexec/fw-restore-boot-cfg | 10 +++++ .../overlay/usr/libexec/fw-prepare-boot | 4 ++ .../overlay/usr/libexec/fw-restore-boot-cfg | 10 +++++ 8 files changed, 59 insertions(+), 27 deletions(-) create mode 100755 board/odroidc1/usr/libexec/fw-prepare-boot create mode 100755 board/raspberrypi/overlay/usr/libexec/fw-prepare-boot create mode 100755 board/raspberrypi/overlay/usr/libexec/fw-restore-boot-cfg create mode 100755 board/raspberrypi2/overlay/usr/libexec/fw-prepare-boot create mode 100755 board/raspberrypi2/overlay/usr/libexec/fw-restore-boot-cfg create mode 100755 board/raspberrypi3/overlay/usr/libexec/fw-prepare-boot create mode 100755 board/raspberrypi3/overlay/usr/libexec/fw-restore-boot-cfg diff --git a/board/common/overlay/sbin/fwupdate b/board/common/overlay/sbin/fwupdate index f9bcd4e7de..ba1ce32651 100755 --- a/board/common/overlay/sbin/fwupdate +++ b/board/common/overlay/sbin/fwupdate @@ -230,7 +230,13 @@ function flash_boot() { wait $pid mount -o rw /boot - restore_boot_$board $FW_DIR/old_boot 2>/dev/null || true + + # the /usr/libexec/fw-restore-boot-cfg script, if present, takes the old (backup) boot dir as argument + # and should restore any /boot configuration that needs to be preserved across updates + # from the old boot dir to the current (new) /boot dir + if [ -x /usr/libexec/fw-restore-boot-cfg ]; then + /usr/libexec/fw-restore-boot-cfg $FW_DIR/old_boot 2>/dev/null || true + fi touch $FW_DIR/$BOOT_READY_FILE } @@ -257,19 +263,6 @@ function flash_cleanup() { mount /boot 2>/dev/null } -function restore_boot_raspberrypi() { - old_boot=$1 - cp $old_boot/config.txt /boot -} - -function restore_boot_raspberrypi2() { - restore_boot_raspberrypi -} - -function restore_boot_raspberrypi3() { - restore_boot_raspberrypi -} - #### flash reboot #### @@ -278,8 +271,13 @@ function flash_reboot() { board=$(cat $SYS_BOARD_FILE) + # the /usr/libexec/fw-prepare-boot script should be present and should + # make the necessary changes to the current boot configuration so that + # the firmware update initramfs will be used by the next boot mount -o remount,rw /boot - prepare_boot_$board + if [ -x /usr/libexec/fw-prepare-boot ]; then + /usr/libexec/fw-prepare-boot + fi sync busybox reboot & @@ -289,18 +287,6 @@ function flash_reboot() { exit 0 } -function prepare_boot_raspberrypi() { - echo "initramfs fwupdater.gz" >> /boot/config.txt -} - -function prepare_boot_raspberrypi2() { - prepare_boot_raspberrypi -} - -function prepare_boot_raspberrypi3() { - prepare_boot_raspberrypi -} - #### status #### diff --git a/board/odroidc1/usr/libexec/fw-prepare-boot b/board/odroidc1/usr/libexec/fw-prepare-boot new file mode 100755 index 0000000000..c506ae2891 --- /dev/null +++ b/board/odroidc1/usr/libexec/fw-prepare-boot @@ -0,0 +1,4 @@ +#!/bin/bash + +sed -i 's/00 - 0x/00 0x22000000 0x/' /boot/boot.ini + diff --git a/board/raspberrypi/overlay/usr/libexec/fw-prepare-boot b/board/raspberrypi/overlay/usr/libexec/fw-prepare-boot new file mode 100755 index 0000000000..e114525d86 --- /dev/null +++ b/board/raspberrypi/overlay/usr/libexec/fw-prepare-boot @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "initramfs fwupdater.gz" >> /boot/config.txt + diff --git a/board/raspberrypi/overlay/usr/libexec/fw-restore-boot-cfg b/board/raspberrypi/overlay/usr/libexec/fw-restore-boot-cfg new file mode 100755 index 0000000000..628189ebf6 --- /dev/null +++ b/board/raspberrypi/overlay/usr/libexec/fw-restore-boot-cfg @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Usage: $0 " 1>&2 + exit -1 +fi + +old_boot=$1 +cp $old_boot/config.txt /boot + diff --git a/board/raspberrypi2/overlay/usr/libexec/fw-prepare-boot b/board/raspberrypi2/overlay/usr/libexec/fw-prepare-boot new file mode 100755 index 0000000000..e114525d86 --- /dev/null +++ b/board/raspberrypi2/overlay/usr/libexec/fw-prepare-boot @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "initramfs fwupdater.gz" >> /boot/config.txt + diff --git a/board/raspberrypi2/overlay/usr/libexec/fw-restore-boot-cfg b/board/raspberrypi2/overlay/usr/libexec/fw-restore-boot-cfg new file mode 100755 index 0000000000..628189ebf6 --- /dev/null +++ b/board/raspberrypi2/overlay/usr/libexec/fw-restore-boot-cfg @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Usage: $0 " 1>&2 + exit -1 +fi + +old_boot=$1 +cp $old_boot/config.txt /boot + diff --git a/board/raspberrypi3/overlay/usr/libexec/fw-prepare-boot b/board/raspberrypi3/overlay/usr/libexec/fw-prepare-boot new file mode 100755 index 0000000000..e114525d86 --- /dev/null +++ b/board/raspberrypi3/overlay/usr/libexec/fw-prepare-boot @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "initramfs fwupdater.gz" >> /boot/config.txt + diff --git a/board/raspberrypi3/overlay/usr/libexec/fw-restore-boot-cfg b/board/raspberrypi3/overlay/usr/libexec/fw-restore-boot-cfg new file mode 100755 index 0000000000..628189ebf6 --- /dev/null +++ b/board/raspberrypi3/overlay/usr/libexec/fw-restore-boot-cfg @@ -0,0 +1,10 @@ +#!/bin/bash + +if [ -z "$1" ]; then + echo "Usage: $0 " 1>&2 + exit -1 +fi + +old_boot=$1 +cp $old_boot/config.txt /boot +