Skip to content

Repository files navigation

Raspberry pi cncjs image

This is a raspberry pi image creation automation project for cnc.js setup on Rpi with 64 bits using HashiCorp packer, using an upgraded version of the popular https://github.com/mkaczanowski/packer-builder-arm plugin (see https://gitub.com/brederle/packer-plugin-armflash)

Raspberry PI host image creation

Please submit bugs and wishes under https://github.com/brederle/packer-image-cncjs/issues.

The repo contains a pre-configured .devcontainer with the required packer tooling and the packer-plugin-armflash plugin preconfigured. To use the DevContainer:

  1. Install the Microsoft-supported VSCode devcontainer extension

  2. Load the repo folder wth VSCode

  3. Push STRG+SHIFT+P > Dev Containers: Rebuild and Reopen in Container

Eventually, a terminal opens up where packer can directly be started as described below.

Simple default image

Without setting any variables, a universal image is build.

packer build .

Neither wifi nor ssh key access is configured by default, make the corresponding settings when uploading cncpi-pi-arm64.img via Raspberry Pi imager.

Custom, personal image

For a custom image build, configure your (private) parameters under .private. You can copy and extend the .template files:

  • authorized_keys the well-known ssh configuration for key access
    For security reasons, ssh is using contemporary elliptic crypto methods and prefers elliptic keys.

  • settings.pkrvars.hcl the well-known ssh configuration for key access
    For security reasons, ssh is using contemporary elliptic crypto methods and prefers elliptic keys.

Look at raspios.vars.pkr.hcl and IMG.vars.pkr.hcl for the documentation of the different setting parameters and their defaults.

Run packer with:

packer build -var-file=".private/settings.pkrvars.hcl" .
Warning
Please avoid to check in credential and other private setting in public repos!

Flashing on Unix systems (Mac/Linux)

diskutl list
sudo diskutil unmountDisk /dev/diskX
sudo dd if=./lowrider3-cncjs-raspi-arm64.img of=/dev/rdiskX bs=4M

where /dev/diskX is the disk with the size of your eMMC listed in the first step. Note: Using rdisk and bs=4M optimized flashing speed.

Detail Packer log

export PACKER-LOG=1

You can already set the variable globally in devcontainer.json to run it as default.

Test mount image in devcontainer

Before flashing the image, you can review the image content by mounting the partitions:

export IMG_LOOP=$(losetup --find --partscan --show lowrider3-cncjs-raspi-arm64.img)
mount -o discard ${IMG_LOOP}p2 /media/img
mount -o discard ${IMG_LOOP}p1 /media/img/boot/firmware

With: * /dev/loopXp1: boot partition (new bookworm layout) * /dev/loopXp2: workload partition

To remove the environnment:

umount ${IMG_LOOP}p1
umount ${IMG_LOOP}p2
losetup --detach ${IMG_LOOP}

About

Arm64 Raspberry image, CNS.js preinstalled and hardened

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages