Gentoo Archives: gentoo-dev

From: Sam James <sam@g.o>
To: gentoo-dev@l.g.o
Cc: dist-kernel@g.o, hppa@g.o, Sam James <sam@g.o>
Subject: [gentoo-dev] [PATCH] kernel-build.eclass: add HPPA support
Date: Wed, 02 Feb 2022 08:05:46
Message-Id: 20220202080506.2194651-1-sam@gentoo.org
1 Support HPPA kernel builds.
2
3 Notes:
4 - HPPA 2.0 supports 32-bit and 64-bit kernels (HPPA 2.0 userland remains
5 32-bit for now as toolchain support isn't there yet for 64-bit).
6
7 I've decided to only accommodate 64-bit kernels here unless/until someone
8 requests & can help figure out an acceptable solution for 32-bit kernels
9 for HPPA 2.0.
10
11 - HPPA 1.x should be fine as there's no need for a cross-compiler there,
12 unlike HPPA 2.x for 64-bit (sys-devel/kgcc64). It should Just Work,
13 but not tested.
14
15 Not adding a BDEPEND on sys-devel/kgcc64 as it's unclear how to do this
16 cleanly only for HPPA 2.0.
17
18 Tested on RP3440 and C8000.
19
20 Signed-off-by: Sam James <sam@g.o>
21 ---
22 eclass/kernel-build.eclass | 16 +++++++++++++++-
23 1 file changed, 15 insertions(+), 1 deletion(-)
24
25 diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
26 index 2796493010878..0a49533e48d34 100644
27 --- a/eclass/kernel-build.eclass
28 +++ b/eclass/kernel-build.eclass
29 @@ -1,4 +1,4 @@
30 -# Copyright 2020-2021 Gentoo Authors
31 +# Copyright 2020-2022 Gentoo Authors
32 # Distributed under the terms of the GNU General Public License v2
33
34 # @ECLASS: kernel-build.eclass
35 @@ -52,6 +52,20 @@ BDEPEND="
36 kernel-build_src_configure() {
37 debug-print-function ${FUNCNAME} "${@}"
38
39 + if ! tc-is-cross-compiler && use hppa ; then
40 + if [[ ${CHOST} == hppa2.0-* ]] ; then
41 + # Only hppa2.0 can handle 64-bit anyway.
42 + # Right now, hppa2.0 can run both 32-bit and 64-bit kernels,
43 + # but it seems like most people do 64-bit kernels now
44 + # (obviously needed for more RAM too).
45 +
46 + # TODO: What if they want a 32-bit kernel?
47 + # Not too worried about this case right now.
48 + elog "Forcing 64 bit (${CHOST/2.0/64}) build..."
49 + export CHOST=${CHOST/2.0/64}
50 + fi
51 + fi
52 +
53 # force ld.bfd if we can find it easily
54 local LD="$(tc-getLD)"
55 if type -P "${LD}.bfd" &>/dev/null; then
56 --
57 2.35.1