diff --git a/README.md b/README.md index 0db3437..364a235 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ # rpi-eeprom This repository contains the scripts and pre-compiled binaries used to create the rpi-eeprom package which is used to update the Raspberry Pi4 bootloader EEPROM. + +# Support +For bootloader support the best place to start is the Raspberry Pi [General Users forum](https://www.raspberrypi.org/forums/viewforum.php?f=63) or for discussion of beta releases try the [Advanced Users forum](https://www.raspberrypi.org/forums/viewforum.php?f=29&sid=9bbc277968ad953e77749b255d0ce3a2) + +# Rescue image +If the Raspberry Pi4 is not booting, then it's very unlikely that the EEPROM is corrupted. If you think it has an invalid image or you want to revert to the factory setting, then download the rescue image from the Raspberry Pi [downloads page](https://www.raspberrypi.org/downloads/) + +# Bootloader documentation +* [The boot folder](https://www.raspberrypi.org/documentation/configuration/boot_folder.md) +* [Config.txt boot options](https://www.raspberrypi.org/documentation/configuration/config-txt/boot.md) +* [Bootloader EEPROM](https://www.raspberrypi.org/documentation/hardware/raspberrypi/booteeprom.md) +* [Bootloader configuration](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md) + +# Bug reports +Bootloader bugs are especially difficult to describe because there's no display. Where possible please include the following information in order to help identify the problem. +* EEPROM version (vcgencmd bootloader_version or the pieeprom filename) +* EEPROM config (from rpi-eeprom-config) +* UART trace using USB serial cable +* Wireshark trace for network boot. Filtering for DHCP and TFTP protocols or by mac-address for the Pi4 is fine. + +# BETA versions of the bootloader +If you want to try the BETA version of the bootloader then we recommend that you always try this with a spare sd-card and comfortable with using the rescue image. For debugging you may find a USB serial cable useful. + +Beta features are always documented [here](https://github.com/raspberrypi/rpi-eeprom/blob/master/firmware/raspberry_pi4_network_boot_beta.md) first. Once the configuration has stabalised then the [Bootloader configuration](https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md) will be updated, however, there's normally a bit of a delay in order to allow official documentation to be reviewed. + diff --git a/firmware/beta/pieeprom-2019-12-03.bin b/firmware/beta/pieeprom-2019-12-03.bin new file mode 100644 index 0000000..e27b2c2 Binary files /dev/null and b/firmware/beta/pieeprom-2019-12-03.bin differ diff --git a/firmware/beta/pieeprom-2020-01-09.bin b/firmware/beta/pieeprom-2020-01-09.bin new file mode 100644 index 0000000..39dcf1a Binary files /dev/null and b/firmware/beta/pieeprom-2020-01-09.bin differ diff --git a/firmware/beta/recovery.bin b/firmware/beta/recovery.bin index 512b1c4..c69c191 100644 Binary files a/firmware/beta/recovery.bin and b/firmware/beta/recovery.bin differ diff --git a/firmware/beta/vl805-000137ad.bin b/firmware/beta/vl805-000137ad.bin new file mode 100644 index 0000000..384a662 Binary files /dev/null and b/firmware/beta/vl805-000137ad.bin differ diff --git a/firmware/beta/vl805.latest b/firmware/beta/vl805.latest index 00b6cc4..600e82c 100644 --- a/firmware/beta/vl805.latest +++ b/firmware/beta/vl805.latest @@ -1 +1 @@ -000137ab +000137ad diff --git a/firmware/release-notes.md b/firmware/release-notes.md index 52e92b0..0921615 100644 --- a/firmware/release-notes.md +++ b/firmware/release-notes.md @@ -1,5 +1,13 @@ # Raspberry Pi4 bootloader EEPROM release notes +## 2020-01-09 - Git df0ff18c (BETA) RC3 + * Fix parsing of multiple menu entries in PXE options. + * Fix regression in IP address parsing + +## 2019-12-03 - Git f0d7269d4 (BETA) RC2 + * Fix handling of multiple menu options with TFTP Option43 + * Ignore unsupported modes in BOOT_ORDER instead of stopping. + ## 2019-11-18 - Git b6a7593d6 (BETA) RC1 First release candidate before this beta is moved to a stable release series. diff --git a/rpi-eeprom-config b/rpi-eeprom-config index c4471a8..ae7c385 100755 --- a/rpi-eeprom-config +++ b/rpi-eeprom-config @@ -97,10 +97,27 @@ class BootloaderImage(object): sys.stdout.write(config_bytes) def main(): - parser = argparse.ArgumentParser('RPI EEPROM config tool') - parser.add_argument('--config', help='Filename of new bootloader config') - parser.add_argument('--out', help='Filename for the EEPROM image with updated config') - parser.add_argument('eeprom', help='EEPROM filename (pieeprom.bin)') + parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, \ + description='Bootloader EEPROM configuration tool for the Raspberry Pi 4B. \ +\n\nThere are 3 operating modes: \ +\n\n1. Output the bootloader configuration stored in an EEPROM image file to \ +the screen (STDOUT): specify only the name of an EEPROM image file using the \ +\'eeprom\' option. \ +\n\n2. Output the bootloader configuration stored in an EEPROM image file to a \ +file: specify the EEPROM image file using the \'eeprom\' option, and the output \ +file using the \'--out\' option.\ +\n\n3. Insert a new bootloader configuration into an EEPROM image file: specify \ +the source EEPROM image file using the \'eeprom\' option and the bootloader \ +configuration file using the \'--config\' option. A new file which is a \ +combination of the EEPROM image file, together with the new bootloader \ +configuration file will be created - specify its name using the \'--out\' option. \ +The new bootloader configuration will replace any configuration present in the \ +source EEPROM image.\ +\n\nBootloader EEPROM images are contained in the \'rpi-eeprom-images\' package,\ + which installs them to the /lib/firmware/raspberrypi/bootloader directory.') + parser.add_argument('--config', help='Name of bootloader configuration file') + parser.add_argument('--out', help='Name of output file') + parser.add_argument('eeprom', help='Name of EEPROM file to use as input') args = parser.parse_args() image = BootloaderImage(args.eeprom, args.out) diff --git a/rpi-eeprom-update b/rpi-eeprom-update index 2f6cabb..3885894 100755 --- a/rpi-eeprom-update +++ b/rpi-eeprom-update @@ -35,6 +35,7 @@ SPI_SPEED=16000 # Timestamp for first release which doesn't have a timestamp field BOOTLOADER_FIRST_VERSION=1557513636 EEPROM_SIZE=524288 +BOARD_REVISION= # 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 @@ -57,6 +58,9 @@ cleanup() { if [ -f "${TMP_EEPROM_CONFIG}" ]; then rm -f "${TMP_EEPROM_CONFIG}" fi + if [ -f "${NEW_EEPROM_CONFIG}" ]; then + rm -f "${NEW_EEPROM_CONFIG}" + fi if [ -d "${TMP_BOOTFS_MNT}" ]; then umount "${TMP_BOOTFS_MNT}" rmdir "${TMP_BOOTFS_MNT}" @@ -64,6 +68,7 @@ cleanup() { TMP_BOOTFS_MNT= TMP_EEPROM_IMAGE= TMP_EEPROM_CONFIG= + NEW_EEPROM_CONFIG= } trap cleanup EXIT @@ -77,6 +82,7 @@ prepareImage() [ -f "${BOOTLOADER_UPDATE_IMAGE}" ] || die "EEPROM image \'${BOOTLOADER_UPDATE_IMAGE}\' not found" TMP_EEPROM_IMAGE="$(mktemp)" TMP_EEPROM_CONFIG="$(mktemp)" + NEW_EEPROM_CONFIG="$(mktemp)" mkdir -p "${FIRMWARE_BACKUP_DIR}" @@ -85,7 +91,17 @@ prepareImage() backup="${FIRMWARE_BACKUP_DIR}/pieeprom-backup-$(date +%Y%m%d-%H%M%S).conf" cp -f "${TMP_EEPROM_CONFIG}" "${backup}" - if [ "$(wc -l "${TMP_EEPROM_CONFIG}" | awk '{print $1}')" -lt 3 ]; then + if [ -x "${EEPROM_CONFIG_HOOK}" ]; then + echo "Running EEPROM config hook ${EEPROM_CONFIG_HOOK}" + if ! "${EEPROM_CONFIG_HOOK}" -u "${BOOTLOADER_UPDATE_IMAGE}" < "${TMP_EEPROM_CONFIG}" > "${NEW_EEPROM_CONFIG}"; then + echo "EEPROM config hook \"${EEPROM_CONFIG_HOOK}\" failed. Using original configuration" + cp -f "${TMP_EEPROM_CONFIG}" "${NEW_EEPROM_CONFIG}" + fi + else + cp -f "${TMP_EEPROM_CONFIG}" "${NEW_EEPROM_CONFIG}" + fi + + if [ "$(wc -l "${NEW_EEPROM_CONFIG}" | awk '{print $1}')" -lt 3 ]; then # Don't propagate empty EEPROM config files and also prevent the initial # bootloader config with WAKE_ON_GPIO=0 propgating to newer versions by # accident. @@ -97,7 +113,7 @@ prepareImage() if [ "${OVERWRITE_CONFIG}" = 0 ]; then "${script_dir}/rpi-eeprom-config" \ --out "${TMP_EEPROM_IMAGE}" \ - --config "${TMP_EEPROM_CONFIG}" "${BOOTLOADER_UPDATE_IMAGE}" + --config "${NEW_EEPROM_CONFIG}" "${BOOTLOADER_UPDATE_IMAGE}" fi } @@ -172,7 +188,7 @@ applyUpdate() { prepareImage "${BOOTLOADER_UPDATE_IMAGE}" - echo "Applying bootloaer update ${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 @@ -224,24 +240,31 @@ 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 + 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 + echo "BCM2711 detected" + else # Not a BCM2711, no EEPROMs to update. exit ${EXIT_SUCCESS} fi + if ! command -v vcgencmd > /dev/null; then + die "vcgencmd not found. On Debian, try installing the libraspberrypi-bin package." + fi + if [ ! -d "${FIRMWARE_IMAGE_DIR}" ]; then die "EEPROM updates directory ${FIRMWARE_IMAGE_DIR} not found." fi + # 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}" + fi + if ! command -v vl805 > /dev/null; then die "vl805 command not found. On Debian, try reinstalling the rpi-eeprom package." - fi + fi if vcgencmd bootloader_config | grep -qi "Command not registered"; then die "vcgencmd: 'bootloader_config' command not supported. Please update VC firmware and reboot." @@ -275,34 +298,30 @@ checkDependencies() { usage() { cat <