A macOS CLI tool for creating custom Raspberry Pi SD card images with Cloud Init support. Detects removable disks, burns .img files, and injects cloud-config — all from the terminal.
- macOS (uses
diskutilanddd) - Python 3.10+
- An SD card reader with a card inserted
git clone https://github.com/open-horizon-services/utility-raspberry-pi-image-builder.git
cd utility-raspberry-pi-image-builder
python -m venv venv && source venv/bin/activate
pip install -e ".[dev]"List available disks, then burn:
rpi-burner list
sudo rpi-burner burn image.img -d /dev/disk4 --cloud-init config.yamlRequires sudo — disk write operations need root access.
rpi-burner list # List removable disks
rpi-burner burn <image> [options] # Burn image to disk| Flag | Description |
|---|---|
-d, --disk PATH |
Target disk device path (e.g., /dev/disk4). Prompts interactively if omitted. |
--cloud-init PATH |
Cloud-init config file (YAML) to inject onto boot partition. |
--confirm |
Skip the confirmation prompt (use with caution). |
--no-eject |
Don't eject the disk after writing. |
Provide a YAML cloud-config file to configure the Pi on first boot. The file is written to the FAT32 boot partition as user-data.
#cloud-config
hostname: rpi-hostname
users:
- name: pi
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
ssh_authorized_keys:
- ssh-rsa AAAAB3... your-key
runcmd:
- echo "Ready" > /home/pi/booted.txtSee samples/ for more examples: Wi-Fi, static IP, SSH keys.
Apache 2.0