From 48aed401949637ac314e59de996ccab19d5eefcd Mon Sep 17 00:00:00 2001 From: Phil Roche Date: Fri, 26 Apr 2024 14:42:10 +0100 Subject: [PATCH] fix(HyperV desktop): Re-enable ability to build HyperV desktop images (LP: #2064280) We have not built Hyperv desktop images since Jammy and with the re-introduction of HyperV for Noble we have encountered build issues caused by refactoring and removals of code assumed to be redundant but the HyperV desktop images were actually using these code paths. In bbedffe6 we split the building of cloud images and non cloud to using an ddisk-image-uefi.binary and disk-image-uefi-non-cloud.binary respectively. In e38264ca there was a change which meant that any attempt to build hyperv images would result in incorrect disk size and incorrect disk label. This has been fixed by ensuring that the ubuntu:desktop-preinstalled $PROJECT:$SUBPROJECT matches and sets the correct disk size and correct disk label. A change in 76d79466 changed the logic of how the image size for amd64 images were being set. This overrode the sizes set for the desktop images incorrectly. This commit ensures that any desktop image being created uses the correct image size. --- .../base/disk-image-uefi-non-cloud.binary | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary index 8ea2128f..2c8de186 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary @@ -9,21 +9,6 @@ case $ARCH in ;; esac -case ${PROJECT:-}:${SUBPROJECT:-} in - ubuntu:) - echo "We don't create EFI images for Ubuntu Desktop." - exit 0 - ;; - ubuntu) - IMAGE_STR="# DESKTOP_IMG: This file was created/modified by the Desktop Image build process" - FS_LABEL="desktop-rootfs" - IMAGE_SIZE=12884901888 # 12G - ;; - *) - IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" - FS_LABEL="cloudimg-rootfs" - ;; -esac if [ "$ARCH" = "amd64" ]; then IMAGE_SIZE=3758096384 # bump to 3.5G (3584*1024**2); Since Kinetic amd64 need more then the default 2.2G @@ -44,6 +29,22 @@ if [ "$ARCH" = "riscv64" ]; then IMAGE_SIZE=4831838208 # bump to 4.5G (4608*1024**2); initrd creation fails with "No space left" with 3.5G fi +case ${PROJECT:-}:${SUBPROJECT:-} in + ubuntu:) + echo "We don't create EFI images for Ubuntu Desktop." + exit 0 + ;; + ubuntu|ubuntu:desktop-preinstalled) + IMAGE_STR="# DESKTOP_IMG: This file was created/modified by the Desktop Image build process" + FS_LABEL="desktop-rootfs" + IMAGE_SIZE=12884901888 # 12G + ;; + *) + IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" + FS_LABEL="cloudimg-rootfs" + ;; +esac + . config/binary . config/functions