Skip to content

Commit 0b231da

Browse files
committed
Update documentation for Raspberry Pi provisioning
- Enhanced README with links to configuration reference documentation and added troubleshooting sections for device provisioning. - Introduced detailed guidance for connecting Raspberry Pi 4, 5, and Zero 2 W devices, including GPIO configuration and troubleshooting tips. - Added a new document for mass provisioning scaling guidance, outlining connection requirements, provisioning strategies, and performance optimization. - Updated API documentation to clarify manufacturing database access and error response formats.
1 parent 3078674 commit 0b231da

File tree

7 files changed

+385
-12
lines changed

7 files changed

+385
-12
lines changed

README.adoc

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ $ xdg-open http://localhost:3142
6969
----
7070

7171
At the minimum, you must consult the 'Options' and 'Images' pages, having uploaded your OS image and set the options as guided by the inline
72-
help text (which is generated from the reference documentation in docs/)
72+
help text (which is generated from the <<docs/config_vars.adoc,configuration reference documentation>>)
7373

7474
Once you have followed all those steps, `rpi-sb-provisioner` should be correctly configured and ready to run.
7575

76+
[#using-rpi-sb-provisioner]
7677
== Using rpi-sb-provisioner
7778
`rpi-sb-provisioner` is composed of three `systemd` services that are triggered by the connection of a device in RPIBOOT mode to a USB port. With `rpi-sb-provisioner` configured to your requirements, all that is therefore required is to connect your target Raspberry Pi device in RPIBOOT mode.
7879

80+
NOTE: For non-compute module connection instructions, see: <<docs/device-guidance/pi4.adoc,Raspberry Pi 4>>, <<docs/device-guidance/pi5.adoc,Raspberry Pi 5>>, or <<docs/device-guidance/zero2.adoc,Zero 2 W>> guidance documents.
81+
7982
For any Raspberry Pi Compute Module on the matching Raspberry Pi Compute Module IO Board, you can do this by using the single Jumper Wire to connect the `disable eMMC Boot` pins on the 12-pin header at the top of the board.
8083

8184
[pdfwidth=90%]
@@ -114,13 +117,22 @@ After these steps have been completed, your device should display both the `acti
114117

115118
No further intervention is required in the success case.
116119

117-
WARNING: `rpi-sb-provisioner` will not, by default, block JTAG access. If you wish to make use of this facility, you _must_ use the `RPI_DEVICE_LOCK_JTAG` configuration option.
120+
WARNING: `rpi-sb-provisioner` will not, by default, block JTAG access. If you wish to make use of this facility, you _must_ use the <<docs/config_vars.adoc#rpi_device_lock_jtag,RPI_DEVICE_LOCK_JTAG>> configuration option.
118121

119-
== Tips and Tricks
122+
[#troubleshooting]
123+
== Troubleshooting
120124

121125
=== Observing active provisioning operations
122126

123-
As `rpi-sb-provisioner` is implemented using `systemd` services, you can use the typical `systemctl` commands to observe the services as they provision your device.
127+
The easiest way to observe active provisioning operations is through the **Web UI**:
128+
129+
1. **Open your browser** and navigate to `http://localhost:3142`
130+
2. **Click the 'Services' tab** to see all provisioning services and their current status
131+
3. **View real-time updates** of device provisioning progress, including serial numbers and current phases
132+
133+
==== Command Line Alternative
134+
135+
As `rpi-sb-provisioner` is implemented using `systemd` services, you can also use the typical `systemctl` commands to observe the services as they provision your device.
124136

125137
To see active provisioning operations, and the serial numbers of the devices involved, type into a Terminal window:
126138

@@ -130,7 +142,16 @@ $ systemctl list-units rpi-sb-provisioner*
130142

131143
=== Observing logs
132144

133-
Logs are stored on a per-device, per-phase basis, where logs for a given device are stored at `/var/log/rpi-sb-provisioner/<serial>/<phase>.log`.
145+
The most convenient way to observe device provisioning logs is through the **Web UI**:
146+
147+
1. **Open your browser** and navigate to `http://localhost:3142`
148+
2. **Click the 'Services' tab** to see all provisioning services
149+
3. **Click on any service** to view its detailed logs with real-time updates
150+
4. **Monitor progress** as logs are automatically refreshed during provisioning
151+
152+
==== Command Line Alternatives
153+
154+
Logs are also stored on a per-device, per-phase basis, where logs for a given device are stored at `/var/log/rpi-sb-provisioner/<serial>/<phase>.log`.
134155

135156
For example, to observe the progress of an individual device through a phase, you could use `tail`:
136157

@@ -149,9 +170,16 @@ Where the `-f` flag will follow the logs as they are written, letting you observ
149170

150171
=== Processing the manufacturing database
151172

152-
If you have enabled the manufacturing database (using RPI_SB_PROVISIONER_MANUFACTURING_DB), you can create a comma-separated value (CSV) file from the manufacturing database for use with other software.
173+
If you have enabled the manufacturing database (using <<docs/config_vars.adoc#rpi_sb_provisioner_manufacturing_db,RPI_SB_PROVISIONER_MANUFACTURING_DB>>), you can view and export the manufacturing data through the **Web UI**:
174+
175+
1. **Open your browser** and navigate to `http://localhost:3142`
176+
2. **Navigate to the Manufacturing Database section** to view all provisioned devices
177+
3. **Review device information** including serial numbers, board types, MAC addresses, and provisioning status
178+
4. **Export as CSV** using the built-in export function to create a comma-separated values file for use with other software
179+
180+
==== Command Line Alternative
153181

154-
To do so, you must use the *sqlite3* program:
182+
You can also create a CSV file directly using the *sqlite3* program:
155183

156184
----
157185
$ sqlite3 ${RPI_SB_PROVISIONER_MANUFACTURING_DB} -cmd ".headers on" -cmd ".mode csv" -cmd ".output mfg_db.csv" "SELECT * FROM rpi_sb_provisioner;"

docs/api_endpoints.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
This document describes the API endpoints available in the provisioner-service. These endpoints can be used for integration with other systems, building custom dashboards, or automating operations.
77

8+
[#manufacturing-database-api]
89
== Manufacturing Database API
910

1011
The Manufacturing Database API provides access to device provisioning data collected during the provisioning process. This API allows for integration with other systems and custom UIs.
@@ -70,7 +71,7 @@ The endpoint returns a JSON array where each element represents a provisioned de
7071
|processor|Processor type (e.g., "BCM2712")
7172
|memory|Device memory size (e.g., "2GB")
7273
|manufacturer|Device manufacturer
73-
|secure|Whether secure boot is enabled ("yes" or "no")
74+
|secure|Whether a device has been provisioned with a device unique identity
7475
|provision_ts|Timestamp of when the device was provisioned
7576
|===
7677

@@ -118,7 +119,7 @@ On error, the endpoint returns a JSON object with error details:
118119
- This endpoint can be used for building custom dashboards or integrating with other monitoring systems.
119120
- The data is ordered by provision timestamp in descending order (newest first).
120121
- For large datasets, it is recommended to use pagination to improve performance.
121-
- The database path is configured using the `RPI_SB_PROVISIONER_MANUFACTURING_DB` setting as described in the configuration documentation.
122+
- The database path is configured using the <<config_vars.adoc#rpi_sb_provisioner_manufacturing_db,RPI_SB_PROVISIONER_MANUFACTURING_DB>> setting as described in the configuration documentation.
122123

123124
== Devices API
124125

@@ -513,6 +514,7 @@ If accessing an unauthorized service:
513514
- Access is restricted to services with approved prefixes for security
514515
- This endpoint is optimized for polling and provides lighter responses than the HTML view
515516

517+
[#error-response-format]
516518
== Error Response Format
517519

518520
All API endpoints follow a standard error response format:

docs/config_vars.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This document describes the configuration variables used in /etc/rpi-sb-provisio
1010
=== PROVISIONING_STYLE
1111
*Mandatory, with a default*
1212

13-
Select the provisioning style you wish to use. Supported values are `secure-boot`, `fde-only` and `naked`.
13+
Select the provisioning style you wish to use. Supported values are `secure-boot`, `fde-only` and `naked`. For details on what each provisioning style does, see the <<../README.adoc#using-rpi-sb-provisioner,main documentation>>.
1414

1515
If `PROVISIONING_STYLE` is not specified, it defaults to `secure-boot`.
1616

@@ -89,6 +89,7 @@ This setting is typically configured through the firmware selection web interfac
8989

9090
WARNING: Ensure the specified firmware file exists and is compatible with your target device family before provisioning.
9191

92+
[#rpi_device_lock_jtag]
9293
=== RPI_DEVICE_LOCK_JTAG
9394
*Optional*
9495

@@ -105,12 +106,13 @@ Raspberry Pi devices that use an EEPROM as part of their boot flow can configure
105106

106107
Set to any value to enable EEPROM write protection.
107108

109+
[#rpi_sb_provisioner_manufacturing_db]
108110
=== RPI_SB_PROVISIONER_MANUFACTURING_DB
109111
*Optional*
110112

111113
Store manufacturing data in a sqlite3 database. This will include the board serial, board revision, the boot ROM version, the MAC address of the ethernet port, any set hash of the customer signing key, the JTAG lock state, the board attributes and the advanced boot flags.
112114

113-
You must not specify the path of a database stored on a network drive or similar storage, as this mechanism is only safe to use on a single provisioning system. For merging the output with multiple provisioning systems, consider "Processing the manufacturing database" later in this document.
115+
You must not specify the path of a database stored on a network drive or similar storage, as this mechanism is only safe to use on a single provisioning system. For merging the output with multiple provisioning systems, consider <<../README.adoc#_processing_the_manufacturing_database,Processing the manufacturing database>> in the main documentation.
114116

115117
Set to the path of a file to contain a SQLite database stored on local storage. The WebUI will create this file if it does not exist.
116118

docs/device-guidance/pi4.adoc

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
= Raspberry Pi 4 Device Guidance
2+
3+
== Connecting Raspberry Pi 4 to rpi-sb-provisioner
4+
5+
=== Prerequisites - GPIO Configuration
6+
7+
Unlike Raspberry Pi 5, the Raspberry Pi 4 does not have a built-in power button to force RPIBOOT mode. Before attempting to use rpi-sb-provisioner with a Raspberry Pi 4 device, you must first configure the nRPIBOOT GPIO pin.
8+
9+
**Recommended GPIO**: GPIO 8
10+
11+
=== Step 1 - Configure nRPIBOOT GPIO using recovery.bin
12+
13+
Before provisioning, you must assign the nRPIBOOT function to a specific GPIO pin using recovery.bin:
14+
15+
1. **Download and prepare recovery.bin** following the instructions at https://github.com/raspberrypi/usbboot/tree/master/secure-boot-recovery#step-2---select-the-nrpiboot-gpio[GitHub usbboot secure-boot-recovery documentation]
16+
2. **Configure GPIO 8** as the nRPIBOOT pin using the recovery.bin process
17+
3. **Verify the configuration** has been applied to the device EEPROM (see <<verifying-gpio-8-configuration,Verifying GPIO 8 Configuration>> below)
18+
19+
This configuration step only needs to be performed **once per device** and will persist in the device EEPROM.
20+
21+
=== Step 2 - Provisioning Connection
22+
23+
To provision a Raspberry Pi 4 device after GPIO configuration:
24+
25+
1. **Prepare a jumper wire or connection** to short GPIO 8 to ground
26+
2. **Connect GPIO 8 to ground** (GND pin) on the Raspberry Pi 4
27+
3. **While maintaining the GPIO 8 to ground connection**, plug the USB cable into the device to connect it to your provisioning machine
28+
4. **Keep the GPIO connection in place throughout the entire provisioning process**
29+
30+
Unlike Raspberry Pi 5, **no re-connection procedure is required** - the device will proceed through all provisioning phases automatically while the GPIO remains connected to ground.
31+
32+
=== Important Notes
33+
34+
* **One-time setup**: The GPIO configuration using recovery.bin only needs to be done once per device
35+
* **GPIO 8 recommended**: We recommend using GPIO 8 for consistency, as referenced in the https://github.com/raspberrypi/usbboot/tree/master/secure-boot-recovery#step-2---select-the-nrpiboot-gpio[usbboot documentation]
36+
* **Maintain connection**: The GPIO 8 to ground connection must be maintained throughout the entire provisioning process
37+
* **No re-plug required**: Unlike Raspberry Pi 5, no disconnection and re-connection is needed
38+
* **Cable quality**: Ensure you are using a high-quality USB cable as specified in the main documentation
39+
* **Complete process**: Do not release the GPIO connection until provisioning is fully complete
40+
41+
[#verifying-gpio-8-configuration]
42+
== Verifying GPIO 8 Configuration
43+
44+
To verify that GPIO 8 has been successfully assigned as the nRPIBOOT pin:
45+
46+
1. **Boot the device normally** (without shorting any GPIO pins)
47+
2. **Run the following command** to read the current EEPROM configuration:
48+
+
49+
----
50+
$ sudo rpi-eeprom-config
51+
----
52+
53+
3. **Look for the GPIO configuration** in the output. You should see a line similar to:
54+
+
55+
----
56+
WAKE_ON_GPIO=1
57+
GPIO_EXPANDER_CFG=0x00000008
58+
----
59+
+
60+
Or other GPIO-related configuration entries that indicate GPIO 8 has been configured for nRPIBOOT functionality.
61+
62+
4. **Alternative verification**: You can also extract the full EEPROM image and inspect it:
63+
+
64+
----
65+
$ sudo rpi-eeprom-config --out /tmp/current-eeprom.bin
66+
$ rpi-eeprom-config /tmp/current-eeprom.bin
67+
----
68+
69+
If the GPIO configuration is not present or incorrect, you will need to repeat the recovery.bin process to properly configure GPIO 8.
70+
71+
== Troubleshooting
72+
73+
=== GPIO Configuration Issues
74+
75+
If you encounter issues with the initial GPIO configuration:
76+
77+
* **Follow official documentation**: Refer to the complete instructions at https://github.com/raspberrypi/usbboot/tree/master/secure-boot-recovery#step-2---select-the-nrpiboot-gpio[GitHub usbboot documentation]
78+
* **Verify EEPROM update**: Use the verification commands above (`sudo rpi-eeprom-config`) to confirm the GPIO configuration was successfully written to EEPROM
79+
* **Check for configuration entries**: Look for `WAKE_ON_GPIO=1` and `GPIO_EXPANDER_CFG` entries in the EEPROM output
80+
* **Repeat recovery.bin process**: If verification shows incorrect or missing GPIO configuration, repeat the recovery.bin configuration process
81+
* **Try alternative GPIO**: Consider using a different GPIO pin if GPIO 8 is not accessible on your setup
82+
83+
=== Device not entering RPIBOOT mode
84+
85+
If your Raspberry Pi 4 device does not enter RPIBOOT mode:
86+
87+
* **Verify GPIO configuration**: Use the verification steps above to confirm GPIO 8 was successfully configured as nRPIBOOT
88+
* **Check physical connection**: Verify GPIO 8 is properly connected to a ground (GND) pin
89+
* **Try different GPIO**: If GPIO 8 doesn't work, try configuring and using a different GPIO pin
90+
* **Cable and port**: Try a shorter, higher quality USB cable and different USB port on your host machine
91+
* **Power supply**: Ensure the provisioning machine has sufficient power supply capability
92+
93+
=== Device not proceeding through provisioning
94+
95+
If the device does not proceed through the provisioning phases:
96+
97+
* **Maintain GPIO connection**: Ensure GPIO 8 to ground connection is maintained throughout the entire process
98+
* **Check provisioning logs**: Review logs for any error messages
99+
* **Verify device recognition**: Confirm the device was initially recognized by the provisioning system
100+
* **Restart procedure**: Disconnect the device, ensure GPIO connection is secure, and try again

docs/device-guidance/pi5.adoc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
= Raspberry Pi 5 Device Guidance
2+
3+
== Connecting Raspberry Pi 5 to rpi-sb-provisioner
4+
5+
=== Initial Connection - Entering RPIBOOT Mode
6+
7+
To provision a Raspberry Pi 5 device, you must force it into RPIBOOT mode:
8+
9+
1. **Hold the power button** on the Raspberry Pi 5 device
10+
2. **While continuing to hold the power button**, plug the USB-C cable into the device to connect it to your provisioning machine
11+
3. Keep holding the power button until the device is recognized by the provisioning system
12+
13+
=== Re-connection Procedure
14+
15+
After the initial connection, you will need to perform a re-connection procedure:
16+
17+
1. **Monitor the device state** until you see the status "bootstrap-fastboot-initialisation-started"
18+
2. **Unplug the device** from the USB-C cable
19+
3. **Hold the power button** on the Raspberry Pi 5 device
20+
4. **While continuing to hold the power button**, re-plug the USB-C cable to reconnect the device
21+
5. Keep holding the power button until the device proceeds to the next phase
22+
23+
=== Important Notes
24+
25+
* Ensure you are using a high-quality USB-A to USB-C cable as specified in the main documentation
26+
* The power button must be held during both the initial connection and the re-connection procedure
27+
* Do not release the power button until you confirm the device has been recognized by the provisioning system
28+
* If the device fails to enter RPIBOOT mode, try using a different USB port on your host machine
29+
30+
== Troubleshooting
31+
32+
=== Device not entering RPIBOOT mode
33+
34+
If your Raspberry Pi 5 device does not enter RPIBOOT mode:
35+
36+
* Ensure you are holding the power button **before** connecting the USB cable
37+
* Try a shorter, higher quality USB-A to USB-C cable
38+
* Try a different USB port on your host machine
39+
* Ensure the provisioning machine has sufficient power supply capability
40+
41+
=== Device not responding after re-connection
42+
43+
If the device does not proceed after the re-connection step:
44+
45+
* Verify that you observed the "bootstrap-fastboot-initialisation-started" state before disconnecting
46+
* Ensure you held the power button during the re-connection
47+
* Check the provisioning logs for any error messages
48+
* Try the complete procedure again from the beginning

docs/zero2_troubleshooting.adoc renamed to docs/device-guidance/zero2.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ If your Zero 2 W device does not enter RPIBOOT mode, try the following:
1616

1717
== Using secure-boot provisioning style on Zero 2 W devices
1818

19-
=== Secure boot is not available on Zero 2 W devices, and forcing the provisioning style will produce undefined results.
19+
=== Secure boot is not available on Zero 2 W devices. Provisioning with secure boot will produce undefined results - but absolutely nothing that will work as expected.

0 commit comments

Comments
 (0)