From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@buildroot.org
Cc: romain.naour@gmail.com,
Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Subject: [Buildroot] [PATCHv2 3/7] core: introduce BR2_KERNEL_ARCH_OVERRIDE
Date: Sat, 15 Jan 2022 21:03:01 +0100 [thread overview]
Message-ID: <20220115200306.14037-4-patrickdepinguin@gmail.com> (raw)
In-Reply-To: <20220115200306.14037-1-patrickdepinguin@gmail.com>
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
There are cases where a 64-bit architecture is running a 64-bit kernel but
32-bit userspace. Examples include:
* aarch64 architecture, with aarch64 kernel and 32-bit (ARM) userspace
* x86_64 architecture, with x86_64 kernel and 32-bit (i386) userspace
In Buildroot, the ARCH/BR2_ARCH and NORMALIZED_ARCH variables will refer to
the 32-bit architecture, but the kernel needs to be built with the 64-bit
architecture.
Make it possible to define the correct architecture to be used for the
kernel, in a new config option 'BR2_KERNEL_ARCH_OVERRIDE'. The user is
expected to know the valid values.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
Makefile | 4 ++++
arch/Config.in | 15 +++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/Makefile b/Makefile
index c130eb61c6..85b91338a5 100644
--- a/Makefile
+++ b/Makefile
@@ -438,7 +438,11 @@ QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
# Strip off the annoying quoting
ARCH := $(call qstrip,$(BR2_ARCH))
NORMALIZED_ARCH := $(call qstrip,$(BR2_KERNEL_ARCH))
+ifeq ($(call qstrip,$(BR2_KERNEL_ARCH_OVERRIDE)),)
KERNEL_ARCH := $(call qstrip,$(BR2_KERNEL_ARCH))
+else
+KERNEL_ARCH := $(call qstrip,$(BR2_KERNEL_ARCH_OVERRIDE))
+endif
ZCAT := $(call qstrip,$(BR2_ZCAT))
BZCAT := $(call qstrip,$(BR2_BZCAT))
diff --git a/arch/Config.in b/arch/Config.in
index edf337f13e..6d8e2dfd7f 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -331,6 +331,21 @@ config BR2_ARCH
config BR2_KERNEL_ARCH
string
+config BR2_KERNEL_ARCH_OVERRIDE
+ string "Kernel architecture override"
+ help
+ Normally, the correct kernel architecture value is derived
+ from the selected architecture, and you should keep this
+ option empty.
+ However, there are cases where you may want to enter a custom
+ value, for example when using a 64-bit architecture but
+ running userspace in 32-bit mode.
+ As an example, in case of an x86_64 processor where you want
+ 32-bit userspace, BR2_ARCH will be 'i386'/'i486'/'i686' and
+ BR2_KERNEL_ARCH_OVERRIDE should be set to 'x86_64'. Note that
+ in this example you will also need a multilib toolchain and
+ pass '-m32' via BR2_TARGET_OPTIMIZATION.
+
config BR2_ENDIAN
string
--
2.32.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-01-15 20:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-15 20:02 [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Thomas De Schampheleire
2022-01-15 20:02 ` [Buildroot] [PATCHv2 1/7] arch: move definition of KERNEL_ARCH to Config.in.<arch> files Thomas De Schampheleire
2022-02-08 20:25 ` Arnout Vandecappelle
2022-01-15 20:03 ` [Buildroot] [PATCHv2 2/7] core: introduce NORMALIZED_ARCH as non-kernel replacement for KERNEL_ARCH Thomas De Schampheleire
2022-02-08 20:26 ` Arnout Vandecappelle
2022-01-15 20:03 ` Thomas De Schampheleire [this message]
2022-01-15 20:03 ` [Buildroot] [PATCHv2 4/7] perf: fix compilation in case of i386 userspace with x86_64 kernel Thomas De Schampheleire
2022-01-15 20:03 ` [Buildroot] [PATCHv2 5/7] package/qemu: add support for overridden KERNEL_ARCH=x86_64 Thomas De Schampheleire
2022-01-15 20:03 ` [Buildroot] [PATCHv2 6/7] configs: add new qemu defconfig 'x86_multilib' Thomas De Schampheleire
2022-01-18 11:19 ` Thomas De Schampheleire
2022-01-18 11:51 ` Romain Naour
2022-01-18 12:02 ` Thomas De Schampheleire
2022-01-19 20:54 ` Romain Naour
2022-01-15 20:03 ` [Buildroot] [PATCHv2 7/7] linux/linux.mk: correct LINUX_ARCH_PATH for sparc64 Thomas De Schampheleire
2022-02-08 20:28 ` Arnout Vandecappelle
2022-02-08 20:49 ` [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Arnout Vandecappelle
2022-02-09 11:55 ` Thomas De Schampheleire
2022-07-30 19:43 ` Yann E. MORIN
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=20220115200306.14037-4-patrickdepinguin@gmail.com \
--to=patrickdepinguin@gmail.com \
--cc=buildroot@buildroot.org \
--cc=romain.naour@gmail.com \
--cc=thomas.de_schampheleire@nokia.com \
/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