X Tutup
Skip to content

Commit 2055e12

Browse files
committed
Add RPi1/RPi0 workaround
On the very popular Raspberry Pi 1 and Zero devices, the CPU is actually ARMv6, but the chip happens to support the feature bit the kernel uses to differentiate v6/v7, so it gets reported as "CPU architecture: 7" and thus fails to run many of the images that get pulled. To account for this very popular edge case, this also checks "model name" which on these chips will begin with "ARMv6-compatible" -- we could also check uname, but getCPUInfo is already handy, low overhead, and mirrors the code before this. Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
1 parent d4e7820 commit 2055e12

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

platforms/cpuinfo.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ func getCPUVariant() string {
9696
return ""
9797
}
9898

99+
// handle edge case for Raspberry Pi ARMv6 devices (which due to a kernel quirk, report "CPU architecture: 7")
100+
// https://www.raspberrypi.org/forums/viewtopic.php?t=12614
101+
if runtime.GOARCH == "arm" && variant == "7" {
102+
model, err := getCPUInfo("model name")
103+
if err == nil && strings.HasPrefix(strings.ToLower(model), "armv6-compatible") {
104+
variant = "6"
105+
}
106+
}
107+
99108
switch strings.ToLower(variant) {
100109
case "8", "aarch64":
101110
// special case: if running a 32-bit userspace on aarch64, the variant should be "v7"

0 commit comments

Comments
 (0)
X Tutup