Skip to content

Commit

Permalink
rpi-eeprom-update: Update VL805 version check for boards without VL80…
Browse files Browse the repository at this point in the history
…5 EEPROM

Newer board revisions do not have a dedicated VL805 EEPROM. Instead,
the VL805 firmware is loaded from the bootloader EEPROM.
Update the version check to ignore standalone VL805 update files
on boards without a dedicated VL805 EEPROM.
  • Loading branch information
timg236 committed May 28, 2020
1 parent be3efea commit fd2ea72
Showing 1 changed file with 35 additions and 10 deletions.
45 changes: 35 additions & 10 deletions rpi-eeprom-update
Expand Up @@ -46,7 +46,16 @@ SPI_SPEED=16000
# Timestamp for first release which doesn't have a timestamp field
BOOTLOADER_FIRST_VERSION=1557513636
EEPROM_SIZE=524288
BOARD_INFO=
BOARD_REVISION=
BOARD_TYPE=

# Newer board revisions embed the VLI firmware in the bootloader EEPROM and
# there is no way to separately update the VLI firmware. Consequently,
# standalone vl805 update files do not trigger automatic updates.
# Recovery.bin and the the SPI bootloader ignore vl805.bin files on boards
# without a dedicate VL805 EEPROM.
HAVE_VL805_EEPROM=0

# Simple bootloader which is able to load start.elf in the event of a power
# cut. This runs SDRAM at low speed and may have reduced functionality but
Expand Down Expand Up @@ -252,14 +261,25 @@ getBootloaderUpdateVersion() {
}

checkDependencies() {
BOARD_REVISION="$(sed -n '/^Revision/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo)"
if [ $(((0x$BOARD_REVISION >> 23) & 1)) -ne 0 ] && [ $(((0x$BOARD_REVISION >> 12) & 15)) -eq 3 ]; then
BOARD_INFO="$(sed -n '/^Revision/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo)"
if [ $(((0x$BOARD_INFO >> 23) & 1)) -ne 0 ] && [ $(((0x$BOARD_INFO >> 12) & 15)) -eq 3 ]; then
echo "BCM2711 detected"
else
# Not a BCM2711, no EEPROMs to update.
exit ${EXIT_SUCCESS}
fi

BOARD_TYPE=$(((0x$BOARD_INFO >> 4) & 0xff))
BOARD_REVISION=$((0x$BOARD_INFO & 0xf))

if [ ${BOARD_TYPE} = 17 ] && [ ${BOARD_REVISION} \< 4 ]; then
echo "Dedicated VL805 EEPROM detected"
HAVE_VL805_EEPROM=1
else
echo "VL805 firmware in bootloader EEPROM"
HAVE_VL805_EEPROM=0
fi

if ! command -v vcgencmd > /dev/null; then
die "vcgencmd not found. On Debian, try installing the libraspberrypi-bin package."
fi
Expand All @@ -270,8 +290,8 @@ checkDependencies() {

# If a board revision specific firmware directory is defined then use that
# in preference to the generic directory.
if [ -d "${FIRMWARE_IMAGE_DIR}-${BOARD_REVISION}" ]; then
FIRMWARE_IMAGE_DIR="${FIRMWARE_IMAGE_DIR}-${BOARD_REVISION}"
if [ -d "${FIRMWARE_IMAGE_DIR}-${BOARD_INFO}" ]; then
FIRMWARE_IMAGE_DIR="${FIRMWARE_IMAGE_DIR}-${BOARD_INFO}"
fi

if vcgencmd bootloader_config | grep -qi "Command not registered"; then
Expand Down Expand Up @@ -505,20 +525,25 @@ lookupVersionInfo()
getBootloaderUpdateVersion

getVL805CurrentVersion
getVL805UpdateVersion

if [ "${BOOTLOADER_UPDATE_VERSION}" -gt "${BOOTLOADER_CURRENT_VERSION}" ]; then
ACTION_UPDATE_BOOTLOADER=1
else
BOOTLOADER_UPDATE_IMAGE=""
fi

if [ -n "${VL805_CURRENT_VERSION}" ] && [ -n "${VL805_UPDATE_VERSION}" ]; then
if [ "${VL805_CURRENT_VERSION}" \< "${VL805_UPDATE_VERSION}" ]; then
ACTION_UPDATE_VL805=1
else
VL805_UPDATE_IMAGE=""
if [ "${HAVE_VL805_EEPROM}" = 1 ]; then
getVL805UpdateVersion
if [ -n "${VL805_CURRENT_VERSION}" ] && [ -n "${VL805_UPDATE_VERSION}" ]; then
if [ "${VL805_CURRENT_VERSION}" \< "${VL805_UPDATE_VERSION}" ]; then
ACTION_UPDATE_VL805=1
else
VL805_UPDATE_IMAGE=""
fi
fi
else
VL805_UPDATE_VERSION="${VL805_CURRENT_VERSION}"
ACTION_UPDATE_VL805=0
fi
}

Expand Down

0 comments on commit fd2ea72

Please sign in to comment.