2019-12-17 20:41:16 +00:00
|
|
|
# See https://wiki.debian.org/RaspberryPi3 for known issues and more details.
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- mkimg: "{{ output }}"
|
|
|
|
size: 1500M
|
|
|
|
|
|
|
|
- mklabel: msdos
|
|
|
|
device: "{{ output }}"
|
|
|
|
|
|
|
|
- mkpart: primary
|
|
|
|
fs-type: 'fat32'
|
|
|
|
device: "{{ output }}"
|
2021-02-19 10:41:43 +00:00
|
|
|
start: 4MiB
|
2019-12-17 20:41:16 +00:00
|
|
|
end: 20%
|
|
|
|
tag: /boot
|
|
|
|
|
|
|
|
- mkpart: primary
|
|
|
|
device: "{{ output }}"
|
|
|
|
start: 20%
|
|
|
|
end: 100%
|
|
|
|
tag: /
|
|
|
|
|
|
|
|
- kpartx: "{{ output }}"
|
|
|
|
|
|
|
|
- mkfs: vfat
|
|
|
|
partition: /boot
|
|
|
|
label: RASPIFIRM
|
|
|
|
|
|
|
|
- mkfs: ext4
|
|
|
|
partition: /
|
|
|
|
label: RASPIROOT
|
|
|
|
|
|
|
|
- mount: /
|
|
|
|
|
|
|
|
- mount: /boot
|
|
|
|
mount-on: /
|
|
|
|
dirname: '/boot/firmware'
|
|
|
|
|
|
|
|
- unpack-rootfs: /
|
|
|
|
|
2021-01-14 06:55:55 +00:00
|
|
|
- qemu-debootstrap: __RELEASE__
|
2019-12-17 20:41:16 +00:00
|
|
|
mirror: http://deb.debian.org/debian
|
|
|
|
target: /
|
|
|
|
arch: __ARCH__
|
|
|
|
components:
|
|
|
|
- main
|
|
|
|
- contrib
|
|
|
|
- non-free
|
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
2020-04-05 02:56:51 +01:00
|
|
|
- create-file: /etc/apt/sources.list
|
2021-08-28 04:25:38 +01:00
|
|
|
contents: |+
|
2021-01-14 06:55:55 +00:00
|
|
|
deb http://deb.debian.org/debian __RELEASE__ main contrib non-free
|
2021-05-07 19:35:05 +01:00
|
|
|
deb http://security.debian.org/debian-security __SECURITY_SUITE__ main contrib non-free
|
2021-08-28 03:01:30 +01:00
|
|
|
__BACKPORTS__
|
2021-08-28 04:25:38 +01:00
|
|
|
|
2020-04-05 02:56:51 +01:00
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
2021-04-30 18:23:21 +01:00
|
|
|
- copy-file: /etc/initramfs-tools/hooks/rpi-resizerootfs
|
|
|
|
src: rootfs/etc/initramfs-tools/hooks/rpi-resizerootfs
|
|
|
|
perm: 0755
|
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
|
|
|
- copy-file: /etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs
|
|
|
|
src: rootfs/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs
|
|
|
|
perm: 0755
|
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
2019-12-17 20:41:16 +00:00
|
|
|
- chroot: /
|
|
|
|
shell: |
|
|
|
|
apt-get update
|
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
|
|
|
- apt: install
|
|
|
|
packages:
|
2021-04-27 14:13:14 +01:00
|
|
|
- ca-certificates
|
2019-12-17 20:41:16 +00:00
|
|
|
- dosfstools
|
2020-10-27 01:19:09 +00:00
|
|
|
- iw
|
2021-04-27 14:13:14 +01:00
|
|
|
- parted
|
|
|
|
- ssh
|
2019-12-17 20:41:16 +00:00
|
|
|
- wpasupplicant
|
|
|
|
- __LINUX_IMAGE__
|
2021-08-28 04:20:39 +01:00
|
|
|
- __RASPI_FIRMWARE__
|
|
|
|
- __WIRELESS_FIRMWARE__
|
2019-12-17 20:41:16 +00:00
|
|
|
tag: /
|
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
|
|
|
- cache-rootfs: /
|
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
|
|
|
- shell: |
|
|
|
|
echo "__HOST__-$(date +%Y%m%d)" > "${ROOT?}/etc/hostname"
|
|
|
|
|
|
|
|
# Allow root logins locally with no password
|
|
|
|
sed -i 's,root:[^:]*:,root::,' "${ROOT?}/etc/shadow"
|
|
|
|
|
2020-08-15 06:06:18 +01:00
|
|
|
install -m 644 -o root -g root rootfs/etc/fstab "${ROOT?}/etc/fstab"
|
2019-12-17 20:41:16 +00:00
|
|
|
|
2020-08-15 06:06:18 +01:00
|
|
|
install -m 644 -o root -g root rootfs/etc/network/interfaces.d/eth0 "${ROOT?}/etc/network/interfaces.d/eth0"
|
2020-08-15 06:15:43 +01:00
|
|
|
install -m 600 -o root -g root rootfs/etc/network/interfaces.d/wlan0 "${ROOT?}/etc/network/interfaces.d/wlan0"
|
2019-12-17 20:41:16 +00:00
|
|
|
|
2020-08-15 06:06:18 +01:00
|
|
|
install -m 755 -o root -g root rootfs/usr/local/sbin/rpi-set-sysconf "${ROOT?}/usr/local/sbin/rpi-set-sysconf"
|
|
|
|
install -m 644 -o root -g root rootfs/etc/systemd/system/rpi-set-sysconf.service "${ROOT?}/etc/systemd/system/"
|
|
|
|
install -m 644 -o root -g root rootfs/boot/firmware/sysconf.txt "${ROOT?}/boot/firmware/sysconf.txt"
|
2019-12-17 20:41:16 +00:00
|
|
|
mkdir -p "${ROOT?}/etc/systemd/system/basic.target.requires/"
|
|
|
|
ln -s /etc/systemd/system/rpi-set-sysconf.service "${ROOT?}/etc/systemd/system/basic.target.requires/rpi-set-sysconf.service"
|
|
|
|
|
2021-04-30 18:23:21 +01:00
|
|
|
# Resize script is now in the initrd for first boot; no need to ship it.
|
|
|
|
rm -f "${ROOT?}/etc/initramfs-tools/hooks/rpi-resizerootfs"
|
|
|
|
rm -f "${ROOT?}/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs"
|
2019-12-17 20:41:16 +00:00
|
|
|
|
2021-02-18 17:31:23 +00:00
|
|
|
install -m 644 -o root -g root rootfs/etc/systemd/system/rpi-reconfigure-raspi-firmware.service "${ROOT?}/etc/systemd/system/"
|
2019-12-17 20:41:16 +00:00
|
|
|
mkdir -p "${ROOT?}/etc/systemd/system/multi-user.target.requires/"
|
2021-02-18 17:31:23 +00:00
|
|
|
ln -s /etc/systemd/system/rpi-reconfigure-raspi-firmware.service "${ROOT?}/etc/systemd/system/multi-user.target.requires/rpi-reconfigure-raspi-firmware.service"
|
2021-07-02 19:01:17 +01:00
|
|
|
__FIX_FIRMWARE_PKG_NAME__
|
2021-02-18 17:31:23 +00:00
|
|
|
|
|
|
|
install -m 644 -o root -g root rootfs/etc/systemd/system/rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/"
|
2019-12-17 20:41:16 +00:00
|
|
|
ln -s /etc/systemd/system/rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/multi-user.target.requires/rpi-generate-ssh-host-keys.service"
|
2019-12-06 15:09:31 +00:00
|
|
|
rm -f "${ROOT?}"/etc/ssh/ssh_host_*_key*
|
2021-04-13 22:58:25 +01:00
|
|
|
|
2021-08-28 03:01:30 +01:00
|
|
|
__EXTRA_ROOT_SHELL_CMDS__
|
2019-12-17 20:41:16 +00:00
|
|
|
root-fs: /
|
|
|
|
|
|
|
|
# Copy the relevant device tree files to the boot partition
|
|
|
|
- chroot: /
|
|
|
|
shell: |
|
|
|
|
install -m 644 -o root -g root __DTB__ /boot/firmware/
|
|
|
|
|
|
|
|
# Clean up archive cache (likely not useful) and lists (likely outdated) to
|
|
|
|
# reduce image size by several hundred megabytes.
|
|
|
|
- chroot: /
|
|
|
|
shell: |
|
|
|
|
apt-get clean
|
|
|
|
rm -rf /var/lib/apt/lists
|
|
|
|
|
|
|
|
# Modify the kernel commandline we take from the firmware to boot from
|
|
|
|
# the partition labeled raspiroot instead of forcing it to mmcblk0p2
|
2021-02-18 17:31:23 +00:00
|
|
|
#
|
|
|
|
# These changes will be overwritten after the hardware is probed
|
|
|
|
# after dpkg reconfigures raspi-firmware (upon first boot).
|
2019-12-17 20:41:16 +00:00
|
|
|
- chroot: /
|
|
|
|
shell: |
|
2021-02-18 17:31:23 +00:00
|
|
|
sed -i 's/^/console=__SERIAL_CONSOLE__ /' /boot/firmware/cmdline.txt
|
2019-12-17 20:41:16 +00:00
|
|
|
sed -i 's/.dev.mmcblk0p2/LABEL=RASPIROOT/' /boot/firmware/cmdline.txt
|
2021-08-28 03:01:30 +01:00
|
|
|
__EXTRA_CHROOT_SHELL_CMDS__
|
2019-12-17 20:41:16 +00:00
|
|
|
|
|
|
|
# TODO(https://github.com/larswirzenius/vmdb2/issues/24): remove once vmdb
|
|
|
|
# clears /etc/resolv.conf on its own.
|
|
|
|
- shell: |
|
|
|
|
rm "${ROOT?}/etc/resolv.conf"
|
|
|
|
root-fs: /
|
2021-05-29 00:48:39 +01:00
|
|
|
|
2021-06-08 17:57:34 +01:00
|
|
|
# Clear /etc/machine-id and /var/lib/dbus/machine-id, as both should
|
2021-06-08 17:51:12 +01:00
|
|
|
# be auto-generated upon first boot. From the manpage
|
|
|
|
# (machine-id(5)):
|
2021-05-29 00:48:39 +01:00
|
|
|
#
|
|
|
|
# For normal operating system installations, where a custom image is
|
|
|
|
# created for a specific machine, /etc/machine-id should be
|
|
|
|
# populated during installation.
|
|
|
|
#
|
|
|
|
# Note this will also trigger ConditionFirstBoot=yes for systemd.
|
|
|
|
- chroot: /
|
|
|
|
shell: |
|
2021-06-08 17:57:34 +01:00
|
|
|
rm -f /etc/machine-id /var/lib/dbus/machine-id
|