From e151a33cee101835cac9b2adcd561ee3ab6f3394 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sat, 22 Mar 2014 22:23:40 -0700 Subject: [PATCH] fix(vm_image_util): Fix building squashfs for /usr Taking a bit of a new approach to booting PXE images here for both amd64-generic and amd64-usr. Instead of requiring the user to specify squashfs and tmpfs on the kernel command line we can simply provide defaults in the initrd's fstab. --- build_library/vm_image_util.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index 1d9231603d..4c96835afb 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -272,6 +272,8 @@ _write_cpio_disk() { local base_dir="${VM_TMP_ROOT}/usr" local squashfs="usr.squashfs" + sudo mkdir -p "${cpio_target}/etc" + # If not a /usr image pack up root instead if ! mountpoint -q "${base_dir}"; then base_dir="${VM_TMP_ROOT}" @@ -280,13 +282,37 @@ _write_cpio_disk() { # The STATE partition and all of its bind mounts shouldn't be # packed into the squashfs image. Just ROOT. sudo umount --all-targets "${VM_TMP_ROOT}/media/state" + + # Set squashfs as the default root filesystem + sudo_clobber "${cpio_target}/etc/fstab" </dev/null sudo mksquashfs "${base_dir}" "./${squashfs}" - echo "./${squashfs}" | cpio -o -H newc | gzip > "$2" + find . | cpio -o -H newc | gzip > "$2" popd >/dev/null # Pull the kernel out of the filesystem