From 8af3f6fd6838e2c9385d18b84f3342829f921247 Mon Sep 17 00:00:00 2001 From: andrum99 <49293562+andrum99@users.noreply.github.com> Date: Tue, 10 Sep 2019 18:22:08 +0100 Subject: [PATCH 1/7] rpi-eeprom-update: minor fixes to usage --- rpi-eeprom-update | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index 1c3dc09..539d155 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -193,7 +193,7 @@ checkDependencies() { fi if vcgencmd bootloader_config | grep -qi "Command not registered"; then - die "vcgencmd: bootloader_config. not supported. Please update VC firmware" + die "vcgencmd: 'bootloader_config` command not supported. Please update VC firmware" fi if ! flashrom --version > /dev/null 2>&1; then @@ -201,14 +201,14 @@ checkDependencies() { fi if [ "${USE_FLASHROM}" = 0 ]; then - [ -f "${RECOVERY_BIN}" ] || die "${RECOVERY_BIN} not found" + [ -f "${RECOVERY_BIN}" ] || die "${RECOVERY_BIN} not found." fi } usage() { cat < Date: Tue, 10 Sep 2019 18:28:17 +0100 Subject: [PATCH 2/7] fix quotation mark --- rpi-eeprom-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index 539d155..3d95e8a 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -193,7 +193,7 @@ checkDependencies() { fi if vcgencmd bootloader_config | grep -qi "Command not registered"; then - die "vcgencmd: 'bootloader_config` command not supported. Please update VC firmware" + die "vcgencmd: 'bootloader_config' command not supported. Please update VC firmware" fi if ! flashrom --version > /dev/null 2>&1; then From 79a58d7469799ca3e225604b162561db19c09b5d Mon Sep 17 00:00:00 2001 From: andrum99 <49293562+andrum99@users.noreply.github.com> Date: Tue, 10 Sep 2019 18:41:15 +0100 Subject: [PATCH 3/7] getLatestCriticalUpdate -> getUpdateVersion Function does not necessarily check for latest version. Also, it does not actually get the update, just the version, so rename function to 'getUpdateVersion' to match 'getCurrentVersion'. Similarly with 2 variable names. --- rpi-eeprom-update | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index 3d95e8a..4cae2da 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -168,15 +168,15 @@ getCurrentVersion() { } # Set to the latest critical firmware version -CRITICAL_UPDATE_IMAGE="" -CRITICAL_UPDATE_VERSION=0 -getLatestCriticalUpdate() { - CRITICAL_UPDATE_VERSION=0 +UPDATE_IMAGE="" +UPDATE_VERSION=0 +getUpdateVersion() { + UPDATE_VERSION=0 match=".*/pieeprom-[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].bin" latest="$(find "${FIRMWARE_IMAGE_DIR}" -maxdepth 1 -type f -size "${EEPROM_SIZE}c" -regex "${match}" | sort -r | head -n1)" if [ -f "${latest}" ]; then - CRITICAL_UPDATE_VERSION=$(strings "${latest}" | grep BUILD_TIMESTAMP | sed 's/.*=//g') - CRITICAL_UPDATE_IMAGE="${latest}" + UPDATE_VERSION=$(strings "${latest}" | grep BUILD_TIMESTAMP | sed 's/.*=//g') + UPDATE_IMAGE="${latest}" fi } @@ -189,7 +189,7 @@ checkDependencies() { fi if [ ! -d "${FIRMWARE_IMAGE_DIR}" ]; then - die "Bootloader critical updates directory ${FIRMWARE_IMAGE_DIR} not found." + die "Bootloader updates directory ${FIRMWARE_IMAGE_DIR} not found." fi if vcgencmd bootloader_config | grep -qi "Command not registered"; then @@ -251,7 +251,7 @@ rpi-eeprom-update [options]... [FILE] sudo rpi-eeprom-update -d -f ./pieeprom-new.bin The syntax is the same as config.txt but section filters etc are not supported. See - online documentation for the list of paramters. + online documentation for the list of parameters. The official documentation for the Raspberry Pi bootloader EEPROM is available at https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md @@ -292,12 +292,12 @@ findBootFS() checkAndApply() { getCurrentVersion - getLatestCriticalUpdate + getUpdateVersion - if [ "${CRITICAL_UPDATE_VERSION}" -gt "${CURRENT_VERSION}" ]; then - printVersions "${CURRENT_VERSION}" "${CRITICAL_UPDATE_VERSION}" + if [ "${UPDATE_VERSION}" -gt "${CURRENT_VERSION}" ]; then + printVersions "${CURRENT_VERSION}" "${UPDATE_VERSION}" echo "*** INSTALLING REQUIRED UPDATE ***" - applyUpdate "${CRITICAL_UPDATE_IMAGE}" + applyUpdate "${UPDATE_IMAGE}" echo "Bootloader EEPROM update pending. Please reboot to apply the update." else echo "Bootloader EEPROM is up to date. $(date -d@${CURRENT_VERSION})" @@ -330,16 +330,16 @@ removePreviousUpdates() checkVersion() { getCurrentVersion - getLatestCriticalUpdate - if [ "${CRITICAL_UPDATE_VERSION}" -gt "${CURRENT_VERSION}" ]; then + getLatestVersion + if [ "${UPDATE_VERSION}" -gt "${CURRENT_VERSION}" ]; then echo "*** UPDATE REQUIRED ***" - printVersions "${CURRENT_VERSION}" "${CRITICAL_UPDATE_VERSION}" - write_status_info EXIT_UPDATE_REQUIRED "${CURRENT_VERSION}" "${CRITICAL_UPDATE_VERSION}" + printVersions "${CURRENT_VERSION}" "${UPDATE_VERSION}" + write_status_info EXIT_UPDATE_REQUIRED "${CURRENT_VERSION}" "${UPDATE_VERSION}" exit ${EXIT_UPDATE_REQUIRED} else echo "Bootloader EEPROM is up to date" - printVersions "${CURRENT_VERSION}" "${CRITICAL_UPDATE_VERSION}" - write_status_info EXIT_SUCCESS "${CURRENT_VERSION}" "${CRITICAL_UPDATE_VERSION}" + printVersions "${CURRENT_VERSION}" "${UPDATE_VERSION}" + write_status_info EXIT_SUCCESS "${CURRENT_VERSION}" "${UPDATE_VERSION}" exit ${EXIT_SUCCESS} fi } From bf0c89afa1d523226cfb7a48eefeb81a1f44c02d Mon Sep 17 00:00:00 2001 From: andrum99 <49293562+andrum99@users.noreply.github.com> Date: Tue, 10 Sep 2019 18:42:44 +0100 Subject: [PATCH 4/7] fix comment --- rpi-eeprom-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index 4cae2da..5a70f70 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -167,7 +167,7 @@ getCurrentVersion() { fi } -# Set to the latest critical firmware version +# Find latest applicable update version UPDATE_IMAGE="" UPDATE_VERSION=0 getUpdateVersion() { From 016c50258bccb56fecd382e7eb7621c63d11dbe7 Mon Sep 17 00:00:00 2001 From: andrum99 <49293562+andrum99@users.noreply.github.com> Date: Tue, 10 Sep 2019 18:44:15 +0100 Subject: [PATCH 5/7] fix call to getUpdateVersion --- rpi-eeprom-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index 5a70f70..c93e546 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -330,7 +330,7 @@ removePreviousUpdates() checkVersion() { getCurrentVersion - getLatestVersion + getUpdateVersion if [ "${UPDATE_VERSION}" -gt "${CURRENT_VERSION}" ]; then echo "*** UPDATE REQUIRED ***" printVersions "${CURRENT_VERSION}" "${UPDATE_VERSION}" From 06ff41d5afa9e77a7e9cda46d46b5cf1bee01ec1 Mon Sep 17 00:00:00 2001 From: andrum99 <49293562+andrum99@users.noreply.github.com> Date: Tue, 10 Sep 2019 18:46:13 +0100 Subject: [PATCH 6/7] add colons to usage --- rpi-eeprom-update | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index c93e546..59b5a05 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -241,13 +241,14 @@ rpi-eeprom-update [options]... [FILE] -j Write status information using JSON notation -m Write status information to the given file when run without -a or -f - To extract the configuration file from an EEPROM image + + To extract the configuration file from an EEPROM image: rpi-eeprom-config pieeprom.bin --out bootconf.txt - To update the configuration file in an EEPROM image + To update the configuration file in an EEPROM image: rpi-eeprom-config pieeprom.bin --config bootconf.txt --out pieeprom-new.bin - To flash the new image + To flash the new image: sudo rpi-eeprom-update -d -f ./pieeprom-new.bin The syntax is the same as config.txt but section filters etc are not supported. See From f70b6745d18e11bf9438c87333af06b9d9d8a66b Mon Sep 17 00:00:00 2001 From: andrum99 <49293562+andrum99@users.noreply.github.com> Date: Tue, 10 Sep 2019 21:41:00 +0100 Subject: [PATCH 7/7] usage: critical -> applicable --- rpi-eeprom-update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index 59b5a05..76a261f 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -232,7 +232,7 @@ rpi-eeprom-update [options]... [FILE] -a Install the latest update if necessary -d Use the default bootloader config instead of migrating the current settings - -f Install the given file instead of the latest critical update + -f Install the given file instead of the latest applicable update Ignores the FREEZE_VERSION flag in bootloader and is intended for manual firmware updates. WARNING: This command should only be run from console mode in order to