diff --git a/firmware/beta/pieeprom-2021-02-16.bin b/firmware/beta/pieeprom-2021-02-16.bin new file mode 100644 index 0000000..7413a3f Binary files /dev/null and b/firmware/beta/pieeprom-2021-02-16.bin differ diff --git a/firmware/beta/recovery.bin b/firmware/beta/recovery.bin index a5864e2..8e30d95 100644 Binary files a/firmware/beta/recovery.bin and b/firmware/beta/recovery.bin differ diff --git a/firmware/release-notes.md b/firmware/release-notes.md index b2273cd..19c1ba8 100644 --- a/firmware/release-notes.md +++ b/firmware/release-notes.md @@ -3,7 +3,13 @@ USB MSD boot also requires the firmware from Raspberry Pi OS 2020-08-20 or newer. https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md -## 2021-01-16 - Fix 1V8 SD voltage reset for Pi 4B R1.1 LATEST + BETA +## 2021-02-16 - Change VC version info & TFTP fix - BETA + * Display the VC_BUILD strings instead of the sha256 of the .elf file so that + the information is the same as "vcgencmd version" + * Change TFTP to ACK data blocks which it has already ACK'd instead of ignoring them. + * Change network boot to use the same "RXID" configuration as the 5.10 kernel. + +## 2021-01-16 - Fix 1V8 SD voltage reset for Pi 4B R1.1 - LATEST + BETA * Fix regression for GPIO expander reset change which caused PMIC reset to get card out of 1V8 mode to be missed. diff --git a/firmware/vl805 b/firmware/vl805 deleted file mode 100755 index 585f318..0000000 Binary files a/firmware/vl805 and /dev/null differ diff --git a/rpi-eeprom-config b/rpi-eeprom-config index 6ce96a4..79322e1 100755 --- a/rpi-eeprom-config +++ b/rpi-eeprom-config @@ -32,6 +32,15 @@ FILE_HDR_LEN = 20 FILENAME_LEN = 12 TEMP_DIR = None +def rpi4(): + compatible_path = "/sys/firmware/devicetree/base/compatible" + if os.path.exists(compatible_path): + with open(compatible_path, "rb") as f: + compatible = f.read().decode('utf-8') + if "bcm2711" in compatible: + return True + return False + def exit_handler(): """ Delete any temporary files. @@ -327,10 +336,12 @@ images. parser.add_argument('eeprom', nargs='?', help='Name of EEPROM file to use as input') args = parser.parse_args() - if (args.edit or args.apply is not None) and os.getuid() != 0: exit_error("--edit/--apply must be run as root") + if (args.edit or args.apply is not None) and not rpi4(): + exit_error("--edit/--apply must run on a Raspberry Pi 4") + if args.edit: edit_config(args.eeprom) elif args.apply is not None: diff --git a/rpi-eeprom-update b/rpi-eeprom-update index 09ccda8..332d39c 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -28,11 +28,11 @@ FIRMWARE_RELEASE_STATUS=${FIRMWARE_RELEASE_STATUS:-default} FIRMWARE_IMAGE_DIR=${FIRMWARE_IMAGE_DIR:-${FIRMWARE_ROOT}/${FIRMWARE_RELEASE_STATUS}} FIRMWARE_BACKUP_DIR=${FIRMWARE_BACKUP_DIR:-/var/lib/raspberrypi/bootloader/backup} 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} CM4_ENABLE_RPI_EEPROM_UPDATE=${CM4_ENABLE_RPI_EEPROM_UPDATE:-0} +RPI_EEPROM_UPDATE_CONFIG_TOOL="${RPI_EEPROM_UPDATE_CONFIG_TOOL:-raspi-config}" DT_BOOTLOADER_TS=${DT_BOOTLOADER_TS:-/proc/device-tree/chosen/bootloader/build-timestamp} @@ -60,10 +60,6 @@ BOARD_TYPE= # 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 -# should be enough to run flashrom again. - TMP_EEPROM_IMAGE="" TMP_BOOTFS_MNT="" @@ -258,43 +254,9 @@ applyUpdate() { ) || die "Unable to validate EEPROM image package checksums" fi - if [ "${USE_FLASHROM}" = 0 ]; then - applyRecoveryUpdate - return - fi - - if [ -f "${BOOTLOADER_UPDATE_IMAGE}" ]; then - echo "WARNING: USE_FLASHROM is deprecated." - # Bootloader EEPROM chip-select is muxed with audio pin so disable audio - # LDO first to avoid sending noise to analog audio. - "${VCMAILBOX}" 0x00030056 4 4 0 > /dev/null || true - dtparam audio=off - - # Switch the SPI pins to boot EEPROM - dtoverlay spi-gpio40-45 - modprobe spidev - modprobe spi-bcm2835 - - prepareImage "${BOOTLOADER_UPDATE_IMAGE}" - - echo "Applying bootloader update ${BOOTLOADER_UPDATE_IMAGE}" - flashrom -p "linux_spi:dev=/dev/spidev0.0,spispeed=${SPI_SPEED}" -w "${TMP_EEPROM_IMAGE}" || die "flashrom EEPROM update failed" - - dtparam -R spi-gpio40-45 - dtparam audio=on - ${VCMAILBOX} 0x00030056 4 4 1 > /dev/null || true - fi - - if [ -f "${VL805_UPDATE_IMAGE}" ]; then - echo "Applying VL805 image ${VL805_UPDATE_IMAGE}" - vl805 -w "${VL805_UPDATE_IMAGE}" - fi - - echo "Applying bootloader update ${BOOTLOADER_UPDATE_IMAGE}" + applyRecoveryUpdate } -# Use the version reported by the loaded EEPROM instead of attempting to retrieve -# this via flashrom to avoid unnecessary audio glitches. BOOTLOADER_CURRENT_VERSION= getBootloaderCurrentVersion() { if [ -f "${DT_BOOTLOADER_TS}" ]; then @@ -345,6 +307,7 @@ checkDependencies() { echo "BCM2711 detected" else # Not a BCM2711, no EEPROMs to update. + echo "This tool only works with a Raspberry Pi 4" exit ${EXIT_SUCCESS} fi @@ -353,7 +316,7 @@ checkDependencies() { if [ ${BOARD_TYPE} -eq 20 ] && [ "${CM4_ENABLE_RPI_EEPROM_UPDATE}" != '1' ]; then # For CM4, USB device boot is the recommended method for EEPROM updates. - echo "rpi-eeprom-update is not enabled by default on CM4" + echo "rpi-eeprom-update is not enabled by default on CM4. Run with -h for more information." exit ${EXIT_SUCCESS} fi @@ -365,11 +328,15 @@ checkDependencies() { HAVE_VL805_EEPROM=0 fi + if ! command -v lspci > /dev/null; then + die "lspci not found. Try installing the pciutils package." + fi + # vcgencmd bootloader_version is deprecated. Use device-tree if available to # reduce the number of dependencies on VCHI. if ! [ -f "${DT_BOOTLOADER_TS}" ]; then if ! command -v vcgencmd > /dev/null; then - die "vcgencmd not found. On Debian, try installing the libraspberrypi-bin package." + die "vcgencmd not found. Try installing the libraspberrypi-bin package." fi fi @@ -388,26 +355,10 @@ checkDependencies() { fi if ! command -v sha256sum > /dev/null; then - die "sha256sum not found. On Debian, try installing the coreutilities package" + die "sha256sum not found. Try installing the coreutilities package." fi - if ! command -v flashrom > /dev/null && [ "${USE_FLASHROM}" = 1 ]; then - die "flashrom not found. On Debian, try installing the flashrom package." - fi - - 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 + if [ ! -f "${RECOVERY_BIN}" ]; then die "${RECOVERY_BIN} not found." fi } @@ -473,21 +424,6 @@ configuration file before it is applied to the new image. The modified output must contain at least 3 lines and should contain WAKE_ON_GPIO and POWER_OFF_ON_HALT settings. -USE_FLASHROM - -USE_FLASHROM is deprecated and there is no support for this. The muxing -of the SPI pins causes too many issues for this to ever be reliable. - -The flashrom update mechanism may be enabled by setting USE_FLASHROM=1. This -also selects the vl805 tool instead of using recovery.bin to perform the -update. This may be desirable if an immediate update is required or if an -SD card is not present. -However, this not recommended because the SPI pins are muxed with audio and other -device drivers may be using SPI (e.g. HATs). This is also not safe in the -event of a power failure during the update of the EEPROM. -Changing the VL805 firmware whilst USB devices are attached may also cause -those devices to stop working until after the system is reboot. - FIRMWARE_RELEASE_STATUS Specifies the release status of the firmware to apply. @@ -539,12 +475,40 @@ The syntax is the same as config.txt See online documentation for the list of pa The official documentation for the Raspberry Pi bootloader EEPROM is available at https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md +Compute Module 4 (CM4): + +CM4 is designed to support embedded applications where physical access to the CM4 +may be limited. An invalid bootloader configuration or software bug could +cause the system to fail to boot so automatic updates are disabled. We also +recommend write-protecting the SPI EPPROM after flashing it using usbboot. + +CM4 bootloader and EEPROM update instructions: + https://www.raspberrypi.org/documentation/hardware/computemodule/cm-emmc-flashing.md + +usbboot instructions for flashing CM4 EMMC and bootloader EEPROM: + https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md + +The CM4 ROM does not support running recovery.bin from the EMMC on CM4 so this service +is disabled by default. SELF_UPDATE from USB or Network boot is supported but this +must first be enabled by removing ENABLE_SELF_UPDATE=0 from the EEPROM config +via usbboot. + +After enabling self-update set the CM4_ENABLE_RPI_EEPROM_UPDATE=1 environment +variable or define it in /etc/default/rpi-eeprom-update. + +N.B. If there is a power failure during SELF_UPDATE the EEPROM write may fail and +usbboot must be used to flash the bootloader EEPROM. SELF_UPDATE is not recommended +for updating the bootloader on remote systems. + EOF exit ${EXIT_SUCCESS} } printVersions() { + echo "Checking for updates in ${FIRMWARE_IMAGE_DIR}" + echo "Use ${RPI_EEPROM_UPDATE_CONFIG_TOOL} to select either the default-production release or latest update." + if [ "${ACTION_UPDATE_BOOTLOADER}" = 1 ]; then echo "BOOTLOADER: update available" else @@ -553,7 +517,7 @@ printVersions() echo "CURRENT: $(date -u "-d@${BOOTLOADER_CURRENT_VERSION}") (${BOOTLOADER_CURRENT_VERSION})" echo " LATEST: $(date -u "-d@${BOOTLOADER_UPDATE_VERSION}") (${BOOTLOADER_UPDATE_VERSION})" - echo " FW DIR: ${FIRMWARE_IMAGE_DIR}" + echo "RELEASE: ${FIRMWARE_RELEASE_STATUS}" if [ "${ACTION_UPDATE_VL805}" = 1 ]; then echo "VL805: update available" @@ -597,11 +561,7 @@ getVL805CurrentVersion() # root then treat the version as unknown and skip VLI updates. VL805_CURRENT_VERSION="" if [ "$(id -u)" = "0" ]; then - if command -v lspci >/dev/null; then vlver="$(lspci -d 1106:3483 -xxx | awk '/^50:/ { print "VL805 FW version: " $5 $4 $3 $2 }')" - else - vlver="$(vl805 | grep "VL805 FW version")" - fi if [ -n "${vlver}" ]; then VL805_CURRENT_VERSION="${vlver#*: }" fi diff --git a/test/install b/test/install index ed667b6..176598a 100755 --- a/test/install +++ b/test/install @@ -22,7 +22,7 @@ CONFIG="/etc/default/rpi-eeprom-update" cp -rfv "${FIRMWARE_DIR}"/* /lib/firmware/raspberrypi/bootloader cp -fv "${script_dir}/../rpi-eeprom-config" /usr/bin cp -fv "${script_dir}/../rpi-eeprom-update" /usr/bin -cp -fv "${script_dir}/../firmware/vl805" /usr/bin +rm -f /usr/bin/vl805 cp -fv "${script_dir}/../rpi-eeprom-update-default" /etc/default/rpi-eeprom-update