rpi-eeprom-update: Improve version selection for VL805

Deprecate the vl805.latest file and compare version numbers. This
ensures that the rpi-eeprom-update will never downgrade the VL805.
This commit is contained in:
Tim Gover
2019-12-12 18:59:22 +00:00
parent 7d9512c741
commit 1a0070fe30

View File

@@ -435,19 +435,17 @@ getVL805CurrentVersion()
getVL805UpdateVersion() getVL805UpdateVersion()
{ {
# The latest VL805 version is indicated by a file containing the version # The VL805 version number is an eight character hex string. Select the
# number. If the version file exists then verify that the corresponding # largest number for the newest version.
# VL805 binary exists before selecting it. # The vl805.latest version is retained for backwards compatibility with
# There are no user modifiable sections in the VL805 firmware and there # thirdparty scripts (are there any?) but it not used by this script and
# are unlikely to be many updates to it so just indicate the latest supported # is deprecated.
# version. This also avoids making any assumptions about the VLI version numbers.
VL805_UPDATE_VERSION="" VL805_UPDATE_VERSION=""
if [ -f "${FIRMWARE_IMAGE_DIR}/vl805.latest" ]; then match='.*/vl805-.*.bin'
ver="$(cat "${FIRMWARE_IMAGE_DIR}/vl805.latest")" ver=$(find "${FIRMWARE_IMAGE_DIR}" -maxdepth 1 -type f -regex "${match}" | sed 's/.*\/vl805-\([0-9a-f]*\)\.bin/\1/' | sort -r | head -n1)
if [ -f "${FIRMWARE_IMAGE_DIR}/vl805-${ver}.bin" ]; then if [ -f "${FIRMWARE_IMAGE_DIR}/vl805-${ver}.bin" ]; then
VL805_UPDATE_VERSION="${ver}" VL805_UPDATE_VERSION="${ver}"
VL805_UPDATE_IMAGE="${FIRMWARE_IMAGE_DIR}/vl805-${ver}.bin" VL805_UPDATE_IMAGE="${FIRMWARE_IMAGE_DIR}/vl805-${ver}.bin"
fi
fi fi
} }
@@ -468,7 +466,7 @@ lookupVersionInfo()
fi fi
if [ -n "${VL805_CURRENT_VERSION}" ] && [ -n "${VL805_UPDATE_VERSION}" ]; then if [ -n "${VL805_CURRENT_VERSION}" ] && [ -n "${VL805_UPDATE_VERSION}" ]; then
if [ "${VL805_CURRENT_VERSION}" != "${VL805_UPDATE_VERSION}" ]; then if [ "${VL805_CURRENT_VERSION}" \< "${VL805_UPDATE_VERSION}" ]; then
ACTION_UPDATE_VL805=1 ACTION_UPDATE_VL805=1
else else
VL805_UPDATE_IMAGE="" VL805_UPDATE_IMAGE=""