From 92dd0bc0e1623d9feda25d9a0ca35f89c8381115 Mon Sep 17 00:00:00 2001 From: Edward Viaene Date: Fri, 20 Nov 2026 21:29:11 -0600 Subject: [PATCH] Signing target 9: xip, the code the pod runs from its W25Q Firmware 4.0.2+ builds blob-xip.bin with the firmware (code that runs straight from the W25Q) and signs it as target 9; 8 stays the Wi-Fi bridge's identity. Without the name, install-blobs sent the blob without its signature and the pod refused it ("signature: none"). TargetXIP and the name, plus a test. Co-Authored-By: Claude Opus 5.5 --- internal/fwsign/fwsign.go | 6 ++++-- internal/fwsign/fwsign_test.go | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/fwsign/fwsign.go b/internal/fwsign/fwsign.go index 5b98d36..a27f21a 100644 --- a/internal/fwsign/fwsign.go +++ b/internal/fwsign/fwsign.go @@ -66,11 +66,13 @@ const ( TargetESP uint8 = 3 TargetBridge uint8 = 6 // the Wi-Fi bridge's firmware (4 and 5, ca and tls, are not signed) TargetGW2 uint8 = 7 // gateware image 2, the sensor emulation image (gateware v54+) + // 8 is a Wi-Fi bridge's identity certificate, never an update. + TargetXIP uint8 = 9 // code the pod runs from its W25Q (blob-xip.bin, firmware 4.0.2+) ) -var targetNames = []string{"firmware", "gw0", "gw1", "esp", "", "", "bridge", "gw2"} +var targetNames = []string{"firmware", "gw0", "gw1", "esp", "", "", "bridge", "gw2", "", "xip"} -// TargetByName maps "firmware", "gw0", "gw1", "esp", "bridge", "gw2" to its number. +// TargetByName maps "firmware", "gw0", "gw1", "esp", "bridge", "gw2", "xip" to its number. func TargetByName(name string) (uint8, bool) { for i, n := range targetNames { if n != "" && n == name { diff --git a/internal/fwsign/fwsign_test.go b/internal/fwsign/fwsign_test.go index 3a8556f..b584371 100644 --- a/internal/fwsign/fwsign_test.go +++ b/internal/fwsign/fwsign_test.go @@ -156,6 +156,12 @@ func TestTargetNames(t *testing.T) { t.Fatalf("bridge: %d %v", n, ok) } // 4 and 5 (ca, tls) are not signed targets: no name, and "" maps to nothing. + if n, ok := TargetByName("xip"); !ok || TargetXIP != 9 || n != TargetXIP || TargetName(9) != "xip" { + t.Errorf("xip: TargetByName = %d, %v; TargetName(9) = %q", n, ok, TargetName(9)) + } + if _, ok := TargetByName(""); ok { + t.Error("the unused target numbers have names") + } if n, ok := TargetByName("gw2"); !ok || TargetGW2 != 7 || n != TargetGW2 || TargetName(7) != "gw2" { t.Fatalf("gw2: %d %v", n, ok) }