{{- $architecture := or .architecture "armhf" -}} {{- $cmdline := or .cmdline "root=LABEL=root rootwait ro fsck.mode=auto fsck.repair=yes console=ttyS1,115200" -}} {{- $kernel := or .kernel "linux-image-armmp" -}} {{- $machine := or .machine "rpi_2" -}} {{- $project := or .project "pinball" -}} {{- $suite := or .suite "bullseye" -}} {{- $uboot_machine := or .uboot_machine (printf "%s" $machine) -}} {{- $image := or .image (printf "%s-%s-%s.img" $project $architecture $machine) -}} architecture: {{$architecture}} actions: - action: image-partition imagename: {{$image}} imagesize: 2GB partitiontype: msdos mountpoints: - mountpoint: / partition: root - mountpoint: /boot/firmware partition: firmware options: [x-systemd.automount] partitions: - name: firmware fs: fat32 start: 0% end: 128MB - name: root fs: ext4 start: 128MB end: 100% flags: [boot] - action: apt packages: - initramfs-tools - e2fsprogs {{if eq $suite "stretch"}} {{else}} - u-boot-menu - u-boot-rpi {{end}} - action: apt packages: - {{$kernel}} - action: apt packages: - firmware-brcm80211 - raspi-firmware - action: run chroot: true command: > mkdir -p /boot/firmware && cp -av /usr/lib/raspi-firmware/* /boot/firmware/ && cp -av /usr/lib/linux-image-*-*/broadcom/*.dtb /boot/firmware/ || cp -av /usr/lib/linux-image-*-*/bcm*rpi*.dtb /boot/firmware/ && cp -av /usr/lib/u-boot/{{$uboot_machine}}/* /boot/firmware/ && echo 'ROOTPART="LABEL=root"' >> /etc/default/raspi-firmware - action: run chroot: true command: > echo "# /boot/firmware/config.txt" | tee /boot/firmware/config.txt \ {{if eq $architecture "arm64"}} && echo 'arm_64bit=1' | tee -a /boot/firmware/config.txt \ {{else}} && echo 'arm_64bit=0' | tee -a /boot/firmware/config.txt \ {{end}} && echo 'enable_uart=1' | tee -a /boot/firmware/config.txt && echo 'uart_2ndstage' | tee -a /boot/firmware/config.txt && echo 'kernel=u-boot.bin' | tee -a /boot/firmware/config.txt && echo 'upstream_kernel=1' | tee -a /boot/firmware/config.txt && cat /boot/firmware/config.txt - action: run chroot: true command: > echo "# /etc/default/u-boot" > /etc/default/u-boot && echo 'U_BOOT_ALTERNATIVES="default recovery"' >> /etc/default/u-boot && echo 'U_BOOT_DEFAULT="l0"' >> /etc/default/u-boot && echo 'U_BOOT_ENTRIES="all"' >> /etc/default/u-boot \ {{if eq $machine "rpi_2"}} \ && echo 'U_BOOT_FDT="broadcom/bcm2836-rpi-2-b.dtb"' >> /etc/default/u-boot \ {{else}} \ {{if eq $machine "rpi_3_32b" "rpi_3_64b"}} \ && echo 'U_BOOT_FDT="broadcom/bcm2837-rpi-3-b.dtb"' >> /etc/default/u-boot \ {{else}} \ {{if eq $machine "rpi_4"}} \ && echo 'U_BOOT_FDT="broadcom/bcm2711-rpi-4-b.dtb"' >> /etc/default/u-boot \ {{end}} \ {{end}} \ {{end}} \ && echo 'U_BOOT_MENU_LABEL="Debian ({{$project}}) GNU/Linux: "' >> /etc/default/u-boot && echo 'U_BOOT_PARAMETERS="{{$cmdline}}"' >> /etc/default/u-boot && echo 'U_BOOT_ROOT=""' >> /etc/default/u-boot && echo 'U_BOOT_TIMEOUT="50"' >> /etc/default/u-boot && echo 'U_BOOT_UPDATE="true"' >> /etc/default/u-boot && cat /etc/default/u-boot {{if eq $suite "stretch"}} {{else}} - action: run description: Update bootloader menu chroot: true command: u-boot-update {{end}} - action: run chroot: true command: update-initramfs -u