From 007da3a58d9ceb7686a7c8c999e60a24d7917029 Mon Sep 17 00:00:00 2001 From: CloudBuilder Date: Tue, 19 Sep 2023 21:51:09 +0000 Subject: [PATCH] Imported 23.10.42 from mantic-release pocket. No reason for CPC update specified. --- debian/changelog | 24 ++++++++++ live-build/auto/build | 18 +++++++ live-build/functions | 5 ++ .../hooks.d/base/disk-image-uefi.binary | 48 +++++++++++++------ 4 files changed, 81 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2607d1e2..68d04ebc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,27 @@ +livecd-rootfs (23.10.42) mantic; urgency=medium + + * fix: Fix the missing `fi` with the recent changes in the + `unminimize` script for `ubuntu-cpc` project (LP: #2036591) + + -- Phil Roche Tue, 19 Sep 2023 11:30:19 +0100 + +livecd-rootfs (23.10.41) mantic; urgency=medium + + * ubuntu-cpc: create a new boot partition on all UEFI cloud-images + * ubuntu-cpc: refactor the logic to define the disk image size for UEFI + images + + -- Gauthier Jolly Tue, 19 Sep 2023 08:20:00 -0700 + +livecd-rootfs (23.10.40) mantic; urgency=medium + + * Enhance unminimize to transform into a base image + for ubuntu-cpc. + * Install linux-virtual to restore the stripped headers + for ubuntu-cpc. + + -- Utkarsh Gupta Tue, 19 Sep 2023 14:05:19 +0530 + livecd-rootfs (23.10.39) mantic; urgency=medium * The chroot tmpfs mount should only be /var/lib/apt/lists, not diff --git a/live-build/auto/build b/live-build/auto/build index 8d53a275..08b42a24 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -292,6 +292,24 @@ if dpkg-query --show --showformat='${db:Status-Status}\n' ubuntu-server 2> /dev/ DEBIAN_FRONTEND=noninteractive apt-get install -y landscape-common fi EOF + fi + + if [ "$PROJECT" = "ubuntu-cpc" ]; then + # we'd like to transform a minimized image to a base image + # when unminimize is run. + cat >> chroot/usr/local/sbin/unminimize <<'EOF' + +# even if ubuntu-server is installed, we should re-install it with --fix-policy --install-recommends +# to ensure all the Recommends of dependencies of ubuntu-server are installed, which aids in transforming +# this minimized image to an equivalent base image. +DEBIAN_FRONTEND=noninteractive apt-get --reinstall --fix-policy --install-recommends install -y ubuntu-server + +if dpkg-query --show --showformat='${db:Status-Status}\n' linux-image-virtual 2> /dev/null | grep -q '^installed$'; then + echo "Installing linux-virtual for installing the headers which were stripped in a minimized image" + DEBIAN_FRONTEND=noninteractive apt-get install -y linux-virtual +fi +EOF + fi if [ "$PROJECT" = "ubuntu-cpc" ] || [ "$PROJECT" = "ubuntu-server" ]; then cat >> chroot/usr/local/sbin/unminimize <<'EOF' diff --git a/live-build/functions b/live-build/functions index b9ac85ec..19953744 100644 --- a/live-build/functions +++ b/live-build/functions @@ -208,6 +208,11 @@ mount_disk_image() { mount_image ${disk_image} 1 mount_partition "${rootfs_dev_mapper}" $mountpoint + local boot_dev="${loop_device}p16" + if [ -b ${boot_dev} -a -e $mountpoint/boot ]; then + mount "${boot_dev}" $mountpoint/boot + fi + local uefi_dev="${loop_device}p15" if [ -b ${uefi_dev} -a -e $mountpoint/boot/efi ]; then mount "${uefi_dev}" $mountpoint/boot/efi 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 020dd33f..3685e464 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 @@ -12,17 +12,20 @@ esac IMAGE_STR="# CLOUD_IMG: This file was created/modified by the Cloud Image build process" FS_LABEL="cloudimg-rootfs" -if [ "$ARCH" = "amd64" ]; then - IMAGE_SIZE=3758096384 # bump to 3.5G (3584*1024**2); Since Kinetic amd64 need more then the default 2.2G -fi - -if [ "$ARCH" = "armhf" ]; then - IMAGE_SIZE=3758096384 # bump to 3.5G (3584*1024**2); Since Jammy armhf need more then the default 2.2G -fi - -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 "$ARCH" in + amd64|arm64|armhf) + # 3.5 GiB + # Since Kinetic amd64 need more then the default 2.2G + # Since Jammy armhf need more then the default 2.2G + # Since Mantic arm64 need more then the default 2.2G + IMAGE_SIZE=3758096384 # bump to 3.5G (3584*1024**2); + ;; + riscv64) + # 4.5 GiB + # initrd creation fails with "No space left" with 3.5G + IMAGE_SIZE=4831838208 # bump to 4.5G (4608*1024**2); + ;; +esac . config/binary @@ -36,6 +39,8 @@ create_partitions() { sgdisk "${disk_image}" \ --new=15:0:204800 \ --typecode=15:ef00 \ + --new=16::1G \ + --typecode=16:ea00 \ --new=1: ;; riscv64) @@ -43,6 +48,8 @@ create_partitions() { --set-alignment=2 \ --new=15::+106M \ --typecode=15:ef00 \ + --new=16::1G \ + --typecode=16:ea00 \ --new=1:: \ --attributes=1:set:2 ;; @@ -50,6 +57,8 @@ create_partitions() { sgdisk "${disk_image}" \ --new=14::+4M \ --new=15::+106M \ + --new=16::1G \ + --typecode=16:ea00 \ --new=1:: sgdisk "${disk_image}" \ -t 14:ef02 \ @@ -60,15 +69,26 @@ create_partitions() { --print } -create_and_mount_uefi_partition() { +create_and_mount_boot_partitions() { uefi_dev="${loop_device}p15" + boot_dev="${loop_device}p16" mountpoint="$1" + mkfs.vfat -F 32 -n UEFI "${uefi_dev}" + mkfs.ext4 -L BOOT "${boot_dev}" + + # copying what was on the rootfs to the new boot partition + mount "${boot_dev}" "${mountpoint}"/mnt + mv "${mountpoint}"/boot/* "${mountpoint}"/mnt + umount "${boot_dev}" + + mount "${boot_dev}" "${mountpoint}"/boot mkdir -p "${mountpoint}"/boot/efi mount "${uefi_dev}" "$mountpoint"/boot/efi cat << EOF >> "mountpoint/etc/fstab" +LABEL=BOOT /boot ext4 defaults 0 2 LABEL=UEFI /boot/efi vfat umask=0077 0 1 EOF } @@ -77,7 +97,7 @@ install_grub() { mkdir mountpoint mount_partition "${rootfs_dev_mapper}" mountpoint - create_and_mount_uefi_partition mountpoint + create_and_mount_boot_partitions mountpoint echo "(hd0) ${loop_device}" > mountpoint/tmp/device.map mkdir -p mountpoint/etc/default/grub.d @@ -149,7 +169,7 @@ install_grub() { chroot mountpoint apt-get -y clean rm mountpoint/tmp/device.map - umount mountpoint/boot/efi + umount -R mountpoint/boot mount umount_partition mountpoint rmdir mountpoint