balena-os / balena-raspberrypi

Balena support for RaspberryPI boards
https://www.balena.io/os/
Apache License 2.0
190 stars 73 forks source link

initrdscripts: Restore the state of Pi4/CM4 firmware GPIOs after kexec #1136

Closed mtoman closed 2 months ago

mtoman commented 3 months ago

The Pi4 devices (Pi4, CM4, Pi400) use an internal 8-pin GPIO header to control some firmware features including wifi and bluetooth. Initially these are set up by the broadcom bootloader, but after kexec (which the balena bootloader uses), they are all reset to zeroes. This means wifi and bluetooth "disappear" after kexec.

This patch adds an initrd scripts that reads the GPIO pin values before kexec and appends them as an extra kernel argument. After kexec, it reads the kernel argument and restores the pin values to what they originally were.

This depends on https://github.com/balena-os/meta-balena/pull/3445, it won't break anything without it, but won't work either.

mtoman commented 3 months ago

@resin-jenkins retest this please

mtoman commented 2 months ago

@resin-jenkins retest this please