Skip to content

Push to production #2669

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

Merged
merged 11 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ GEM
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
nokogiri (1.13.8)
nokogiri (1.13.9)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
pathutil (0.16.2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ The Compute Module has an on-board eMMC device connected to the primary SD card

Please also read the section in the xref:compute-module.adoc#datasheets-and-schematics[Compute Module Datasheets]

IMPORTANT: For mass provisioning of CM3, CM3+ and CM4 the https://github.com/raspberrypi/cmprovision[Raspberry Pi Compute Module Provisioning System] is recommended.

=== Steps to Flash the eMMC

To flash the Compute Module eMMC, you either need a Linux system (a Raspberry Pi is recommended, or Ubuntu on a PC) or a Windows system (Windows 10 is recommended). For BCM2837 (CM3), a bug which affected the Mac has been fixed, so this will also work.
Expand Down Expand Up @@ -44,60 +46,9 @@ Please ensure you are not writing to any USB devices whilst the installer is run
. Once the driver installation is complete, run the `RPiBoot.exe` tool that was previously installed.
. After a few seconds, the Compute Module eMMC will pop up under Windows as a disk (USB mass storage device).

==== Building `rpiboot` on your host system (Cygwin/Linux)

We will be using Git to get the rpiboot source code, so ensure Git is installed. In Cygwin, use the Cygwin installer. On a Raspberry Pi or other Debian-based Linux machine, use the following command:

[,bash]
----
sudo apt install git
----

Git may produce an error if the date is not set correctly. On a Raspberry Pi, enter the following to correct this:

[,bash]
----
sudo date MMDDhhmm
----

where `MM` is the month, `DD` is the date, and `hh` and `mm` are hours and minutes respectively.

Clone the `usbboot` tool repository:

[,bash]
----
git clone --depth=1 https://github.com/raspberrypi/usbboot
cd usbboot
----

`libusb` must be installed. If you are using Cygwin, please make sure `libusb` is installed as previously described. On Raspberry Pi OS or other Debian-based Linux, enter the following command:

[,bash]
----
sudo apt install libusb-1.0-0-dev
----

Now build and install the `usbboot` tool:

[,bash]
----
make
----
==== Building `rpiboot` on your host system.

Run the `usbboot` tool and it will wait for a connection:

[,bash]
----
sudo ./rpiboot
----

Now plug the host machine into the Compute Module IO board USB slave port and power the CMIO board on. The `rpiboot` tool will discover the Compute Module and send boot code to allow access to the eMMC.

For more information run

----
./rpiboot -h
----
Instructions for building and running the latest release of `rpiboot` are documented in the https://github.com/raspberrypi/usbboot/blob/master/Readme.md#building[usbboot readme] on Github.

==== Writing to the eMMC (Windows)

Expand Down Expand Up @@ -140,6 +91,12 @@ The default bootloader configuration on CM4 is designed to support bringup and d

N.B. The Compute Module 4 ROM never runs `recovery.bin` from SD/EMMC and the `rpi-eeprom-update` service is not enabled by default. This is necessary because the EMMC is not removable and an invalid `recovery.bin` file would prevent the system from booting. This can be overridden and used with `self-update` mode where the bootloader can be updated from USB MSD or Network boot. However, `self-update` mode is not an atomic update and therefore not safe in the event of a power failure whilst the EEPROM was being updated.

==== Flashing NVMe / other storage devices.
The new Linux-based https://github.com/raspberrypi/usbboot/blob/master/mass-storage-gadget/README.md[mass-storage gadget] supports flashing of NVMe, EMMC and USB block devices.
This is normally faster than using the `rpiboot` firmware driver and also provides a UART console to the device for easier debug.

See also: https://github.com/raspberrypi/usbboot/blob/master/Readme.md#compute-module-4-extensions[CM4 rpiboot extensions]

==== Modifying the bootloader configuration

To modify the CM4 bootloader configuration:-
Expand Down
4 changes: 3 additions & 1 deletion documentation/asciidoc/computers/config_txt/memory.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ The recommended maximum values are as follows:
| `384`

| 1GB or greater
| `512`, `256` on the Raspberry Pi 4
| `512`, `76` on the Raspberry Pi 4
|===

IMPORTANT: The default camera stack (libcamera2) on Raspberry Pi OS - Bullseye uses Linux CMA memory to allocate buffers instead of GPU memory so there is no benefit in increasing the GPU memory size.

It is possible to set `gpu_mem` to larger values, however this should be avoided since it can cause problems, such as preventing Linux from booting. The minimum value is `16`, however this disables certain GPU features.

You can also use `gpu_mem_256`, `gpu_mem_512`, and `gpu_mem_1024` to allow swapping the same SD card between Raspberry Pis with different amounts of RAM without having to edit `config.txt` each time:
Expand Down
31 changes: 31 additions & 0 deletions documentation/asciidoc/computers/configuration/device-tree.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,37 @@ The root hub port number that the boot device is connected to - possibly via oth

The Logical Unit Number for the mass-storage device.

==== NVMEM nodes
The firmware provides read-only, in-memory copies of portions of the bootloader EEPROM via the https://www.kernel.org/doc/html/latest/driver-api/nvmem.html[NVMEM] Subsystem.

Each region appears as an NVMEM device under `/sys/bus/nvmem/devices/` with a named alias under `/sys/firmware/devicetree/base/aliases`.

Example shell script code for reading an NVMEM mode from https://github.com/raspberrypi/rpi-eeprom/blob/master/rpi-eeprom-update[rpi-eeprom-update]

----
blconfig_alias="/sys/firmware/devicetree/base/aliases/blconfig"
blconfig_nvmem_path=""

if [ -f "${blconfig_alias}" ]; then
blconfig_ofnode_path="/sys/firmware/devicetree/base"$(strings "${blconfig_alias}")""
blconfig_ofnode_link=$(find -L /sys/bus/nvmem -samefile "${blconfig_ofnode_path}" 2>/dev/null)
if [ -e "${blconfig_ofnode_link}" ]; then
blconfig_nvmem_path=$(dirname "${blconfig_ofnode_link}")
fi
fi
fi
----

`blconfig`

The `blconfig` alias refers to an NVMEM device that stores a copy of the bootloader EEPROM config file.

`blpubkey`

The `blpubkey` alias points to an NVMEM device that stores a copy of the bootloader EEPROM public key (if defined) in binary format.
The https://github.com/raspberrypi/usbboot/blob/master/tools/rpi-bootloader-key-convert[rpi-bootloader-key-convert] utility can be used to convert the data into PEM format for use with OpenSSL.

See also: https://github.com/raspberrypi/usbboot#secure-boot[secure-boot]

[[part5]]
=== Troubleshooting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ If `secure-boot` is enabled then `tryboot` mode will cause `tryboot.img` to be l

=== TRYBOOT_A_B mode
If the `tryboot_a_b` property in xref:config_txt.adoc#autoboot-txt[autoboot.txt] is set to `1` then `config.txt` is loaded instead of `tryboot.txt`.
This is because the `tryboot` switch has already been made at a higher level (the partition) and so it's unecessary to have a `tryboot.txt` file within alternate partition itself.
This is because the `tryboot` switch has already been made at a higher level (the partition) and so it's unnecessary to have a `tryboot.txt` file within alternate partition itself.

N.B. The `tryboot_a_b` property is implicitly set to `1` when loading files from within a `boot.img` ramdisk.

Binary file added documentation/images/full-sized/Tutorials.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions documentation/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
"image": "full-sized/Datasheets.png",
"url": "https://datasheets.raspberrypi.com"
},
{
"title": "Tutorials",
"description": "Hands-on hardware and software tutorials",
"image": "full-sized/Tutorials.png",
"url": "https://www.raspberrypi.com/tutorials/"
},
{
"title": "Forums",
"description": "User and product support forums",
Expand Down Expand Up @@ -144,6 +150,12 @@
"image": "full-sized/Datasheets.png",
"url": "https://datasheets.raspberrypi.com"
},
{
"title": "Tutorials",
"description": "Hands-on hardware and software tutorials",
"image": "full-sized/Tutorials.png",
"url": "https://www.raspberrypi.com/tutorials/"
},
{
"title": "Forums",
"description": "User and product support forums",
Expand Down Expand Up @@ -192,6 +204,12 @@
"image": "full-sized/Datasheets.png",
"url": "https://datasheets.raspberrypi.com"
},
{
"title": "Tutorials",
"description": "Hands-on hardware and software tutorials",
"image": "full-sized/Tutorials.png",
"url": "https://www.raspberrypi.com/tutorials/"
},
{
"title": "Forums",
"description": "User and product support forums",
Expand Down