Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB boot support for raspberrypicm4-ioboard-sb #1141

Merged
merged 9 commits into from
Jul 21, 2024
Merged

USB boot support for raspberrypicm4-ioboard-sb #1141

merged 9 commits into from
Jul 21, 2024

Conversation

alexgg
Copy link
Contributor

@alexgg alexgg commented Jun 21, 2024

No description provided.

@alexgg alexgg marked this pull request as draft June 21, 2024 12:17
@alexgg alexgg force-pushed the alexgg/rpisb branch 5 times, most recently from b2c0b9f to 7f933b5 Compare July 1, 2024 13:01
@alexgg alexgg force-pushed the alexgg/rpisb branch 6 times, most recently from 3f5d6a2 to cdfe6e2 Compare July 8, 2024 08:03
@alexgg alexgg changed the title [TEST] WIP alexgg/rpisb USB boot support for raspberrypicm4-ioboard-sb Jul 8, 2024
@alexgg alexgg marked this pull request as ready for review July 8, 2024 08:03
@flowzone-app flowzone-app bot enabled auto-merge July 8, 2024 08:09
…e USB boot

With this change the device will first attempt to boot from USB and then
boot from the NVME/internal eMMC/SD card. This allows to use USB flasher
images as provisioning tools in preference of usbboot.

5: USB 2.0 boot from USB type A socket (CM4) or Type C socket (RPI4)
6: NVME
1: eMMC / SD Card
2: Network boot

We place NVME before eMMC/SDcard as there are reports that NVME is not
working if initialized after.

Also, there is no USB mass storage boot to limit this option to using
physical jumper configuration.

See https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#BOOT_ORDER

Note that trying USB boot first adds a considerable delay to the boot
process as the CM4 has a timeout of 2s (5s if extended via
`program_usb_boot_timeout=1`  per USB port enumeration.

As such, this change is only done to the `raspberrypicm4-ioboard-sb`
that requires USB boot for the secure boot provisioning flow.

Changelog-entry: Modify boot order to prioritize USB boot
Signed-off-by: Alex Gonzalez <alexg@balena.io>
This is useful for the use case of a flasher image ran from external
media, like in the traditional flasher workflow that expects the device
to shutdown after programming.

From https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#POWER_OFF_ON_HALT

Changelog-entry: configure to power off on halt for raspberrypicm4-ioboard-sb
Signed-off-by: Alex Gonzalez <alexg@balena.io>
As CM4 and CM4IO don’t include the external USB 3 controller,
RaspberryPi OS sets `otg_mode=1` for better performance.

See https://www.raspberrypi.com/documentation/computers/config_txt.html#otg_mode-raspberry-pi-4-only

However, while testing, the kernel driver oops when the otg cable is
connected at boot (works well if it is connected after boot though).

As this is only needed in the USB provisioning mode, restrict the change
to the raspberrypicm4-ioboard-sb for the time being.

Changelog-entry: enable USB 2.0 for raspberrypicm4-ioboard-sb
Signed-off-by: Alex Gonzalez <alexg@balena.io>
With the USB provisioning being preferred, the msd binaries are no
longer required.

This commit adds a recipe configuration to make the signing conditional.

Changelog-entry: do not sign msd binaries by default as they are not needed
Signed-off-by: Alex Gonzalez <alexg@balena.io>
Changelog-entry: deploy CM4/RPI4 locking binaries
Signed-off-by: Alex Gonzalez <alexg@balena.io>
Also, remove mentioning that write protecting further OTP changes is
globally possible as only the customer OTP registers have this feature
and these are not used by the secure boot implementation.

Change-type: patch
Signed-off-by: Alex Gonzalez <alexg@balena.io>
Changelog-entry: update rpi-eeprom firmware to 2024-05-17
Signed-off-by: Alex Gonzalez <alexg@balena.io>
@alexgg
Copy link
Contributor Author

alexgg commented Jul 16, 2024

@resin-jenkins retest this please

The `otg_mode=1` setting makes the firmware mux the USB port
to the XHCI host-only controller. However, even though this correctly
enabled host mode in the USB port, the kernel drivers oops when a cable
is plugged into the OTG port in the ioboard, probably because the XCHI
controller does not support OTG or device mode.

This commit reverts to using the dwc2 kernel overlay which has less
performance but does not crash.

Changelog-entry: use dwc2 driver for USB host mode in CM4-SB.
Signed-off-by: Alex Gonzalez <alexg@balena.io>
This adds support for the DesignWare Core USB 2.0 controller, required
for the USB boot flow.

Changelog-entry: add dwc2 support to the raspberrypicm4-ioboard-sb kernel
Signed-off-by: Alex Gonzalez <alexg@balena.io>
@alexgg alexgg requested a review from a team July 16, 2024 09:05
@alexgg
Copy link
Contributor Author

alexgg commented Jul 16, 2024

@resin-jenkins retest this please

@alexgg
Copy link
Contributor Author

alexgg commented Jul 16, 2024

lgtm

@alexgg
Copy link
Contributor Author

alexgg commented Jul 17, 2024

Passed:

  • test-raspberrypi0-2w-64
  • test-raspberrypi3-64
  • test-revpi-connect
  • test-revpi-connect-4
  • test-revpi-core-3
  • test-rt-rpi-300

@alexgg
Copy link
Contributor Author

alexgg commented Jul 18, 2024

@resin-jenkins retest this please

1 similar comment
@alexgg
Copy link
Contributor Author

alexgg commented Jul 19, 2024

@resin-jenkins retest this please

@alexgg alexgg disabled auto-merge July 21, 2024 17:41
@alexgg alexgg merged commit f878014 into master Jul 21, 2024
55 of 63 checks passed
@alexgg alexgg deleted the alexgg/rpisb branch July 21, 2024 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant