An opinionated HashiCorp Packer template for Raspberry Pi images, built around the packer-builder-arm ARM Packer builder plugin. It implements cloud-init for last-mile OS configuration and management.
See pi.pkr.hcl.
Copy example.pkrvars.hcl and edit.
(See Packer docs for more ways to set input variables)
(e.g. using usb-gadget/usb_gadget.pkrvars.hcl)
docker run --rm --privileged \
    -v /dev:/dev \
    -v ${PWD}:/build \
    mkaczanowski/packer-builder-arm \
        build \
        -var-file=usb-gadget/usb_gadget.pkrvars.hcl \
        -var "git_repo=$(git remote get-url origin)" \
        -var "git_commit=$(git rev-parse HEAD)" \
        pi.pkr.hcl(Using the above Docker image and run command is the easiest way to build cross-platform ARM images. See packer-builder-arm for alternative ways to run Packer with the packer-builder-arm plugin)
| Name | Description | Type | Default | Required | 
|---|---|---|---|---|
| boot_cmdline | /boot/cmdline.txt config.Linux kernel boot parameters, as a list. Will be joined as a space-delimited string. e.g.: boot_cmdline = [Will create /boot/cmdline.txt asabc def  | 
list(string) | 
[  | 
no | 
| boot_config | /boot/config.txtRaspberry Pi system configuration, as a list. Will be joined by newlines. e.g.: boot_cmdline = [Will begin /boot/config.txt with:abc=123  | 
list(string) | 
[] | 
no | 
| boot_config_filters | /boot/config.txtRaspberry Pi system conditional filters configuration, as a list. e.g.: boot_config_filters = [Will end /boot/config.txt with:[pi0]  | 
list(list(string)) | 
[  | 
no | 
| cloudinit_metadata_file | The local path to a cloud-init metadata file. See the cloud-init NoCloud datasource | 
string | 
n/a | yes | 
| cloudinit_userdata_file | The local path to a cloud-init userdata file. See the cloud-init NoCloud datasource | 
string | 
n/a | yes | 
| file_checksum | The checksum value of file_url.See packer-builder-arm.  | 
string | 
"" | 
no | 
| file_checksum_type | The checksum type of file_checksum_url.See packer-builder-arm.  | 
string | 
"sha256" | 
no | 
| file_checksum_url | The checksum file URL of file_url.See packer-builder-arm.  | 
string | 
"" | 
no | 
| file_target_extension | The file extension of file_url.See packer-builder-arm.  | 
string | 
"zip" | 
no | 
| file_url | The URL of the OS image file. See packer-builder-arm.  | 
string | 
n/a | yes | 
| git_commit | The current git commit to pass to the build. It will be prepended to /boot/config.txtUse on the command-line, i.e. -var "git_commit=$(git rev-parse HEAD)" | 
string | 
"" | 
no | 
| git_repo | The current git remote to pass to the build. It will be prepended to /boot/config.txtUse on the command-line, i.e. -var "git_repo=$(git remote get-url origin)"  | 
string | 
"" | 
no | 
| image_path | The file path the new OS image to create. | string | 
n/a | yes | 
| kernel_modules | List of Linux kernel modules to enable, as seen in /etc/modules | 
list(string) | 
[] | 
no | 
| locales | List of locales to generate, as seen in /etc/locale.gen. | 
list(string) | 
[  | 
no | 
| wpa_supplicant_country | The ISO 3166-1 alpha-2 country code in which the device is operating. Required by the wpa_supplicant.  | 
string | 
"CA" | 
no | 
| wpa_supplicant_enabled | Create a wpa_supplicant.conf file on the image.If wpa_supplicant_path exists, it will be copied to the OS image, otherwise a basic wpa_supplicant.conf file will be created using wpa_supplicant_ssid, wpa_supplicant_pass and wpa_supplicant_country. | 
bool | 
true | 
no | 
| wpa_supplicant_pass | The WiFi password. | string | 
"" | 
no | 
| wpa_supplicant_path | The local path to existing wpa_supplicant.conf to copy to the image. | 
string | 
"/tmp/dummy" | 
no | 
| wpa_supplicant_ssid | The WiFi SSID. | string | 
"" | 
no |