diff --git a/.idea.bkup/inspectionProfiles/profiles_settings.xml b/.idea.bkup/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/.idea.bkup/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea.bkup/livecd-rootfs.iml b/.idea.bkup/livecd-rootfs.iml new file mode 100644 index 00000000..d0876a78 --- /dev/null +++ b/.idea.bkup/livecd-rootfs.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea.bkup/misc.xml b/.idea.bkup/misc.xml new file mode 100644 index 00000000..02b69cde --- /dev/null +++ b/.idea.bkup/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea.bkup/modules.xml b/.idea.bkup/modules.xml new file mode 100644 index 00000000..8f7a3b65 --- /dev/null +++ b/.idea.bkup/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea.bkup/vcs.xml b/.idea.bkup/vcs.xml new file mode 100644 index 00000000..1fb36172 --- /dev/null +++ b/.idea.bkup/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea.bkup/workspace.xml b/.idea.bkup/workspace.xml new file mode 100644 index 00000000..fde7212b --- /dev/null +++ b/.idea.bkup/workspace.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + 1695662751675 + + + + + + \ No newline at end of file diff --git a/.idea.bkup2/inspectionProfiles/profiles_settings.xml b/.idea.bkup2/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/.idea.bkup2/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea.bkup2/livecd-rootfs.iml b/.idea.bkup2/livecd-rootfs.iml new file mode 100644 index 00000000..d0876a78 --- /dev/null +++ b/.idea.bkup2/livecd-rootfs.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea.bkup2/modules.xml b/.idea.bkup2/modules.xml new file mode 100644 index 00000000..8f7a3b65 --- /dev/null +++ b/.idea.bkup2/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea.bkup2/workspace.xml b/.idea.bkup2/workspace.xml new file mode 100644 index 00000000..d12cdb62 --- /dev/null +++ b/.idea.bkup2/workspace.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea.bkup3/inspectionProfiles/profiles_settings.xml b/.idea.bkup3/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/.idea.bkup3/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea.bkup3/livecd-rootfs.iml b/.idea.bkup3/livecd-rootfs.iml new file mode 100644 index 00000000..d0876a78 --- /dev/null +++ b/.idea.bkup3/livecd-rootfs.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea.bkup3/modules.xml b/.idea.bkup3/modules.xml new file mode 100644 index 00000000..8f7a3b65 --- /dev/null +++ b/.idea.bkup3/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea.bkup3/workspace.xml b/.idea.bkup3/workspace.xml new file mode 100644 index 00000000..d12cdb62 --- /dev/null +++ b/.idea.bkup3/workspace.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/livecd-rootfs.iml b/.idea/livecd-rootfs.iml new file mode 100644 index 00000000..d0876a78 --- /dev/null +++ b/.idea/livecd-rootfs.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..8f7a3b65 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..d12cdb62 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/arm64-minimized-alignment.patch b/arm64-minimized-alignment.patch new file mode 100644 index 00000000..784e2373 --- /dev/null +++ b/arm64-minimized-alignment.patch @@ -0,0 +1,40 @@ +diff --git a/live-build/auto/config b/live-build/auto/config +index 20d28139..8f188b5d 100755 +--- a/live-build/auto/config ++++ b/live-build/auto/config +@@ -1048,12 +1048,13 @@ case $PROJECT in + add_task install ubuntu-server-raspi + ;; + armhf*) +- add_package install flash-kernel ++ if [ "${SUBPROJECT:-}" != minimized ]; then ++ add_package install flash-kernel ++ fi + ;; + arm64*) +- add_package install flash-kernel +- if [ "${SUBARCH:-}" = "generic" ]; then +- KERNEL_FLAVOURS=generic ++ if [ "${SUBPROJECT:-}" != minimized ]; then ++ add_package install flash-kernel + fi + ;; + amd64*) +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 3685e464..4602267c 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 +@@ -112,11 +112,11 @@ install_grub() { + # please file a bug against grub2 to include the affected module. + case $ARCH in + arm64) +- chroot mountpoint apt-get -qqy install --no-install-recommends shim-signed grub-efi-arm64-signed ++ chroot mountpoint apt-get install -qqy shim-signed + efi_target=arm64-efi + ;; + armhf) +- chroot mountpoint apt-get -qqy install --no-install-recommends grub-efi-arm grub-efi-arm-bin ++ chroot mountpoint apt-get -qqy install grub-efi-arm grub-efi-arm-bin + efi_target=arm-efi + ;; + amd64) diff --git a/buildd-noble-ls-python-3-apt.patch b/buildd-noble-ls-python-3-apt.patch new file mode 100644 index 00000000..8e38228d --- /dev/null +++ b/buildd-noble-ls-python-3-apt.patch @@ -0,0 +1,63 @@ +diff --git a/live-build/buildd/hooks/02-disk-image-uefi.binary b/live-build/buildd/hooks/02-disk-image-uefi.binary +index 44a7ff42..a90f19c7 100755 +--- a/live-build/buildd/hooks/02-disk-image-uefi.binary ++++ b/live-build/buildd/hooks/02-disk-image-uefi.binary +@@ -53,6 +53,26 @@ LABEL=UEFI /boot/efi vfat defaults 0 1 + EOF + } + ++ ++divert_lsb_release() { ++ CHROOT_ROOT="$1" ++ chroot "$CHROOT_ROOT" dpkg-divert --local \ ++ --divert /usr/bin/lsb_release.dpkg-divert \ ++ --rename /usr/bin/lsb_release ++ echo "echo Ubuntu" > "$CHROOT_ROOT"/usr/bin/lsb_release ++ chmod +x "$CHROOT_ROOT"/usr/bin/lsb_release ++ ++} ++ ++undivert_lsb_release() { ++ CHROOT_ROOT="$1" ++ if grep -q "^echo Ubuntu$" "$CHROOT_ROOT"/usr/bin/lsb_release; then ++ rm "$CHROOT_ROOT"/usr/bin/lsb_release ++ fi ++ chroot "$CHROOT_ROOT" dpkg-divert --remove --local \ ++ --rename /usr/bin/lsb_release ++} ++ + install_grub() { + mkdir mountpoint + mount_partition "${rootfs_dev_mapper}" mountpoint +@@ -69,7 +89,8 @@ install_grub() { + fi + + chroot mountpoint apt-get -y update +- ++ divert_lsb_release mountpoint ++ chroot mountpoint lsb_release + # UEFI GRUB modules are meant to be used equally by Secure Boot and + # non-Secure Boot systems. If you need an extra module not already + # provided or run into "Secure Boot policy forbids loading X" problems, +@@ -84,7 +105,7 @@ install_grub() { + efi_target=arm-efi + ;; + amd64) +- chroot mountpoint apt-get install -qqy grub-pc shim-signed ++ chroot mountpoint apt-get install -qqy grub-pc shim-signed python3-apt + efi_target=x86_64-efi + ;; + esac +@@ -121,10 +142,12 @@ GRUB_RECORDFAIL_TIMEOUT=0 + GRUB_TERMINAL=console + EOF + ++ + divert_grub mountpoint + chroot mountpoint update-grub + replace_grub_root_with_label mountpoint + undivert_grub mountpoint ++ undivert_lsb_release mountpoint + + chroot mountpoint apt-get -y clean + diff --git a/debian/changelog b/debian/changelog index b34aef75..e4ce6c6f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +livecd-rootfs (24.04.71) noble; urgency=medium + + * Re-enable ability to build HyperV desktop images (LP: #2064280) + + -- Philip Roche Fri, 24 May 2024 15:47:48 +0100 + livecd-rootfs (24.04.70) noble; urgency=medium [ Ɓukasz 'sil2100' Zemczak ] diff --git a/debian/files b/debian/files new file mode 100644 index 00000000..12597f08 --- /dev/null +++ b/debian/files @@ -0,0 +1 @@ +livecd-rootfs_2.765.30_source.buildinfo devel optional diff --git a/live-build/genbuildinfo.py b/live-build/genbuildinfo.py new file mode 100755 index 00000000..25e519bd --- /dev/null +++ b/live-build/genbuildinfo.py @@ -0,0 +1,43 @@ +#!/usr/bin/python3 +import apt +import os +import platform +import datetime +from datetime import datetime, timezone + +# Get the current date and time in UTC timezone aware +utc_now = datetime.now(timezone.utc) + +def get_system_architecture(): + arch = platform.machine() + if arch == 'x86_64': + return 'amd64' + elif arch == 'aarch64': + return 'arm64' + else: + return f"Unknown architecture: {arch}" + +print("Format: 1.0") +print("Build-Origin: Ubuntu") +print(f"Build-Architecture: {get_system_architecture()}") +print(f"Build-Date: {utc_now}") +# Using python-apt to gather installed packages +try: + package_cache = apt.Cache() + + print("List of installed packages:") + for package in package_cache: + if package.is_installed: + print(f" {package.name} (= {package.installed.version}),") + +except Exception as e: + print(f"An error occurred while fetching installed packages: {e}") + +# Using os module to list all environment variables +try: + print("\nEnvironment variables:") + for param, value in os.environ.items(): + print(f" {param}={value}") + +except Exception as e: + print(f"An error occurred while fetching environment variables: {e}") 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..44d2e4cf 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: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 diff --git a/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary b/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary index 1e7bc461..b10536b9 100644 --- a/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary +++ b/live-build/ubuntu/hooks/040-hyperv-desktop-images.binary @@ -39,8 +39,14 @@ trap cleanup_hyperv EXIT # Perform customisations +# For Ubuntu 24.04 and later cloud-init is included in desktop images. This is not applicable for Hyperv images so +# we can disable cloud-init. This leaves the cloud-init package installed but disabled so users can still +# use it if they want. +touch "${scratch_d}/etc/cloud/cloud-init.disabled" + + chroot "${scratch_d}" apt-get update -y -chroot "${scratch_d}" apt-get -y install xrdp linux-azure linux-tools-azure linux-cloud-tools-azure +chroot "${scratch_d}" apt-get -y install xrdp linux-azure linux-tools-azure linux-cloud-tools-azure polkitd-pkla oem-config-gtk language-pack-en-base oem-config-slideshow-ubuntu cat > ${scratch_d}/etc/modules-load.d/hyperv.conf << EOF ${IMAGE_STR} @@ -124,20 +130,19 @@ touch "${scratch_d}/var/lib/oem-config/run" chroot "${scratch_d}" apt-get clean +raw_img=binary/boot/disk-hyperv-uefi.ext4 +vhd_img=livecd.ubuntu-desktop-hyperv.vhdx + +create_manifest "${scratch_d}" "$vhd_img.zip.manifest" # End customisations cleanup_hyperv trap - EXIT -raw_img=binary/boot/disk-hyperv-uefi.ext4 -vhd_img=livecd.ubuntu-desktop-hyperv.vhdx - qemu-img convert -O vhdx "$raw_img" "$vhd_img" rm "$raw_img" apt-get install -y zip -create_manifest chroot "$vhd_img.zip.manifest" - zip "$vhd_img.zip" "$vhd_img" rm "$vhd_img" diff --git a/livecd-rootfs b/livecd-rootfs new file mode 120000 index 00000000..f5d3076e --- /dev/null +++ b/livecd-rootfs @@ -0,0 +1 @@ +/home/philroche/Working/livecd-rootfs \ No newline at end of file