From c1b2d88aa2a1ab29631c000426af7597efc3b531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Wed, 28 Jul 2021 14:01:12 +0200 Subject: [PATCH] build_image_util.sh: delete vmlinuz file from /usr partition The vmlinuz kernel image gets installed to /usr/boot/ but isn't usable for dm-verity until it gets copied over to /boot/flatcar/ and the hash gets embedded at a particular offset. The file in /usr/boot/ uses space while it's not having a real purpose as long as dm-verity is used. Delete the vmlinuz file under /usr/boot/ to free up space. When generating the ISO image we use the vmlinuz file from /boot/flatcar/ which also has the advantage that we only distribute a single vmlinuz file with one particular checksum. --- build_library/build_image_util.sh | 5 ++++- build_library/vm_image_util.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index 1049f62786..8c443e161f 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -597,10 +597,13 @@ finish_image() { *) disable_read_write=${FLAGS_FALSE} ;; esac - # Copy kernel to support dm-verity boots + # Copy kernel to the /boot partition to support dm-verity boots by embedding + # the hash of the /usr partition into the kernel. + # Remove the kernel from the /usr partition to save space. sudo mkdir -p "${root_fs_dir}/boot/flatcar" sudo cp "${root_fs_dir}/usr/boot/vmlinuz" \ "${root_fs_dir}/boot/flatcar/vmlinuz-a" + sudo rm "${root_fs_dir}/usr/boot/vmlinuz"* # Record directories installed to the state partition. # Explicitly ignore entries covered by existing configs. diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index 67c9b785e3..a63edb85be 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -661,7 +661,7 @@ _write_iso_disk() { pushd "${iso_target}" >/dev/null mkdir isolinux syslinux flatcar _write_cpio_common "$1" "${iso_target}/flatcar/cpio.gz" - cp "${base_dir}"/boot/vmlinuz "${iso_target}/flatcar/vmlinuz" + cp "${VM_TMP_ROOT}"/boot/flatcar/vmlinuz-a "${iso_target}/flatcar/vmlinuz" cp -R /usr/share/syslinux/* isolinux/ cat< isolinux/isolinux.cfg INCLUDE /syslinux/syslinux.cfg