commit:     26f1a66a46f8d170f267696805ed904dfbbcae91
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 20 00:02:56 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Tue Nov 22 03:48:34 2022 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=26f1a66a

targets: Fix CHOST vs `uname -m` confusion

We've had difficulties keeping straight CHOST (e.g. "hppa") vs `uname
-m` output in the past, and I suspect I've made it worse over time.

Fix the issues I spotted, and add a catch-all for architectures we are
missing support for, so if ISO/netboot/etc creation doesn't silently
fail.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 targets/support/bootloader-setup.sh | 13 +++++++------
 targets/support/create-iso.sh       | 30 ++++++++++++++++--------------
 targets/support/netboot-final.sh    |  8 ++++++--
 targets/support/pre-kmerge.sh       |  2 +-
 4 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/targets/support/bootloader-setup.sh 
b/targets/support/bootloader-setup.sh
index 08d25b59..6ca3e38a 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -56,10 +56,7 @@ case ${clst_hostarch} in
                        ((bctr=${bctr}+1))
                done
        ;;
-       arm)
-               # NO SOFTLEVEL SUPPORT YET
-       ;;
-       hppa)
+       hppa*)
                # NO SOFTLEVEL SUPPORT YET
                mkdir -p $1/boot
 
@@ -81,7 +78,7 @@ case ${clst_hostarch} in
                        echo "--recoverykernel=boot/${x}" >> ${icfg}
                done
        ;;
-       amd64|arm64|ia64|ppc*|powerpc*|sparc*|x86)
+       aarch64*|amd64|ia64|ppc*|powerpc*|sparc*|x86)
                kern_subdir=/boot
                iacfg=$1/boot/grub/grub.cfg
                mkdir -p $1/boot/grub
@@ -119,7 +116,7 @@ case ${clst_hostarch} in
                        echo "" >> ${iacfg}
                done
        ;;
-       mips)
+       mips*)
                # NO SOFTLEVEL SUPPORT YET
 
                # Mips is an interesting arch -- where most archs will
@@ -179,5 +176,9 @@ case ${clst_hostarch} in
                [ -e "${1}/sash64" ] && mv ${1}/sash64 ${scratch}/arcload
                [ -e "${1}/arc.cf" ] && mv ${1}/arc.cf ${scratch}/arcload
                ;;
+       *)
+               echo "Boot loader support for ${clst_hostarch} is unimplemented"
+               exit 1
+       ;;
 esac
 exit $?

diff --git a/targets/support/create-iso.sh b/targets/support/create-iso.sh
index 8eada6a7..8412f6fb 100755
--- a/targets/support/create-iso.sh
+++ b/targets/support/create-iso.sh
@@ -10,7 +10,7 @@ case ${clst_hostarch} in
                cdmaker="xorriso"
                cdmakerpkg="dev-libs/libisoburn"
                ;;
-       mips)
+       mips*)
                cdmaker="sgibootcd"
                cdmakerpkg="sys-boot/sgibootcd"
                ;;
@@ -18,7 +18,7 @@ case ${clst_hostarch} in
                cdmaker="grub-mkrescue"
                cdmakerpkg="dev-libs/libisoburn and sys-boot/grub:2"
                ;;
-       amd64|arm64|ia64|x86)
+       aarch64*|amd64|ia64|x86)
                cdmaker="grub-mkrescue"
                # grub-mkrescue requires:
                #  xorriso from libisoburn
@@ -49,28 +49,28 @@ then
                                amd64)
                                        clst_iso_volume_id="Gentoo Linux - 
AMD64"
                                ;;
-                               arm)
+                               arm*)
                                        clst_iso_volume_id="Gentoo Linux - ARM"
                                ;;
-                               arm64)
+                               aarch64*)
                                        clst_iso_volume_id="Gentoo Linux - 
ARM64"
                                ;;
-                               hppa)
-                                       clst_iso_volume_id="Gentoo Linux - HPPA"
-                               ;;
                                ia64)
                                        clst_iso_volume_id="Gentoo Linux - IA64"
                                ;;
                                m68k)
                                        clst_iso_volume_id="Gentoo Linux - M68K"
                                ;;
-                               mips)
+                               mips*)
                                        clst_iso_volume_id="Gentoo Linux - MIPS"
                                ;;
+                               hppa*)
+                                       clst_iso_volume_id="Gentoo Linux - HPPA"
+                               ;;
                                ppc*|powerpc*)
                                        clst_iso_volume_id="Gentoo Linux - 
PowerPC"
                                ;;
-                               s390)
+                               s390*)
                                        clst_iso_volume_id="Gentoo Linux - S390"
                                ;;
                                sh)
@@ -126,16 +126,14 @@ case ${clst_hostarch} in
                echo ">> xorriso -as genisofs -alpha-boot boot/bootlx -R -l -J 
-V \"${clst_iso_volume_id}\" -o \"${1}\" \"${clst_target_path}\""
                xorriso -as genisofs -alpha-boot boot/bootlx -R -l -J -V 
"${clst_iso_volume_id}" -o "${1}" "${clst_target_path}" || die "Cannot make ISO 
image"
        ;;
-       arm)
-       ;;
-       hppa)
+       hppa*)
                echo ">> Running mkisofs to create iso image...."
                run_mkisofs -R -l -J -V "${clst_iso_volume_id}" -o "${1}" 
"${clst_target_path}"/
                pushd "${clst_target_path}/"
                palo -f boot/palo.conf -C "${1}"
                popd
        ;;
-       mips)
+       mips*)
                if [[ ${clst_fstype} != squashfs ]]; then
                        die "SGI LiveCD(s) only support the 'squashfs' fstype!"
                fi
@@ -191,7 +189,7 @@ case ${clst_hostarch} in
                # o=    output image (burnable to CD; readable by fdisk)
                /usr/bin/sgibootcd c=${cfg} o=${clst_iso}
        ;;
-       amd64|arm64|ia64|ppc*|powerpc*|sparc*|x86)
+       aarch64*|amd64|ia64|ppc*|powerpc*|sparc*|x86)
                isoroot_checksum
 
                extra_opts=("-joliet" "-iso-level" "3")
@@ -202,5 +200,9 @@ case ${clst_hostarch} in
                echo ">> Running grub-mkrescue to create iso image...."
                grub-mkrescue "${extra_opts[@]}" -o "${1}" "${clst_target_path}"
        ;;
+       *)
+               echo "ISO support for ${clst_hostarch} is unimplemented"
+               exit 1
+       ;;
 esac
 exit  $?

diff --git a/targets/support/netboot-final.sh b/targets/support/netboot-final.sh
index 7a26e0f4..3071f698 100755
--- a/targets/support/netboot-final.sh
+++ b/targets/support/netboot-final.sh
@@ -20,7 +20,7 @@ rmdir ${clst_target_path}/boot
 # Any post-processing necessary for each architecture can be done here.  This
 # may include things like sparc's elftoaout, x86's PXE boot, etc.
 case ${clst_hostarch} in
-       hppa)
+       hppa*)
                # Only one kernel should be there
                kname=${clst_boot_kernel[0]}
                rm -f ${clst_target_path}/${kname}-hppa.lif
@@ -36,7 +36,7 @@ case ${clst_hostarch} in
 
                ;;
        sparc*)
-               if [ "${clst_subarch}" == "sparc" ]; then
+               if [[ ${clst_hostarch} == sparc* ]]; then
                        piggyback=piggyback
                else
                        piggyback=piggyback64
@@ -46,5 +46,9 @@ case ${clst_hostarch} in
                        ${piggyback} ${clst_target_path}/${x}-a.out 
${clst_target_path}/kernels/misc/System-${x}.map 
${clst_target_path}/kernels/misc/${x}.igz
                done
                ;;
+       *)
+               echo "Netboot support for ${clst_hostarch} is unimplemented"
+               exit 1
+       ;;
 esac
 exit $?

diff --git a/targets/support/pre-kmerge.sh b/targets/support/pre-kmerge.sh
index 0dfc835e..4a14fe8d 100755
--- a/targets/support/pre-kmerge.sh
+++ b/targets/support/pre-kmerge.sh
@@ -4,7 +4,7 @@ RUN_DEFAULT_FUNCS="yes"
 
 source /tmp/chroot-functions.sh
 
-if [[ ${clst_hostarch} == hppa ]]; then
+if [[ ${clst_hostarch} == hppa* ]]; then
        for i in ${clst_boot_kernel}; do
                case ${i} in
                        *32)

Reply via email to