| 1 |
{{- $architecture := or .architecture "armhf" -}} |
| 2 |
{{- $cmdline := or .cmdline "root=LABEL=root rootwait ro fsck.mode=auto fsck.repair=yes console=ttyS1,115200" -}} |
| 3 |
{{- $kernel := or .kernel "linux-image-armmp" -}} |
| 4 |
{{- $machine := or .machine "rpi_2" -}} |
| 5 |
{{- $project := or .project "pinball" -}} |
| 6 |
{{- $suite := or .suite "bullseye" -}} |
| 7 |
{{- $uboot_machine := or .uboot_machine (printf "%s" $machine) -}} |
| 8 |
{{- $image := or .image (printf "%s-%s-%s.img" $project $architecture $machine) -}} |
| 9 |
|
| 10 |
architecture: {{$architecture}} |
| 11 |
|
| 12 |
actions: |
| 13 |
|
| 14 |
- action: image-partition |
| 15 |
imagename: {{$image}} |
| 16 |
imagesize: 2GB |
| 17 |
partitiontype: msdos |
| 18 |
mountpoints: |
| 19 |
- mountpoint: / |
| 20 |
partition: root |
| 21 |
- mountpoint: /boot/firmware |
| 22 |
partition: firmware |
| 23 |
options: [x-systemd.automount] |
| 24 |
partitions: |
| 25 |
- name: firmware |
| 26 |
fs: fat32 |
| 27 |
start: 0% |
| 28 |
end: 128MB |
| 29 |
- name: root |
| 30 |
fs: ext4 |
| 31 |
start: 128MB |
| 32 |
end: 100% |
| 33 |
flags: [boot] |
| 34 |
|
| 35 |
- action: apt |
| 36 |
packages: |
| 37 |
- initramfs-tools |
| 38 |
- e2fsprogs |
| 39 |
{{if eq $suite "stretch"}} |
| 40 |
{{else}} |
| 41 |
- u-boot-menu |
| 42 |
- u-boot-rpi |
| 43 |
{{end}} |
| 44 |
|
| 45 |
- action: apt |
| 46 |
packages: |
| 47 |
- {{$kernel}} |
| 48 |
|
| 49 |
- action: apt |
| 50 |
packages: |
| 51 |
- firmware-brcm80211 |
| 52 |
- raspi-firmware |
| 53 |
|
| 54 |
- action: run |
| 55 |
chroot: true |
| 56 |
command: > |
| 57 |
mkdir -p /boot/firmware |
| 58 |
&& cp -av /usr/lib/raspi-firmware/* /boot/firmware/ |
| 59 |
&& cp -av /usr/lib/linux-image-*-*/broadcom/*.dtb /boot/firmware/ |
| 60 |
|| cp -av /usr/lib/linux-image-*-*/bcm*rpi*.dtb /boot/firmware/ |
| 61 |
&& cp -av /usr/lib/u-boot/{{$uboot_machine}}/* /boot/firmware/ |
| 62 |
&& echo 'ROOTPART="LABEL=root"' >> /etc/default/raspi-firmware |
| 63 |
|
| 64 |
- action: run |
| 65 |
chroot: true |
| 66 |
command: > |
| 67 |
echo "# /boot/firmware/config.txt" |
| 68 |
| tee /boot/firmware/config.txt \ |
| 69 |
{{if eq $architecture "arm64"}} |
| 70 |
&& echo 'arm_64bit=1' |
| 71 |
| tee -a /boot/firmware/config.txt \ |
| 72 |
{{else}} |
| 73 |
&& echo 'arm_64bit=0' |
| 74 |
| tee -a /boot/firmware/config.txt \ |
| 75 |
{{end}} |
| 76 |
&& echo 'enable_uart=1' |
| 77 |
| tee -a /boot/firmware/config.txt |
| 78 |
&& echo 'uart_2ndstage' |
| 79 |
| tee -a /boot/firmware/config.txt |
| 80 |
&& echo 'kernel=u-boot.bin' |
| 81 |
| tee -a /boot/firmware/config.txt |
| 82 |
&& echo 'upstream_kernel=1' |
| 83 |
| tee -a /boot/firmware/config.txt |
| 84 |
&& cat /boot/firmware/config.txt |
| 85 |
|
| 86 |
- action: run |
| 87 |
chroot: true |
| 88 |
command: > |
| 89 |
echo "# /etc/default/u-boot" > /etc/default/u-boot |
| 90 |
&& echo 'U_BOOT_ALTERNATIVES="default recovery"' >> /etc/default/u-boot |
| 91 |
&& echo 'U_BOOT_DEFAULT="l0"' >> /etc/default/u-boot |
| 92 |
&& echo 'U_BOOT_ENTRIES="all"' >> /etc/default/u-boot \ |
| 93 |
{{if eq $machine "rpi_2"}} \ |
| 94 |
&& echo 'U_BOOT_FDT="broadcom/bcm2836-rpi-2-b.dtb"' >> /etc/default/u-boot \ |
| 95 |
{{else}} \ |
| 96 |
{{if eq $machine "rpi_3_32b" "rpi_3_64b"}} \ |
| 97 |
&& echo 'U_BOOT_FDT="broadcom/bcm2837-rpi-3-b.dtb"' >> /etc/default/u-boot \ |
| 98 |
{{else}} \ |
| 99 |
{{if eq $machine "rpi_4"}} \ |
| 100 |
&& echo 'U_BOOT_FDT="broadcom/bcm2711-rpi-4-b.dtb"' >> /etc/default/u-boot \ |
| 101 |
{{end}} \ |
| 102 |
{{end}} \ |
| 103 |
{{end}} \ |
| 104 |
&& echo 'U_BOOT_MENU_LABEL="Debian ({{$project}}) GNU/Linux: "' >> /etc/default/u-boot |
| 105 |
&& echo 'U_BOOT_PARAMETERS="{{$cmdline}}"' >> /etc/default/u-boot |
| 106 |
&& echo 'U_BOOT_ROOT=""' >> /etc/default/u-boot |
| 107 |
&& echo 'U_BOOT_TIMEOUT="50"' >> /etc/default/u-boot |
| 108 |
&& echo 'U_BOOT_UPDATE="true"' >> /etc/default/u-boot |
| 109 |
&& cat /etc/default/u-boot |
| 110 |
|
| 111 |
{{if eq $suite "stretch"}} |
| 112 |
{{else}} |
| 113 |
- action: run |
| 114 |
description: Update bootloader menu |
| 115 |
chroot: true |
| 116 |
command: u-boot-update |
| 117 |
{{end}} |
| 118 |
|
| 119 |
- action: run |
| 120 |
chroot: true |
| 121 |
command: update-initramfs -u |