From bf2eb46fc8067afb096fe536e302fcaa07b73c7c Mon Sep 17 00:00:00 2001 From: Allen Abraham Date: Wed, 11 Mar 2026 11:40:32 -0400 Subject: [PATCH] fix: Resolving comments on MP - Adding parition ordering using imagecraft - Removing redundant locales install - Better logging for empty ARCH and SUBPROJECT - Using mktemp for mountpoint --- .../base/imagecraft-configs/imagecraft.yaml | 6 ++- .../hooks.d/base/imagecraft-image.binary | 37 ++++++++----------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/live-build/ubuntu-cpc/hooks.d/base/imagecraft-configs/imagecraft.yaml b/live-build/ubuntu-cpc/hooks.d/base/imagecraft-configs/imagecraft.yaml index 070d4ce2..ef635dfd 100644 --- a/live-build/ubuntu-cpc/hooks.d/base/imagecraft-configs/imagecraft.yaml +++ b/live-build/ubuntu-cpc/hooks.d/base/imagecraft-configs/imagecraft.yaml @@ -18,6 +18,7 @@ volumes: role: system-boot filesystem: vfat size: 4M + partition-number: 14 # 2. EFI System Partition - name: efi type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B @@ -25,13 +26,15 @@ volumes: filesystem-label: UEFI role: system-boot size: 106M + partition-number: 15 # 3. Linux Extended Boot - name: boot type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 filesystem: ext4 filesystem-label: BOOT role: system-data - size: 913M + size: 1G + partition-number: 13 # 4. Root Filesystem - name: rootfs type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 @@ -39,6 +42,7 @@ volumes: filesystem-label: cloudimg-rootfs role: system-data size: 3G + partition-number: 1 filesystems: default: diff --git a/live-build/ubuntu-cpc/hooks.d/base/imagecraft-image.binary b/live-build/ubuntu-cpc/hooks.d/base/imagecraft-image.binary index bfd258d1..82063574 100644 --- a/live-build/ubuntu-cpc/hooks.d/base/imagecraft-image.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/imagecraft-image.binary @@ -7,19 +7,19 @@ SUBPROJECT="${SUBPROJECT:-}" # We want to start off imagecraft builds with just amd64 support right now case $ARCH in - amd64) - ;; - *) - echo "$ARCH builds for imagecraft is currently not implemented." - exit 0 - ;; + amd64) + ;; + *) + echo "imagecraft build is currently not implemented for ARCH=${ARCH:-unset}." + exit 0 + ;; esac case ${SUBPROJECT} in minimized) ;; *) - echo "$SUBPROJECT builds for imagecraft is currently not implemented" + echo "imagecraft build is currently not implemented for SUBPROJECT=${SUBPROJECT:-unset}." exit 0 ;; esac @@ -27,29 +27,24 @@ esac _src_d=$(dirname $(readlink -f ${0})) snap install imagecraft --classic --channel latest/edge -apt install -y qemu-utils parted locales - -locale-gen C.UTF-8 -export LANG=C.UTF-8 -export LC_ALL=C.UTF-8 cp -r "$_src_d"/imagecraft-configs/* . CRAFT_BUILD_ENVIRONMENT=host imagecraft --verbosity debug pack +# We are using this function instead of mount_disk_image from functions +# because imagecraft doesn't currently support XBOOTLDR's GUID and +# mount_disk_image has an explicit check for the XBOOTLDR GUID +# TODO: Use mount_disk_image once imagecraft supports XBOOTLDR's GUID mount_image_partitions() { mount_image "${disk_image}" "$ROOT_PARTITION" # Making sure that the loop device is ready partprobe "${loop_device}" udevadm settle - ls -l "${loop_device}"* - - mkdir -p "$mountpoint" - mount_partition "${rootfs_dev_mapper}" "$mountpoint" - mount "${loop_device}p3" "$mountpoint/boot" - mount "${loop_device}p2" "$mountpoint/boot/efi" + mount "${loop_device}p13" "$mountpoint/boot" + mount "${loop_device}p15" "$mountpoint/boot/efi" } install_grub_on_image() { @@ -58,7 +53,7 @@ install_grub_on_image() { chroot "$mountpoint" update-grub undivert_grub "$mountpoint" - echo "GRUB installed successfully." + echo "GRUB for BIOS boot installed successfully." } unmount_image_partitions() { @@ -70,8 +65,8 @@ unmount_image_partitions() { } disk_image="pc.img" -ROOT_PARTITION=4 -mountpoint="mountpoint" +ROOT_PARTITION=1 +mountpoint=$(mktemp -d) mount_image_partitions