This provides an environment based in a container to deploy Raspberry Pi utilities related to the provisioning of their devices. Currently it contains:
raspberrypi/usbboot: See here
Once deployed, a shell can be attached to perform the operations like:
- eeprom upgrade
- image transfer
While there is nothing fancy here, this repo should provide an easy to deploy service that helps with the preparation of several Pi devices in a reliable fashion, using nothing more than a Linux machine with an USB port.
See raspberrypi/cmprovision for a more elaborated solution.
- Clone this in a Linux machine (macOS / Windows don't provide access to their USB ports)
git clone https://github.com/vidalastudillo/provision_pi- Get the
Major Versionfor the USB Driver in your Kernel
The container needs access to the Pi trough the host and as it is expected to connect / disconnect several times when the container it is already running.
The Major Version will be used to set the type of device allowed to have access by the container.
Connect the Pi to the host, with the jumper on the position to enable the Boot function.
Ask for the USB buses in the system and the devices connected to them:
lsusbCheck for the line that contains something like: Broadcom Corp. BCM2711 Boot and take note of its Bus and Device.
ie. if the result is Bus 001 Device 007: ID 0a5c:2711 Broadcom Corp. BCM2711 Boot, then its Bus is 001 and its Device is 007
Get the Major number for the Bus and Device:
ls -la /dev/bus/usb/001/007ie. if the result is crw-rw-r-- 1 root root 189, 34 Apr 13 21:23 /dev/bus/usb/001/007 the number is 189 which will be used in the next step.
- Configure the service
Make a copy of the .env template and update it according to your preferences and using your favorite editor if it is not nano:
cd provision_pi
cp template.env .env
nano .env- Create the folder in your host to store the persistent home folder for the user
ie. mkdir pi
The name of the folder should be the same of the username you selected in the configuration, as this is the home folder of the user.
If this is not done before launching the container for the first time, docker will create with owner root, and you'll get issues with user permissions. To fix it, issue this in your host to change the ownership of the folder:
chown :
ie: chwon 1000:1000 ./pi
Once in the folder provision_pi use the run.sh script to manage the container deployment:
./run.sh start./run.sh attachNote the prompt root@provision_pi in your terminal, which means you are inside the container.
Make sure you are inside the persistent folder, which is the home of the user. The user is the one you selected in the .env file.
cd /home/piBased on the instructions from https://github.com/raspberrypi/usbboot build usbboot and enjoy!
git clone --depth=1 https://github.com/raspberrypi/usbboot
cd usbboot
make
./rpibootThe solution to deal with the dynamic access to the connecting / disconnecting of the devices is based on:
Accessing USB Devices In Docker (ttyUSB0, /dev/bus/usb/... for fastboot, adb) without using --privileged
https://stackoverflow.com/a/53892718/15786299
https://stackoverflow.com/a/34472148/15786299
https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/devices.txt