From 92f08cce01d7e84ad43fe2633dd8933b0b089384 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 31 Dec 2018 20:58:41 +0200 Subject: [PATCH 1/3] Fix: make raspi3.yaml work with current vmdb2 Add the kpartx step. It is now mandtory for building an image file. (Not necessary if building on a real drive directly.) Use only one set of tag names: boot-part and root-fs. vmdb2 has changed so that partitions and mount points share the same tag name space: there's no need to have a tag for the partition and for the mount point for that partition, anymore. As part of that, there's no need to specify both the partition tag for the root partition, and then also the tag for the mount point for that partition. ea7b9bc1d3e5de362b5edf12603ee83c708ad1a1 is the commit of vmdb2 that this works with. --- raspi3.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/raspi3.yaml b/raspi3.yaml index 3db9ff3..328fb91 100644 --- a/raspi3.yaml +++ b/raspi3.yaml @@ -18,18 +18,19 @@ steps: device: "{{ output }}" start: 20% end: 100% - part-tag: root-part + part-tag: root-fs + + - kpartx: "{{ output }}" - mkfs: vfat partition: boot-part label: RASPIFIRM - mkfs: ext4 - partition: root-part + partition: root-fs label: RASPIROOT - - mount: root-part - fs-tag: root-fs + - mount: root-fs - mount: boot-part mount-on: root-fs From 5e2dc9c56977942a96c1ce5d2bb7bd03b861540a Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 2 Jan 2019 10:40:34 +0200 Subject: [PATCH 2/3] Add: support for caching and unpacking the rootfs This speeds up iterative development of a vmdb specification file: the output of qemu-debootstrap and the apt installation additinal packages are cached. They take up most of the time of a full run. If modifying other parts of raspi3.yaml, this means an iteration drops from about 20 minutes to 16 seconds on my laptop. If making changes to the cached parts, the cache tarball needs to be deleted between runs. The --rootfs-tarball options MUST now be used on all invocations. --- raspi3.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/raspi3.yaml b/raspi3.yaml index 328fb91..df03ba1 100644 --- a/raspi3.yaml +++ b/raspi3.yaml @@ -37,6 +37,8 @@ steps: dirname: '/boot/firmware' fs-tag: boot-fs + - unpack-rootfs: root-fs + # We need to use Debian buster (currently testing) instead of Debian stretch # (currently stable) for: # @@ -58,6 +60,7 @@ steps: - main - contrib - non-free + unless: rootfs_unpacked # TODO(https://bugs.debian.org/877855): remove this workaround once # debootstrap is fixed @@ -65,6 +68,7 @@ steps: 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: @@ -78,6 +82,10 @@ steps: - raspi3-firmware - linux-image-arm64 fs-tag: root-fs + unless: rootfs_unpacked + + - cache-rootfs: root-fs + unless: rootfs_unpacked - shell: | echo "rpi3" > "${ROOT?}/etc/hostname" @@ -122,6 +130,7 @@ steps: # the partition labeled raspiroot instead of forcing it to mmcblk0p2 - chroot: root-fs 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 From fe68770d3e1de015c93be414227b2aa7df3cc3d1 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 13 Jan 2019 15:38:36 +0200 Subject: [PATCH 3/3] Change: use mount point names for all tags / and /boot specifically. I find these names to be clearer. --- raspi3.yaml | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/raspi3.yaml b/raspi3.yaml index df03ba1..c3e5b3b 100644 --- a/raspi3.yaml +++ b/raspi3.yaml @@ -12,32 +12,31 @@ steps: device: "{{ output }}" start: 0% end: 20% - part-tag: boot-part + tag: /boot - mkpart: primary device: "{{ output }}" start: 20% end: 100% - part-tag: root-fs + tag: / - kpartx: "{{ output }}" - mkfs: vfat - partition: boot-part + partition: /boot label: RASPIFIRM - mkfs: ext4 - partition: root-fs + partition: / label: RASPIROOT - - mount: root-fs + - mount: / - - mount: boot-part - mount-on: root-fs + - mount: /boot + mount-on: / dirname: '/boot/firmware' - fs-tag: boot-fs - - unpack-rootfs: root-fs + - unpack-rootfs: / # We need to use Debian buster (currently testing) instead of Debian stretch # (currently stable) for: @@ -54,7 +53,7 @@ steps: # required by the WiFi driver. - qemu-debootstrap: buster mirror: http://deb.debian.org/debian - target: root-fs + target: / arch: arm64 components: - main @@ -64,7 +63,7 @@ steps: # TODO(https://bugs.debian.org/877855): remove this workaround once # debootstrap is fixed - - chroot: root-fs + - chroot: / shell: | echo 'deb http://deb.debian.org/debian buster main contrib non-free' > /etc/apt/sources.list apt-get update @@ -81,10 +80,10 @@ steps: - wpasupplicant - raspi3-firmware - linux-image-arm64 - fs-tag: root-fs + tag: / unless: rootfs_unpacked - - cache-rootfs: root-fs + - cache-rootfs: / unless: rootfs_unpacked - shell: | @@ -117,18 +116,18 @@ steps: Please change the root password by running passwd EOT - root-fs: root-fs + root-fs: / # Clean up archive cache (likely not useful) and lists (likely outdated) to # reduce image size by several hundred megabytes. - - chroot: root-fs + - 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: root-fs + - chroot: / shell: | ls -aR /boot sed -i 's/.dev.mmcblk0p2/LABEL=RASPIROOT/' /boot/firmware/cmdline.txt @@ -137,4 +136,4 @@ steps: # clears /etc/resolv.conf on its own. - shell: | rm "${ROOT?}/etc/resolv.conf" - root-fs: root-fs + root-fs: /