From e678af400992a31fa60b7fc24480adce29d16931 Mon Sep 17 00:00:00 2001 From: Ian Jordan Date: Wed, 24 Jun 2026 01:38:03 +0100 Subject: [PATCH 1/3] SPARC emu bootloader When using qemu-user to build ISOs, Catalyst runs into an issue where the bootloader creation is called from the host machine rather than chroot. This results in an unbootable image. For GRUB based media this is an easy fix by adding sys-boot/grub to the stage1 then this addition to create-iso.sh can use grub-mkrescue's directory switch to use the chroot's /usr/lib/grub/sparc64-ieee1275 This is onlt tested in qemu-system-sparc64 for now. Signed-off-by: Ian Jordan --- targets/support/create-iso.sh | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh index 1623b034..c54451f6 100755 --- a/targets/support/create-iso.sh +++ b/targets/support/create-iso.sh @@ -239,9 +239,33 @@ if [[ -z "${clst_interpreter}" ]] ; then ;; esac -else - - die "Emulated iso build is not supported yet" + else + # Emulated ISO creation + # When using qemu-user to build ISOs Catalyst uses the host + # machine's bootloader creation tool's which doesn't have the + # needed support. + # GRUB can workaround this by adding the package to stage1 + # and pointing to /usr/lib/grub/(target). + case ${clst_hostarch} in + sparc*) + isoroot_checksum + echo ">> grub-mkrescue (emulated sparc build)" + grub-mkrescue \ + --directory="${clst_chroot_path}/usr/lib/grub/sparc64-ieee1275" \ + --mbr-force-bootable \ + --sparc-boot \ + -volid "${clst_iso_volume_id}" \ + -joliet \ + -iso-level 3 \ + -o "${1}" \ + "${clst_target_path}" \ + || die "Cannot make ISO image" + ;; + *) + die "Emulated iso build is not supported for ${clst_hostarch}" + ;; + esac + fi fi From b894b135c3e770ee64f5c67388d7f10dbfd04735 Mon Sep 17 00:00:00 2001 From: Ian Jordan Date: Mon, 29 Jun 2026 13:04:05 +0100 Subject: [PATCH 2/3] RISCV Emu bootloader When using qemu-user to build ISOs, Catalyst runs into an issue where the bootloader creation is called from the host machine rather than chroot. This results in an unbootable image. For GRUB based media this is an easy fix by adding sys-boot/grub to the stage1 then this addition to create-iso.sh can use grub-mkrescue's directory switch to use the chroot's /usr/lib/grub/riscv64-efi Signed-off-by: Ian Jordan --- targets/support/create-iso.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh index c54451f6..b39c3010 100755 --- a/targets/support/create-iso.sh +++ b/targets/support/create-iso.sh @@ -238,15 +238,22 @@ if [[ -z "${clst_interpreter}" ]] ; then grub-mkrescue --mbr-force-bootable -volid "${clst_iso_volume_id}" "${extra_opts[@]}" -o "${1}" "${clst_target_path}" ;; esac - else - # Emulated ISO creation - # When using qemu-user to build ISOs Catalyst uses the host - # machine's bootloader creation tool's which doesn't have the - # needed support. - # GRUB can workaround this by adding the package to stage1 - # and pointing to /usr/lib/grub/(target). + # Emulated build: run ISO creation on host where possible case ${clst_hostarch} in + rv64*|riscv*) + isoroot_checksum + echo ">> grub-mkrescue (emulated riscv build)" + grub-mkrescue \ + --directory="${clst_chroot_path}/usr/lib/grub/riscv64-efi" \ + --mbr-force-bootable \ + -volid "${clst_iso_volume_id}" \ + -joliet \ + -iso-level 3 \ + -o "${1}" \ + "${clst_target_path}" \ + || die "Cannot make ISO image" + ;; sparc*) isoroot_checksum echo ">> grub-mkrescue (emulated sparc build)" @@ -260,13 +267,11 @@ if [[ -z "${clst_interpreter}" ]] ; then -o "${1}" \ "${clst_target_path}" \ || die "Cannot make ISO image" - ;; + ;; *) die "Emulated iso build is not supported for ${clst_hostarch}" ;; esac fi -fi - exit $? From aa25de843f59e84818c4429be888369898f86a57 Mon Sep 17 00:00:00 2001 From: Ian Jordan Date: Mon, 29 Jun 2026 13:23:22 +0100 Subject: [PATCH 3/3] Loong Emu Bootloader When using qemu-user to build ISOs, Catalyst runs into an issue where the bootloader creation is called from the host machine rather than chroot. This results in an unbootable image. For GRUB based media this is an easy fix by adding sys-boot/grub to the stage1 then this addition to create-iso.sh can use grub-mkrescue's directory switch to use the chroot's /usr/lib/grub/loongarch64-efi Signed-off-by: Ian Jordan --- targets/support/create-iso.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh index b39c3010..21976f6e 100755 --- a/targets/support/create-iso.sh +++ b/targets/support/create-iso.sh @@ -241,6 +241,19 @@ if [[ -z "${clst_interpreter}" ]] ; then else # Emulated build: run ISO creation on host where possible case ${clst_hostarch} in + loong*) + isoroot_checksum + echo ">> grub-mkrescue (emulated loong build)" + grub-mkrescue \ + --directory="${clst_chroot_path}/usr/lib/grub/loongarch64-efi" \ + --mbr-force-bootable \ + -volid "${clst_iso_volume_id}" \ + -joliet \ + -iso-level 3 \ + -o "${1}" \ + "${clst_target_path}" \ + die "Cannot make ISO image" + ;; rv64*|riscv*) isoroot_checksum echo ">> grub-mkrescue (emulated riscv build)"