From 95ba7b50eb538761103b2f6bdb5f0bfe488be812 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Thu, 24 Oct 2019 12:47:06 +0100 Subject: [PATCH 1/3] Tweak update status for BOOTLOADER, VL805 Make up-to-date message specific to bootloader or vl805 and indicate if the tool was not run as root. --- rpi-eeprom-update | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index 49f39b6..d313b26 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -231,7 +231,7 @@ checkDependencies() { fi if [ ! -d "${FIRMWARE_IMAGE_DIR}" ]; then - die "Bootloader updates directory ${FIRMWARE_IMAGE_DIR} not found." + die "EEPROM updates directory ${FIRMWARE_IMAGE_DIR} not found." fi if ! command -v vl805 -h > /dev/null 2>&1; then @@ -322,10 +322,25 @@ EOF printVersions() { - echo "BOOTLOADER" + if [ "${ACTION_UPDATE_BOOTLOADER}" = 1 ]; then + echo "BOOTLOADER: update required" + else + echo "BOOTLOADER: up-to-date" + fi + echo "CURRENT: $(date -u "-d@${BOOTLOADER_CURRENT_VERSION}") (${BOOTLOADER_CURRENT_VERSION})" echo " LATEST: $(date -u "-d@${BOOTLOADER_UPDATE_VERSION}") (${BOOTLOADER_UPDATE_VERSION})" - echo "VL805" + + if [ "${ACTION_UPDATE_VL805}" = 1 ]; then + echo "VL805: update required" + else + if [ "$(id -u)" = "0" ]; then + echo "VL805: up-to-date" + else + echo "VL805: version unknown. Try sudo rpi-eeprom-update" + fi + fi + echo "CURRENT: ${VL805_CURRENT_VERSION}" echo " LATEST: ${VL805_UPDATE_VERSION}" } @@ -424,9 +439,9 @@ checkAndApply() echo "*** INSTALLING EEPROM UPDATES ***" printVersions applyUpdate - echo "Bootloader and/or VL805 EEPROM update pending. Please reboot to apply the update." + echo "EEPROM updates pending. Please reboot to apply the update." else - echo "Bootloader and VL805 EEPROMs are up to date. $(date -d@${BOOTLOADER_CURRENT_VERSION})" + printVersions fi } @@ -473,7 +488,6 @@ checkVersion() write_status_info "EXIT_UPDATE_REQUIRED" exit ${EXIT_UPDATE_REQUIRED} else - echo "Bootloader EEPROM is up to date" printVersions write_status_info "EXIT_SUCCESS" exit ${EXIT_SUCCESS} From 5c9a0cf40d4e948c263c0e3fffea1c1823c0401f Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Thu, 24 Oct 2019 13:49:00 +0100 Subject: [PATCH 2/3] rpi-eeprom-update: Check for vcmailbox, vcgencmd, dtparam, dtoverlay Check for these commands and issue an error indicating how to fix this on Debian. These are all installed by default on Raspbian but this script might be re-used in other-systems e.g. custom busybox builds. --- rpi-eeprom-update | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index d313b26..9f5a3de 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -20,6 +20,7 @@ ENABLE_VL805_UPDATES=${ENABLE_VL805_UPDATES:-1} USE_FLASHROM=${USE_FLASHROM:-0} RECOVERY_BIN=${RECOVERY_BIN:-${FIRMWARE_ROOT}/${FIRMWARE_RELEASE_STATUS}/recovery.bin} BOOTFS=${BOOTFS:-/boot} +VCMAILBOX=${VCMAILBOX:-/opt/vc/bin/vcmailbox} EXIT_SUCCESS=0 EXIT_UPDATE_REQUIRED=1 @@ -161,7 +162,7 @@ applyUpdate() { if [ -f "${BOOTLOADER_UPDATE_IMAGE}" ]; then # Bootloader EEPROM chip-select is muxed with audio pin so disable audio # LDO first to avoid sending noise to analog audio. - /opt/vc/bin/vcmailbox 0x00030056 4 4 0 > /dev/null || true + "${VCMAILBOX}" 0x00030056 4 4 0 > /dev/null || true dtparam audio=off # Switch the SPI pins to boot EEPROM @@ -176,7 +177,7 @@ applyUpdate() { dtparam -R spi-gpio40-45 dtparam audio=on - /opt/vc/bin/vcmailbox 0x00030056 4 4 1 > /dev/null || true + ${VCMAILBOX} 0x00030056 4 4 1 > /dev/null || true fi if [ -f "${VL805_UPDATE_IMAGE}" ]; then @@ -223,6 +224,10 @@ getBootloaderUpdateVersion() { } checkDependencies() { + if ! command -v vcgencmd > /dev/null; then + die "vcgencmd not found. On Debian, try installing the libraspberrypi-bin package." + fi + CPU_VER="$(vcgencmd otp_dump | grep 30: | cut -c8)" if [ "${CPU_VER}" != "3" ]; then @@ -234,24 +239,36 @@ checkDependencies() { die "EEPROM updates directory ${FIRMWARE_IMAGE_DIR} not found." fi - if ! command -v vl805 -h > /dev/null 2>&1; then - die "vl805 command not found" + if ! command -v vl805 > /dev/null; then + die "vl805 command not found. On Debian, try reinstalling the rpi-eeprom package." fi if vcgencmd bootloader_config | grep -qi "Command not registered"; then die "vcgencmd: 'bootloader_config' command not supported. Please update VC firmware and reboot." fi - if ! command -v sha256sum > /dev/null 2>&1; then + if ! command -v sha256sum > /dev/null; then die "sha256sum not found. On Debian, try installing the coreutilities package" fi - if ! command -v flashrom > /dev/null 2>&1; then - [ "${USE_FLASHROM}" = 0 ] || die "flashrom not found. On Debian, try installing the flashrom package." + if ! command -v flashrom > /dev/null && [ "${USE_FLASHROM}" = 1 ]; then + die "flashrom not found. On Debian, try installing the flashrom package." fi - if [ "${USE_FLASHROM}" = 0 ]; then - [ -f "${RECOVERY_BIN}" ] || die "${RECOVERY_BIN} not found." + if [ ! -x "${VCMAILBOX}" ] && [ "${USE_FLASHROM}" = 1 ]; then + die "vcmailbox not found. On Debian, try installing the libraspberrypi-bin package." + fi + + if ! command -v dtparam > /dev/null && [ "${USE_FLASHROM}" = 1 ]; then + die "dtparam not found. On Debian, try installing the libraspberrypi-bin package." + fi + + if ! command -v dtoverlay > /dev/null && [ "${USE_FLASHROM}" = 1 ]; then + die "dtoverlay not found. On Debian, try installing the libraspberrypi-bin package." + fi + + if [ "${USE_FLASHROM}" = 0 ] && [ ! -f "${RECOVERY_BIN}" ]; then + die "${RECOVERY_BIN} not found." fi } From 439192768ca47b52738df40a4f772732ed881d80 Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Mon, 28 Oct 2019 13:35:10 +0000 Subject: [PATCH 3/3] 2.1-1 release --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index 29347ee..5ab243b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +rpi-eeprom (2.1-1) buster; urgency=medium + + [ Tim Gover ] + * Tweak update status for BOOTLOADER, VL805 + * rpi-eeprom-update: Check for vcmailbox, vcgencmd, dtparam, dtoverlay + + -- Serge Schneider Mon, 28 Oct 2019 13:35:00 +0000 + rpi-eeprom (2.0-1) buster; urgency=medium [ MilhouseVH ]