From df8749aaa9eefb0b72c8a9610b1b7fb904a357ab Mon Sep 17 00:00:00 2001 From: reubenmiller Date: Fri, 17 Nov 2023 16:41:45 +0100 Subject: [PATCH] feat: add support for rpi5 firmware Raspberry Pi 5 logic can be added via include_firmware = "pi5" --- crates/rugpi-bakery/src/config.rs | 1 + crates/rugpi-bakery/src/tasks/bake.rs | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/crates/rugpi-bakery/src/config.rs b/crates/rugpi-bakery/src/config.rs index 6bee049..1e3b20a 100644 --- a/crates/rugpi-bakery/src/config.rs +++ b/crates/rugpi-bakery/src/config.rs @@ -34,6 +34,7 @@ pub enum IncludeFirmware { None, #[default] Pi4, + Pi5, } /// Load the configuration file from the current directory. diff --git a/crates/rugpi-bakery/src/tasks/bake.rs b/crates/rugpi-bakery/src/tasks/bake.rs index 744e2bd..18673bc 100644 --- a/crates/rugpi-bakery/src/tasks/bake.rs +++ b/crates/rugpi-bakery/src/tasks/bake.rs @@ -62,6 +62,7 @@ pub fn run(task: &BakeTask) -> Anyhow<()> { match config.include_firmware { crate::config::IncludeFirmware::None => { /* Do not include any firmware. */ } crate::config::IncludeFirmware::Pi4 => include_pi4_firmware(&temp_dir_path)?, + crate::config::IncludeFirmware::Pi5 => include_pi5_firmware(&temp_dir_path)?, } } Ok(()) @@ -110,3 +111,26 @@ fn include_pi4_firmware(autoboot_path: &Utf8Path) -> Anyhow<()> { ])?; Ok(()) } + +fn include_pi5_firmware(autoboot_path: &Utf8Path) -> Anyhow<()> { + run!([ + "cp", + "-f", + "/usr/share/rugpi/rpi-eeprom/firmware-2712/stable/pieeprom-2023-10-30.bin", + autoboot_path.join("pieeprom.upd") + ])?; + run!([ + "/usr/share/rugpi/rpi-eeprom/rpi-eeprom-digest", + "-i", + autoboot_path.join("pieeprom.upd"), + "-o", + autoboot_path.join("pieeprom.sig") + ])?; + run!([ + "cp", + "-f", + "/usr/share/rugpi/rpi-eeprom/firmware-2712/stable/recovery.bin", + autoboot_path.join("recovery.bin") + ])?; + Ok(()) +}