From cc0780ee693a393a94182661407ba5ff3d069efc Mon Sep 17 00:00:00 2001 From: Gunnar Wolf Date: Thu, 18 Jul 2019 21:18:59 -0300 Subject: [PATCH] Change references from rpi3-* to rpi-* --- raspi0w.yaml | 10 +- raspi1_b0rken.yaml | 144 ++++++++++++++ raspi1_uboot_b0rken.yaml | 182 ++++++++++++++++++ raspi2.yaml | 10 +- raspi3.yaml | 12 +- ...vice => rpi-generate-ssh-host-keys.service | 0 rpi3-resizerootfs => rpi-resizerootfs | 0 ...rootfs.service => rpi-resizerootfs.service | 2 +- 8 files changed, 343 insertions(+), 17 deletions(-) create mode 100644 raspi1_b0rken.yaml create mode 100644 raspi1_uboot_b0rken.yaml rename rpi3-generate-ssh-host-keys.service => rpi-generate-ssh-host-keys.service (100%) rename rpi3-resizerootfs => rpi-resizerootfs (100%) rename rpi3-resizerootfs.service => rpi-resizerootfs.service (85%) diff --git a/raspi0w.yaml b/raspi0w.yaml index 92a2f89..78b2a4a 100644 --- a/raspi0w.yaml +++ b/raspi0w.yaml @@ -102,14 +102,14 @@ steps: install -m 644 -o root -g root rules.v4 "${ROOT?}/etc/iptables/rules.v4" install -m 644 -o root -g root rules.v6 "${ROOT?}/etc/iptables/rules.v6" - install -m 755 -o root -g root rpi3-resizerootfs "${ROOT?}/usr/sbin/rpi3-resizerootfs" - install -m 644 -o root -g root rpi3-resizerootfs.service "${ROOT?}/etc/systemd/system" + install -m 755 -o root -g root rpi-resizerootfs "${ROOT?}/usr/sbin/rpi-resizerootfs" + install -m 644 -o root -g root rpi-resizerootfs.service "${ROOT?}/etc/systemd/system" mkdir -p "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/" - ln -s /etc/systemd/system/rpi3-resizerootfs.service "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/rpi3-resizerootfs.service" + ln -s /etc/systemd/system/rpi-resizerootfs.service "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/rpi-resizerootfs.service" - install -m 644 -o root -g root rpi3-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system" + install -m 644 -o root -g root rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system" mkdir -p "${ROOT?}/etc/systemd/system/multi-user.target.requires/" - ln -s /etc/systemd/system/rpi3-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/multi-user.target.requires/rpi3-generate-ssh-host-keys.service" + 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" rm -f ${ROOT?}/etc/ssh/ssh_host_*_key* cp "${ROOT?}/usr/lib/linux-image-4.19.0.5-rpi/bcm2835-rpi-zero-w.dtb" "${ROOT?}/boot/" diff --git a/raspi1_b0rken.yaml b/raspi1_b0rken.yaml new file mode 100644 index 0000000..c33982c --- /dev/null +++ b/raspi1_b0rken.yaml @@ -0,0 +1,144 @@ +# 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 }}" + start: 0% + 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: / + + # We need to use Debian buster (currently testing) instead of Debian stretch + # (currently stable) for: + # + # linux ≥ 4.14 + # Which includes the sdhost driver for faster SD card access and making the + # WiFi chip available, and has the WiFi driver enabled. + # + # raspi3-firmware ≥ 1.20171201-1 + # Which includes a recent enough firmware version to correctly pass the MAC + # address to the kernel. This is a regression with Linux ≥ 4.12, see + # https://github.com/raspberrypi/firmware/issues/846 + # Also, this package contains a Raspberry Pi 3-specific firmware file + # required by the WiFi driver. + - qemu-debootstrap: buster + mirror: http://deb.debian.org/debian + target: / + arch: armel + components: + - main + - contrib + - non-free + unless: rootfs_unpacked + + # TODO(https://bugs.debian.org/877855): remove this workaround once + # debootstrap is fixed + - chroot: / + shell: | + echo 'deb http://deb.debian.org/debian buster main contrib non-free' > /etc/apt/sources.list + apt-get update + unless: rootfs_unpacked + + - apt: install + packages: + - ssh + - parted + - dosfstools + # Contains /lib/firmware/brcm/brcmfmac43430-sdio.bin (required for WiFi). + - firmware-brcm80211 + - wireless-tools + - wpasupplicant + - raspi3-firmware + - linux-image-rpi + tag: / + unless: rootfs_unpacked + + - cache-rootfs: / + unless: rootfs_unpacked + + - shell: | + echo "rpi-z" > "${ROOT?}/etc/hostname" + + # '..VyaTFxP8kT6' is crypt.crypt('raspberry', '..') + sed -i 's,root:[^:]*,root:..VyaTFxP8kT6,' "${ROOT?}/etc/shadow" + + sed -i 's,#PermitRootLogin prohibit-password,PermitRootLogin yes,g' "${ROOT?}/etc/ssh/sshd_config" + + install -m 644 -o root -g root fstab "${ROOT?}/etc/fstab" + + install -m 644 -o root -g root eth0 "${ROOT?}/etc/network/interfaces.d/eth0" + + mkdir -p "${ROOT?}/etc/iptables" + install -m 644 -o root -g root rules.v4 "${ROOT?}/etc/iptables/rules.v4" + install -m 644 -o root -g root rules.v6 "${ROOT?}/etc/iptables/rules.v6" + + install -m 755 -o root -g root rpi-resizerootfs "${ROOT?}/usr/sbin/rpi3-resizerootfs" + install -m 644 -o root -g root rpi-resizerootfs.service "${ROOT?}/etc/systemd/system" + mkdir -p "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/" + ln -s /etc/systemd/system/rpi-resizerootfs.service "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/rpi3-resizerootfs.service" + + install -m 644 -o root -g root rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system" + mkdir -p "${ROOT?}/etc/systemd/system/multi-user.target.requires/" + ln -s /etc/systemd/system/rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/multi-user.target.requires/rpi3-generate-ssh-host-keys.service" + rm -f ${ROOT?}/etc/ssh/ssh_host_*_key* + + wget https://github.com/raspberrypi/firmware/blob/master/boot/bcm2708-rpi-b.dtb -O "${ROOT?}/boot/firmware/bcm2708-rpi-b.dtb" + wget https://github.com/raspberrypi/firmware/blob/master/boot/bcm2708-rpi-b-plus.dtb -O "${ROOT?}/boot/firmware/bcm2708-rpi-b-plus.dtb" + wget https://github.com/raspberrypi/firmware/blob/master/boot/bcm2708-rpi-0-w.dtb -O "${ROOT?}/boot/firmware/bcm2708-rpi-0-w.dtb" + wget https://github.com/raspberrypi/firmware/blob/master/boot/bcm2708-rpi-cm.dtb -O "${ROOT?}/boot/firmware/bcm2708-rpi-cm.dtb" + + cat >> "${ROOT?}/etc/motd" <<'EOT' + + Please change the root password by running passwd + EOT + root-fs: / + + # 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 + - chroot: / + shell: | + ls -aR /boot + sed -i 's/.dev.mmcblk0p2/LABEL=RASPIROOT/' /boot/firmware/cmdline.txt + + # 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: / diff --git a/raspi1_uboot_b0rken.yaml b/raspi1_uboot_b0rken.yaml new file mode 100644 index 0000000..afaf488 --- /dev/null +++ b/raspi1_uboot_b0rken.yaml @@ -0,0 +1,182 @@ +# 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 }}" + start: 0% + 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: / + + # We need to use Debian buster (currently testing) instead of Debian stretch + # (currently stable) for: + # + # linux ≥ 4.14 + # Which includes the sdhost driver for faster SD card access and making the + # WiFi chip available, and has the WiFi driver enabled. + # + # raspi3-firmware ≥ 1.20171201-1 + # Which includes a recent enough firmware version to correctly pass the MAC + # address to the kernel. This is a regression with Linux ≥ 4.12, see + # https://github.com/raspberrypi/firmware/issues/846 + # Also, this package contains a Raspberry Pi 3-specific firmware file + # required by the WiFi driver. + - qemu-debootstrap: buster + mirror: http://deb.debian.org/debian + target: / + arch: armel + components: + - main + - contrib + - non-free + unless: rootfs_unpacked + + # TODO(https://bugs.debian.org/877855): remove this workaround once + # debootstrap is fixed + - chroot: / + shell: | + echo 'deb http://deb.debian.org/debian buster main contrib non-free' > /etc/apt/sources.list + echo 'deb http://deb.debian.org/debian experimental main contrib non-free' >> /etc/apt/sources.list + echo 'APT::Default-Release "Buster";' > /etc/apt/apt.conf.d/08default-release + apt-get update + unless: rootfs_unpacked + + - apt: install + packages: + - ssh + - parted + - dosfstools + # Contains /lib/firmware/brcm/brcmfmac43430-sdio.bin (required for WiFi). + - firmware-brcm80211 + - wireless-tools + - wpasupplicant + # - raspi3-firmware + # linux-image >= 5.0.0 is needed (hence the addition of + # experimental above and the chrooted command below) + # - linux-image-rpi + tag: / + unless: rootfs_unpacked + + - apt: install + packages: + - u-boot-rpi + - u-boot-menu + tag: / + + - chroot: / + shell: | + cat > /etc/default/u-boot <<'EOF' + ## /etc/default/u-boot - configuration file for + ## u-boot-update(8) + + U_BOOT_UPDATE="true" + + U_BOOT_ALTERNATIVES="default recovery" + U_BOOT_DEFAULT="l0" + U_BOOT_ENTRIES="all" + U_BOOT_MENU_LABEL="Debian GNU/Linux" + U_BOOT_PARAMETERS="root=/dev/mmcblk0p2 ro rootwait console=tty0" + U_BOOT_ROOT="" + U_BOOT_TIMEOUT="50" + U_BOOT_FDT="bcm2835-rpi-zero-w.dts" + #U_BOOT_FDT_DIR="/boot/dtbs/" + EOF + apt-get -y -t experimental install raspi3-firmware + # apt-get -y -t experimental install linux-image-5.0.0-trunk-rpi + apt-get -y install linux-image-rpi + + - cache-rootfs: / + unless: rootfs_unpacked + + - shell: | + echo "rpi-z" > "${ROOT?}/etc/hostname" + + # '..VyaTFxP8kT6' is crypt.crypt('raspberry', '..') + sed -i 's,root:[^:]*,root:..VyaTFxP8kT6,' "${ROOT?}/etc/shadow" + + sed -i 's,#PermitRootLogin prohibit-password,PermitRootLogin yes,g' "${ROOT?}/etc/ssh/sshd_config" + + install -m 644 -o root -g root fstab "${ROOT?}/etc/fstab" + + install -m 644 -o root -g root eth0 "${ROOT?}/etc/network/interfaces.d/eth0" + + mkdir -p "${ROOT?}/etc/iptables" + install -m 644 -o root -g root rules.v4 "${ROOT?}/etc/iptables/rules.v4" + install -m 644 -o root -g root rules.v6 "${ROOT?}/etc/iptables/rules.v6" + + install -m 755 -o root -g root rpi-resizerootfs "${ROOT?}/usr/sbin/rpi3-resizerootfs" + install -m 644 -o root -g root rpi-resizerootfs.service "${ROOT?}/etc/systemd/system" + mkdir -p "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/" + ln -s /etc/systemd/system/rpi-resizerootfs.service "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/rpi3-resizerootfs.service" + + install -m 644 -o root -g root rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system" + mkdir -p "${ROOT?}/etc/systemd/system/multi-user.target.requires/" + ln -s /etc/systemd/system/rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/multi-user.target.requires/rpi3-generate-ssh-host-keys.service" + rm -f ${ROOT?}/etc/ssh/ssh_host_*_key* + + wget https://github.com/raspberrypi/firmware/blob/master/boot/bcm2708-rpi-b.dtb -O "${ROOT?}/boot/firmware/bcm2708-rpi-b.dtb" + wget https://github.com/raspberrypi/firmware/blob/master/boot/bcm2708-rpi-b-plus.dtb -O "${ROOT?}/boot/firmware/bcm2708-rpi-b-plus.dtb" + wget https://github.com/raspberrypi/firmware/blob/master/boot/bcm2708-rpi-0-w.dtb -O "${ROOT?}/boot/firmware/bcm2708-rpi-0-w.dtb" + wget https://github.com/raspberrypi/firmware/blob/master/boot/bcm2708-rpi-cm.dtb -O "${ROOT?}/boot/firmware/bcm2708-rpi-cm.dtb" + + cat >> "${ROOT?}/etc/motd" <<'EOT' + + Please change the root password by running passwd + EOT + root-fs: / + + # 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 + - chroot: / + shell: | + ls -aR /boot + sed -i 's/.dev.mmcblk0p2/LABEL=RASPIROOT/' /boot/firmware/cmdline.txt + + - chroot: / + shell: | + cp /usr/lib/u-boot/rpi_0_w/u-boot.bin /boot/firmware/ + sed -i s/^kernel=.*/kernel=u-boot.bin/ /boot/firmware/config.txt + u-boot-update + + # 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: / diff --git a/raspi2.yaml b/raspi2.yaml index 2c8b9f3..0657871 100644 --- a/raspi2.yaml +++ b/raspi2.yaml @@ -100,14 +100,14 @@ steps: install -m 644 -o root -g root rules.v4 "${ROOT?}/etc/iptables/rules.v4" install -m 644 -o root -g root rules.v6 "${ROOT?}/etc/iptables/rules.v6" - install -m 755 -o root -g root rpi3-resizerootfs "${ROOT?}/usr/sbin/rpi3-resizerootfs" - install -m 644 -o root -g root rpi3-resizerootfs.service "${ROOT?}/etc/systemd/system" + install -m 755 -o root -g root rpi-resizerootfs "${ROOT?}/usr/sbin/rpi3-resizerootfs" + install -m 644 -o root -g root rpi-resizerootfs.service "${ROOT?}/etc/systemd/system" mkdir -p "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/" - ln -s /etc/systemd/system/rpi3-resizerootfs.service "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/rpi3-resizerootfs.service" + ln -s /etc/systemd/system/rpi-resizerootfs.service "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/rpi3-resizerootfs.service" - install -m 644 -o root -g root rpi3-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system" + install -m 644 -o root -g root rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system" mkdir -p "${ROOT?}/etc/systemd/system/multi-user.target.requires/" - ln -s /etc/systemd/system/rpi3-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/multi-user.target.requires/rpi3-generate-ssh-host-keys.service" + ln -s /etc/systemd/system/rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/multi-user.target.requires/rpi3-generate-ssh-host-keys.service" rm -f ${ROOT?}/etc/ssh/ssh_host_*_key* wget https://github.com/raspberrypi/firmware/blob/master/boot/bcm2709-rpi-2-b.dtb -O "${ROOT?}/boot/bcm2708-rpi-2-b.dtb" diff --git a/raspi3.yaml b/raspi3.yaml index c3e5b3b..8b7f7b0 100644 --- a/raspi3.yaml +++ b/raspi3.yaml @@ -87,7 +87,7 @@ steps: unless: rootfs_unpacked - shell: | - echo "rpi3" > "${ROOT?}/etc/hostname" + echo "rpi" > "${ROOT?}/etc/hostname" # '..VyaTFxP8kT6' is crypt.crypt('raspberry', '..') sed -i 's,root:[^:]*,root:..VyaTFxP8kT6,' "${ROOT?}/etc/shadow" @@ -102,14 +102,14 @@ steps: install -m 644 -o root -g root rules.v4 "${ROOT?}/etc/iptables/rules.v4" install -m 644 -o root -g root rules.v6 "${ROOT?}/etc/iptables/rules.v6" - install -m 755 -o root -g root rpi3-resizerootfs "${ROOT?}/usr/sbin/rpi3-resizerootfs" - install -m 644 -o root -g root rpi3-resizerootfs.service "${ROOT?}/etc/systemd/system" + install -m 755 -o root -g root rpi-resizerootfs "${ROOT?}/usr/sbin/rpi3-resizerootfs" + install -m 644 -o root -g root rpi-resizerootfs.service "${ROOT?}/etc/systemd/system" mkdir -p "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/" - ln -s /etc/systemd/system/rpi3-resizerootfs.service "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/rpi3-resizerootfs.service" + ln -s /etc/systemd/system/rpi-resizerootfs.service "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/rpi3-resizerootfs.service" - install -m 644 -o root -g root rpi3-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system" + install -m 644 -o root -g root rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system" mkdir -p "${ROOT?}/etc/systemd/system/multi-user.target.requires/" - ln -s /etc/systemd/system/rpi3-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/multi-user.target.requires/rpi3-generate-ssh-host-keys.service" + ln -s /etc/systemd/system/rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/multi-user.target.requires/rpi3-generate-ssh-host-keys.service" rm -f ${ROOT?}/etc/ssh/ssh_host_*_key* cat >> "${ROOT?}/etc/motd" <<'EOT' diff --git a/rpi3-generate-ssh-host-keys.service b/rpi-generate-ssh-host-keys.service similarity index 100% rename from rpi3-generate-ssh-host-keys.service rename to rpi-generate-ssh-host-keys.service diff --git a/rpi3-resizerootfs b/rpi-resizerootfs similarity index 100% rename from rpi3-resizerootfs rename to rpi-resizerootfs diff --git a/rpi3-resizerootfs.service b/rpi-resizerootfs.service similarity index 85% rename from rpi3-resizerootfs.service rename to rpi-resizerootfs.service index 02207e4..089aecc 100644 --- a/rpi3-resizerootfs.service +++ b/rpi-resizerootfs.service @@ -6,7 +6,7 @@ DefaultDependencies=no [Service] Type=oneshot TimeoutSec=infinity -ExecStart=/usr/sbin/rpi3-resizerootfs +ExecStart=/usr/sbin/rpi-resizerootfs ExecStart=/bin/systemctl --no-reload disable %n [Install]