* [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland
@ 2022-01-15 20:02 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
` (8 more replies)
0 siblings, 9 replies; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-01-15 20:02 UTC (permalink / raw)
To: buildroot; +Cc: romain.naour, Thomas De Schampheleire
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Hello,
Even though there are already cases where a 64-bit kernel is combined with
32-bit userland, like MIPS64n32, that Buildroot can support out-of-the-box,
there are other combinations that don't currently work.
At work, we have two such cases:
- 64-bit x86_64 kernel with 32-bit i386 userspace
- 64-bit aarch64 kernel with 32-bit arm userspace
This series adds basic support for these cases, with the limitation that the
user still needs to know what they are doing.
Patch 1 is a general improvement and can land even if you don't agree
with the rest.
Patch 2 handles the realization that 'KERNEL_ARCH' can mean two different
things, and that we need two separate variables.
Patch 3 makes it possible for users to specify the kernel architecture that
differs from the Buildroot notion of userspace architecture.
Patch 4 fixes the build of perf in this mixed 64-bit-kernel+32-bit-userspace
case.
Patch 5 prepares host-qemu for the case of x86_64. I'm not very fond of the fact
that this does not provide a generic solution.
Patch 6 adds a new qemu defconfig for x86_64 kernel and x86 userspace, that
employs the new logic.
Finally patch 7 corrects LINUX_ARCH_PATH for sparc64, not directly related to
this series but reported by Romain Naour during his review.
As hinted above, users that would like to employ such scenarios still need to
know what they are doing:
- the correct value of BR2_KERNEL_ARCH_OVERRIDE is to be known by the user
- the toolchain should be capable of generating both 64-bit (kernel) output as
well as 32-bit userspace output. This is typically done with a multilib
toolchain, where the default output is 64-bit so that the kernel build does
not require additional changes, while passing the correct '-mXXX' flag as
BR2_TARGET_OPTIMIZATION for the userspace compilations.
- it is not possible to create one multilib toolchain that supports Aarch64 and
(32-bit) ARM output. We have solved it by packaging two individual toolchains
in one archive, with symlinks at top-level to the 32-bit toolchain, and
some additional changes in Buildroot to make sure the 64-bit toolchain is
used where needed (kernel, bootloader)
- BR2_KERNEL_64_USERLAND_32 is not automatically passed.
An alternative implementation would be to explicitly support certain
combinations, but this is less flexible.
Best regards,
Thomas
Thomas De Schampheleire (7):
arch: move definition of KERNEL_ARCH to Config.in.<arch> files
core: introduce NORMALIZED_ARCH as non-kernel replacement for
KERNEL_ARCH
core: introduce BR2_KERNEL_ARCH_OVERRIDE
perf: fix compilation in case of i386 userspace with x86_64 kernel
package/qemu: add support for overridden KERNEL_ARCH=x86_64
configs: add new qemu defconfig 'x86_multilib'
linux/linux.mk: correct LINUX_ARCH_PATH for sparc64
Makefile | 22 ++-----
arch/Config.in | 18 ++++++
arch/Config.in.arc | 3 +
arch/Config.in.arm | 4 ++
arch/Config.in.csky | 3 +
arch/Config.in.m68k | 3 +
arch/Config.in.microblaze | 3 +
arch/Config.in.mips | 3 +
arch/Config.in.nds32 | 3 +
arch/Config.in.nios2 | 3 +
arch/Config.in.or1k | 3 +
arch/Config.in.powerpc | 3 +
arch/Config.in.riscv | 3 +
arch/Config.in.s390x | 3 +
arch/Config.in.sh | 3 +
arch/Config.in.sparc | 4 ++
arch/Config.in.x86 | 4 ++
arch/Config.in.xtensa | 3 +
board/qemu/x86_multilib/linux.config | 57 +++++++++++++++++++
board/qemu/x86_multilib/post-build.sh | 11 ++++
board/qemu/x86_multilib/readme.txt | 7 +++
boot/barebox/barebox.mk | 10 ++--
boot/uboot/uboot.mk | 6 +-
configs/qemu_x86_multilib_defconfig | 26 +++++++++
linux/linux.mk | 2 +
package/busybox/busybox.mk | 2 +-
.../environment-setup/environment-setup.mk | 2 +-
package/kvmtool/kvmtool.mk | 4 +-
package/libselinux/libselinux.mk | 2 +-
package/linux-tools/linux-tool-perf.mk.in | 7 ++-
.../linux-tools/linux-tool-selftests.mk.in | 6 +-
package/olsr/olsr.mk | 4 +-
package/pciutils/pciutils.mk | 2 +-
package/qemu/qemu.mk | 3 +
package/uboot-tools/uboot-tools.mk | 10 ++--
35 files changed, 210 insertions(+), 42 deletions(-)
create mode 100644 board/qemu/x86_multilib/linux.config
create mode 100755 board/qemu/x86_multilib/post-build.sh
create mode 100644 board/qemu/x86_multilib/readme.txt
create mode 100644 configs/qemu_x86_multilib_defconfig
--
2.32.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Buildroot] [PATCHv2 1/7] arch: move definition of KERNEL_ARCH to Config.in.<arch> files
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 ` 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
` (7 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-01-15 20:02 UTC (permalink / raw)
To: buildroot
Cc: ARC Maintainers, Guo Ren, Mark Corbin, Alexander Egorenkov,
Nylon Chen, Ezequiel Garcia, Thomas Petazzoni, Spenser Gilliland,
romain.naour, Cyril Bur, Thomas De Schampheleire
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Similar to other arch-specific strings, the 'KERNEL_ARCH' variable can be
determined from Config.in.<arch> files.
Besides aligning with similar strings, this also means simplification: the
big 'sed' covers several architectures not even supported by Buildroot.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Reviewed-by: Romain Naour <romain.naour@gmail.com>
---
Makefile | 17 +----------------
arch/Config.in | 3 +++
arch/Config.in.arc | 3 +++
arch/Config.in.arm | 4 ++++
arch/Config.in.csky | 3 +++
arch/Config.in.m68k | 3 +++
arch/Config.in.microblaze | 3 +++
arch/Config.in.mips | 3 +++
arch/Config.in.nds32 | 3 +++
arch/Config.in.nios2 | 3 +++
arch/Config.in.or1k | 3 +++
arch/Config.in.powerpc | 3 +++
arch/Config.in.riscv | 3 +++
arch/Config.in.s390x | 3 +++
arch/Config.in.sh | 3 +++
arch/Config.in.sparc | 4 ++++
arch/Config.in.x86 | 4 ++++
arch/Config.in.xtensa | 3 +++
18 files changed, 55 insertions(+), 16 deletions(-)
diff --git a/Makefile b/Makefile
index 5fc7137e5a..e012d121b9 100644
--- a/Makefile
+++ b/Makefile
@@ -437,22 +437,7 @@ QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
# Strip off the annoying quoting
ARCH := $(call qstrip,$(BR2_ARCH))
-
-KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
- -e s/i.86/i386/ -e s/sun4u/sparc64/ \
- -e s/arcle/arc/ \
- -e s/arceb/arc/ \
- -e s/arm.*/arm/ -e s/sa110/arm/ \
- -e s/aarch64.*/arm64/ \
- -e s/nds32.*/nds32/ \
- -e s/or1k/openrisc/ \
- -e s/parisc64/parisc/ \
- -e s/powerpc64.*/powerpc/ \
- -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
- -e s/riscv.*/riscv/ \
- -e s/sh.*/sh/ \
- -e s/s390x/s390/ \
- -e s/microblazeel/microblaze/)
+KERNEL_ARCH := $(call qstrip,$(BR2_KERNEL_ARCH))
ZCAT := $(call qstrip,$(BR2_ZCAT))
BZCAT := $(call qstrip,$(BR2_BZCAT))
diff --git a/arch/Config.in b/arch/Config.in
index c99af89efa..edf337f13e 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -328,6 +328,9 @@ config BR2_ARCH_NEEDS_GCC_AT_LEAST_11
config BR2_ARCH
string
+config BR2_KERNEL_ARCH
+ string
+
config BR2_ENDIAN
string
diff --git a/arch/Config.in.arc b/arch/Config.in.arc
index f7a6d920b5..cc55c9e68f 100644
--- a/arch/Config.in.arc
+++ b/arch/Config.in.arc
@@ -62,6 +62,9 @@ config BR2_ARCH
default "arc" if BR2_arcle
default "arceb" if BR2_arceb
+config BR2_KERNEL_ARCH
+ default "arc"
+
config BR2_arc
bool
default y if BR2_arcle || BR2_arceb
diff --git a/arch/Config.in.arm b/arch/Config.in.arm
index 4c0910e4f8..0f50512fad 100644
--- a/arch/Config.in.arm
+++ b/arch/Config.in.arm
@@ -822,6 +822,10 @@ config BR2_ARCH
default "aarch64" if BR2_aarch64
default "aarch64_be" if BR2_aarch64_be
+config BR2_KERNEL_ARCH
+ default "arm" if BR2_arm || BR2_armeb
+ default "arm64" if BR2_aarch64 || BR2_aarch64_be
+
config BR2_ENDIAN
default "LITTLE" if (BR2_arm || BR2_aarch64)
default "BIG" if (BR2_armeb || BR2_aarch64_be)
diff --git a/arch/Config.in.csky b/arch/Config.in.csky
index 7e2029f759..df9e7ab75b 100644
--- a/arch/Config.in.csky
+++ b/arch/Config.in.csky
@@ -39,6 +39,9 @@ config BR2_GCC_TARGET_FLOAT_ABI
config BR2_ARCH
default "csky"
+config BR2_KERNEL_ARCH
+ default "csky"
+
config BR2_ENDIAN
default "LITTLE"
diff --git a/arch/Config.in.m68k b/arch/Config.in.m68k
index 275f47f1d3..7f3aec7232 100644
--- a/arch/Config.in.m68k
+++ b/arch/Config.in.m68k
@@ -1,6 +1,9 @@
config BR2_ARCH
default "m68k" if BR2_m68k
+config BR2_KERNEL_ARCH
+ default "m68k"
+
config BR2_ENDIAN
default "BIG"
diff --git a/arch/Config.in.microblaze b/arch/Config.in.microblaze
index 5fe2906d40..52aa252a2c 100644
--- a/arch/Config.in.microblaze
+++ b/arch/Config.in.microblaze
@@ -2,6 +2,9 @@ config BR2_ARCH
default "microblazeel" if BR2_microblazeel
default "microblaze" if BR2_microblazebe
+config BR2_KERNEL_ARCH
+ default "microblaze"
+
config BR2_ENDIAN
default "LITTLE" if BR2_microblazeel
default "BIG" if BR2_microblazebe
diff --git a/arch/Config.in.mips b/arch/Config.in.mips
index 619456c2d5..b4923f8484 100644
--- a/arch/Config.in.mips
+++ b/arch/Config.in.mips
@@ -235,6 +235,9 @@ config BR2_ARCH
default "mips64" if BR2_mips64
default "mips64el" if BR2_mips64el
+config BR2_KERNEL_ARCH
+ default "mips"
+
config BR2_ENDIAN
default "LITTLE" if BR2_mipsel || BR2_mips64el
default "BIG" if BR2_mips || BR2_mips64
diff --git a/arch/Config.in.nds32 b/arch/Config.in.nds32
index 322ff49f2e..61fc346260 100644
--- a/arch/Config.in.nds32
+++ b/arch/Config.in.nds32
@@ -1,6 +1,9 @@
config BR2_ARCH
default "nds32le"
+config BR2_KERNEL_ARCH
+ default "nds32"
+
config BR2_GCC_TARGET_ARCH
default "v3"
diff --git a/arch/Config.in.nios2 b/arch/Config.in.nios2
index aae435fa17..c77b1a1c59 100644
--- a/arch/Config.in.nios2
+++ b/arch/Config.in.nios2
@@ -1,6 +1,9 @@
config BR2_ARCH
default "nios2"
+config BR2_KERNEL_ARCH
+ default "nios2"
+
config BR2_ENDIAN
default "LITTLE"
diff --git a/arch/Config.in.or1k b/arch/Config.in.or1k
index abdf498fb8..ef1bded453 100644
--- a/arch/Config.in.or1k
+++ b/arch/Config.in.or1k
@@ -1,6 +1,9 @@
config BR2_ARCH
default "or1k"
+config BR2_KERNEL_ARCH
+ default "openrisc"
+
config BR2_ENDIAN
default "BIG"
diff --git a/arch/Config.in.powerpc b/arch/Config.in.powerpc
index ba56c9c721..33b2471cf9 100644
--- a/arch/Config.in.powerpc
+++ b/arch/Config.in.powerpc
@@ -157,6 +157,9 @@ config BR2_ARCH
default "powerpc64" if BR2_powerpc64
default "powerpc64le" if BR2_powerpc64le
+config BR2_KERNEL_ARCH
+ default "powerpc"
+
config BR2_ENDIAN
default "BIG" if BR2_powerpc || BR2_powerpc64
default "LITTLE" if BR2_powerpc64le
diff --git a/arch/Config.in.riscv b/arch/Config.in.riscv
index e6436d7c39..1a008a935d 100644
--- a/arch/Config.in.riscv
+++ b/arch/Config.in.riscv
@@ -118,6 +118,9 @@ config BR2_ARCH
default "riscv32" if !BR2_ARCH_IS_64
default "riscv64" if BR2_ARCH_IS_64
+config BR2_KERNEL_ARCH
+ default "riscv"
+
config BR2_ENDIAN
default "LITTLE"
diff --git a/arch/Config.in.s390x b/arch/Config.in.s390x
index ad866b421e..bf4b70f957 100644
--- a/arch/Config.in.s390x
+++ b/arch/Config.in.s390x
@@ -17,6 +17,9 @@ endchoice
config BR2_ARCH
default "s390x" if BR2_s390x
+config BR2_KERNEL_ARCH
+ default "s390"
+
config BR2_ENDIAN
default "BIG"
diff --git a/arch/Config.in.sh b/arch/Config.in.sh
index b5cce18e22..fde42dfce2 100644
--- a/arch/Config.in.sh
+++ b/arch/Config.in.sh
@@ -24,6 +24,9 @@ config BR2_ARCH
default "sh4a" if BR2_sh4a
default "sh4aeb" if BR2_sh4aeb
+config BR2_KERNEL_ARCH
+ default "sh"
+
config BR2_ENDIAN
default "LITTLE" if BR2_sh4 || BR2_sh4a
default "BIG" if BR2_sh2a || BR2_sh4eb || BR2_sh4aeb
diff --git a/arch/Config.in.sparc b/arch/Config.in.sparc
index 4c4dc61745..b91df6892b 100644
--- a/arch/Config.in.sparc
+++ b/arch/Config.in.sparc
@@ -21,6 +21,10 @@ config BR2_ARCH
default "sparc" if BR2_sparc
default "sparc64" if BR2_sparc64
+config BR2_KERNEL_ARCH
+ default "sparc" if BR2_sparc
+ default "sparc64" if BR2_sparc64
+
config BR2_ENDIAN
default "BIG"
diff --git a/arch/Config.in.x86 b/arch/Config.in.x86
index 0ba9ecbcea..b38d0f8106 100644
--- a/arch/Config.in.x86
+++ b/arch/Config.in.x86
@@ -337,6 +337,10 @@ config BR2_ARCH
default "i686" if BR2_x86_athlon_4
default "x86_64" if BR2_x86_64
+config BR2_KERNEL_ARCH
+ default "i386" if !BR2_x86_64
+ default "x86_64" if BR2_x86_64
+
config BR2_ENDIAN
default "LITTLE"
diff --git a/arch/Config.in.xtensa b/arch/Config.in.xtensa
index a79d906985..acc340eca6 100644
--- a/arch/Config.in.xtensa
+++ b/arch/Config.in.xtensa
@@ -48,6 +48,9 @@ config BR2_ENDIAN
config BR2_ARCH
default "xtensa" if BR2_xtensa
+config BR2_KERNEL_ARCH
+ default "xtensa"
+
config BR2_READELF_ARCH_NAME
default "Tensilica Xtensa Processor"
--
2.32.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Buildroot] [PATCHv2 2/7] core: introduce NORMALIZED_ARCH as non-kernel replacement for KERNEL_ARCH
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-01-15 20:03 ` Thomas De Schampheleire
2022-02-08 20:26 ` Arnout Vandecappelle
2022-01-15 20:03 ` [Buildroot] [PATCHv2 3/7] core: introduce BR2_KERNEL_ARCH_OVERRIDE Thomas De Schampheleire
` (6 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-01-15 20:03 UTC (permalink / raw)
To: buildroot
Cc: Marcus Folkesson, Antoine Tenart, Yann E. MORIN, romain.naour,
Clayton Shotwell, Matt Weber, Thomas De Schampheleire
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
The variable 'KERNEL_ARCH' is actually a normalized version of
'ARCH'/'BR2_ARCH'. For example, 'arcle' and 'arceb' both become 'arc', just
as all powerpc variants become 'powerpc'.
It is presumably called 'KERNEL_ARCH' because the Linux kernel is typically
the first place where support for a new architecture is added, and thus is
the entity that defines the normalized name.
However, the term 'KERNEL_ARCH' can also be interpreted as 'the architecture
used by the kernel', which need not be exactly the same as 'the normalized
name for a certain arch'. In particular, for 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 such cases, the 'architecture used by the kernel' needs to refer to the
64-bit name (aarch64, x86_64), whereas all userspace applications need to
refer the, potentially normalized, 32-bit name.
This means that there need to be two different variables:
KERNEL_ARCH: the architecture used by the kernel
NORMALIZED_ARCH: the normalized name for the current userspace architecture
At this moment, both will actually have the same content. But a subsequent
patch will add basic support for situations described above, in which
KERNEL_ARCH may become overwritten to the 64-bit architecture, while
NORMALIZED_ARCH needs to remain the same (32-bit) case.
This commit replaces use of KERNEL_ARCH where actually the userspace arch is
needed. Places that use KERNEL_ARCH in combination with building of kernel
modules are not touched.
There may be cases where a package builds both a kernel module as userspace,
in which case it may need to know about both KERNEL_ARCH and
NORMALIZED_ARCH, for the case where they differ. But this is to be fixed on
a per-need basis.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Reviewed-by: Romain Naour <romain.naour@gmail.com>
---
Makefile | 1 +
boot/barebox/barebox.mk | 10 +++++-----
boot/uboot/uboot.mk | 6 +++---
package/busybox/busybox.mk | 2 +-
package/environment-setup/environment-setup.mk | 2 +-
package/kvmtool/kvmtool.mk | 4 ++--
package/libselinux/libselinux.mk | 2 +-
package/linux-tools/linux-tool-perf.mk.in | 4 ++--
package/linux-tools/linux-tool-selftests.mk.in | 6 +++---
package/olsr/olsr.mk | 4 ++--
package/pciutils/pciutils.mk | 2 +-
package/uboot-tools/uboot-tools.mk | 10 +++++-----
12 files changed, 27 insertions(+), 26 deletions(-)
diff --git a/Makefile b/Makefile
index e012d121b9..c130eb61c6 100644
--- a/Makefile
+++ b/Makefile
@@ -437,6 +437,7 @@ 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))
KERNEL_ARCH := $(call qstrip,$(BR2_KERNEL_ARCH))
ZCAT := $(call qstrip,$(BR2_ZCAT))
diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
index 8f02f9f9e1..6506294d6d 100644
--- a/boot/barebox/barebox.mk
+++ b/boot/barebox/barebox.mk
@@ -59,16 +59,16 @@ ifneq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
$(1)_INSTALL_TARGET = NO
endif
-ifeq ($$(KERNEL_ARCH),i386)
+ifeq ($$(NORMALIZED_ARCH),i386)
$(1)_ARCH = x86
-else ifeq ($$(KERNEL_ARCH),x86_64)
+else ifeq ($$(NORMALIZED_ARCH),x86_64)
$(1)_ARCH = x86
-else ifeq ($$(KERNEL_ARCH),powerpc)
+else ifeq ($$(NORMALIZED_ARCH),powerpc)
$(1)_ARCH = ppc
-else ifeq ($$(KERNEL_ARCH),arm64)
+else ifeq ($$(NORMALIZED_ARCH),arm64)
$(1)_ARCH = arm
else
-$(1)_ARCH = $$(KERNEL_ARCH)
+$(1)_ARCH = $$(NORMALIZED_ARCH)
endif
$(1)_MAKE_FLAGS = ARCH=$$($(1)_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 574fc7089a..49ebf42800 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -143,12 +143,12 @@ endif
# The kernel calls AArch64 'arm64', but U-Boot calls it just 'arm', so
# we have to special case it. Similar for i386/x86_64 -> x86
-ifeq ($(KERNEL_ARCH),arm64)
+ifeq ($(NORMALIZED_ARCH),arm64)
UBOOT_ARCH = arm
-else ifneq ($(filter $(KERNEL_ARCH),i386 x86_64),)
+else ifneq ($(filter $(NORMALIZED_ARCH),i386 x86_64),)
UBOOT_ARCH = x86
else
-UBOOT_ARCH = $(KERNEL_ARCH)
+UBOOT_ARCH = $(NORMALIZED_ARCH)
endif
UBOOT_MAKE_OPTS += \
diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
index 60ebc4985f..75e57ba53f 100644
--- a/package/busybox/busybox.mk
+++ b/package/busybox/busybox.mk
@@ -95,7 +95,7 @@ BUSYBOX_MAKE_OPTS = \
NM="$(TARGET_NM)" \
RANLIB="$(TARGET_RANLIB)" \
CC="$(TARGET_CC)" \
- ARCH=$(KERNEL_ARCH) \
+ ARCH=$(NORMALIZED_ARCH) \
PREFIX="$(TARGET_DIR)" \
EXTRA_LDFLAGS="$(BUSYBOX_LDFLAGS)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
diff --git a/package/environment-setup/environment-setup.mk b/package/environment-setup/environment-setup.mk
index f4c52921f7..29ec5a9a95 100644
--- a/package/environment-setup/environment-setup.mk
+++ b/package/environment-setup/environment-setup.mk
@@ -11,7 +11,7 @@ define HOST_ENVIRONMENT_SETUP_INSTALL_CMDS
for var in $(TARGET_CONFIGURE_OPTS); do \
printf "export \"$$var\"\n" >> $(ENVIRONMENT_SETUP_FILE); \
done
- printf "export \"ARCH=$(KERNEL_ARCH)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
+ printf "export \"ARCH=$(NORMALIZED_ARCH)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
printf "export \"CROSS_COMPILE=$(TARGET_CROSS)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
printf "export \"CONFIGURE_FLAGS=--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
diff --git a/package/kvmtool/kvmtool.mk b/package/kvmtool/kvmtool.mk
index 2984817c7e..df6ae7e0f1 100644
--- a/package/kvmtool/kvmtool.mk
+++ b/package/kvmtool/kvmtool.mk
@@ -25,11 +25,11 @@ KVMTOOL_MAKE_OPTS = \
WERROR=0
define KVMTOOL_BUILD_CMDS
- $(TARGET_MAKE_ENV) ARCH=$(KERNEL_ARCH) $(MAKE) -C $(@D) $(KVMTOOL_MAKE_OPTS)
+ $(TARGET_MAKE_ENV) ARCH=$(NORMALIZED_ARCH) $(MAKE) -C $(@D) $(KVMTOOL_MAKE_OPTS)
endef
define KVMTOOL_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) ARCH=$(KERNEL_ARCH) $(MAKE) -C $(@D) \
+ $(TARGET_MAKE_ENV) ARCH=$(NORMALIZED_ARCH) $(MAKE) -C $(@D) \
$(KVMTOOL_MAKE_OPTS) install DESTDIR=$(TARGET_DIR) prefix=/usr
endef
diff --git a/package/libselinux/libselinux.mk b/package/libselinux/libselinux.mk
index c1e90130d2..5790e79040 100644
--- a/package/libselinux/libselinux.mk
+++ b/package/libselinux/libselinux.mk
@@ -18,7 +18,7 @@ LIBSELINUX_INSTALL_STAGING = YES
# we won't have to use a relative path in 0002-revert-ln-relative.patch
LIBSELINUX_MAKE_OPTS = \
$(TARGET_CONFIGURE_OPTS) \
- ARCH=$(KERNEL_ARCH) \
+ ARCH=$(NORMALIZED_ARCH) \
SHLIBDIR=/usr/lib
LIBSELINUX_MAKE_INSTALL_TARGETS = install
diff --git a/package/linux-tools/linux-tool-perf.mk.in b/package/linux-tools/linux-tool-perf.mk.in
index efa747cf8d..4e28129f50 100644
--- a/package/linux-tools/linux-tool-perf.mk.in
+++ b/package/linux-tools/linux-tool-perf.mk.in
@@ -8,10 +8,10 @@ LINUX_TOOLS += perf
PERF_DEPENDENCIES = host-flex host-bison
-ifeq ($(KERNEL_ARCH),x86_64)
+ifeq ($(NORMALIZED_ARCH),x86_64)
PERF_ARCH=x86
else
-PERF_ARCH=$(KERNEL_ARCH)
+PERF_ARCH=$(NORMALIZED_ARCH)
endif
PERF_MAKE_FLAGS = \
diff --git a/package/linux-tools/linux-tool-selftests.mk.in b/package/linux-tools/linux-tool-selftests.mk.in
index c4e5bf0fea..b824c11bd6 100644
--- a/package/linux-tools/linux-tool-selftests.mk.in
+++ b/package/linux-tools/linux-tool-selftests.mk.in
@@ -6,13 +6,13 @@
LINUX_TOOLS += selftests
-ifeq ($(KERNEL_ARCH),x86_64)
+ifeq ($(NORMALIZED_ARCH),x86_64)
SELFTESTS_ARCH=x86
else
-ifeq ($(KERNEL_ARCH),i386)
+ifeq ($(NORMALIZED_ARCH),i386)
SELFTESTS_ARCH=x86
else
-SELFTESTS_ARCH=$(KERNEL_ARCH)
+SELFTESTS_ARCH=$(NORMALIZED_ARCH)
endif
endif
diff --git a/package/olsr/olsr.mk b/package/olsr/olsr.mk
index b2c8e7e001..4ad88991f2 100644
--- a/package/olsr/olsr.mk
+++ b/package/olsr/olsr.mk
@@ -27,10 +27,10 @@ OLSR_PLUGINS += pud
endif
define OLSR_BUILD_CMDS
- $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+ $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(NORMALIZED_ARCH) \
CFLAGS="$(OLSR_CFLAGS)" -C $(@D) olsrd
$(foreach p,$(OLSR_PLUGINS), \
- $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
+ $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(NORMALIZED_ARCH) \
CFLAGS="$(OLSR_CFLAGS)" -C $(@D)/lib/$(p)
)
endef
diff --git a/package/pciutils/pciutils.mk b/package/pciutils/pciutils.mk
index 9b83b62b55..67defcc743 100644
--- a/package/pciutils/pciutils.mk
+++ b/package/pciutils/pciutils.mk
@@ -12,7 +12,7 @@ PCIUTILS_LICENSE = GPL-2.0+
PCIUTILS_LICENSE_FILES = COPYING
PCIUTILS_MAKE_OPTS = \
CROSS_COMPILE="$(TARGET_CROSS)" \
- HOST="$(KERNEL_ARCH)-linux" \
+ HOST="$(NORMALIZED_ARCH)-linux" \
OPT="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDFLAGS)" \
DNS=no \
diff --git a/package/uboot-tools/uboot-tools.mk b/package/uboot-tools/uboot-tools.mk
index 37e329a2af..26450b7adf 100644
--- a/package/uboot-tools/uboot-tools.mk
+++ b/package/uboot-tools/uboot-tools.mk
@@ -224,14 +224,14 @@ $(eval $(host-generic-package))
MKIMAGE = $(HOST_DIR)/bin/mkimage
# mkimage supports alpha arc arm arm64 blackfin ia64 invalid m68k microblaze mips mips64 nds32 nios2 or1k powerpc riscv s390 sandbox sh sparc sparc64 x86 x86_64 xtensa
-# KERNEL_ARCH can be arm64 arc arm blackfin m68k microblaze mips nios2 powerpc sh sparc i386 x86_64 xtensa
+# NORMALIZED_ARCH can be arm64 arc arm blackfin m68k microblaze mips nios2 powerpc sh sparc i386 x86_64 xtensa
# For i386, we need to convert
# For openrisc, we need to convert
-# For others, we'll just keep KERNEL_ARCH
-ifeq ($(KERNEL_ARCH),i386)
+# For others, we'll just keep NORMALIZED_ARCH
+ifeq ($(NORMALIZED_ARCH),i386)
MKIMAGE_ARCH = x86
-else ifeq ($(KERNEL_ARCH),openrisc)
+else ifeq ($(NORMALIZED_ARCH),openrisc)
MKIMAGE_ARCH = or1k
else
-MKIMAGE_ARCH = $(KERNEL_ARCH)
+MKIMAGE_ARCH = $(NORMALIZED_ARCH)
endif
--
2.32.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Buildroot] [PATCHv2 3/7] core: introduce BR2_KERNEL_ARCH_OVERRIDE
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-01-15 20:03 ` [Buildroot] [PATCHv2 2/7] core: introduce NORMALIZED_ARCH as non-kernel replacement for KERNEL_ARCH Thomas De Schampheleire
@ 2022-01-15 20:03 ` Thomas De Schampheleire
2022-01-15 20:03 ` [Buildroot] [PATCHv2 4/7] perf: fix compilation in case of i386 userspace with x86_64 kernel Thomas De Schampheleire
` (5 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-01-15 20:03 UTC (permalink / raw)
To: buildroot; +Cc: romain.naour, Thomas De Schampheleire
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
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Buildroot] [PATCHv2 4/7] perf: fix compilation in case of i386 userspace with x86_64 kernel
2022-01-15 20:02 [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Thomas De Schampheleire
` (2 preceding siblings ...)
2022-01-15 20:03 ` [Buildroot] [PATCHv2 3/7] core: introduce BR2_KERNEL_ARCH_OVERRIDE Thomas De Schampheleire
@ 2022-01-15 20:03 ` 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
` (4 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-01-15 20:03 UTC (permalink / raw)
To: buildroot; +Cc: romain.naour, Yann E. MORIN, Thomas De Schampheleire
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
If a 64-bit kernel is combined with 32-bit userspace, and this is achieved
via a multilib toolchain that defaults to 64-bit with '-m32' in
BR2_TARGET_OPTIMIZATION, the '<cross>-ld' command will still default to
64-bit output.
In this case, packages that use 'ld' directly need to be instructed to use
the correct ABI via the '-m' parameter. 'perf' is one such package.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
package/linux-tools/linux-tool-perf.mk.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/package/linux-tools/linux-tool-perf.mk.in b/package/linux-tools/linux-tool-perf.mk.in
index 4e28129f50..b84b5fd415 100644
--- a/package/linux-tools/linux-tool-perf.mk.in
+++ b/package/linux-tools/linux-tool-perf.mk.in
@@ -45,6 +45,9 @@ PERF_MAKE_FLAGS += LD="$(TARGET_LD) -m elf32ltsmipn32"
else
PERF_MAKE_FLAGS += LD="$(TARGET_LD) -m elf64ltsmip"
endif
+# case for x86 toolchain that defaults to 64-bit output
+else ifeq ($(BR2_i386):$(call qstrip,$(BR2_KERNEL_ARCH_OVERRIDE)),y:x86_64)
+PERF_MAKE_FLAGS += LD="$(TARGET_LD) -m elf_i386"
endif
# The call to backtrace() function fails for ARC, because for some
--
2.32.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Buildroot] [PATCHv2 5/7] package/qemu: add support for overridden KERNEL_ARCH=x86_64
2022-01-15 20:02 [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Thomas De Schampheleire
` (3 preceding siblings ...)
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 ` Thomas De Schampheleire
2022-01-15 20:03 ` [Buildroot] [PATCHv2 6/7] configs: add new qemu defconfig 'x86_multilib' Thomas De Schampheleire
` (3 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-01-15 20:03 UTC (permalink / raw)
To: buildroot; +Cc: romain.naour, Thomas De Schampheleire
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
When the kernel architecture is overridden via BR2_KERNEL_ARCH_OVERRIDE,
this has an impact on the required architecture for qemu-system.
The correct architecture for Qemu is currently determined based on ARCH, not
KERNEL_ARCH. For example, while KERNEL_ARCH is 'powerpc' for all PowerPC
variants, ARCH may be powerpc, powerpc64 or powerpc64le. And this translates
to ppc, ppc64 and ppc64le for Qemu.
This means that it is not generically possible to determine the Qemu
architecture based on KERNEL_ARCH alone.
For now, already handle the case of x86_64.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
package/qemu/qemu.mk | 3 +++
1 file changed, 3 insertions(+)
diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
index e69e813059..bcf684e615 100644
--- a/package/qemu/qemu.mk
+++ b/package/qemu/qemu.mk
@@ -302,6 +302,9 @@ endif
ifeq ($(HOST_QEMU_ARCH),sh4aeb)
HOST_QEMU_ARCH = sh4eb
endif
+ifeq ($(call qstrip,$(BR2_KERNEL_ARCH_OVERRIDE)),x86_64)
+HOST_QEMU_SYS_ARCH = x86_64
+endif
HOST_QEMU_SYS_ARCH ?= $(HOST_QEMU_ARCH)
HOST_QEMU_CFLAGS = $(HOST_CFLAGS)
--
2.32.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Buildroot] [PATCHv2 6/7] configs: add new qemu defconfig 'x86_multilib'
2022-01-15 20:02 [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Thomas De Schampheleire
` (4 preceding siblings ...)
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 ` Thomas De Schampheleire
2022-01-18 11:19 ` Thomas De Schampheleire
2022-01-15 20:03 ` [Buildroot] [PATCHv2 7/7] linux/linux.mk: correct LINUX_ARCH_PATH for sparc64 Thomas De Schampheleire
` (2 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-01-15 20:03 UTC (permalink / raw)
To: buildroot; +Cc: Gerome Burlats, romain.naour, Thomas De Schampheleire
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Add a new qemu defconfig for an x86_64 target that will run an x86_64 kernel
but userspace in 32-bit (x86) mode, using BR2_KERNEL_ARCH_OVERRIDE.
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
Note that the defconfig refers to a toolchain at
autobuild.buildroot.org, but is not yet present at that location.
I uploaded the toolchain temporarily to:
http://patrickdepinguin.com/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11.tar.xz
md5sum:b085c0d8f137c078f8f09d116d8364f8
sha256sum 2a5241d9274239532e44d37c65509931fbc120db5991412f946eb38176db4dc2
board/qemu/x86_multilib/linux.config | 57 +++++++++++++++++++++++++++
board/qemu/x86_multilib/post-build.sh | 11 ++++++
board/qemu/x86_multilib/readme.txt | 7 ++++
configs/qemu_x86_multilib_defconfig | 26 ++++++++++++
4 files changed, 101 insertions(+)
create mode 100644 board/qemu/x86_multilib/linux.config
create mode 100755 board/qemu/x86_multilib/post-build.sh
create mode 100644 board/qemu/x86_multilib/readme.txt
create mode 100644 configs/qemu_x86_multilib_defconfig
diff --git a/board/qemu/x86_multilib/linux.config b/board/qemu/x86_multilib/linux.config
new file mode 100644
index 0000000000..0ea9e53a06
--- /dev/null
+++ b/board/qemu/x86_multilib/linux.config
@@ -0,0 +1,57 @@
+CONFIG_SYSVIPC=y
+# CONFIG_USELIB is not set
+CONFIG_CGROUPS=y
+CONFIG_SMP=y
+CONFIG_HYPERVISOR_GUEST=y
+CONFIG_PARAVIRT=y
+CONFIG_IA32_EMULATION=y
+# CONFIG_COMPAT_32BIT_TIME is not set
+# CONFIG_GCC_PLUGINS is not set
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+# CONFIG_WIRELESS is not set
+CONFIG_PCI=y
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_VIRTIO_BLK=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_SCSI_VIRTIO=y
+CONFIG_ATA=y
+CONFIG_ATA_PIIX=y
+CONFIG_NETDEVICES=y
+CONFIG_VIRTIO_NET=y
+CONFIG_NE2K_PCI=y
+CONFIG_8139CP=y
+# CONFIG_WLAN is not set
+CONFIG_INPUT_EVDEV=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_VIRTIO_CONSOLE=y
+CONFIG_HW_RANDOM_VIRTIO=m
+CONFIG_DRM=y
+CONFIG_DRM_QXL=y
+CONFIG_DRM_VIRTIO_GPU=y
+CONFIG_DRM_BOCHS=y
+CONFIG_SOUND=y
+CONFIG_SND=y
+CONFIG_SND_HDA_INTEL=y
+CONFIG_SND_HDA_GENERIC=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_UHCI_HCD=y
+CONFIG_USB_STORAGE=y
+CONFIG_VIRTIO_PCI=y
+CONFIG_VIRTIO_BALLOON=y
+CONFIG_VIRTIO_INPUT=y
+CONFIG_VIRTIO_MMIO=y
+CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
+CONFIG_EXT4_FS=y
+CONFIG_AUTOFS4_FS=y
+CONFIG_TMPFS=y
+CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_UNWINDER_FRAME_POINTER=y
diff --git a/board/qemu/x86_multilib/post-build.sh b/board/qemu/x86_multilib/post-build.sh
new file mode 100755
index 0000000000..bf83a002c2
--- /dev/null
+++ b/board/qemu/x86_multilib/post-build.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -u
+set -e
+
+# Add a console on tty1
+if [ -e ${TARGET_DIR}/etc/inittab ]; then
+ grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
+ sed -i '/GENERIC_SERIAL/a\
+tty1::respawn:/sbin/getty -L tty1 0 vt100 # QEMU graphical window' ${TARGET_DIR}/etc/inittab
+fi
diff --git a/board/qemu/x86_multilib/readme.txt b/board/qemu/x86_multilib/readme.txt
new file mode 100644
index 0000000000..fbc8ae9a6a
--- /dev/null
+++ b/board/qemu/x86_multilib/readme.txt
@@ -0,0 +1,7 @@
+Run the emulation with:
+
+ qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append "rootwait root=/dev/vda console=tty1 console=ttyS0" -serial stdio -net nic,model=virtio -net user # qemu_x86_multilib_defconfig
+
+Optionally add -smp N to emulate a SMP system with N CPUs.
+
+The login prompt will appear in the graphical window.
diff --git a/configs/qemu_x86_multilib_defconfig b/configs/qemu_x86_multilib_defconfig
new file mode 100644
index 0000000000..1c3a8179c1
--- /dev/null
+++ b/configs/qemu_x86_multilib_defconfig
@@ -0,0 +1,26 @@
+BR2_KERNEL_ARCH_OVERRIDE="x86_64"
+BR2_x86_core2=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
+BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
+BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11.tar.xz"
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="x86_64-multilib-linux-gnu"
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_15=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
+# BR2_TOOLCHAIN_EXTERNAL_INET_RPC is not set
+BR2_TOOLCHAIN_EXTERNAL_CXX=y
+BR2_TARGET_OPTIMIZATION="-m32"
+BR2_SYSTEM_DHCP="eth0"
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/qemu/x86_multilib/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.15"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86_multilib/linux.config"
+BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
+BR2_TARGET_ROOTFS_EXT2=y
+# BR2_TARGET_ROOTFS_TAR is not set
+BR2_PACKAGE_HOST_QEMU=y
+BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
--
2.32.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Buildroot] [PATCHv2 7/7] linux/linux.mk: correct LINUX_ARCH_PATH for sparc64
2022-01-15 20:02 [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Thomas De Schampheleire
` (5 preceding siblings ...)
2022-01-15 20:03 ` [Buildroot] [PATCHv2 6/7] configs: add new qemu defconfig 'x86_multilib' Thomas De Schampheleire
@ 2022-01-15 20:03 ` 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-07-30 19:43 ` Yann E. MORIN
8 siblings, 1 reply; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-01-15 20:03 UTC (permalink / raw)
To: buildroot; +Cc: romain.naour, Thomas De Schampheleire
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Buildroot uses variable LINUX_ARCH_PATH to refer to the arch-specific
directory in the Linux tree, which may not necessarily be arch/$(KERNEL_ARCH).
Buildroot already accounts for the case of KERNEL_ARCH=i386 and
KERNEL_ARCH=x86_64, but does not for KERNEL_ARCH=sparc64, in which case the
correct directory is arch/sparc.
Reported-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
linux/linux.mk | 2 ++
1 file changed, 2 insertions(+)
diff --git a/linux/linux.mk b/linux/linux.mk
index dd2eebd446..35e2484588 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -242,6 +242,8 @@ ifeq ($(KERNEL_ARCH),i386)
LINUX_ARCH_PATH = $(LINUX_DIR)/arch/x86
else ifeq ($(KERNEL_ARCH),x86_64)
LINUX_ARCH_PATH = $(LINUX_DIR)/arch/x86
+else ifeq ($(KERNEL_ARCH),sparc64)
+LINUX_ARCH_PATH = $(LINUX_DIR)/arch/sparc
else
LINUX_ARCH_PATH = $(LINUX_DIR)/arch/$(KERNEL_ARCH)
endif
--
2.32.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Buildroot] [PATCHv2 6/7] configs: add new qemu defconfig 'x86_multilib'
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
0 siblings, 1 reply; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-01-18 11:19 UTC (permalink / raw)
To: buildroot, romain.naour; +Cc: Gerome Burlats, Thomas De Schampheleire
Hi,
El sáb, 15 ene 2022 a las 21:03, Thomas De Schampheleire
(<patrickdepinguin@gmail.com>) escribió:
>
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>
> Add a new qemu defconfig for an x86_64 target that will run an x86_64 kernel
> but userspace in 32-bit (x86) mode, using BR2_KERNEL_ARCH_OVERRIDE.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> ---
>
> Note that the defconfig refers to a toolchain at
> autobuild.buildroot.org, but is not yet present at that location.
> I uploaded the toolchain temporarily to:
> http://patrickdepinguin.com/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11.tar.xz
> md5sum:b085c0d8f137c078f8f09d116d8364f8
> sha256sum 2a5241d9274239532e44d37c65509931fbc120db5991412f946eb38176db4dc2
>
>
Romain Naour notified me that this toolchain does not run on the GCC
Farm (Illegal instruction) so I made a new version, currently uploaded
at:
http://patrickdepinguin.com/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11-2.tar.xz
md5sum: 3cee64f82675446ad255f6c165786eb5
sha256sum: 6715bfbc195588b6483d39e9ec6d70611cac3b99bf2dd34fedbed0d4e6c7edc1
Best regards,
Thomas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Buildroot] [PATCHv2 6/7] configs: add new qemu defconfig 'x86_multilib'
2022-01-18 11:19 ` Thomas De Schampheleire
@ 2022-01-18 11:51 ` Romain Naour
2022-01-18 12:02 ` Thomas De Schampheleire
0 siblings, 1 reply; 18+ messages in thread
From: Romain Naour @ 2022-01-18 11:51 UTC (permalink / raw)
To: Thomas De Schampheleire, buildroot
Cc: Gerome Burlats, Thomas De Schampheleire
Hello Thomas,
Le 18/01/2022 à 12:19, Thomas De Schampheleire a écrit :
> Hi,
>
> El sáb, 15 ene 2022 a las 21:03, Thomas De Schampheleire
> (<patrickdepinguin@gmail.com>) escribió:
>>
>> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>>
>> Add a new qemu defconfig for an x86_64 target that will run an x86_64 kernel
>> but userspace in 32-bit (x86) mode, using BR2_KERNEL_ARCH_OVERRIDE.
>>
>> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>> ---
>>
>> Note that the defconfig refers to a toolchain at
>> autobuild.buildroot.org, but is not yet present at that location.
>> I uploaded the toolchain temporarily to:
>> http://patrickdepinguin.com/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11.tar.xz
>> md5sum:b085c0d8f137c078f8f09d116d8364f8
>> sha256sum 2a5241d9274239532e44d37c65509931fbc120db5991412f946eb38176db4dc2
>>
>>
>
> Romain Naour notified me that this toolchain does not run on the GCC
> Farm (Illegal instruction) so I made a new version, currently uploaded
> at:
> http://patrickdepinguin.com/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11-2.tar.xz
> md5sum: 3cee64f82675446ad255f6c165786eb5
> sha256sum: 6715bfbc195588b6483d39e9ec6d70611cac3b99bf2dd34fedbed0d4e6c7edc1
This toolchain doesn't work either.
Did you tried with CT_EXTRA_CFLAGS_FOR_BUILD="-march=x86-64" ?
With CT_EXTRA_CXXFLAGS_FOR_BUILD maybe or both.
Also, building with a Debian jessie docker container would allow to run the
toolchain with old Glibc.
Best regards,
Romain
>
> Best regards,
> Thomas
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Buildroot] [PATCHv2 6/7] configs: add new qemu defconfig 'x86_multilib'
2022-01-18 11:51 ` Romain Naour
@ 2022-01-18 12:02 ` Thomas De Schampheleire
2022-01-19 20:54 ` Romain Naour
0 siblings, 1 reply; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-01-18 12:02 UTC (permalink / raw)
To: Romain Naour; +Cc: Gerome Burlats, Thomas De Schampheleire, buildroot
Hi Romain,
El mar, 18 ene 2022 a las 12:51, Romain Naour
(<romain.naour@gmail.com>) escribió:
>
> Hello Thomas,
>
> Le 18/01/2022 à 12:19, Thomas De Schampheleire a écrit :
> > Hi,
> >
> > El sáb, 15 ene 2022 a las 21:03, Thomas De Schampheleire
> > (<patrickdepinguin@gmail.com>) escribió:
> >>
> >> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> >>
> >> Add a new qemu defconfig for an x86_64 target that will run an x86_64 kernel
> >> but userspace in 32-bit (x86) mode, using BR2_KERNEL_ARCH_OVERRIDE.
> >>
> >> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> >> ---
> >>
> >> Note that the defconfig refers to a toolchain at
> >> autobuild.buildroot.org, but is not yet present at that location.
> >> I uploaded the toolchain temporarily to:
> >> http://patrickdepinguin.com/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11.tar.xz
> >> md5sum:b085c0d8f137c078f8f09d116d8364f8
> >> sha256sum 2a5241d9274239532e44d37c65509931fbc120db5991412f946eb38176db4dc2
> >>
> >>
> >
> > Romain Naour notified me that this toolchain does not run on the GCC
> > Farm (Illegal instruction) so I made a new version, currently uploaded
> > at:
> > http://patrickdepinguin.com/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11-2.tar.xz
> > md5sum: 3cee64f82675446ad255f6c165786eb5
> > sha256sum: 6715bfbc195588b6483d39e9ec6d70611cac3b99bf2dd34fedbed0d4e6c7edc1
>
> This toolchain doesn't work either.
>
> Did you tried with CT_EXTRA_CFLAGS_FOR_BUILD="-march=x86-64" ?
> With CT_EXTRA_CXXFLAGS_FOR_BUILD maybe or both.
So you get the same error of 'Illegal instruction' ?
Following config was used (both the config as the build log are part
of the archive):
CT_CONFIG_VERSION="3"
# CT_PREFIX_DIR_RO is not set
CT_EXTRA_CFLAGS_FOR_BUILD="-march=x86-64"
CT_EXTRA_CXXFLAGS_FOR_BUILD="-march=x86-64"
CT_ARCH_X86=y
CT_MULTILIB=y
CT_ARCH_64=y
CT_STATIC_TOOLCHAIN=y
CT_TARGET_VENDOR="multilib"
CT_KERNEL_LINUX=y
CT_GLIBC_KERNEL_VERSION_NONE=y
# CT_CREATE_LDSO_CONF is not set
CT_CC_GCC_MULTILIB_LIST="m64,m32"
CT_CC_GCC_LNK_HASH_STYLE_BOTH=y
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
CT_ZLIB_NEEDED=y
>
> Also, building with a Debian jessie docker container would allow to run the
> toolchain with old Glibc.
The toolchain is built statically, so the glibc version on the host
does not matter.
Perhaps I misunderstand the problem you are referring to?
Thanks,
Thomas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Buildroot] [PATCHv2 6/7] configs: add new qemu defconfig 'x86_multilib'
2022-01-18 12:02 ` Thomas De Schampheleire
@ 2022-01-19 20:54 ` Romain Naour
0 siblings, 0 replies; 18+ messages in thread
From: Romain Naour @ 2022-01-19 20:54 UTC (permalink / raw)
To: Thomas De Schampheleire
Cc: Gerome Burlats, Thomas De Schampheleire, buildroot
Hi Thomas,
Le 18/01/2022 à 13:02, Thomas De Schampheleire a écrit :
> Hi Romain,
>
> El mar, 18 ene 2022 a las 12:51, Romain Naour
> (<romain.naour@gmail.com>) escribió:
>>
>> Hello Thomas,
>>
>> Le 18/01/2022 à 12:19, Thomas De Schampheleire a écrit :
>>> Hi,
>>>
>>> El sáb, 15 ene 2022 a las 21:03, Thomas De Schampheleire
>>> (<patrickdepinguin@gmail.com>) escribió:
>>>>
>>>> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>>>>
>>>> Add a new qemu defconfig for an x86_64 target that will run an x86_64 kernel
>>>> but userspace in 32-bit (x86) mode, using BR2_KERNEL_ARCH_OVERRIDE.
>>>>
>>>> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>>>> ---
>>>>
>>>> Note that the defconfig refers to a toolchain at
>>>> autobuild.buildroot.org, but is not yet present at that location.
>>>> I uploaded the toolchain temporarily to:
>>>> http://patrickdepinguin.com/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11.tar.xz
>>>> md5sum:b085c0d8f137c078f8f09d116d8364f8
>>>> sha256sum 2a5241d9274239532e44d37c65509931fbc120db5991412f946eb38176db4dc2
>>>>
>>>>
>>>
>>> Romain Naour notified me that this toolchain does not run on the GCC
>>> Farm (Illegal instruction) so I made a new version, currently uploaded
>>> at:
>>> http://patrickdepinguin.com/ctng-6737cfaa8ce6-x86_multilib-glibc-gcc11-2.tar.xz
>>> md5sum: 3cee64f82675446ad255f6c165786eb5
>>> sha256sum: 6715bfbc195588b6483d39e9ec6d70611cac3b99bf2dd34fedbed0d4e6c7edc1
>>
>> This toolchain doesn't work either.
>>
>> Did you tried with CT_EXTRA_CFLAGS_FOR_BUILD="-march=x86-64" ?
>> With CT_EXTRA_CXXFLAGS_FOR_BUILD maybe or both.
>
> So you get the same error of 'Illegal instruction' ?
>
> Following config was used (both the config as the build log are part
> of the archive):
>
> CT_CONFIG_VERSION="3"
> # CT_PREFIX_DIR_RO is not set
> CT_EXTRA_CFLAGS_FOR_BUILD="-march=x86-64"
> CT_EXTRA_CXXFLAGS_FOR_BUILD="-march=x86-64"
> CT_ARCH_X86=y
> CT_MULTILIB=y
> CT_ARCH_64=y
> CT_STATIC_TOOLCHAIN=y
I didn't enabled static toolchain option. Can you try without it.
Notes: All Bootlin toolchain use glibc installed on the host, so we can't use
really old systems.
> CT_TARGET_VENDOR="multilib"
> CT_KERNEL_LINUX=y
> CT_GLIBC_KERNEL_VERSION_NONE=y
> # CT_CREATE_LDSO_CONF is not set
> CT_CC_GCC_MULTILIB_LIST="m64,m32"
> CT_CC_GCC_LNK_HASH_STYLE_BOTH=y
> CT_CC_LANG_CXX=y
> CT_DEBUG_GDB=y
> CT_ZLIB_NEEDED=y
>
>
>
>>
>> Also, building with a Debian jessie docker container would allow to run the
>> toolchain with old Glibc.
>
> The toolchain is built statically, so the glibc version on the host
> does not matter.
> Perhaps I misunderstand the problem you are referring to?
I missed that your toolchain was build statically.
Usually other prebuilt toolchain are not built statically.
Best regards,
Romain
>
> Thanks,
> Thomas
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Buildroot] [PATCHv2 1/7] arch: move definition of KERNEL_ARCH to Config.in.<arch> files
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
0 siblings, 0 replies; 18+ messages in thread
From: Arnout Vandecappelle @ 2022-02-08 20:25 UTC (permalink / raw)
To: Thomas De Schampheleire, buildroot
Cc: ARC Maintainers, Guo Ren, Mark Corbin, Alexander Egorenkov,
Nylon Chen, Jonathan Ben Avraham, Ezequiel Garcia,
Thomas Petazzoni, Spenser Gilliland, romain.naour, Cyril Bur,
Thomas De Schampheleire
On 15/01/2022 21:02, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>
> Similar to other arch-specific strings, the 'KERNEL_ARCH' variable can be
> determined from Config.in.<arch> files.
>
> Besides aligning with similar strings, this also means simplification: the
> big 'sed' covers several architectures not even supported by Buildroot.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> Reviewed-by: Romain Naour <romain.naour@gmail.com>
Applied to master, thanks.
Regards,
Arnout
>
> ---
> Makefile | 17 +----------------
> arch/Config.in | 3 +++
> arch/Config.in.arc | 3 +++
> arch/Config.in.arm | 4 ++++
> arch/Config.in.csky | 3 +++
> arch/Config.in.m68k | 3 +++
> arch/Config.in.microblaze | 3 +++
> arch/Config.in.mips | 3 +++
> arch/Config.in.nds32 | 3 +++
> arch/Config.in.nios2 | 3 +++
> arch/Config.in.or1k | 3 +++
> arch/Config.in.powerpc | 3 +++
> arch/Config.in.riscv | 3 +++
> arch/Config.in.s390x | 3 +++
> arch/Config.in.sh | 3 +++
> arch/Config.in.sparc | 4 ++++
> arch/Config.in.x86 | 4 ++++
> arch/Config.in.xtensa | 3 +++
> 18 files changed, 55 insertions(+), 16 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 5fc7137e5a..e012d121b9 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -437,22 +437,7 @@ QUIET := $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),-q)
>
> # Strip off the annoying quoting
> ARCH := $(call qstrip,$(BR2_ARCH))
> -
> -KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
> - -e s/i.86/i386/ -e s/sun4u/sparc64/ \
> - -e s/arcle/arc/ \
> - -e s/arceb/arc/ \
> - -e s/arm.*/arm/ -e s/sa110/arm/ \
> - -e s/aarch64.*/arm64/ \
> - -e s/nds32.*/nds32/ \
> - -e s/or1k/openrisc/ \
> - -e s/parisc64/parisc/ \
> - -e s/powerpc64.*/powerpc/ \
> - -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
> - -e s/riscv.*/riscv/ \
> - -e s/sh.*/sh/ \
> - -e s/s390x/s390/ \
> - -e s/microblazeel/microblaze/)
> +KERNEL_ARCH := $(call qstrip,$(BR2_KERNEL_ARCH))
>
> ZCAT := $(call qstrip,$(BR2_ZCAT))
> BZCAT := $(call qstrip,$(BR2_BZCAT))
> diff --git a/arch/Config.in b/arch/Config.in
> index c99af89efa..edf337f13e 100644
> --- a/arch/Config.in
> +++ b/arch/Config.in
> @@ -328,6 +328,9 @@ config BR2_ARCH_NEEDS_GCC_AT_LEAST_11
> config BR2_ARCH
> string
>
> +config BR2_KERNEL_ARCH
> + string
> +
> config BR2_ENDIAN
> string
>
> diff --git a/arch/Config.in.arc b/arch/Config.in.arc
> index f7a6d920b5..cc55c9e68f 100644
> --- a/arch/Config.in.arc
> +++ b/arch/Config.in.arc
> @@ -62,6 +62,9 @@ config BR2_ARCH
> default "arc" if BR2_arcle
> default "arceb" if BR2_arceb
>
> +config BR2_KERNEL_ARCH
> + default "arc"
> +
> config BR2_arc
> bool
> default y if BR2_arcle || BR2_arceb
> diff --git a/arch/Config.in.arm b/arch/Config.in.arm
> index 4c0910e4f8..0f50512fad 100644
> --- a/arch/Config.in.arm
> +++ b/arch/Config.in.arm
> @@ -822,6 +822,10 @@ config BR2_ARCH
> default "aarch64" if BR2_aarch64
> default "aarch64_be" if BR2_aarch64_be
>
> +config BR2_KERNEL_ARCH
> + default "arm" if BR2_arm || BR2_armeb
> + default "arm64" if BR2_aarch64 || BR2_aarch64_be
> +
> config BR2_ENDIAN
> default "LITTLE" if (BR2_arm || BR2_aarch64)
> default "BIG" if (BR2_armeb || BR2_aarch64_be)
> diff --git a/arch/Config.in.csky b/arch/Config.in.csky
> index 7e2029f759..df9e7ab75b 100644
> --- a/arch/Config.in.csky
> +++ b/arch/Config.in.csky
> @@ -39,6 +39,9 @@ config BR2_GCC_TARGET_FLOAT_ABI
> config BR2_ARCH
> default "csky"
>
> +config BR2_KERNEL_ARCH
> + default "csky"
> +
> config BR2_ENDIAN
> default "LITTLE"
>
> diff --git a/arch/Config.in.m68k b/arch/Config.in.m68k
> index 275f47f1d3..7f3aec7232 100644
> --- a/arch/Config.in.m68k
> +++ b/arch/Config.in.m68k
> @@ -1,6 +1,9 @@
> config BR2_ARCH
> default "m68k" if BR2_m68k
>
> +config BR2_KERNEL_ARCH
> + default "m68k"
> +
> config BR2_ENDIAN
> default "BIG"
>
> diff --git a/arch/Config.in.microblaze b/arch/Config.in.microblaze
> index 5fe2906d40..52aa252a2c 100644
> --- a/arch/Config.in.microblaze
> +++ b/arch/Config.in.microblaze
> @@ -2,6 +2,9 @@ config BR2_ARCH
> default "microblazeel" if BR2_microblazeel
> default "microblaze" if BR2_microblazebe
>
> +config BR2_KERNEL_ARCH
> + default "microblaze"
> +
> config BR2_ENDIAN
> default "LITTLE" if BR2_microblazeel
> default "BIG" if BR2_microblazebe
> diff --git a/arch/Config.in.mips b/arch/Config.in.mips
> index 619456c2d5..b4923f8484 100644
> --- a/arch/Config.in.mips
> +++ b/arch/Config.in.mips
> @@ -235,6 +235,9 @@ config BR2_ARCH
> default "mips64" if BR2_mips64
> default "mips64el" if BR2_mips64el
>
> +config BR2_KERNEL_ARCH
> + default "mips"
> +
> config BR2_ENDIAN
> default "LITTLE" if BR2_mipsel || BR2_mips64el
> default "BIG" if BR2_mips || BR2_mips64
> diff --git a/arch/Config.in.nds32 b/arch/Config.in.nds32
> index 322ff49f2e..61fc346260 100644
> --- a/arch/Config.in.nds32
> +++ b/arch/Config.in.nds32
> @@ -1,6 +1,9 @@
> config BR2_ARCH
> default "nds32le"
>
> +config BR2_KERNEL_ARCH
> + default "nds32"
> +
> config BR2_GCC_TARGET_ARCH
> default "v3"
>
> diff --git a/arch/Config.in.nios2 b/arch/Config.in.nios2
> index aae435fa17..c77b1a1c59 100644
> --- a/arch/Config.in.nios2
> +++ b/arch/Config.in.nios2
> @@ -1,6 +1,9 @@
> config BR2_ARCH
> default "nios2"
>
> +config BR2_KERNEL_ARCH
> + default "nios2"
> +
> config BR2_ENDIAN
> default "LITTLE"
>
> diff --git a/arch/Config.in.or1k b/arch/Config.in.or1k
> index abdf498fb8..ef1bded453 100644
> --- a/arch/Config.in.or1k
> +++ b/arch/Config.in.or1k
> @@ -1,6 +1,9 @@
> config BR2_ARCH
> default "or1k"
>
> +config BR2_KERNEL_ARCH
> + default "openrisc"
> +
> config BR2_ENDIAN
> default "BIG"
>
> diff --git a/arch/Config.in.powerpc b/arch/Config.in.powerpc
> index ba56c9c721..33b2471cf9 100644
> --- a/arch/Config.in.powerpc
> +++ b/arch/Config.in.powerpc
> @@ -157,6 +157,9 @@ config BR2_ARCH
> default "powerpc64" if BR2_powerpc64
> default "powerpc64le" if BR2_powerpc64le
>
> +config BR2_KERNEL_ARCH
> + default "powerpc"
> +
> config BR2_ENDIAN
> default "BIG" if BR2_powerpc || BR2_powerpc64
> default "LITTLE" if BR2_powerpc64le
> diff --git a/arch/Config.in.riscv b/arch/Config.in.riscv
> index e6436d7c39..1a008a935d 100644
> --- a/arch/Config.in.riscv
> +++ b/arch/Config.in.riscv
> @@ -118,6 +118,9 @@ config BR2_ARCH
> default "riscv32" if !BR2_ARCH_IS_64
> default "riscv64" if BR2_ARCH_IS_64
>
> +config BR2_KERNEL_ARCH
> + default "riscv"
> +
> config BR2_ENDIAN
> default "LITTLE"
>
> diff --git a/arch/Config.in.s390x b/arch/Config.in.s390x
> index ad866b421e..bf4b70f957 100644
> --- a/arch/Config.in.s390x
> +++ b/arch/Config.in.s390x
> @@ -17,6 +17,9 @@ endchoice
> config BR2_ARCH
> default "s390x" if BR2_s390x
>
> +config BR2_KERNEL_ARCH
> + default "s390"
> +
> config BR2_ENDIAN
> default "BIG"
>
> diff --git a/arch/Config.in.sh b/arch/Config.in.sh
> index b5cce18e22..fde42dfce2 100644
> --- a/arch/Config.in.sh
> +++ b/arch/Config.in.sh
> @@ -24,6 +24,9 @@ config BR2_ARCH
> default "sh4a" if BR2_sh4a
> default "sh4aeb" if BR2_sh4aeb
>
> +config BR2_KERNEL_ARCH
> + default "sh"
> +
> config BR2_ENDIAN
> default "LITTLE" if BR2_sh4 || BR2_sh4a
> default "BIG" if BR2_sh2a || BR2_sh4eb || BR2_sh4aeb
> diff --git a/arch/Config.in.sparc b/arch/Config.in.sparc
> index 4c4dc61745..b91df6892b 100644
> --- a/arch/Config.in.sparc
> +++ b/arch/Config.in.sparc
> @@ -21,6 +21,10 @@ config BR2_ARCH
> default "sparc" if BR2_sparc
> default "sparc64" if BR2_sparc64
>
> +config BR2_KERNEL_ARCH
> + default "sparc" if BR2_sparc
> + default "sparc64" if BR2_sparc64
> +
> config BR2_ENDIAN
> default "BIG"
>
> diff --git a/arch/Config.in.x86 b/arch/Config.in.x86
> index 0ba9ecbcea..b38d0f8106 100644
> --- a/arch/Config.in.x86
> +++ b/arch/Config.in.x86
> @@ -337,6 +337,10 @@ config BR2_ARCH
> default "i686" if BR2_x86_athlon_4
> default "x86_64" if BR2_x86_64
>
> +config BR2_KERNEL_ARCH
> + default "i386" if !BR2_x86_64
> + default "x86_64" if BR2_x86_64
> +
> config BR2_ENDIAN
> default "LITTLE"
>
> diff --git a/arch/Config.in.xtensa b/arch/Config.in.xtensa
> index a79d906985..acc340eca6 100644
> --- a/arch/Config.in.xtensa
> +++ b/arch/Config.in.xtensa
> @@ -48,6 +48,9 @@ config BR2_ENDIAN
> config BR2_ARCH
> default "xtensa" if BR2_xtensa
>
> +config BR2_KERNEL_ARCH
> + default "xtensa"
> +
> config BR2_READELF_ARCH_NAME
> default "Tensilica Xtensa Processor"
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Buildroot] [PATCHv2 2/7] core: introduce NORMALIZED_ARCH as non-kernel replacement for KERNEL_ARCH
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
0 siblings, 0 replies; 18+ messages in thread
From: Arnout Vandecappelle @ 2022-02-08 20:26 UTC (permalink / raw)
To: Thomas De Schampheleire, buildroot
Cc: Marcus Folkesson, Antoine Tenart, Yann E. MORIN, romain.naour,
Clayton Shotwell, Matt Weber, Thomas De Schampheleire
On 15/01/2022 21:03, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>
> The variable 'KERNEL_ARCH' is actually a normalized version of
> 'ARCH'/'BR2_ARCH'. For example, 'arcle' and 'arceb' both become 'arc', just
> as all powerpc variants become 'powerpc'.
>
> It is presumably called 'KERNEL_ARCH' because the Linux kernel is typically
> the first place where support for a new architecture is added, and thus is
> the entity that defines the normalized name.
>
> However, the term 'KERNEL_ARCH' can also be interpreted as 'the architecture
> used by the kernel', which need not be exactly the same as 'the normalized
> name for a certain arch'. In particular, for 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 such cases, the 'architecture used by the kernel' needs to refer to the
> 64-bit name (aarch64, x86_64), whereas all userspace applications need to
> refer the, potentially normalized, 32-bit name.
>
> This means that there need to be two different variables:
>
> KERNEL_ARCH: the architecture used by the kernel
> NORMALIZED_ARCH: the normalized name for the current userspace architecture
>
> At this moment, both will actually have the same content. But a subsequent
> patch will add basic support for situations described above, in which
> KERNEL_ARCH may become overwritten to the 64-bit architecture, while
> NORMALIZED_ARCH needs to remain the same (32-bit) case.
>
> This commit replaces use of KERNEL_ARCH where actually the userspace arch is
> needed. Places that use KERNEL_ARCH in combination with building of kernel
> modules are not touched.
> There may be cases where a package builds both a kernel module as userspace,
> in which case it may need to know about both KERNEL_ARCH and
> NORMALIZED_ARCH, for the case where they differ. But this is to be fixed on
> a per-need basis.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> Reviewed-by: Romain Naour <romain.naour@gmail.com>
I also renamed BR2_KERNEL_ARCH introduced in the previous patch to
BR2_NORMALIZED_ARCH.
Applied to master, thanks.
Regards,
Arnout
>
> ---
> Makefile | 1 +
> boot/barebox/barebox.mk | 10 +++++-----
> boot/uboot/uboot.mk | 6 +++---
> package/busybox/busybox.mk | 2 +-
> package/environment-setup/environment-setup.mk | 2 +-
> package/kvmtool/kvmtool.mk | 4 ++--
> package/libselinux/libselinux.mk | 2 +-
> package/linux-tools/linux-tool-perf.mk.in | 4 ++--
> package/linux-tools/linux-tool-selftests.mk.in | 6 +++---
> package/olsr/olsr.mk | 4 ++--
> package/pciutils/pciutils.mk | 2 +-
> package/uboot-tools/uboot-tools.mk | 10 +++++-----
> 12 files changed, 27 insertions(+), 26 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index e012d121b9..c130eb61c6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -437,6 +437,7 @@ 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))
> KERNEL_ARCH := $(call qstrip,$(BR2_KERNEL_ARCH))
>
> ZCAT := $(call qstrip,$(BR2_ZCAT))
> diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
> index 8f02f9f9e1..6506294d6d 100644
> --- a/boot/barebox/barebox.mk
> +++ b/boot/barebox/barebox.mk
> @@ -59,16 +59,16 @@ ifneq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
> $(1)_INSTALL_TARGET = NO
> endif
>
> -ifeq ($$(KERNEL_ARCH),i386)
> +ifeq ($$(NORMALIZED_ARCH),i386)
> $(1)_ARCH = x86
> -else ifeq ($$(KERNEL_ARCH),x86_64)
> +else ifeq ($$(NORMALIZED_ARCH),x86_64)
> $(1)_ARCH = x86
> -else ifeq ($$(KERNEL_ARCH),powerpc)
> +else ifeq ($$(NORMALIZED_ARCH),powerpc)
> $(1)_ARCH = ppc
> -else ifeq ($$(KERNEL_ARCH),arm64)
> +else ifeq ($$(NORMALIZED_ARCH),arm64)
> $(1)_ARCH = arm
> else
> -$(1)_ARCH = $$(KERNEL_ARCH)
> +$(1)_ARCH = $$(NORMALIZED_ARCH)
> endif
>
> $(1)_MAKE_FLAGS = ARCH=$$($(1)_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> index 574fc7089a..49ebf42800 100644
> --- a/boot/uboot/uboot.mk
> +++ b/boot/uboot/uboot.mk
> @@ -143,12 +143,12 @@ endif
>
> # The kernel calls AArch64 'arm64', but U-Boot calls it just 'arm', so
> # we have to special case it. Similar for i386/x86_64 -> x86
> -ifeq ($(KERNEL_ARCH),arm64)
> +ifeq ($(NORMALIZED_ARCH),arm64)
> UBOOT_ARCH = arm
> -else ifneq ($(filter $(KERNEL_ARCH),i386 x86_64),)
> +else ifneq ($(filter $(NORMALIZED_ARCH),i386 x86_64),)
> UBOOT_ARCH = x86
> else
> -UBOOT_ARCH = $(KERNEL_ARCH)
> +UBOOT_ARCH = $(NORMALIZED_ARCH)
> endif
>
> UBOOT_MAKE_OPTS += \
> diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
> index 60ebc4985f..75e57ba53f 100644
> --- a/package/busybox/busybox.mk
> +++ b/package/busybox/busybox.mk
> @@ -95,7 +95,7 @@ BUSYBOX_MAKE_OPTS = \
> NM="$(TARGET_NM)" \
> RANLIB="$(TARGET_RANLIB)" \
> CC="$(TARGET_CC)" \
> - ARCH=$(KERNEL_ARCH) \
> + ARCH=$(NORMALIZED_ARCH) \
> PREFIX="$(TARGET_DIR)" \
> EXTRA_LDFLAGS="$(BUSYBOX_LDFLAGS)" \
> CROSS_COMPILE="$(TARGET_CROSS)" \
> diff --git a/package/environment-setup/environment-setup.mk b/package/environment-setup/environment-setup.mk
> index f4c52921f7..29ec5a9a95 100644
> --- a/package/environment-setup/environment-setup.mk
> +++ b/package/environment-setup/environment-setup.mk
> @@ -11,7 +11,7 @@ define HOST_ENVIRONMENT_SETUP_INSTALL_CMDS
> for var in $(TARGET_CONFIGURE_OPTS); do \
> printf "export \"$$var\"\n" >> $(ENVIRONMENT_SETUP_FILE); \
> done
> - printf "export \"ARCH=$(KERNEL_ARCH)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
> + printf "export \"ARCH=$(NORMALIZED_ARCH)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
> printf "export \"CROSS_COMPILE=$(TARGET_CROSS)\"\n" >> $(ENVIRONMENT_SETUP_FILE)
> printf "export \"CONFIGURE_FLAGS=--target=$(GNU_TARGET_NAME) \
> --host=$(GNU_TARGET_NAME) \
> diff --git a/package/kvmtool/kvmtool.mk b/package/kvmtool/kvmtool.mk
> index 2984817c7e..df6ae7e0f1 100644
> --- a/package/kvmtool/kvmtool.mk
> +++ b/package/kvmtool/kvmtool.mk
> @@ -25,11 +25,11 @@ KVMTOOL_MAKE_OPTS = \
> WERROR=0
>
> define KVMTOOL_BUILD_CMDS
> - $(TARGET_MAKE_ENV) ARCH=$(KERNEL_ARCH) $(MAKE) -C $(@D) $(KVMTOOL_MAKE_OPTS)
> + $(TARGET_MAKE_ENV) ARCH=$(NORMALIZED_ARCH) $(MAKE) -C $(@D) $(KVMTOOL_MAKE_OPTS)
> endef
>
> define KVMTOOL_INSTALL_TARGET_CMDS
> - $(TARGET_MAKE_ENV) ARCH=$(KERNEL_ARCH) $(MAKE) -C $(@D) \
> + $(TARGET_MAKE_ENV) ARCH=$(NORMALIZED_ARCH) $(MAKE) -C $(@D) \
> $(KVMTOOL_MAKE_OPTS) install DESTDIR=$(TARGET_DIR) prefix=/usr
> endef
>
> diff --git a/package/libselinux/libselinux.mk b/package/libselinux/libselinux.mk
> index c1e90130d2..5790e79040 100644
> --- a/package/libselinux/libselinux.mk
> +++ b/package/libselinux/libselinux.mk
> @@ -18,7 +18,7 @@ LIBSELINUX_INSTALL_STAGING = YES
> # we won't have to use a relative path in 0002-revert-ln-relative.patch
> LIBSELINUX_MAKE_OPTS = \
> $(TARGET_CONFIGURE_OPTS) \
> - ARCH=$(KERNEL_ARCH) \
> + ARCH=$(NORMALIZED_ARCH) \
> SHLIBDIR=/usr/lib
>
> LIBSELINUX_MAKE_INSTALL_TARGETS = install
> diff --git a/package/linux-tools/linux-tool-perf.mk.in b/package/linux-tools/linux-tool-perf.mk.in
> index efa747cf8d..4e28129f50 100644
> --- a/package/linux-tools/linux-tool-perf.mk.in
> +++ b/package/linux-tools/linux-tool-perf.mk.in
> @@ -8,10 +8,10 @@ LINUX_TOOLS += perf
>
> PERF_DEPENDENCIES = host-flex host-bison
>
> -ifeq ($(KERNEL_ARCH),x86_64)
> +ifeq ($(NORMALIZED_ARCH),x86_64)
> PERF_ARCH=x86
> else
> -PERF_ARCH=$(KERNEL_ARCH)
> +PERF_ARCH=$(NORMALIZED_ARCH)
> endif
>
> PERF_MAKE_FLAGS = \
> diff --git a/package/linux-tools/linux-tool-selftests.mk.in b/package/linux-tools/linux-tool-selftests.mk.in
> index c4e5bf0fea..b824c11bd6 100644
> --- a/package/linux-tools/linux-tool-selftests.mk.in
> +++ b/package/linux-tools/linux-tool-selftests.mk.in
> @@ -6,13 +6,13 @@
>
> LINUX_TOOLS += selftests
>
> -ifeq ($(KERNEL_ARCH),x86_64)
> +ifeq ($(NORMALIZED_ARCH),x86_64)
> SELFTESTS_ARCH=x86
> else
> -ifeq ($(KERNEL_ARCH),i386)
> +ifeq ($(NORMALIZED_ARCH),i386)
> SELFTESTS_ARCH=x86
> else
> -SELFTESTS_ARCH=$(KERNEL_ARCH)
> +SELFTESTS_ARCH=$(NORMALIZED_ARCH)
> endif
> endif
>
> diff --git a/package/olsr/olsr.mk b/package/olsr/olsr.mk
> index b2c8e7e001..4ad88991f2 100644
> --- a/package/olsr/olsr.mk
> +++ b/package/olsr/olsr.mk
> @@ -27,10 +27,10 @@ OLSR_PLUGINS += pud
> endif
>
> define OLSR_BUILD_CMDS
> - $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
> + $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(NORMALIZED_ARCH) \
> CFLAGS="$(OLSR_CFLAGS)" -C $(@D) olsrd
> $(foreach p,$(OLSR_PLUGINS), \
> - $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) \
> + $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(NORMALIZED_ARCH) \
> CFLAGS="$(OLSR_CFLAGS)" -C $(@D)/lib/$(p)
> )
> endef
> diff --git a/package/pciutils/pciutils.mk b/package/pciutils/pciutils.mk
> index 9b83b62b55..67defcc743 100644
> --- a/package/pciutils/pciutils.mk
> +++ b/package/pciutils/pciutils.mk
> @@ -12,7 +12,7 @@ PCIUTILS_LICENSE = GPL-2.0+
> PCIUTILS_LICENSE_FILES = COPYING
> PCIUTILS_MAKE_OPTS = \
> CROSS_COMPILE="$(TARGET_CROSS)" \
> - HOST="$(KERNEL_ARCH)-linux" \
> + HOST="$(NORMALIZED_ARCH)-linux" \
> OPT="$(TARGET_CFLAGS)" \
> LDFLAGS="$(TARGET_LDFLAGS)" \
> DNS=no \
> diff --git a/package/uboot-tools/uboot-tools.mk b/package/uboot-tools/uboot-tools.mk
> index 37e329a2af..26450b7adf 100644
> --- a/package/uboot-tools/uboot-tools.mk
> +++ b/package/uboot-tools/uboot-tools.mk
> @@ -224,14 +224,14 @@ $(eval $(host-generic-package))
> MKIMAGE = $(HOST_DIR)/bin/mkimage
>
> # mkimage supports alpha arc arm arm64 blackfin ia64 invalid m68k microblaze mips mips64 nds32 nios2 or1k powerpc riscv s390 sandbox sh sparc sparc64 x86 x86_64 xtensa
> -# KERNEL_ARCH can be arm64 arc arm blackfin m68k microblaze mips nios2 powerpc sh sparc i386 x86_64 xtensa
> +# NORMALIZED_ARCH can be arm64 arc arm blackfin m68k microblaze mips nios2 powerpc sh sparc i386 x86_64 xtensa
> # For i386, we need to convert
> # For openrisc, we need to convert
> -# For others, we'll just keep KERNEL_ARCH
> -ifeq ($(KERNEL_ARCH),i386)
> +# For others, we'll just keep NORMALIZED_ARCH
> +ifeq ($(NORMALIZED_ARCH),i386)
> MKIMAGE_ARCH = x86
> -else ifeq ($(KERNEL_ARCH),openrisc)
> +else ifeq ($(NORMALIZED_ARCH),openrisc)
> MKIMAGE_ARCH = or1k
> else
> -MKIMAGE_ARCH = $(KERNEL_ARCH)
> +MKIMAGE_ARCH = $(NORMALIZED_ARCH)
> endif
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Buildroot] [PATCHv2 7/7] linux/linux.mk: correct LINUX_ARCH_PATH for sparc64
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
0 siblings, 0 replies; 18+ messages in thread
From: Arnout Vandecappelle @ 2022-02-08 20:28 UTC (permalink / raw)
To: Thomas De Schampheleire, buildroot; +Cc: romain.naour, Thomas De Schampheleire
On 15/01/2022 21:03, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>
> Buildroot uses variable LINUX_ARCH_PATH to refer to the arch-specific
> directory in the Linux tree, which may not necessarily be arch/$(KERNEL_ARCH).
>
> Buildroot already accounts for the case of KERNEL_ARCH=i386 and
> KERNEL_ARCH=x86_64, but does not for KERNEL_ARCH=sparc64, in which case the
> correct directory is arch/sparc.
>
> Reported-by: Romain Naour <romain.naour@gmail.com>
> Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
AFAIU this is completely independent of the rest of the series, so I applied
to master, thanks.
Regards,
Arnout
> ---
> linux/linux.mk | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/linux/linux.mk b/linux/linux.mk
> index dd2eebd446..35e2484588 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -242,6 +242,8 @@ ifeq ($(KERNEL_ARCH),i386)
> LINUX_ARCH_PATH = $(LINUX_DIR)/arch/x86
> else ifeq ($(KERNEL_ARCH),x86_64)
> LINUX_ARCH_PATH = $(LINUX_DIR)/arch/x86
> +else ifeq ($(KERNEL_ARCH),sparc64)
> +LINUX_ARCH_PATH = $(LINUX_DIR)/arch/sparc
> else
> LINUX_ARCH_PATH = $(LINUX_DIR)/arch/$(KERNEL_ARCH)
> endif
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland
2022-01-15 20:02 [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Thomas De Schampheleire
` (6 preceding siblings ...)
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:49 ` Arnout Vandecappelle
2022-02-09 11:55 ` Thomas De Schampheleire
2022-07-30 19:43 ` Yann E. MORIN
8 siblings, 1 reply; 18+ messages in thread
From: Arnout Vandecappelle @ 2022-02-08 20:49 UTC (permalink / raw)
To: Thomas De Schampheleire, buildroot; +Cc: romain.naour, Thomas De Schampheleire
On 15/01/2022 21:02, Thomas De Schampheleire wrote:
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
>
> Hello,
>
> Even though there are already cases where a 64-bit kernel is combined with
> 32-bit userland, like MIPS64n32, that Buildroot can support out-of-the-box,
> there are other combinations that don't currently work.
>
> At work, we have two such cases:
> - 64-bit x86_64 kernel with 32-bit i386 userspace
> - 64-bit aarch64 kernel with 32-bit arm userspace
>
> This series adds basic support for these cases, with the limitation that the
> user still needs to know what they are doing.
>
> Patch 1 is a general improvement and can land even if you don't agree
> with the rest.
>
> Patch 2 handles the realization that 'KERNEL_ARCH' can mean two different
> things, and that we need two separate variables.
>
> Patch 3 makes it possible for users to specify the kernel architecture that
> differs from the Buildroot notion of userspace architecture.
>
> Patch 4 fixes the build of perf in this mixed 64-bit-kernel+32-bit-userspace
> case.
>
> Patch 5 prepares host-qemu for the case of x86_64. I'm not very fond of the fact
> that this does not provide a generic solution.
>
> Patch 6 adds a new qemu defconfig for x86_64 kernel and x86 userspace, that
> employs the new logic.
>
> Finally patch 7 corrects LINUX_ARCH_PATH for sparc64, not directly related to
> this series but reported by Romain Naour during his review.
>
>
> As hinted above, users that would like to employ such scenarios still need to
> know what they are doing:
>
> - the correct value of BR2_KERNEL_ARCH_OVERRIDE is to be known by the user
>
> - the toolchain should be capable of generating both 64-bit (kernel) output as
> well as 32-bit userspace output. This is typically done with a multilib
> toolchain, where the default output is 64-bit so that the kernel build does
> not require additional changes, while passing the correct '-mXXX' flag as
> BR2_TARGET_OPTIMIZATION for the userspace compilations.
>
> - it is not possible to create one multilib toolchain that supports Aarch64 and
> (32-bit) ARM output. We have solved it by packaging two individual toolchains
> in one archive, with symlinks at top-level to the 32-bit toolchain, and
> some additional changes in Buildroot to make sure the 64-bit toolchain is
> used where needed (kernel, bootloader)
>
> - BR2_KERNEL_64_USERLAND_32 is not automatically passed.
>
>
> An alternative implementation would be to explicitly support certain
> combinations, but this is less flexible.
So, I'm not entirely convinced about this approach. Here are my objections.
- At least for arm, you need an entirely different toolchain for the 32 and the
64-bit variants. But even for x86, the Buildroot internal toolchain for x86_64
doesn't support -m32. So for most users this is not even going to work.
- There is an alternative: two separate Buildroot configs, one for the kernel +
modules, one for userspace.
- I don't think the flexibility is useful. I think it would be better to reuse
the BR2_KERNEL_64_USERLAND_32 option. (E.g. add an option to Config.in.x86 when
the arch is x86_64 to build a 32-bit userspace.) That way we can use it to pass
-m32 where needed, to build an internal toolchain that supports it, and to check
for the external toolchain if it supports it. Doesn't solve the issue for ARM,
but it's a start.
Also, I think we absolutely need to test this feature. At the very least, we'd
need to config in the autobuilders that enables it, or enable it randomly in
genrandconfig. Although I'm not sure if it tests anything if no kernel is built
(let alone that it's not even booted).
For now, I've left the rest of the series as New in patchwork, let's see what
the others think.
Regards,
Arnout
>
> Best regards,
> Thomas
>
> Thomas De Schampheleire (7):
> arch: move definition of KERNEL_ARCH to Config.in.<arch> files
> core: introduce NORMALIZED_ARCH as non-kernel replacement for
> KERNEL_ARCH
> core: introduce BR2_KERNEL_ARCH_OVERRIDE
> perf: fix compilation in case of i386 userspace with x86_64 kernel
> package/qemu: add support for overridden KERNEL_ARCH=x86_64
> configs: add new qemu defconfig 'x86_multilib'
> linux/linux.mk: correct LINUX_ARCH_PATH for sparc64
>
> Makefile | 22 ++-----
> arch/Config.in | 18 ++++++
> arch/Config.in.arc | 3 +
> arch/Config.in.arm | 4 ++
> arch/Config.in.csky | 3 +
> arch/Config.in.m68k | 3 +
> arch/Config.in.microblaze | 3 +
> arch/Config.in.mips | 3 +
> arch/Config.in.nds32 | 3 +
> arch/Config.in.nios2 | 3 +
> arch/Config.in.or1k | 3 +
> arch/Config.in.powerpc | 3 +
> arch/Config.in.riscv | 3 +
> arch/Config.in.s390x | 3 +
> arch/Config.in.sh | 3 +
> arch/Config.in.sparc | 4 ++
> arch/Config.in.x86 | 4 ++
> arch/Config.in.xtensa | 3 +
> board/qemu/x86_multilib/linux.config | 57 +++++++++++++++++++
> board/qemu/x86_multilib/post-build.sh | 11 ++++
> board/qemu/x86_multilib/readme.txt | 7 +++
> boot/barebox/barebox.mk | 10 ++--
> boot/uboot/uboot.mk | 6 +-
> configs/qemu_x86_multilib_defconfig | 26 +++++++++
> linux/linux.mk | 2 +
> package/busybox/busybox.mk | 2 +-
> .../environment-setup/environment-setup.mk | 2 +-
> package/kvmtool/kvmtool.mk | 4 +-
> package/libselinux/libselinux.mk | 2 +-
> package/linux-tools/linux-tool-perf.mk.in | 7 ++-
> .../linux-tools/linux-tool-selftests.mk.in | 6 +-
> package/olsr/olsr.mk | 4 +-
> package/pciutils/pciutils.mk | 2 +-
> package/qemu/qemu.mk | 3 +
> package/uboot-tools/uboot-tools.mk | 10 ++--
> 35 files changed, 210 insertions(+), 42 deletions(-)
> create mode 100644 board/qemu/x86_multilib/linux.config
> create mode 100755 board/qemu/x86_multilib/post-build.sh
> create mode 100644 board/qemu/x86_multilib/readme.txt
> create mode 100644 configs/qemu_x86_multilib_defconfig
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland
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
0 siblings, 0 replies; 18+ messages in thread
From: Thomas De Schampheleire @ 2022-02-09 11:55 UTC (permalink / raw)
To: Arnout Vandecappelle; +Cc: romain.naour, Thomas De Schampheleire, buildroot
Hi Arnout,
El mar, 8 feb 2022 a las 21:49, Arnout Vandecappelle
(<arnout@mind.be>) escribió:
>
>
>
> On 15/01/2022 21:02, Thomas De Schampheleire wrote:
> > From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> >
> > Hello,
> >
> > Even though there are already cases where a 64-bit kernel is combined with
> > 32-bit userland, like MIPS64n32, that Buildroot can support out-of-the-box,
> > there are other combinations that don't currently work.
> >
> > At work, we have two such cases:
> > - 64-bit x86_64 kernel with 32-bit i386 userspace
> > - 64-bit aarch64 kernel with 32-bit arm userspace
> >
> > This series adds basic support for these cases, with the limitation that the
> > user still needs to know what they are doing.
> >
> > Patch 1 is a general improvement and can land even if you don't agree
> > with the rest.
> >
> > Patch 2 handles the realization that 'KERNEL_ARCH' can mean two different
> > things, and that we need two separate variables.
> >
> > Patch 3 makes it possible for users to specify the kernel architecture that
> > differs from the Buildroot notion of userspace architecture.
> >
> > Patch 4 fixes the build of perf in this mixed 64-bit-kernel+32-bit-userspace
> > case.
> >
> > Patch 5 prepares host-qemu for the case of x86_64. I'm not very fond of the fact
> > that this does not provide a generic solution.
> >
> > Patch 6 adds a new qemu defconfig for x86_64 kernel and x86 userspace, that
> > employs the new logic.
> >
> > Finally patch 7 corrects LINUX_ARCH_PATH for sparc64, not directly related to
> > this series but reported by Romain Naour during his review.
> >
> >
> > As hinted above, users that would like to employ such scenarios still need to
> > know what they are doing:
> >
> > - the correct value of BR2_KERNEL_ARCH_OVERRIDE is to be known by the user
> >
> > - the toolchain should be capable of generating both 64-bit (kernel) output as
> > well as 32-bit userspace output. This is typically done with a multilib
> > toolchain, where the default output is 64-bit so that the kernel build does
> > not require additional changes, while passing the correct '-mXXX' flag as
> > BR2_TARGET_OPTIMIZATION for the userspace compilations.
> >
> > - it is not possible to create one multilib toolchain that supports Aarch64 and
> > (32-bit) ARM output. We have solved it by packaging two individual toolchains
> > in one archive, with symlinks at top-level to the 32-bit toolchain, and
> > some additional changes in Buildroot to make sure the 64-bit toolchain is
> > used where needed (kernel, bootloader)
> >
> > - BR2_KERNEL_64_USERLAND_32 is not automatically passed.
> >
> >
> > An alternative implementation would be to explicitly support certain
> > combinations, but this is less flexible.
>
> So, I'm not entirely convinced about this approach. Here are my objections.
>
> - At least for arm, you need an entirely different toolchain for the 32 and the
> 64-bit variants. But even for x86, the Buildroot internal toolchain for x86_64
> doesn't support -m32. So for most users this is not even going to work.
With crosstool-ng it is possible to build a multilib toolchain for x86
without issue. It's true that the internal Buildroot logic does not
allow this currently, but that by itself is not necessarily an
objection to me.
For ARM we have packaged two toolchains in one, with the bin/, lib/
etc. paths at top-level pointing to the 'default' toolchain, i.e.
32-bit in our case, and changes in linux/uboot to use the 64-bit
toolchain specifically. We'd need to discuss if and how we would
integrate that in mainline Buildroot.
>
> - There is an alternative: two separate Buildroot configs, one for the kernel +
> modules, one for userspace.
Ok, but it is not so convenient at least in our case, where all
surrounding build logic and validation assumes that you just set a
single defconfig, build it, then obtain the results from
output/images. We'd need surrounding scripting to handle the separate
kernel build.
Additionally, what about a build with initramfs built-in the vmlinux
image? This would need the rootfs file from the 32-bit buildroot
copied over to the kernel buildroot context, and then attached there.
This is additional complexity.
>
> - I don't think the flexibility is useful. I think it would be better to reuse
> the BR2_KERNEL_64_USERLAND_32 option. (E.g. add an option to Config.in.x86 when
> the arch is x86_64 to build a 32-bit userspace.) That way we can use it to pass
> -m32 where needed, to build an internal toolchain that supports it, and to check
> for the external toolchain if it supports it. Doesn't solve the issue for ARM,
> but it's a start.
>
>
> Also, I think we absolutely need to test this feature. At the very least, we'd
> need to config in the autobuilders that enables it, or enable it randomly in
> genrandconfig. Although I'm not sure if it tests anything if no kernel is built
> (let alone that it's not even booted).
Yes I had created a qemu defconfig and multilib toolchain that can be
used for tests. But Romain found that the binaries do not run on the
build farm.
Would it be possible to get temporary shell access to that environment
so I can find out what options I really need?
>
>
> For now, I've left the rest of the series as New in patchwork, let's see what
> the others think.
Thanks for your feedback,
Thomas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland
2022-01-15 20:02 [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Thomas De Schampheleire
` (7 preceding siblings ...)
2022-02-08 20:49 ` [Buildroot] [PATCHv2 0/7] Basic support for 64-bit kernel and 32-bit userland Arnout Vandecappelle
@ 2022-07-30 19:43 ` Yann E. MORIN
8 siblings, 0 replies; 18+ messages in thread
From: Yann E. MORIN @ 2022-07-30 19:43 UTC (permalink / raw)
To: Thomas De Schampheleire; +Cc: romain.naour, Thomas De Schampheleire, buildroot
Thomas, All,
On 2022-01-15 21:02 +0100, Thomas De Schampheleire spake thusly:
> From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
> Even though there are already cases where a 64-bit kernel is combined with
> 32-bit userland, like MIPS64n32, that Buildroot can support out-of-the-box,
> there are other combinations that don't currently work.
>
> At work, we have two such cases:
> - 64-bit x86_64 kernel with 32-bit i386 userspace
> - 64-bit aarch64 kernel with 32-bit arm userspace
>
> This series adds basic support for these cases, with the limitation that the
> user still needs to know what they are doing.
We've discussed this series, and Arnout provided some feedback.
It is not entirely clear that this is something we want to carry,
especially, as Arnout suggest, as there are other ways to do so.
I agree with most of what Arnout said. If your tooling can't handle
building two defconfigs, then I would adapt the tooling (it's very easy
with e.g. gitlab-CI to have two jobs in sequence, where the first builds
the kernel + modules, puts that artefacts, retrieved from the second job
that builds userland + final image).
It also look a bit to fragile and complex (as someone put it: "spit and
ducktape").
So, we're going to decline the rest of this series, sorry.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2022-07-30 19:43 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [Buildroot] [PATCHv2 3/7] core: introduce BR2_KERNEL_ARCH_OVERRIDE Thomas De Schampheleire
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
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.