From dc59fe83ca78fd06c731e2f86c3af39736574f1b Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Wed, 28 Jun 2023 12:17:50 +0100 Subject: [PATCH] Deprecate linux-kvm usage Remove kvm-image altogether. Previously for minimal image replace_kernel function replaced virtual images with kvm, and called force_boot_without_initramfs. Now simply call force_boot_without_initramfs for minimal image without replacing kernel flavour. This also means minimal images can now be built for arm64 and armhf. Signed-off-by: Dimitri John Ledkov --- .../hooks.d/base/disk-image-uefi.binary | 7 +-- .../ubuntu-cpc/hooks.d/base/disk-image.binary | 7 +-- .../ubuntu-cpc/hooks.d/base/kvm-image.binary | 63 ------------------- live-build/ubuntu-cpc/hooks.d/base/series/kvm | 5 -- 4 files changed, 6 insertions(+), 76 deletions(-) delete mode 100755 live-build/ubuntu-cpc/hooks.d/base/kvm-image.binary delete mode 100644 live-build/ubuntu-cpc/hooks.d/base/series/kvm diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary index 042db427..79d165ef 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary @@ -485,10 +485,9 @@ EOF chroot mountpoint grub-install --target=i386-pc "${loop_device}" fi - # Use the linux-kvm kernel for minimal images where available - # linux-kvm currently only exists for amd64 - if [ "${SUBPROJECT:-}" = "minimized" ] && [ "$ARCH" = "amd64" ]; then - replace_kernel mountpoint linux-kvm + # Use initrdless boot for minimal images + if [ "${SUBPROJECT:-}" = "minimized" ]; then + force_boot_without_initramfs ${mountpoint} fi # This call to rewrite the debian package manifest is added here to capture diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary index 7c8bc9b7..68b1888a 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image.binary @@ -131,10 +131,9 @@ if [ "${should_install_grub}" -eq 1 ]; then rm mountpoint/tmp/device.map fi -# Use the linux-kvm kernel for minimal images where available -# linux-kvm currently only exists for amd64 -if [ "${SUBPROJECT:-}" = "minimized" ] && [ "$ARCH" = "amd64" ]; then - replace_kernel mountpoint linux-kvm +# Use initrdless boot for minimal images +if [ "${SUBPROJECT:-}" = "minimized" ]; then + force_boot_without_initramfs ${mountpoint} fi if [ "$ARCH" = "s390x" ]; then diff --git a/live-build/ubuntu-cpc/hooks.d/base/kvm-image.binary b/live-build/ubuntu-cpc/hooks.d/base/kvm-image.binary deleted file mode 100755 index f9782d0b..00000000 --- a/live-build/ubuntu-cpc/hooks.d/base/kvm-image.binary +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -eux -# vi: ts=4 expandtab -# -# Generate KVM image -# - -echo "Building KVM image" -IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" -case ${SUBPROJECT:-} in - minimized) - echo "Skipping minimized $0 builds" - exit 0 - ;; - *) - ;; -esac - -# Only allow amd64 builds for now -case $ARCH in - amd64) - ;; - *) - echo "Linux KVM images are not supported for $ARCH yet."; - exit 0;; -esac - -. config/functions - -mount_d=$(mktemp -d) - -create_derivative uefi kvm #sets ${derivative_img} -mount_disk_image ${derivative_img} ${mount_d} - -# unmount disk image and remove created folders on exit -# even though we unmount manually before we convert to -# qcow2, we have this here just in case we error out before -# that step -cleanup_kvm() { - if [ -d "$mount_d" ]; then - umount_disk_image "$mount_d" - fi - rm -rf ${mount_d} ${derivative_img} -} -trap cleanup_kvm EXIT - - -divert_grub "${mount_d}" -replace_kernel ${mount_d} "linux-kvm" -chroot "${mount_d}" update-grub -undivert_grub "${mount_d}" - -# Remove indices -env DEBIAN_FRONTEND=noninteractive chroot "${mount_d}" apt-get \ - clean - -create_manifest ${mount_d} livecd.ubuntu-cpc.disk-kvm.manifest - -# unmount disk image to prevent corruption -# and remove it so the trap doesn't try to unmount it again -umount_disk_image ${mount_d} -rm -rf ${mount_d} - -convert_to_qcow2 ${derivative_img} livecd.ubuntu-cpc.disk-kvm.img diff --git a/live-build/ubuntu-cpc/hooks.d/base/series/kvm b/live-build/ubuntu-cpc/hooks.d/base/series/kvm deleted file mode 100644 index 7e560c31..00000000 --- a/live-build/ubuntu-cpc/hooks.d/base/series/kvm +++ /dev/null @@ -1,5 +0,0 @@ -depends disk-image -base/kvm-image.binary -provides livecd.ubuntu-cpc.disk-kvm.img -provides livecd.ubuntu-cpc.disk-kvm.manifest -provides livecd.ubuntu-cpc.disk-kvm.filelist