From 3b952e996adc72047f44fe704693b416a02d6624 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Thu, 4 Mar 2021 15:15:50 +0000 Subject: [PATCH] make-release: Add a script for generating Raspberry Pi Imager releases Create an EEPROM update zip files for use with the Raspberry Pi Imager. The Raspberry Pi Imager JSON will soon be updated to support the 3 different boot priority choices offered by raspi-config. --- imager/README.txt | 28 ++++++++++++++++ imager/boot-conf-default.txt | 6 ++++ imager/boot-conf-network.txt | 6 ++++ imager/boot-conf-sd.txt | 6 ++++ imager/boot-conf-usb.txt | 6 ++++ imager/make-release | 65 ++++++++++++++++++++++++++++++++++++ imager/pieeprom.bin | 1 + imager/recovery.bin | 1 + imager/vl805.bin | 1 + 9 files changed, 120 insertions(+) create mode 100644 imager/README.txt create mode 100644 imager/boot-conf-default.txt create mode 100644 imager/boot-conf-network.txt create mode 100644 imager/boot-conf-sd.txt create mode 100644 imager/boot-conf-usb.txt create mode 100755 imager/make-release create mode 120000 imager/pieeprom.bin create mode 120000 imager/recovery.bin create mode 120000 imager/vl805.bin diff --git a/imager/README.txt b/imager/README.txt new file mode 100644 index 00000000..954de49f --- /dev/null +++ b/imager/README.txt @@ -0,0 +1,28 @@ +Raspberry Pi 4 EEPROM bootloader rescue image +********************************************* + +The Raspberry Pi4 has a small EEPROM used to store the bootloader. + +This rescue image reverts the bootloader EEPROM to factory default settings. + +This rescue image also updates the USB 3.0 (VL805) firmware to the latest +version (138a1) with better full-speed Isochronous endpoint support. + +To re-flash the EEPROM(s) + +1. Unzip the contents of this zip file to a blank FAT formatted SD-SDCARD. +2. Power off the Raspberry Pi +3. Insert the sd-card. +4. Power on Raspberry Pi +5. Wait at least 10 seconds. + +This easiest method for creating and formatting the SD-CARD is to use the +Raspberry Pi Imager from https://raspberrypi.org/downloads + +If successful, the green LED light will blink rapidly (forever), otherwise +an error pattern will be displayed. + +If a HDMI display is attached then screen will display green for success +or red if failure a failure occurs. + +N.B. This image is not a bootloader it simply replaces the on-board bootloader. diff --git a/imager/boot-conf-default.txt b/imager/boot-conf-default.txt new file mode 100644 index 00000000..ec09fc70 --- /dev/null +++ b/imager/boot-conf-default.txt @@ -0,0 +1,6 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +ENABLE_SELF_UPDATE=1 +BOOT_ORDER=0xf41 + diff --git a/imager/boot-conf-network.txt b/imager/boot-conf-network.txt new file mode 100644 index 00000000..6ebc8559 --- /dev/null +++ b/imager/boot-conf-network.txt @@ -0,0 +1,6 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +ENABLE_SELF_UPDATE=1 +BOOT_ORDER=0xf21 + diff --git a/imager/boot-conf-sd.txt b/imager/boot-conf-sd.txt new file mode 100644 index 00000000..ec09fc70 --- /dev/null +++ b/imager/boot-conf-sd.txt @@ -0,0 +1,6 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +ENABLE_SELF_UPDATE=1 +BOOT_ORDER=0xf41 + diff --git a/imager/boot-conf-usb.txt b/imager/boot-conf-usb.txt new file mode 100644 index 00000000..30abc040 --- /dev/null +++ b/imager/boot-conf-usb.txt @@ -0,0 +1,6 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +ENABLE_SELF_UPDATE=1 +BOOT_ORDER=0xf14 + diff --git a/imager/make-release b/imager/make-release new file mode 100755 index 00000000..579a33c1 --- /dev/null +++ b/imager/make-release @@ -0,0 +1,65 @@ +#!/bin/sh + +# Generates three variants of the rpi-eeprom-recovery.zip file for +# SD, USB and NETWORK priority matching the raspi-config options. + +set -e + +script_dir=$(cd "$(dirname "$0")" && pwd) +tmp_dir="" + +die() { + echo "$@" >&2 + exit 1 +} + +cleanup() { + if [ -d "${tmp_dir}" ]; then + rm -rf "${tmp_dir}" + fi + tmp_dir="" +} + +gen_release() { + config="${1}" + out="${2}" + + [ -f "${config}" ] || die "File not found \"${config}\"" + + ( + tmp_dir="$(mktemp -d)" + cd "${tmp_dir}" + cp "${script_dir}/vl805.bin" . + cp "${script_dir}/README.txt" . + sha256sum vl805.bin | awk '{print $1}' > vl805.sig + + "${script_dir}/../rpi-eeprom-config" \ + --config "${script_dir}/${config}" --out pieeprom.bin \ + "${script_dir}/pieeprom.bin" || die "Failed to create update EEPROM config with \"${config}\"" + sha256sum pieeprom.bin | awk '{print $1}' > pieeprom.sig + echo "Creating ${out}" + zip "${out}" * + ) +} + +usage() { +cat < + + Example tag "2020-09-03-vl805-000138a1" +EOF +exit +} + +trap cleanup EXIT +tag="${1}" +[ -n "${tag}" ] || usage +release_dir="${script_dir}/release" +rm -rf "${release_dir}" +mkdir "${release_dir}" + +# Build the different boot priority flavours +gen_release boot-conf-default.txt "${release_dir}/rpi-boot-eeprom-recovery-${tag}.zip" +gen_release boot-conf-sd.txt "${release_dir}/rpi-boot-eeprom-recovery-${tag}-sd.zip" +gen_release boot-conf-usb.txt "${release_dir}/rpi-boot-eeprom-recovery-${tag}-usb.zip" +gen_release boot-conf-network.txt "${release_dir}/rpi-boot-eeprom-recovery-${tag}-network.zip" diff --git a/imager/pieeprom.bin b/imager/pieeprom.bin new file mode 120000 index 00000000..2c1270fb --- /dev/null +++ b/imager/pieeprom.bin @@ -0,0 +1 @@ +../firmware/critical/pieeprom-2020-09-03.bin \ No newline at end of file diff --git a/imager/recovery.bin b/imager/recovery.bin new file mode 120000 index 00000000..c6d8de09 --- /dev/null +++ b/imager/recovery.bin @@ -0,0 +1 @@ +../firmware/critical/recovery.bin \ No newline at end of file diff --git a/imager/vl805.bin b/imager/vl805.bin new file mode 120000 index 00000000..b78e45a9 --- /dev/null +++ b/imager/vl805.bin @@ -0,0 +1 @@ +../firmware/critical/vl805-000138a1.bin \ No newline at end of file