From patchwork Tue May 18 11:36:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 1480200 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=WGNK8lOE; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fkv9f3MCHz9sWP for ; Tue, 18 May 2021 21:37:10 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E76AB84248; Tue, 18 May 2021 11:37:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2VwUXvWlQHZv; Tue, 18 May 2021 11:37:05 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 6C542842AD; Tue, 18 May 2021 11:37:04 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id DD1CD1BF397 for ; Tue, 18 May 2021 11:37:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C91E8842D7 for ; Tue, 18 May 2021 11:37:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VftRJ2pvPc0G for ; Tue, 18 May 2021 11:36:59 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by smtp1.osuosl.org (Postfix) with ESMTPS id D6A8782BC4 for ; Tue, 18 May 2021 11:36:58 +0000 (UTC) Received: by mail-ed1-x533.google.com with SMTP id f1so10718843edt.4 for ; Tue, 18 May 2021 04:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eGZ3qyH7Lr4D4rhhSYQRcRhQDFhKgkOyGa1EZ3XR+NU=; b=WGNK8lOE1QvfjpwbAaF6tUNITjURbDHjteu+BLFU8b8j1+LQ9uTBO4jQPYiXcTU64A 2iM1MHYHpC+aGQSu4GDePYFwU3NgpiuT1gEJMCSLBaIiAitq5W1+hA4ix31+IvHjKoLW smiNhyOHg5xI+TT4Px+r/ELCJM0KmEwgyI/oXWNXgFKIShhKoVP//V3hwqIvHbXk/uo1 KdczxTcB/BbrvDqbxZMyGndfikPJ+UnIrg0ahecAIV1QKkd2wdLrbITmETFcBx6j4SPF onOmMVky5WqB+n8mM0Exoh0r4UFnVb69tiSyMXjc6K481pqY6Dq9yV04VPYa151eqOOL xfig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eGZ3qyH7Lr4D4rhhSYQRcRhQDFhKgkOyGa1EZ3XR+NU=; b=E60G713TaW5vWBDrTYEDnC8EyN1CJQhXSBjTHHa7HW58biJBhfMXs5CZRYwveWbL5b fZzVjScSnk7kiBQID3aw3116YUUVwDNLxO4Uyjdw2vx64WkTb2qpNSXfz7ahH7ElBAih g9EEs2gS/rXcb9cYFmPp2OZSBmGkFSoCPhw1HN9dODyy6c8Lyj/mK5OmaddGWQt+O3iE hUNJvXw/y6CZW9QIsBKVgJ+9EJRsFoqQGNSwHcYfzoxRUppktq5Q1n6GBZz+X8gNYDdK 7bz7UgAukaNqHnpAT6C9+UxBumz66NUKB4W30w8ozHssLQMPI/lSeMyhDb77AiexQuUF Jg0g== X-Gm-Message-State: AOAM531I81qmrMnQ/KzalmYNisPrcVfGmYcWlb8hcq6kMltzAUiavM7m PXXZ9Jr+otm11chDA7AUIVMX3VrPtekitl6E X-Google-Smtp-Source: ABdhPJysQomsSV5dCkdRxxv+Rx5jiq8ttReqp+ass6KUQVxjH0DcF3jNN+ev3MqZRhHWQqxWxJr6zg== X-Received: by 2002:a05:6402:781:: with SMTP id d1mr6734083edy.32.1621337817150; Tue, 18 May 2021 04:36:57 -0700 (PDT) Received: from localhost (ptr-5gw9txf6g5tndjqqqz.18120a2.ip6.access.telenet.be. [2a02:1810:510:3800:1b15:18e4:57d1:eb]) by smtp.gmail.com with ESMTPSA id bw16sm10289536ejb.50.2021.05.18.04.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 04:36:56 -0700 (PDT) From: Thomas De Schampheleire To: buildroot@buildroot.org Date: Tue, 18 May 2021 13:36:47 +0200 Message-Id: <20210518113652.29609-1-patrickdepinguin@gmail.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Subject: [Buildroot] [PATCH RFC 0/4] Basic support for 64-bit kernel and 32-bit userland X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas De Schampheleire Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Thomas De Schampheleire 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. 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 (4): arch: move definition of KERNEL_ARCH to Config.in. 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 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 +++ boot/barebox/barebox.mk | 10 ++++----- boot/uboot/uboot.mk | 6 ++--- 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/uboot-tools/uboot-tools.mk | 10 ++++----- 29 files changed, 104 insertions(+), 42 deletions(-)