Commit 8d1a3e60c1ddbfeb83b335badd73561413ca4220

Authored by Tim Gover
Committed by Phil Elwell
1 parent 042cd145

Add mass-storage-gadget replacement for msd on 2711

Create a new rpiboot mode that uses a Linux initramfs to
implement mass-storage-gadget mode supporting EMMC and NVMe
block devices.

To use:
cd usbboot/mass-storage/gadget
../rpiboot -d .
mass-storage-gadget/.gitignore 0 → 100644
  1 +*.h
  2 +boot.sig
mass-storage-gadget/README.md 0 → 100644
  1 +# USB mass-storage drivers for Compute Module 4
  2 +
  3 +This directory provides a bootloader image that loads a Linux
  4 +initramfs that exports common block devices (EMMC, NVMe) as
  5 +USB mass storage devices using the Linux gadget-fs drivers.
  6 +
  7 +This allows Raspberry Pi Imager to be run on the host computer
  8 +and write OS images to the Compute Module block devices.
  9 +
  10 +## secure-boot
  11 +If secure-boot mode has been locked (via OTP) then both the
  12 +bootloader and rpiboot `bootcode4.bin` will only load `boot.img`
  13 +files signed with the customer's private key. Therefore, access
  14 +to rpiboot mass storage mode is disabled.
  15 +
  16 +Mass storage mode can be re-enabled by signing a boot image
  17 +containing the firmware mass storage drivers.
  18 +
  19 +N.B. The signed image should normally be kept secure because can
  20 +be used on any device signed with the same customer key.
  21 +
  22 +To sign the mass storage mode boot image run:-
  23 +```bash
  24 +KEY_FILE=$HOME/private.pem
  25 +../tools/rpi-eeprom-digest -i boot.img -o boot.sig -k "${KEY_FILE}"
  26 +```
  27 +
  28 +## Running
  29 +To run load the USB MSD device drivers via RPIBOOT run
  30 +```bash
  31 +../rpiboot -d .
  32 +```
  33 +
  34 +The activity LED will flash three times once the USB MSD
  35 +devices have been initialised. A message will also be printed
  36 +to the HDMI console.
  37 +
  38 +The UART console is also enabled (user 'root' no password)
  39 +so that the user can login and debug the Compute Module.
  40 +
  41 +N.B. This takes a few seconds longer to initialise than the
  42 +previous mass storage implementation. However, the write speed
  43 +should be much faster now that all of the file-system code
  44 +is running on the ARM processors.
mass-storage-gadget/boot.img 0 → 100644
No preview for this file type
mass-storage-gadget/bootcode4.bin 0 → 100644
No preview for this file type
mass-storage-gadget/config.txt 0 → 100644
  1 +# Load boot.img which contains usb.elf
  2 +# In signed-boot or secure-boot mode the bootloader checks the
  3 +# RSA signature of the ramdisk. The signature is located in boot.sig
  4 +boot_ramdisk=1
  5 +uart_2ndstage=1