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