talos-rpi5/patches/talos-rpi5/sbc-raspberrypi5/0002-Fix-SBC-overlay-upgrade-detect-EFI-mount-path-for-SB.patch
Mathias Beaulieu-Duncan 118ef4dcc9
Some checks failed
Check Upstream Updates / check-and-build (push) Failing after 6s
Add serial console support, remove wrong debug UART patch
Enable GPIO UART0 on Pi5/CM5 via dtoverlay=uart0-pi5 in
configTxtAppend. Remove the old 0002 patch that targeted the
debug UART (ttyAMA10) — Compute Blade uses GPIO 14/15 (ttyAMA0).
Renumber overlay patches (old 0003 becomes 0002).

Update README with tested serial console docs: wiring diagram,
even parity config, 3.3V requirement, and read-only limitation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 14:04:39 -05:00

78 lines
3.2 KiB
Diff

From 5cdfe8ddb717e8de4e9d1c9e3000614ad8a1b5bb Mon Sep 17 00:00:00 2001
From: Mathias Beaulieu-Duncan <mathias@openharbor.io>
Date: Wed, 25 Feb 2026 12:41:51 -0500
Subject: [PATCH] Fix SBC overlay upgrade: detect EFI mount path for SBC
layouts
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On SBC platforms (RPi5/CM5), the disk layout has no separate BOOT
partition. During upgrades, the GRUB install code mounts the EFI
partition at /boot instead of /boot/EFI. The overlay installer was
always writing to /boot/EFI, causing config.txt and firmware files
to end up in the wrong subdirectory — invisible to the firmware.
Detect the SBC layout by checking if config.txt already exists at
/boot/ (indicating EFI is mounted there), and write files to the
correct location.
---
installers/rpi5/src/config.txt | 3 ++-
installers/rpi5/src/main.go | 18 +++++++++++++-----
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/installers/rpi5/src/config.txt b/installers/rpi5/src/config.txt
index 1445d0e..e38291b 100644
--- a/installers/rpi5/src/config.txt
+++ b/installers/rpi5/src/config.txt
@@ -11,7 +11,8 @@ kernel=u-boot.bin
arm_64bit=1
# Run as fast as firmware / board allows.
arm_boost=1
-# Enable the primary/console UART.
+# Enable UART0 on GPIO 14/15 (Pi5/CM5 requires explicit dt overlay).
+dtoverlay=uart0-pi5
enable_uart=1
# Disable Bluetooth.
dtoverlay=disable-bt
diff --git a/installers/rpi5/src/main.go b/installers/rpi5/src/main.go
index 38cd824..155a86b 100644
--- a/installers/rpi5/src/main.go
+++ b/installers/rpi5/src/main.go
@@ -41,13 +41,21 @@ func (i *RpiInstaller) GetOptions(extra rpiOptions) (overlay.Options, error) {
}
func (i *RpiInstaller) Install(options overlay.InstallOptions[rpiOptions]) error {
- err := copy.Dir(filepath.Join(options.ArtifactsPath, "arm64/firmware/boot"), filepath.Join(options.MountPrefix, "/boot/EFI"))
- if err != nil {
+ // Determine where the EFI partition is mounted.
+ // Standard layout: BOOT (XFS) at /boot, EFI (VFAT) at /boot/EFI
+ // SBC layout: no BOOT partition, EFI (VFAT) at /boot
+ efiDir := filepath.Join(options.MountPrefix, "/boot/EFI")
+
+ if _, err := os.Stat(filepath.Join(options.MountPrefix, "/boot/config.txt")); err == nil {
+ // config.txt exists at /boot — EFI partition is mounted at /boot (SBC layout).
+ efiDir = filepath.Join(options.MountPrefix, "/boot")
+ }
+
+ if err := copy.Dir(filepath.Join(options.ArtifactsPath, "arm64/firmware/boot"), efiDir); err != nil {
return err
}
- err = copy.File(filepath.Join(options.ArtifactsPath, "arm64/u-boot/rpi5/u-boot.bin"), filepath.Join(options.MountPrefix, "/boot/EFI/u-boot.bin"))
- if err != nil {
+ if err := copy.File(filepath.Join(options.ArtifactsPath, "arm64/u-boot/rpi5/u-boot.bin"), filepath.Join(efiDir, "u-boot.bin")); err != nil {
return err
}
@@ -57,5 +65,5 @@ func (i *RpiInstaller) Install(options overlay.InstallOptions[rpiOptions]) error
configTxt = append(configTxt, []byte("\n"+options.ExtraOptions.ConfigTxtAppend)...)
- return os.WriteFile(filepath.Join(options.MountPrefix, "/boot/EFI/config.txt"), configTxt, 0o644)
+ return os.WriteFile(filepath.Join(efiDir, "config.txt"), configTxt, 0o644)
}
--
2.50.1 (Apple Git-155)