public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: toolchain@gentoo.org, dist-kernel@gentoo.org, sparc@gentoo.org,
	Sam James <sam@gentoo.org>
Subject: [gentoo-dev] [PATCH 3/6] kernel-build.eclass: add special-case for sparc arch/ directory
Date: Fri, 21 Jul 2023 13:46:09 +0100	[thread overview]
Message-ID: <20230721124615.1797438-3-sam@gentoo.org> (raw)
In-Reply-To: <20230721124615.1797438-1-sam@gentoo.org>

Unfortunately, we still have a mess wrt dual-bitness arches.

For sparc, there's arch/sparc, with ARCH=sparc being "whatever the toolchain is",
ARCH=sparc32 being "give me a 32-bit kernel", and ARCH=sparc64 being "give me
a 64-bit kernel".

You do, seemingly, need to actually pass ARCH=sparc64 to guarantee correct results,
as various kernel Makefiles check for the ARCH value, even though ARCH=sparc will
pop out a 64-bit kernel.

(I originally updated toolchain-funcs.eclass's tc-ninja_magic_to_arch, but we
later found that doesn't look particularly sturdy.

Per at the very least 5ba800962a80d4158b73fb91a7779df7b770c750 ("kbuild: update ARCH alias info for sparc")
upstream, although it seems to go back a fair bit earlier, ARCH=sparc when building
the kernel means "sparc64" if on a sparc64 host.)

Signed-off-by: Sam James <sam@gentoo.org>
---
 eclass/kernel-build.eclass | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index ff615a02d0ebf..276a08a104e0e 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -257,6 +257,14 @@ kernel-build_src_install() {
 	local kern_arch=$(tc-arch-kernel)
 	local dir_ver=${PV}${KV_LOCALVERSION}
 	local kernel_dir=/usr/src/linux-${dir_ver}
+
+	if use sparc ; then
+		# We don't want tc-arch-kernel's sparc64, even though we do
+		# need to pass ARCH=sparc64 to the build system. It's a quasi-alias
+		# in Kbuild.
+		kern_arch=sparc
+	fi
+
 	dodir "${kernel_dir}/arch/${kern_arch}"
 	mv include scripts "${ED}${kernel_dir}/" || die
 	mv "arch/${kern_arch}/include" \
-- 
2.41.0



  parent reply	other threads:[~2023-07-21 12:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21 12:46 [gentoo-dev] [PATCH 1/6] toolchain-funcs.eclass: tc-ninja_magic_to_arch: rename helper function Sam James
2023-07-21 12:46 ` [gentoo-dev] [PATCH 2/6] dist-kernel-utils.eclass: dist-kernel_get_image_path: handle sparc Sam James
2023-07-21 12:46 ` Sam James [this message]
2023-07-21 12:46 ` [gentoo-dev] [PATCH 4/6] kernel-install.eclass: kernel-install_get_qemu_arch: port to sparc Sam James
2023-07-21 12:58   ` Ulrich Mueller
2023-07-21 13:16     ` Sam James
2023-07-21 14:49   ` Michał Górny
2023-07-21 15:05     ` Ulrich Mueller
2023-07-21 12:46 ` [gentoo-dev] [PATCH 5/6] sys-kernel/gentoo-kernel: " Sam James
2023-07-21 12:46 ` [gentoo-dev] [PATCH 6/6] virtual/dist-kernel: keyword ~sparc Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230721124615.1797438-3-sam@gentoo.org \
    --to=sam@gentoo.org \
    --cc=dist-kernel@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=sparc@gentoo.org \
    --cc=toolchain@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox