All of lore.kernel.org
 help / color / mirror / Atom feed
* [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

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.