mirror of
https://github.com/raspberrypi/rpi-eeprom.git
synced 2026-01-20 21:13:36 +08:00
scripts: Add support for chip-specific firmware directories
BCM2711 and BCM2712 require different EEPROM firmware and consequently the binaries have been moved to chip specific firmware directories. firmware-2711 / firmware-2712
This commit is contained in:
4
imager/2712-config/boot-conf-default.txt
Normal file
4
imager/2712-config/boot-conf-default.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[all]
|
||||||
|
BOOT_UART=1
|
||||||
|
BOOT_ORDER=0xf41
|
||||||
|
POWER_OFF_ON_HALT=0
|
||||||
5
imager/2712-config/boot-conf-network.txt
Normal file
5
imager/2712-config/boot-conf-network.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[all]
|
||||||
|
BOOT_UART=1
|
||||||
|
BOOT_ORDER=0xf21
|
||||||
|
POWER_OFF_ON_HALT=0
|
||||||
|
|
||||||
4
imager/2712-config/boot-conf-sd.txt
Normal file
4
imager/2712-config/boot-conf-sd.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
[all]
|
||||||
|
BOOT_UART=1
|
||||||
|
BOOT_ORDER=0xf41
|
||||||
|
POWER_OFF_ON_HALT=0
|
||||||
5
imager/2712-config/boot-conf-usb.txt
Normal file
5
imager/2712-config/boot-conf-usb.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[all]
|
||||||
|
BOOT_UART=1
|
||||||
|
BOOT_ORDER=0xf14
|
||||||
|
POWER_OFF_ON_HALT=0
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
script_dir=$(cd "$(dirname "$0")" && pwd)
|
|
||||||
|
|
||||||
firmware_status=${firmware_status:-"beta"}
|
|
||||||
firmware_dir=${script_dir}/../firmware/${firmware_status}
|
|
||||||
pieeprom_version=$(basename $(ls ${firmware_dir}/pieeprom-*.bin | sort -V | tail -1) .bin | cut -d- -f2-5)
|
|
||||||
vl805_version=$(basename $(ls ${firmware_dir}/vl805-*.bin | sort -V | tail -1) .bin | cut -d- -f2)
|
|
||||||
|
|
||||||
${script_dir}/make-release ${firmware_status} ${pieeprom_version} ${vl805_version} "${script_dir}" ${firmware_status}_release rpi-boot-eeprom-recovery-${firmware_status}
|
|
||||||
|
|
||||||
@@ -4,4 +4,8 @@ set -e
|
|||||||
|
|
||||||
script_dir=$(cd "$(dirname "$0")" && pwd)
|
script_dir=$(cd "$(dirname "$0")" && pwd)
|
||||||
|
|
||||||
${script_dir}/make-release critical 2023-01-11 000138c0 "${script_dir}" release rpi-boot-eeprom-recovery
|
# Pi4, Pi400, CM4, CM4-S
|
||||||
|
${script_dir}/make-release critical 2023-01-11 000138c0 "${script_dir}/2711-config" release-2711 rpi-boot-eeprom-recovery 2711
|
||||||
|
|
||||||
|
# Pi5
|
||||||
|
${script_dir}/make-release critical 2023-09-21 "" "${script_dir}/2712-config" release-2712 rpi-boot-eeprom-recovery 2712
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ gen_release() {
|
|||||||
cd "${tmp_dir}"
|
cd "${tmp_dir}"
|
||||||
cp "${script_dir}/README.txt" .
|
cp "${script_dir}/README.txt" .
|
||||||
cp "${firmware_dir}/recovery.bin" .
|
cp "${firmware_dir}/recovery.bin" .
|
||||||
|
if [ ${bcm_chip} = 2711 ]; then
|
||||||
cp "${firmware_dir}/vl805-${vl805_version}.bin" vl805.bin
|
cp "${firmware_dir}/vl805-${vl805_version}.bin" vl805.bin
|
||||||
sha256sum vl805.bin | awk '{print $1}' > vl805.sig
|
sha256sum vl805.bin | awk '{print $1}' > vl805.sig
|
||||||
|
fi
|
||||||
|
|
||||||
"${script_dir}/../rpi-eeprom-config" \
|
"${script_dir}/../rpi-eeprom-config" \
|
||||||
--config "${config}" --out pieeprom.bin \
|
--config "${config}" --out pieeprom.bin \
|
||||||
@@ -61,20 +63,26 @@ vl805_version="${3}"
|
|||||||
config_dir="${4}"
|
config_dir="${4}"
|
||||||
output_dir="${5}"
|
output_dir="${5}"
|
||||||
output_basename="${6}"
|
output_basename="${6}"
|
||||||
|
bcm_chip="${7}"
|
||||||
|
|
||||||
[ -n "${firmware_status}" ] || usage
|
[ -n "${firmware_status}" ] || usage
|
||||||
[ -n "${pieeprom_version}" ] || usage
|
[ -n "${pieeprom_version}" ] || usage
|
||||||
[ -n "${vl805_version}" ] || usage
|
|
||||||
[ -n "${config_dir}" ] || usage
|
[ -n "${config_dir}" ] || usage
|
||||||
[ -n "${output_dir}" ] || usage
|
[ -n "${output_dir}" ] || usage
|
||||||
[ -n "${output_basename}" ] || usage
|
[ -n "${output_basename}" ] || usage
|
||||||
|
[ -n "${bcm_chip}" ] || usage
|
||||||
|
|
||||||
firmware_dir=${script_dir}/../firmware/${firmware_status}
|
firmware_dir=${script_dir}/../firmware-${bcm_chip}/${firmware_status}
|
||||||
[ -d "${firmware_dir}" ] || (echo "${firmware_dir} doesn't exist" && exit 1)
|
[ -d "${firmware_dir}" ] || (echo "${firmware_dir} doesn't exist" && exit 1)
|
||||||
[ -f "${firmware_dir}/pieeprom-${pieeprom_version}.bin" ] || (echo "${firmware_status}/pieeprom-${pieeprom_version}.bin doesn't exist" && exit 1)
|
[ -f "${firmware_dir}/pieeprom-${pieeprom_version}.bin" ] || (echo "${firmware_status}/pieeprom-${pieeprom_version}.bin doesn't exist" && exit 1)
|
||||||
|
|
||||||
|
if [ "${bcm_chip}" = 2711 ]; then
|
||||||
[ -f "${firmware_dir}/vl805-${vl805_version}.bin" ] || (echo "${firmware_status}/vl805-${vl805_version}.bin doesn't exist" && exit 1)
|
[ -f "${firmware_dir}/vl805-${vl805_version}.bin" ] || (echo "${firmware_status}/vl805-${vl805_version}.bin doesn't exist" && exit 1)
|
||||||
[ -d "${config_dir}" ] || (echo "${config_dir} doesn't exist" && exit 1)
|
[ -d "${config_dir}" ] || (echo "${config_dir} doesn't exist" && exit 1)
|
||||||
tag="${pieeprom_version}-vl805-${vl805_version}"
|
tag="${pieeprom_version}-vl805-${vl805_version}"
|
||||||
|
else
|
||||||
|
tag="${pieeprom_version}"
|
||||||
|
fi
|
||||||
# use realpath to ensure paths are absolute
|
# use realpath to ensure paths are absolute
|
||||||
config_dir=$(realpath "${config_dir}")
|
config_dir=$(realpath "${config_dir}")
|
||||||
output_dir=$(realpath "${output_dir}")
|
output_dir=$(realpath "${output_dir}")
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
# Raspberry Pi 4B, 400 and CM4 bootloader EEPROM releases
|
# Raspberry Pi 4 and Raspberry Pi 5 bootloader EEPROM releases.
|
||||||
This page provides links to the production and development release images for the bootloader EEPROM on BCM2711-based Raspberry Pi computers. Normally, the
|
This page provides links to the production and development release images for the bootloader EEPROM on BCM2711 and BCM2712 based Raspberry Pi computers. Normally, the
|
||||||
bootloader is automatically updated after an APT update via the [rpi-eeprom-update](https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#automatic-updates) utility.
|
bootloader is automatically updated after an APT update via the [rpi-eeprom-update](https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#automatic-updates) utility.
|
||||||
|
|
||||||
## Release notes
|
## Release notes
|
||||||
Release notes are available [here](https://github.com/raspberrypi/rpi-eeprom/blob/master/firmware/release-notes.md).
|
Release notes are available [here](https://github.com/raspberrypi/rpi-eeprom/blob/master/firmware/release-notes.md).
|
||||||
|
|
||||||
## Default release
|
## Default release
|
||||||
The default production EEPROM image release is [2022-11-25](https://github.com/raspberrypi/rpi-eeprom/releases/tag/v2022.11.25-138a1) and can be installed via the [Raspberry Pi Imager](https://www.raspberrypi.com/software/).
|
### Raspberry Pi 4, CM4, CM4-s, Pi400
|
||||||
|
The default production EEPROM image release is [2023-01-11](https://github.com/raspberrypi/rpi-eeprom/releases/tag/v2023.01.11-138c0) and can be installed via the [Raspberry Pi Imager](https://www.raspberrypi.com/software/).
|
||||||
|
|
||||||
## USB MSD boot
|
## USB MSD boot
|
||||||
Please see the [USB mass storage boot](https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#usb-mass-storage-boot) guide.
|
Please see the [USB mass storage boot](https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#usb-mass-storage-boot) guide.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import sys
|
|||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
|
||||||
IMAGE_SIZE = 512 * 1024
|
VALID_IMAGE_SIZES = [512 * 1024, 2 * 1024 * 1024]
|
||||||
|
|
||||||
BOOTCONF_TXT = 'bootconf.txt'
|
BOOTCONF_TXT = 'bootconf.txt'
|
||||||
BOOTCONF_SIG = 'bootconf.sig'
|
BOOTCONF_SIG = 'bootconf.sig'
|
||||||
@@ -55,6 +55,15 @@ def rpi4():
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def rpi5():
|
||||||
|
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 "bcm2712" in compatible:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def exit_handler():
|
def exit_handler():
|
||||||
"""
|
"""
|
||||||
Delete any temporary files.
|
Delete any temporary files.
|
||||||
@@ -233,6 +242,7 @@ class BootloaderImage(object):
|
|||||||
"""
|
"""
|
||||||
self._filename = filename
|
self._filename = filename
|
||||||
self._sections = []
|
self._sections = []
|
||||||
|
self._image_size = 0
|
||||||
try:
|
try:
|
||||||
self._bytes = bytearray(open(filename, 'rb').read())
|
self._bytes = bytearray(open(filename, 'rb').read())
|
||||||
except IOError as err:
|
except IOError as err:
|
||||||
@@ -241,9 +251,10 @@ class BootloaderImage(object):
|
|||||||
if output is not None:
|
if output is not None:
|
||||||
self._out = open(output, 'wb')
|
self._out = open(output, 'wb')
|
||||||
|
|
||||||
if len(self._bytes) != IMAGE_SIZE:
|
self._image_size = len(self._bytes)
|
||||||
|
if self._image_size not in VALID_IMAGE_SIZES:
|
||||||
exit_error("%s: Expected size %d bytes actual size %d bytes" %
|
exit_error("%s: Expected size %d bytes actual size %d bytes" %
|
||||||
(filename, IMAGE_SIZE, len(self._bytes)))
|
(filename, self._image_size, len(self._bytes)))
|
||||||
self.parse()
|
self.parse()
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
@@ -252,7 +263,7 @@ class BootloaderImage(object):
|
|||||||
"""
|
"""
|
||||||
offset = 0
|
offset = 0
|
||||||
magic = 0
|
magic = 0
|
||||||
while offset < IMAGE_SIZE:
|
while offset < self._image_size:
|
||||||
magic, length = struct.unpack_from('>LL', self._bytes, offset)
|
magic, length = struct.unpack_from('>LL', self._bytes, offset)
|
||||||
if magic == 0x0 or magic == 0xffffffff:
|
if magic == 0x0 or magic == 0xffffffff:
|
||||||
break # EOF
|
break # EOF
|
||||||
@@ -278,7 +289,7 @@ class BootloaderImage(object):
|
|||||||
length = -1
|
length = -1
|
||||||
is_last = False
|
is_last = False
|
||||||
|
|
||||||
next_offset = IMAGE_SIZE - ERASE_ALIGN_SIZE # Don't create padding inside the bootloader scratch page
|
next_offset = self._image_size - ERASE_ALIGN_SIZE # Don't create padding inside the bootloader scratch page
|
||||||
for i in range(0, len(self._sections)):
|
for i in range(0, len(self._sections)):
|
||||||
s = self._sections[i]
|
s = self._sections[i]
|
||||||
if s.magic == FILE_MAGIC and s.filename == filename:
|
if s.magic == FILE_MAGIC and s.filename == filename:
|
||||||
@@ -306,7 +317,7 @@ class BootloaderImage(object):
|
|||||||
hdr_offset, length, is_last, next_offset = self.find_file(dst_filename)
|
hdr_offset, length, is_last, next_offset = self.find_file(dst_filename)
|
||||||
update_len = len(src_bytes) + FILE_HDR_LEN
|
update_len = len(src_bytes) + FILE_HDR_LEN
|
||||||
|
|
||||||
if hdr_offset + update_len > IMAGE_SIZE - ERASE_ALIGN_SIZE:
|
if hdr_offset + update_len > self._image_size - ERASE_ALIGN_SIZE:
|
||||||
raise Exception('No space available - image past EOF.')
|
raise Exception('No space available - image past EOF.')
|
||||||
|
|
||||||
if hdr_offset < 0:
|
if hdr_offset < 0:
|
||||||
@@ -406,10 +417,10 @@ class BootloaderImage(object):
|
|||||||
def main():
|
def main():
|
||||||
"""
|
"""
|
||||||
Utility for reading and writing the configuration file in the
|
Utility for reading and writing the configuration file in the
|
||||||
Raspberry Pi 4 bootloader EEPROM image.
|
Raspberry Pi bootloader EEPROM image.
|
||||||
"""
|
"""
|
||||||
description = """\
|
description = """\
|
||||||
Bootloader EEPROM configuration tool for the Raspberry Pi 4.
|
Bootloader EEPROM configuration tool for the Raspberry Pi 4 and Raspberry Pi 5.
|
||||||
Operating modes:
|
Operating modes:
|
||||||
|
|
||||||
1. Outputs the current bootloader configuration to STDOUT if no arguments are
|
1. Outputs the current bootloader configuration to STDOUT if no arguments are
|
||||||
@@ -493,8 +504,8 @@ See 'rpi-eeprom-update -h' for more information about the available EEPROM image
|
|||||||
if (args.edit or args.apply is not None) and os.getuid() != 0:
|
if (args.edit or args.apply is not None) and os.getuid() != 0:
|
||||||
exit_error("--edit/--apply must be run as root")
|
exit_error("--edit/--apply must be run as root")
|
||||||
|
|
||||||
if (args.edit or args.apply is not None) and not rpi4():
|
if (args.edit or args.apply is not None) and not rpi4() and not rpi5():
|
||||||
exit_error("--edit/--apply must run on a Raspberry Pi 4")
|
exit_error("--edit/--apply must run on a Raspberry Pi 4 or Raspberry Pi 5")
|
||||||
|
|
||||||
if args.edit:
|
if args.edit:
|
||||||
edit_config(args.eeprom)
|
edit_config(args.eeprom)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Raspberry Pi4 boot EEPROM updater.
|
# Raspberry Pi bootloader EEPROM updater.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -14,8 +14,7 @@ LOCAL_MODE=0
|
|||||||
if [ -n "$FIRMWARE_ROOT" ]; then
|
if [ -n "$FIRMWARE_ROOT" ]; then
|
||||||
# Provided by environment
|
# Provided by environment
|
||||||
true
|
true
|
||||||
elif [ -d /lib/firmware/raspberrypi/bootloader ]; then
|
elif [ -d /lib/firmware/raspberrypi/bootloader ] || [ -d /lib/firmware/raspberrypi/bootloader-2711 ] || [ -d /lib/firmware/raspberrypi/bootloader-2712 ]; then
|
||||||
# Default firmware root exists
|
|
||||||
FIRMWARE_ROOT=/lib/firmware/raspberrypi/bootloader
|
FIRMWARE_ROOT=/lib/firmware/raspberrypi/bootloader
|
||||||
else
|
else
|
||||||
# Work from local git checkout
|
# Work from local git checkout
|
||||||
@@ -25,10 +24,8 @@ fi
|
|||||||
|
|
||||||
# Selects the release sub-directory
|
# Selects the release sub-directory
|
||||||
FIRMWARE_RELEASE_STATUS=${FIRMWARE_RELEASE_STATUS:-default}
|
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}
|
FIRMWARE_BACKUP_DIR=${FIRMWARE_BACKUP_DIR:-/var/lib/raspberrypi/bootloader/backup}
|
||||||
ENABLE_VL805_UPDATES=${ENABLE_VL805_UPDATES:-1}
|
ENABLE_VL805_UPDATES=${ENABLE_VL805_UPDATES:-1}
|
||||||
RECOVERY_BIN=${RECOVERY_BIN:-${FIRMWARE_ROOT}/${FIRMWARE_RELEASE_STATUS}/recovery.bin}
|
|
||||||
CM4_ENABLE_RPI_EEPROM_UPDATE=${CM4_ENABLE_RPI_EEPROM_UPDATE:-0}
|
CM4_ENABLE_RPI_EEPROM_UPDATE=${CM4_ENABLE_RPI_EEPROM_UPDATE:-0}
|
||||||
RPI_EEPROM_UPDATE_CONFIG_TOOL="${RPI_EEPROM_UPDATE_CONFIG_TOOL:-raspi-config}"
|
RPI_EEPROM_UPDATE_CONFIG_TOOL="${RPI_EEPROM_UPDATE_CONFIG_TOOL:-raspi-config}"
|
||||||
|
|
||||||
@@ -43,10 +40,6 @@ RPI_EEPROM_UPDATE_CONFIG_TOOL="${RPI_EEPROM_UPDATE_CONFIG_TOOL:-raspi-config}"
|
|||||||
RPI_EEPROM_SELF_UPDATE="${RPI_EEPROM_SELF_UPDATE:-0}"
|
RPI_EEPROM_SELF_UPDATE="${RPI_EEPROM_SELF_UPDATE:-0}"
|
||||||
RPI_EEPROM_SELF_UPDATE_MIN_VER=1650968668
|
RPI_EEPROM_SELF_UPDATE_MIN_VER=1650968668
|
||||||
|
|
||||||
# Automatic, critical updates are not applied unless the current bootloader version
|
|
||||||
# is older than pieeprom-2020-09-03
|
|
||||||
BOOTLOADER_AUTO_UPDATE_MIN_VERSION="${BOOTLOADER_AUTO_UPDATE_MIN_VERSION:-1599135103}"
|
|
||||||
|
|
||||||
DT_BOOTLOADER_TS=${DT_BOOTLOADER_TS:-/proc/device-tree/chosen/bootloader/build-timestamp}
|
DT_BOOTLOADER_TS=${DT_BOOTLOADER_TS:-/proc/device-tree/chosen/bootloader/build-timestamp}
|
||||||
|
|
||||||
EXIT_SUCCESS=0
|
EXIT_SUCCESS=0
|
||||||
@@ -63,6 +56,7 @@ EEPROM_SIZE=524288
|
|||||||
BOARD_INFO=
|
BOARD_INFO=
|
||||||
BOARD_REVISION=
|
BOARD_REVISION=
|
||||||
BOARD_TYPE=
|
BOARD_TYPE=
|
||||||
|
BCM_CHIP=
|
||||||
|
|
||||||
# Newer board revisions embed the VLI firmware in the bootloader EEPROM and
|
# Newer board revisions embed the VLI firmware in the bootloader EEPROM and
|
||||||
# there is no way to separately update the VLI firmware. Consequently,
|
# there is no way to separately update the VLI firmware. Consequently,
|
||||||
@@ -314,6 +308,11 @@ getBootloaderUpdateVersion() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chipNotSupported() {
|
||||||
|
echo "This tool only works with Raspberry Pi4 and Rapberry Pi5"
|
||||||
|
exit ${EXIT_SUCCESS}
|
||||||
|
}
|
||||||
|
|
||||||
checkDependencies() {
|
checkDependencies() {
|
||||||
|
|
||||||
if [ -f "/sys/firmware/devicetree/base/system/linux,revision" ]; then
|
if [ -f "/sys/firmware/devicetree/base/system/linux,revision" ]; then
|
||||||
@@ -327,12 +326,32 @@ checkDependencies() {
|
|||||||
exit ${EXIT_SUCCESS}
|
exit ${EXIT_SUCCESS}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(((0x$BOARD_INFO >> 23) & 1)) -eq 0 ] || [ $(((0x$BOARD_INFO >> 12) & 15)) -ne 3 ]; then
|
if [ $(((0x$BOARD_INFO >> 23) & 1)) = 0 ]; then
|
||||||
# Not a BCM2711, no EEPROMs to update.
|
chipNotSupported
|
||||||
echo "This tool only works with a Raspberry Pi 4"
|
|
||||||
exit ${EXIT_SUCCESS}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $(((0x$BOARD_INFO >> 12) & 15)) = 3 ]; then
|
||||||
|
BCM_CHIP=2711
|
||||||
|
EEPROM_SIZE=524288
|
||||||
|
BOOTLOADER_AUTO_UPDATE_MIN_VERSION="${BOOTLOADER_AUTO_UPDATE_MIN_VERSION:-1599135103}"
|
||||||
|
elif [ $(((0x$BOARD_INFO >> 12) & 15)) = 4 ]; then
|
||||||
|
# BCM2712 always supports self-update so recovery.bin is only used for RPi imager
|
||||||
|
# bootloader updated SD cards or with RPIBOOT.
|
||||||
|
BCM_CHIP=2712
|
||||||
|
EEPROM_SIZE=2097152
|
||||||
|
RPI_EEPROM_SELF_UPDATE=1
|
||||||
|
BOOTLOADER_AUTO_UPDATE_MIN_VERSION="${BOOTLOADER_AUTO_UPDATE_MIN_VERSION:-1694601426}"
|
||||||
|
else
|
||||||
|
chipNotSupported
|
||||||
|
fi
|
||||||
|
|
||||||
|
FIRMWARE_IMAGE_DIR="${FIRMWARE_ROOT}-${BCM_CHIP}/${FIRMWARE_RELEASE_STATUS}"
|
||||||
|
if ! [ -d "${FIRMWARE_IMAGE_DIR}" ]; then
|
||||||
|
# Use unadorned name for backwards compatiblity
|
||||||
|
FIRMWARE_IMAGE_DIR="${FIRMWARE_ROOT}/${FIRMWARE_RELEASE_STATUS}"
|
||||||
|
fi
|
||||||
|
RECOVERY_BIN=${RECOVERY_BIN:-${FIRMWARE_IMAGE_DIR}/recovery.bin}
|
||||||
|
|
||||||
BOARD_TYPE=$(((0x$BOARD_INFO >> 4) & 0xff))
|
BOARD_TYPE=$(((0x$BOARD_INFO >> 4) & 0xff))
|
||||||
BOARD_REVISION=$((0x$BOARD_INFO & 0xf))
|
BOARD_REVISION=$((0x$BOARD_INFO & 0xf))
|
||||||
|
|
||||||
@@ -385,7 +404,7 @@ checkDependencies() {
|
|||||||
die "sha256sum not found. Try installing the coreutilities package."
|
die "sha256sum not found. Try installing the coreutilities package."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "${RECOVERY_BIN}" ]; then
|
if [ "${BCM_CHIP}" = 2711 ] && [ ! -f "${RECOVERY_BIN}" ]; then
|
||||||
die "${RECOVERY_BIN} not found."
|
die "${RECOVERY_BIN} not found."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -394,13 +413,15 @@ usage() {
|
|||||||
cat <<EOF
|
cat <<EOF
|
||||||
rpi-eeprom-update [options]... [FILE]
|
rpi-eeprom-update [options]... [FILE]
|
||||||
|
|
||||||
Bootloader EEPROM update tool for the Raspberry Pi 4.
|
Bootloader EEPROM update tool for the Raspberry Pi 4 and Raspberry Pi 5.
|
||||||
|
|
||||||
Checks whether the Raspberry Pi 4 bootloader and the VL805 USB controller
|
This script also updates the SPI EEPROM image for the VL805 USB HC
|
||||||
EEPROMs are up to date and optionally updates the EEPROMs at the next reboot.
|
firmware on early Pi4B boards where the USB firmware is stored in
|
||||||
|
a dedicated SPI EEPROM instead of embedding it in the bootloader
|
||||||
|
EEPROM. Raspberry Pi 5 uses the RP1.
|
||||||
|
|
||||||
The default update mechanism writes recovery.bin and the EEPROM update
|
The default update mechanism writes recovery.bin and the EEPROM update
|
||||||
image(s) (pieeprom.upd and vl805.bin) to the boot partition.
|
image(s) (pieeprom.upd and vl805.bin (if required)) to the boot partition.
|
||||||
The SHA256 hash of the corresponding images are written to pieeprom.sig
|
The SHA256 hash of the corresponding images are written to pieeprom.sig
|
||||||
and/or vl805.sig. This guards against file system corruption which could
|
and/or vl805.sig. This guards against file system corruption which could
|
||||||
cause the EEPROM to be flashed with an invalid image. This is not a
|
cause the EEPROM to be flashed with an invalid image. This is not a
|
||||||
@@ -541,6 +562,7 @@ printVersions()
|
|||||||
echo " RELEASE: ${FIRMWARE_RELEASE_STATUS} (${FIRMWARE_IMAGE_DIR})"
|
echo " RELEASE: ${FIRMWARE_RELEASE_STATUS} (${FIRMWARE_IMAGE_DIR})"
|
||||||
echo " Use ${RPI_EEPROM_UPDATE_CONFIG_TOOL} to change the release."
|
echo " Use ${RPI_EEPROM_UPDATE_CONFIG_TOOL} to change the release."
|
||||||
|
|
||||||
|
if [ "${BCM_CHIP}" = 2711 ]; then
|
||||||
echo ""
|
echo ""
|
||||||
if [ "${HAVE_VL805_EEPROM}" = 1 ]; then
|
if [ "${HAVE_VL805_EEPROM}" = 1 ]; then
|
||||||
echo " VL805_FW: Dedicated VL805 EEPROM"
|
echo " VL805_FW: Dedicated VL805 EEPROM"
|
||||||
@@ -559,6 +581,7 @@ printVersions()
|
|||||||
|
|
||||||
echo " CURRENT: ${VL805_CURRENT_VERSION}"
|
echo " CURRENT: ${VL805_CURRENT_VERSION}"
|
||||||
echo " LATEST: ${VL805_UPDATE_VERSION}"
|
echo " LATEST: ${VL805_UPDATE_VERSION}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
findBootFS()
|
findBootFS()
|
||||||
@@ -585,9 +608,16 @@ findBootFS()
|
|||||||
# If BOOTFS is not a directory or doesn't contain any .elf files then
|
# If BOOTFS is not a directory or doesn't contain any .elf files then
|
||||||
# it's probably not the boot partition.
|
# it's probably not the boot partition.
|
||||||
[ -d "${BOOTFS}" ] || die "BOOTFS: \"${BOOTFS}\" is not a directory"
|
[ -d "${BOOTFS}" ] || die "BOOTFS: \"${BOOTFS}\" is not a directory"
|
||||||
|
|
||||||
|
if [ "${BCM_CHIP}" = 2712 ]; then
|
||||||
|
if ! [ -e "${BOOTFS}/config.txt" ]; then
|
||||||
|
echo "WARNING: BOOTFS: \"${BOOTFS}/config.txt\" not found. Please check boot directory"
|
||||||
|
fi
|
||||||
|
else
|
||||||
if [ "$(find "${BOOTFS}/" -name "*.elf" | wc -l)" = 0 ]; then
|
if [ "$(find "${BOOTFS}/" -name "*.elf" | wc -l)" = 0 ]; then
|
||||||
echo "WARNING: BOOTFS: \"${BOOTFS}\" contains no .elf files. Please check boot directory"
|
echo "WARNING: BOOTFS: \"${BOOTFS}\" contains no .elf files. Please check boot directory"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
getVL805CurrentVersion()
|
getVL805CurrentVersion()
|
||||||
@@ -596,12 +626,15 @@ getVL805CurrentVersion()
|
|||||||
# space which is only accessible as root. If the command is not run as
|
# space which is only accessible as root. If the command is not run as
|
||||||
# root then treat the version as unknown and skip VLI updates.
|
# root then treat the version as unknown and skip VLI updates.
|
||||||
VL805_CURRENT_VERSION=""
|
VL805_CURRENT_VERSION=""
|
||||||
|
|
||||||
|
if [ "${BCM_CHIP}" = 2711 ]; then
|
||||||
if [ "$(id -u)" = "0" ]; then
|
if [ "$(id -u)" = "0" ]; then
|
||||||
vlver="$(lspci -d 1106:3483 -xxx | awk '/^50:/ { print "VL805 FW version: " $5 $4 $3 $2 }')"
|
vlver="$(lspci -d 1106:3483 -xxx | awk '/^50:/ { print "VL805 FW version: " $5 $4 $3 $2 }')"
|
||||||
if [ -n "${vlver}" ]; then
|
if [ -n "${vlver}" ]; then
|
||||||
VL805_CURRENT_VERSION="${vlver#*: }"
|
VL805_CURRENT_VERSION="${vlver#*: }"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
getVL805UpdateVersion()
|
getVL805UpdateVersion()
|
||||||
@@ -824,6 +857,7 @@ while getopts A:abdhilf:m:ju:rs option; do
|
|||||||
j) JSON_OUTPUT="yes"
|
j) JSON_OUTPUT="yes"
|
||||||
;;
|
;;
|
||||||
l)
|
l)
|
||||||
|
checkDependencies
|
||||||
getBootloaderUpdateVersion
|
getBootloaderUpdateVersion
|
||||||
echo "${BOOTLOADER_UPDATE_IMAGE}"
|
echo "${BOOTLOADER_UPDATE_IMAGE}"
|
||||||
exit 0
|
exit 0
|
||||||
@@ -834,6 +868,7 @@ while getopts A:abdhilf:m:ju:rs option; do
|
|||||||
;;
|
;;
|
||||||
r) [ "$(id -u)" = "0" ] || die "* Must be run as root - try 'sudo rpi-eeprom-update -r'"
|
r) [ "$(id -u)" = "0" ] || die "* Must be run as root - try 'sudo rpi-eeprom-update -r'"
|
||||||
echo "Removing temporary files from previous EEPROM update"
|
echo "Removing temporary files from previous EEPROM update"
|
||||||
|
checkDependencies
|
||||||
removePreviousUpdates
|
removePreviousUpdates
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
FIRMWARE_ROOT=/lib/firmware/raspberrypi/bootloader
|
FIRMWARE_ROOT=/lib/firmware/raspberrypi/bootloader
|
||||||
FIRMWARE_RELEASE_STATUS="critical"
|
FIRMWARE_RELEASE_STATUS="default"
|
||||||
FIRMWARE_IMAGE_DIR="${FIRMWARE_ROOT}/${FIRMWARE_RELEASE_STATUS}"
|
|
||||||
FIRMWARE_BACKUP_DIR="/var/lib/raspberrypi/bootloader/backup"
|
FIRMWARE_BACKUP_DIR="/var/lib/raspberrypi/bootloader/backup"
|
||||||
USE_FLASHROM=0
|
USE_FLASHROM=0
|
||||||
EEPROM_CONFIG_HOOK=
|
EEPROM_CONFIG_HOOK=
|
||||||
|
|||||||
11
test/install
11
test/install
@@ -19,9 +19,16 @@ CONFIG="/etc/default/rpi-eeprom-update"
|
|||||||
|
|
||||||
[ "$(id -u)" = "0" ] || die "$0 Must be run as root - try 'sudo $0 [-b]'"
|
[ "$(id -u)" = "0" ] || die "$0 Must be run as root - try 'sudo $0 [-b]'"
|
||||||
|
|
||||||
|
# Clear out the old firmware
|
||||||
rm -rf /lib/firmware/raspberrypi/bootloader
|
rm -rf /lib/firmware/raspberrypi/bootloader
|
||||||
mkdir -p /lib/firmware/raspberrypi/bootloader
|
rm -rf /lib/firmware/raspberrypi/bootloader-2711
|
||||||
cp -rf "${FIRMWARE_DIR}"/* /lib/firmware/raspberrypi/bootloader
|
rm -rf /lib/firmware/raspberrypi/bootloader-2712
|
||||||
|
|
||||||
|
mkdir -p /lib/firmware/raspberrypi/bootloader-2711
|
||||||
|
rsync -alv "${FIRMWARE_DIR}-2711"/* /lib/firmware/raspberrypi/bootloader-2711 || echo "Failed"
|
||||||
|
mkdir -p /lib/firmware/raspberrypi/bootloader-2712
|
||||||
|
rsync -alv "${FIRMWARE_DIR}-2712"/* /lib/firmware/raspberrypi/bootloader-2712 || echo "Failed"
|
||||||
|
|
||||||
cp -fv "${script_dir}/../rpi-eeprom-config" /usr/bin
|
cp -fv "${script_dir}/../rpi-eeprom-config" /usr/bin
|
||||||
cp -fv "${script_dir}/../rpi-eeprom-digest" /usr/bin
|
cp -fv "${script_dir}/../rpi-eeprom-digest" /usr/bin
|
||||||
cp -fv "${script_dir}/../rpi-eeprom-update" /usr/bin
|
cp -fv "${script_dir}/../rpi-eeprom-update" /usr/bin
|
||||||
|
|||||||
@@ -167,11 +167,11 @@ check_conf_size_too_large()
|
|||||||
echo "Check config read and loopback read/write against reference config files"
|
echo "Check config read and loopback read/write against reference config files"
|
||||||
versions="$(cd configs; ls *.txt | sed 's/bootconf-//g' | sed 's/.txt//g')"
|
versions="$(cd configs; ls *.txt | sed 's/bootconf-//g' | sed 's/.txt//g')"
|
||||||
for ver in ${versions}; do
|
for ver in ${versions}; do
|
||||||
if [ -f "../firmware/old/beta/pieeprom-${ver}.bin" ]; then
|
if [ -f "../firmware-2711/old/beta/pieeprom-${ver}.bin" ]; then
|
||||||
# Use this directory if the bootloader has been archived
|
# Use this directory if the bootloader has been archived
|
||||||
check_loopback "../firmware/old/beta/pieeprom-${ver}.bin" "configs/bootconf-${ver}.txt"
|
check_loopback "../firmware-2711/old/beta/pieeprom-${ver}.bin" "configs/bootconf-${ver}.txt"
|
||||||
else
|
else
|
||||||
check_loopback "../firmware/beta/pieeprom-${ver}.bin" "configs/bootconf-${ver}.txt"
|
check_loopback "../firmware-2711/beta/pieeprom-${ver}.bin" "configs/bootconf-${ver}.txt"
|
||||||
fi
|
fi
|
||||||
cleanup
|
cleanup
|
||||||
done
|
done
|
||||||
@@ -181,14 +181,14 @@ check_loopback pieeprom-signed.bin bootconf.txt
|
|||||||
check_signed_loopback pieeprom-signed.bin bootconf.txt bootconf.sig public.pem
|
check_signed_loopback pieeprom-signed.bin bootconf.txt bootconf.sig public.pem
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
check_update "../firmware/old/beta/pieeprom-2019-07-15.bin" "pieeprom-2019-07-15-freeze.bin" "bootconf-2019-07-15-freeze.txt"
|
check_update "../firmware-2711/old/beta/pieeprom-2019-07-15.bin" "pieeprom-2019-07-15-freeze.bin" "bootconf-2019-07-15-freeze.txt"
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
check_reduce_size "../firmware/old/beta/pieeprom-2019-07-15.bin" "bootconf-2019-07-15.txt"
|
check_reduce_size "../firmware-2711/old/beta/pieeprom-2019-07-15.bin" "bootconf-2019-07-15.txt"
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
check_conf_size_large "../firmware/old/beta/pieeprom-2019-07-15.bin"
|
check_conf_size_large "../firmware-2711/old/beta/pieeprom-2019-07-15.bin"
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
check_conf_size_too_large "../firmware/old/beta/pieeprom-2019-07-15.bin"
|
check_conf_size_too_large "../firmware-2711/old/beta/pieeprom-2019-07-15.bin"
|
||||||
cleanup
|
cleanup
|
||||||
|
|||||||
Reference in New Issue
Block a user