From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CD23915808A for ; Sat, 02 Aug 2025 11:11:15 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id B6064340D4C for ; Sat, 02 Aug 2025 11:11:15 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 966C811055F; Sat, 02 Aug 2025 11:11:10 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 8CC5C11055F for ; Sat, 02 Aug 2025 11:11:10 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3C9D6340871 for ; Sat, 02 Aug 2025 11:11:10 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D5D1C3234 for ; Sat, 02 Aug 2025 11:11:08 +0000 (UTC) From: "Andreas K. Hüttel" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas K. Hüttel" Message-ID: <1754133036.112acab35f410b185e8d55eef8aba924c1bf26f8.dilfridge@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: targets/support/ X-VCS-Repository: proj/catalyst X-VCS-Files: targets/support/create-qcow2.sh targets/support/qcow2-grub-install.sh X-VCS-Directories: targets/support/ X-VCS-Committer: dilfridge X-VCS-Committer-Name: Andreas K. Hüttel X-VCS-Revision: 112acab35f410b185e8d55eef8aba924c1bf26f8 X-VCS-Branch: master Date: Sat, 02 Aug 2025 11:11:08 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f343228d-58e8-42ee-ae0b-7d4af080fa61 X-Archives-Hash: 23ccc50c9ca753f5b639178970f7bd78 commit: 112acab35f410b185e8d55eef8aba924c1bf26f8 Author: Andreas K. Hüttel gentoo org> AuthorDate: Sat Aug 2 11:10:36 2025 +0000 Commit: Andreas K. Hüttel gentoo org> CommitDate: Sat Aug 2 11:10:36 2025 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=112acab3 Revert "Add support for bios boot in qcow2 images" Doesn't work yet. This reverts commit 8bcf3bcb36880a00bdbc26aa594dd075862f146f. Signed-off-by: Andreas K. Hüttel gentoo.org> targets/support/create-qcow2.sh | 102 +++++++++------------------------- targets/support/qcow2-grub-install.sh | 14 +---- 2 files changed, 28 insertions(+), 88 deletions(-) diff --git a/targets/support/create-qcow2.sh b/targets/support/create-qcow2.sh index 5808ee85..499197f2 100755 --- a/targets/support/create-qcow2.sh +++ b/targets/support/create-qcow2.sh @@ -11,15 +11,12 @@ source ${clst_shdir}/support/functions.sh # # Configuration parameters: # All sizes are in forms as understood by parted: use MiB, GiB, ... or M, G, ... -# - clst_qcow2_size (internal) size of the qcow2 image in MiB (default 20GiB) -# - clst_qcow2_efisize size of the EFI boot partition in MiB (default 512MiB) +# - clst_qcow2_size (internal) size of the qcow2 image (default 20GiB) +# - clst_qcow2_efisize size of the EFI boot partition (default 512MiB) # - clst_qcow2_roottype type of the root partition (default xfs) # -: "${clst_qcow2_size:=20480}" -: "${clst_qcow2_biossize:=4}" -: "${clst_qcow2_efisize:=512}" -: "${clst_qcow2_enable_bios:=1}" -: "${clst_qcow2_enable_efi:=1}" +: "${clst_qcow2_size:=20GiB}" +: "${clst_qcow2_efisize:=512MiB}" : "${clst_qcow2_roottype:=xfs}" # @@ -54,7 +51,6 @@ qcow2die() { umount "${mydevice}p1" umount "${mydevice}p2" - umount "${mydevice}p3" qemu-nbd -d "${mydevice}" die "Caught error: $@" @@ -63,9 +59,7 @@ qcow2die() { # We need a means to execute a script inside the qcow with filesystems mounted # Which means reproducing half of catalyst here. exec_in_qcow2() { - local file_full="${1}" local file_name=$(basename ${1}) - shift # prepare qcow2 for chrooting mount --types proc /proc "${mymountpoint}/proc" @@ -76,8 +70,8 @@ exec_in_qcow2() { mount --bind /run "${mymountpoint}/run" mount --make-slave "${mymountpoint}/run" - # copy_to_chroot ${file_full} - cp -pPR "${file_full}" "${mymountpoint}/tmp" || qcow2die + # copy_to_chroot ${1} + cp -pPR "${1}" "${mymountpoint}/tmp" || qcow2die # copy_to_chroot ${clst_shdir}/support/chroot-functions.sh cp -pPR "${clst_shdir}/support/chroot-functions.sh" "${mymountpoint}/tmp" || qcow2die @@ -93,8 +87,8 @@ exec_in_qcow2() { fi echo "Running ${file_name} in qcow2:" - echo " ${clst_CHROOT} ${mymountpoint} /tmp/${file_name} $@" - ${clst_CHROOT} "${mymountpoint}" "/tmp/${file_name}" $@ || qcow2die + echo " ${clst_CHROOT} ${mymountpoint} /tmp/${file_name}" + ${clst_CHROOT} "${mymountpoint}" "/tmp/${file_name}" || qcow2die # Remove binary interpreter if [[ -n "${clst_interpreter}" ]] ; then @@ -126,53 +120,19 @@ sleep 5s echo "Creating a GPT disklabel" parted -s ${mydevice} mklabel gpt 2>&1 || qcow2die "Cannot create disklabel" -echo "We start with partition 1 and sector 2048" -mynextpart=1 -mynextsector=2048 - -mypartbios="" -mypartefi="" - -if [[ "${clst_qcow2_enable_bios}" == "1" ]] ; then - - mysectors=$(( ${clst_qcow2_biossize} * 2048 )) - myendsector=$(( ${mynextsector} + ${mysectors} - 1 )) - - echo "Creating a bios boot partition, number ${mynextpart}, size ${clst_qcow2_biossize}, start ${mynextsector}, end ${myendsector}" - parted -s ${mydevice} -- mkpart gentoobios ${mynextsector}s ${myendsector}s || qcow2die "Cannot create bios boot partition" - # mark it as bios boot partition - parted -s ${mydevice} -- type ${mynextpart} 21686148-6449-6E6F-744E-656564454649 || qcow2die "Cannot set bios boot partition UUID" - # note down name - mypartbios=${mydevice}p${mynextpart} - # increase counters - mynextpart=$(( ${mynextpart} +1 )) - mynextsector=$(( ${mynextsector} + ${mysectors} )) - -fi - -if [[ "${clst_qcow2_enable_efi}" == "1" ]] ; then - - mysectors=$(( ${clst_qcow2_efisize} * 2048 )) - myendsector=$(( ${mynextsector} + ${mysectors} - 1 )) - - echo "Creating an EFI boot partition, number ${mynextpart}, size ${clst_qcow2_efisize}, start ${mynextsector}, end ${myendsector}" - parted -s ${mydevice} -- mkpart gentooefi fat32 ${mynextsector}s ${myendsector}s || qcow2die "Cannot create EFI partition" - # mark it as EFI boot partition - parted -s ${mydevice} -- type ${mynextpart} C12A7328-F81F-11D2-BA4B-00A0C93EC93B || qcow2die "Cannot set EFI partition UUID" - # note down name - mypartefi=${mydevice}p${mynextpart} - # increase counters - mynextpart=$(( ${mynextpart} +1 )) - mynextsector=$(( ${mynextsector} + ${mysectors} )) - -fi +echo "Creating an EFI boot partition" +parted -s ${mydevice} -- mkpart gentooefi fat32 1M ${clst_qcow2_efisize} || qcow2die "Cannot create EFI partition" +# mark it as EFI boot partition +parted -s ${mydevice} -- type 1 C12A7328-F81F-11D2-BA4B-00A0C93EC93B || qcow2die "Cannot set EFI partition UUID" +# note down name +mypartefi=${mydevice}p1 -echo "Creating the root partition, number ${mynextpart}, start ${mynextsector}" -parted -s ${mydevice} -- mkpart gentooroot ${clst_qcow2_roottype} ${mynextsector}s -1s || qcow2die "Cannot create root partition" +echo "Creating the root partition" +parted -s ${mydevice} -- mkpart gentooroot ${clst_qcow2_roottype} ${clst_qcow2_efisize}GiB -1M || qcow2die "Cannot create root partition" # mark it as generic linux filesystem partition -parted -s ${mydevice} -- type ${mynextpart} 0FC63DAF-8483-4772-8E79-3D69D8477DE4 || qcow2die "Cannot set root partition UUID" +parted -s ${mydevice} -- type 2 0FC63DAF-8483-4772-8E79-3D69D8477DE4 || qcow2die "Cannot set root partition UUID" # note down name -mypartroot=${mydevice}p${mynextpart} +mypartroot=${mydevice}p2 echo "Re-reading the partition table" partprobe ${mydevice} || qcow2die "Probing partition table failed" @@ -183,12 +143,10 @@ parted -s ${mydevice} -- print || qcow2die "Printing the partition table failed" echo "Waiting 5s to ensure the partition device nodes exist" sleep 5s -if [[ "${clst_qcow2_enable_efi}" == "1" ]] ; then - echo "Making a vfat filesystem in ${mypartefi}" - mkfs.fat -v -F 32 -n gentooefi ${mypartefi} || qcow2die "Formatting EFI partition failed" -fi +echo "Making a vfat filesystem in p1" +mkfs.fat -v -F 32 -n gentooefi ${mypartefi} || qcow2die "Formatting EFI partition failed" -echo "Making an xfs filesystem in ${mypartroot}" +echo "Making an xfs filesystem in p2" # nrext64=0 is needed for compatibility with 5.15 kernels mkfs.xfs -i nrext64=0 -L gentooroot ${mypartroot} || qcow2die "Formatting root partition failed" @@ -198,10 +156,8 @@ blkid ${mydevice}* || qcow2die "blkid failed" echo "Mounting things at ${mymountpoint}" mkdir -p "${mymountpoint}" || qcow2die "Could not create root mount point" mount ${mypartroot} "${mymountpoint}" || qcow2die "Could not mount root partition" -if [[ "${clst_qcow2_enable_efi}" == "1" ]] ; then - mkdir -p "${mymountpoint}"/boot || qcow2die "Could not create boot mount point" - mount ${mypartefi} "${mymountpoint}/boot" || qcow2die "Could not mount boot partition" -fi +mkdir -p "${mymountpoint}"/boot || qcow2die "Could not create boot mount point" +mount ${mypartefi} "${mymountpoint}/boot" || qcow2die "Could not mount boot partition" # copy contents in; the source is the stage dir and not any "iso content" echo "Copying files into the mounted directories from ${clst_stage_path}" @@ -215,7 +171,7 @@ rm -f "${mymountpoint}/etc/machine-id" touch "${mymountpoint}/etc/machine-id" || qcow2die "Could not set machine-id to empty" # now we can chroot in and install grub -exec_in_qcow2 "${clst_shdir}/support/qcow2-grub-install.sh" ${mydevice} ${clst_qcow2_enable_bios} ${clst_qcow2_enable_efi} +exec_in_qcow2 "${clst_shdir}/support/qcow2-grub-install.sh" echo "Generating /etc/fstab" cat > "${mymountpoint}/etc/fstab" < "${mymountpoint}/etc/fstab" < LABEL=gentooroot / xfs noatime,rw 0 1 -END - -if [[ "${clst_qcow2_enable_efi}" == "1" ]] ; then -cat >> "${mymountpoint}/etc/fstab" < /dev/null || qcow2die "Could not cd into mountpoint" @@ -243,9 +195,7 @@ echo "Compressing the CONTENTS file" gzip "${myqcow2}.CONTENTS" || qcow2die "Could not compress the CONTENTS file" echo "Unmounting things" -if [[ "${clst_qcow2_enable_efi}" == "1" ]] ; then - umount "${mymountpoint}/boot" || qcow2die "Could not unmount boot partition" -fi +umount "${mymountpoint}/boot" || qcow2die "Could not unmount boot partition" umount "${mymountpoint}" || qcow2die "Could not unmount root partition" echo "Disconnecting ${mydevice}" diff --git a/targets/support/qcow2-grub-install.sh b/targets/support/qcow2-grub-install.sh index 306dedb3..4806be06 100755 --- a/targets/support/qcow2-grub-install.sh +++ b/targets/support/qcow2-grub-install.sh @@ -5,10 +5,6 @@ source /tmp/chroot-functions.sh echo "Setting up grub for also serial console" cat >> /etc/default/grub <