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
This commit is contained in:
Allen Abraham 2026-03-11 11:40:32 -04:00
parent f45429018c
commit bf2eb46fc8
2 changed files with 21 additions and 22 deletions

View File

@ -18,6 +18,7 @@ volumes:
role: system-boot role: system-boot
filesystem: vfat filesystem: vfat
size: 4M size: 4M
partition-number: 14
# 2. EFI System Partition # 2. EFI System Partition
- name: efi - name: efi
type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B
@ -25,13 +26,15 @@ volumes:
filesystem-label: UEFI filesystem-label: UEFI
role: system-boot role: system-boot
size: 106M size: 106M
partition-number: 15
# 3. Linux Extended Boot # 3. Linux Extended Boot
- name: boot - name: boot
type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
filesystem: ext4 filesystem: ext4
filesystem-label: BOOT filesystem-label: BOOT
role: system-data role: system-data
size: 913M size: 1G
partition-number: 13
# 4. Root Filesystem # 4. Root Filesystem
- name: rootfs - name: rootfs
type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4
@ -39,6 +42,7 @@ volumes:
filesystem-label: cloudimg-rootfs filesystem-label: cloudimg-rootfs
role: system-data role: system-data
size: 3G size: 3G
partition-number: 1
filesystems: filesystems:
default: default:

View File

@ -10,7 +10,7 @@ case $ARCH in
amd64) amd64)
;; ;;
*) *)
echo "$ARCH builds for imagecraft is currently not implemented." echo "imagecraft build is currently not implemented for ARCH=${ARCH:-unset}."
exit 0 exit 0
;; ;;
esac esac
@ -19,7 +19,7 @@ case ${SUBPROJECT} in
minimized) minimized)
;; ;;
*) *)
echo "$SUBPROJECT builds for imagecraft is currently not implemented" echo "imagecraft build is currently not implemented for SUBPROJECT=${SUBPROJECT:-unset}."
exit 0 exit 0
;; ;;
esac esac
@ -27,29 +27,24 @@ esac
_src_d=$(dirname $(readlink -f ${0})) _src_d=$(dirname $(readlink -f ${0}))
snap install imagecraft --classic --channel latest/edge 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/* . cp -r "$_src_d"/imagecraft-configs/* .
CRAFT_BUILD_ENVIRONMENT=host imagecraft --verbosity debug pack 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_partitions() {
mount_image "${disk_image}" "$ROOT_PARTITION" mount_image "${disk_image}" "$ROOT_PARTITION"
# Making sure that the loop device is ready # Making sure that the loop device is ready
partprobe "${loop_device}" partprobe "${loop_device}"
udevadm settle udevadm settle
ls -l "${loop_device}"*
mkdir -p "$mountpoint"
mount_partition "${rootfs_dev_mapper}" "$mountpoint" mount_partition "${rootfs_dev_mapper}" "$mountpoint"
mount "${loop_device}p3" "$mountpoint/boot" mount "${loop_device}p13" "$mountpoint/boot"
mount "${loop_device}p2" "$mountpoint/boot/efi" mount "${loop_device}p15" "$mountpoint/boot/efi"
} }
install_grub_on_image() { install_grub_on_image() {
@ -58,7 +53,7 @@ install_grub_on_image() {
chroot "$mountpoint" update-grub chroot "$mountpoint" update-grub
undivert_grub "$mountpoint" undivert_grub "$mountpoint"
echo "GRUB installed successfully." echo "GRUB for BIOS boot installed successfully."
} }
unmount_image_partitions() { unmount_image_partitions() {
@ -70,8 +65,8 @@ unmount_image_partitions() {
} }
disk_image="pc.img" disk_image="pc.img"
ROOT_PARTITION=4 ROOT_PARTITION=1
mountpoint="mountpoint" mountpoint=$(mktemp -d)
mount_image_partitions mount_image_partitions