raspberrypi / cmprovision

Provisioning system for CM4 products
BSD 3-Clause "New" or "Revised" License
88 stars 11 forks source link

Raspberry Pi Compute Module Provisioning System

Web application to mass program compute modules; designed to run on a Raspberry Pi 4. Compute Module 3, 3+ and 4 are supported out-of-the-box. Pi 4 boards can also be provisioned, but that requires that network boot is enabled in EEPROM settings first.

screenshot

Documentation

Full documentation is available on the Product Information Portal: Using the Compute Module Provisioner.pdf

Provisioning Compute Module 4 Devices

This process requires a Raspberry Pi 4 which will be used solely to mass program compute modules. Make sure eth0 connects to an Ethernet switch that only has the compute modules you wish to program connected.

WARNING: Do NOT connect eth0 to your office/public network, since it may also provision other Raspberry Pi devices. Instead, use the wireless LAN interface to access the web interface, and your local network.

  1. Start with a fresh 64-bit Raspberry Pi OS (Lite) installation. For simplicity, use Raspberry Pi Imager and the advanced settings menu (Ctrl-Shift-X) to set the password, hostname and wireless LAN configuration.

    NOTE: If you intend to write images larger than 2 GB, you MUST install the 64-bit edition of Raspberry Pi OS (Lite), which is available in Raspberry Pi Imager under the category "Raspberry Pi OS (other)" -> "Raspberry Pi OS Lite (64-bit)".

  2. Configure eth0 to have a static IP of 172.20.0.1 inside a /16 subnet (netmask 255.255.0.0):

    sudo nano /etc/dhcpcd.conf  

    Add to bottom of file:

    interface eth0
    static ip_address=172.20.0.1/16  

    Do not set a default gateway. Reboot afterwards.

  3. Run sudo apt update to make sure the package information on your Pi is up to date, and it is able to install dependencies.

  4. Install the ready-made .deb package from https://github.com/raspberrypi/cmprovision/releases/:

    sudo apt install ./cmprovision4_*_all.deb  
  5. Set a web application username and password with:

    sudo /var/lib/cmprovision/artisan auth:create-user  

You can now access the web interface with a web browser on the wireless LAN IP address.

Provisioning Compute Module 3 and 3+ Devices

This process requires a Raspberry Pi 4 which will be used solely to mass program compute modules.

WARNING: Do NOT connect eth0 to your office/public network, since it may also provision other Raspberry Pi devices. Instead, use the wireless LAN interface to access the web interface, and your local network.

When provisioning Compute Module 3 and 3+ modules, Ethernet is not used: instead the images are transferred over USB. Use a good quality USB A to micro USB cable between the Pi 4 acting as server and the USB slave port of each CMIO board containing the compute modules to be provisioned. If you wish to provision more than 4 compute modules at a time, a USB hub can be used. Connect power supplies to the power in micro USB port of the CMIO boards, and make sure the J4 USB slave boot enable jumper is set to en.

  1. Start with a fresh 64-bit Raspberry Pi OS (Lite) installation. For simplicity, use Raspberry Pi Imager and the advanced settings menu (Ctrl-Shift-X) to set the password, hostname and wireless LAN configuration.

    NOTE: If you intend to write images larger than 2 GB, you MUST install the 64-bit edition of Raspberry Pi OS (Lite), which is available in Raspberry Pi Imager under the category "Raspberry Pi OS (other)" -> "Raspberry Pi OS Lite (64-bit)".

  2. Run sudo apt update to make sure the package information on your Pi is up to date, and it is able to install dependencies.

  3. Install the ready-made .deb package from https://github.com/raspberrypi/cmprovision/releases/:

    sudo apt install ./cmprovision4_*_all.deb  
  4. Set a web application username and password with:

    sudo /var/lib/cmprovision/artisan auth:create-user  

You can now access the web interface with a web browser on the wireless LAN IP address.

Provisioning from an alternate OS

During provisioning of CM3 and CM3+ devices, a small utility operating system, scriptexecute, is USB booted on each compute module. This configures the compute modules as USB network adapters, and expects to be able to reach the provisioning server on predictable IPv6 link-local addresses that can be calculated based on the MAC address that each compute module chooses for its USB network interface. On Raspberry Pi OS, this is configured automatically by putting slaac hwaddr in /etc/dhcpcd.conf, however if your OS does not use dhcpcd as its network manager, then you will need to set this up manually. Examples of alternate network managers include systemd-networkd and Network Manager. How you set this up depends on the exact network manager used by your Linux distribution, so we cannot advise on how to do this.

Provisioning Raspberry Pi 4 boards

It is also possible to use the system to provision regular Raspberry Pi 4 boards, instead of CM4 modules. However that requires that network boot is enabled first in the EEPROM settings of each Pi 4.

You can create a SD card that enables that with Imager, by going to: "Choose OS" -> "Misc utility images" -> "Bootloader" -> "Network boot"

Development

This PHP web application uses the Laravel framework. Make sure you familarize yourself with the fine documentation: https://laravel.com/docs/8.x/.

In particular note:

Licence

The main code of the Raspberry Pi compute module provisioning system is made available under the terms of the BSD 3-clause ("new") license. Look in the vendor directory (after running composer --install) to consult the open source licenses of the various dependencies like the Laravel framework used.