mirror of
https://github.com/raspberrypi/rpi-eeprom.git
synced 2026-01-21 06:13:33 +08:00
rpi-eeprom-update: Display a warning when the bootloader is downgraded
Display a warning if the bootloader version is downgraded. This can happen when swapping boot-media and the bootloader configuration is changed from an OS with an old version of the rpi-eeprom package. Remove the duplicated "update pending" and "to cancel update" messages.
This commit is contained in:
@@ -118,8 +118,6 @@ def apply_update(config, eeprom=None, config_src=None):
|
|||||||
sys.stdout.write("Updating bootloader EEPROM\n image: %s\nconfig_src: %s\nconfig: %s\n%s\n%s\n%s\n" %
|
sys.stdout.write("Updating bootloader EEPROM\n image: %s\nconfig_src: %s\nconfig: %s\n%s\n%s\n%s\n" %
|
||||||
(eeprom_image, config_src, config, '#' * 80, config_str, '#' * 80))
|
(eeprom_image, config_src, config, '#' * 80, config_str, '#' * 80))
|
||||||
|
|
||||||
sys.stdout.write("\n*** To cancel this update run 'sudo rpi-eeprom-update -r' ***\n\n")
|
|
||||||
|
|
||||||
# Ignore APT package checksums so that this doesn't fail when used
|
# Ignore APT package checksums so that this doesn't fail when used
|
||||||
# with EEPROMs with configs delivered outside of APT.
|
# with EEPROMs with configs delivered outside of APT.
|
||||||
# The checksums are really just a safety check for automatic updates.
|
# The checksums are really just a safety check for automatic updates.
|
||||||
|
|||||||
@@ -174,8 +174,18 @@ applyRecoveryUpdate()
|
|||||||
{
|
{
|
||||||
[ -n "${BOOTLOADER_UPDATE_IMAGE}" ] || [ -n "${VL805_UPDATE_IMAGE}" ] || die "No update images specified"
|
[ -n "${BOOTLOADER_UPDATE_IMAGE}" ] || [ -n "${VL805_UPDATE_IMAGE}" ] || die "No update images specified"
|
||||||
|
|
||||||
|
getBootloaderCurrentVersion
|
||||||
|
BOOTLOADER_UPDATE_VERSION=$(strings "${BOOTLOADER_UPDATE_IMAGE}" | grep BUILD_TIMESTAMP | sed 's/.*=//g')
|
||||||
|
if [ "${BOOTLOADER_CURRENT_VERSION}" -gt "${BOOTLOADER_UPDATE_VERSION}" ]; then
|
||||||
|
echo " WARNING: Installing an older bootloader version."
|
||||||
|
echo " Update the rpi-eeprom package to fetch the latest bootloader images."
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
echo " CURRENT: $(date -u "-d@${BOOTLOADER_CURRENT_VERSION}") (${BOOTLOADER_CURRENT_VERSION})"
|
||||||
|
echo " UPDATE: $(date -u "-d@${BOOTLOADER_UPDATE_VERSION}") (${BOOTLOADER_UPDATE_VERSION})"
|
||||||
|
|
||||||
findBootFS
|
findBootFS
|
||||||
echo "BOOTFS ${BOOTFS}"
|
echo " BOOTFS: ${BOOTFS}"
|
||||||
|
|
||||||
# A '.sig' file is created so that recovery.bin can check that the
|
# A '.sig' file is created so that recovery.bin can check that the
|
||||||
# EEPROM image has not been corrupted (e.g. SD card corruption).
|
# EEPROM image has not been corrupted (e.g. SD card corruption).
|
||||||
@@ -232,6 +242,10 @@ applyRecoveryUpdate()
|
|||||||
|
|
||||||
cp -f "${RECOVERY_BIN}" "${BOOTFS}/recovery.bin" \
|
cp -f "${RECOVERY_BIN}" "${BOOTFS}/recovery.bin" \
|
||||||
|| die "Failed to copy ${RECOVERY_BIN} to ${BOOTFS}"
|
|| die "Failed to copy ${RECOVERY_BIN} to ${BOOTFS}"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "EEPROM updates pending. Please reboot to apply the update."
|
||||||
|
echo "To cancel a pending update run \"sudo rpi-eeprom-update -r\"."
|
||||||
}
|
}
|
||||||
|
|
||||||
applyUpdate() {
|
applyUpdate() {
|
||||||
@@ -658,9 +672,6 @@ checkAndApply()
|
|||||||
|
|
||||||
printVersions
|
printVersions
|
||||||
applyUpdate
|
applyUpdate
|
||||||
echo ""
|
|
||||||
echo "EEPROM updates pending. Please reboot to apply the update."
|
|
||||||
echo "To cancel a pending update run \"sudo rpi-eeprom-update -r\"."
|
|
||||||
else
|
else
|
||||||
printVersions
|
printVersions
|
||||||
fi
|
fi
|
||||||
@@ -670,6 +681,7 @@ fileUpdate()
|
|||||||
{
|
{
|
||||||
removePreviousUpdates
|
removePreviousUpdates
|
||||||
echo "*** INSTALLING ${BOOTLOADER_UPDATE_IMAGE} ${VL805_UPDATE_IMAGE} ***"
|
echo "*** INSTALLING ${BOOTLOADER_UPDATE_IMAGE} ${VL805_UPDATE_IMAGE} ***"
|
||||||
|
echo
|
||||||
|
|
||||||
if [ -n "${BOOTLOADER_UPDATE_IMAGE}" ]; then
|
if [ -n "${BOOTLOADER_UPDATE_IMAGE}" ]; then
|
||||||
[ -f "${BOOTLOADER_UPDATE_IMAGE}" ] || die "Bootloader image \"${BOOTLOADER_UPDATE_IMAGE}\" not found"
|
[ -f "${BOOTLOADER_UPDATE_IMAGE}" ] || die "Bootloader image \"${BOOTLOADER_UPDATE_IMAGE}\" not found"
|
||||||
@@ -680,7 +692,6 @@ fileUpdate()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
applyUpdate
|
applyUpdate
|
||||||
echo "EEPROM update pending. Please reboot to apply the update."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removePreviousUpdates()
|
removePreviousUpdates()
|
||||||
|
|||||||
Reference in New Issue
Block a user