From patchwork Tue Aug 6 23:09:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Gomez via B4 Relay X-Patchwork-Id: 13755438 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3A8CC49EA1 for ; Tue, 6 Aug 2024 23:11:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date:Subject: From:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=FVtByddIlPHTSseEZyhH2YaHBt8EAc78pAkqmT6oT+M=; b=y1HaNthScYTcGG6ZWIIsvJ9vFF qPvqusoPQo219QtQzDUsNtNz01ArVT7AtKrc3DWsB86NpagAvUCvD194nrYf7Bi9pmJTZ06pjKwFZ hDaEAd23CRiIcMddfIqMtOAesMRnrTQH4ym3jmkj35s63P9vUfEKyHmkYvjhYC+/sHEK0XUIP/uVr r+ae5etbbHc6khM2v1i/ZkIQ1wRsvTr/4rcRxkgENeFCl0xl4TBvAf9/8V4WA55RDLtZaIazx25HP nTQqO0SrGia/mO1cLHg0rrOKVBS+zwLMEnuBzuwXSG3J3AaR88omejVPZnGaJCwt60MZVNMSG8zwr BCQI9Nsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbTKG-00000003G05-46Xt; Tue, 06 Aug 2024 23:10:44 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbTJc-00000003FeU-0qsF for linux-arm-kernel@lists.infradead.org; Tue, 06 Aug 2024 23:10:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1E23661119; Tue, 6 Aug 2024 23:10:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id B3CB0C32786; Tue, 6 Aug 2024 23:10:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722985802; bh=srDtPMkx+3Ib/2vxXDsh66x8GKusBSCFnXcAPZ0/fJs=; h=From:Subject:Date:To:Cc:Reply-To:From; b=XyM4t6uixRdVtkkTDbe0NOXLXZ37CozxQGFZMrfsO/1RoZeoVND7Z91irbEFkZG1o QK9utNoPH7ktjzxgS9PHoD3qn/DNgqvVdZsgReOQMjUrT2TlQWFkqaNximTlbkANJw fwIaCs8OsL+5RpaxQ7RQgnnJNhR2sK1DHuPhkA26DmsSHTA9hDidEKUXDf1733zm99 S42u2FVCM/ikVhxmWNb19aaYerJ5H8KgfmYrOTZTuTaNNyjHX7w/yoQnm1GFvnWvt/ BEBQiXjUFnQg6HPQgb/LURhqtACOPKxOuV9p3+Gjq6Aluocc6VajyOLbdkqKccoIPM bvFunUNgxUrOA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96120C49EA1; Tue, 6 Aug 2024 23:10:02 +0000 (UTC) From: Daniel Gomez via B4 Relay Subject: [PATCH 00/12] Enable build system on macOS hosts Date: Wed, 07 Aug 2024 01:09:14 +0200 Message-Id: <20240807-macos-build-support-v1-0-4cd1ded85694@samsung.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIABqtsmYC/x3MQQqAIBBA0avErBuwCKyuEi1MpxqoFCcjiO6et HyL/x8QikwCffFApIuF/ZFRlQXY1RwLIbtsqFXdqFZp3I31glPizaGkEHw8sbNGOa2NmyoNuQy RZr7/6zC+7wcg7OjoZQAAAA== To: Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Lucas De Marchi , =?utf-8?q?Thomas_Hellstr=C3=B6?= =?utf-8?q?m?= , Rodrigo Vivi , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , William Hubbs , Chris Brannon , Kirk Reiser , Samuel Thibault , Paul Moore , Stephen Smalley , Ondrej Mosnacek , Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Greg Kroah-Hartman , Jiri Slaby , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, speakup@linux-speakup.org, selinux@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-serial@vger.kernel.org, llvm@lists.linux.dev, Finn Behrens , "Daniel Gomez (Samsung)" , gost.dev@samsung.com, Daniel Gomez , Nick Desaulniers X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1722985800; l=5760; i=da.gomez@samsung.com; s=20240621; h=from:subject:message-id; bh=srDtPMkx+3Ib/2vxXDsh66x8GKusBSCFnXcAPZ0/fJs=; b=LiLIkclk6gyjYUEvcQG/jWd8xczYA+IguM7XsmOaFyvBmuk7FzB0cX6xsiSYYX3g4q3i4pKTn rvltGN/7ZboBznQAO+ngrBCel8MYDLLj7yJ1vi5dIVQBZPHBahIv5wm X-Developer-Key: i=da.gomez@samsung.com; a=ed25519; pk=BqYk31UHkmv0WZShES6pIZcdmPPGay5LbzifAdZ2Ia4= X-Endpoint-Received: by B4 Relay for da.gomez@samsung.com/20240621 with auth_id=175 X-Original-From: Daniel Gomez X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240806_161004_372780_3D0A577A X-CRM114-Status: GOOD ( 19.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: da.gomez@samsung.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patch set allows for building the Linux kernel for arm64 in macOS with LLVM. Patches are based on previous Nick's work and suggestions [1][2][3] to enable build system in macOS hosts. Since macOS does not provide some of the headers available in the GNU C Library (glibc), the patches include a copy of these headers from glibc-2.40, with minor modifications detailed in the commit message. To set up the environment: * Provide build dependencies (installed via Homebrew): coreutils, findutils, gnu-sed, gnu-tar, grep, llvm, make and pkg-config. * A case sensitive volume for building: diskutil apfs addVolume /dev/disk "Case-sensitive APFS" linux * And include in your PATH all GNU tools required by the Linux kernel as well as LLVM: PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/llvm/bin:$PATH" * Start the build using LLVM: make LLVM=1 allyesconfig make LLVM=1 -j$(nproc) I believe other architectures could also be supported if we can move forward this initiative. Additionally, we could incorporate Rust support. I understand that Finn Behrens has some patches [4][5] based on Nick's previous work. [1]: WIP: build Linux on MacOS https://github.com/ClangBuiltLinux/linux/commit/f06333e29addbc3d714adb340355f471c1dfe95a [2] Subject: [PATCH] scripts: subarch.include: fix SUBARCH on MacOS hosts https://lore.kernel.org/all/20221113233812.36784-1-nick.desaulniers@gmail.com/ [3] Subject: Any interest in building the Linux kernel from a MacOS host? https://lore.kernel.org/all/CAH7mPvj64Scp6_Nbaj8KOfkoV5f7_N5L=Tv5Z9zGyn5SS+gsUw@mail.gmail.com/ [4] https://github.com/kloenk/linux/commits/rust-project_macos-dylib/ [5] https://kloenk.eu/posts/build-linux-on-m1-macos/ To: Masahiro Yamada To: Nathan Chancellor To: Nicolas Schier To: Lucas De Marchi To: Thomas Hellström To: Rodrigo Vivi To: Maarten Lankhorst To: Maxime Ripard To: Thomas Zimmermann To: David Airlie To: Daniel Vetter To: William Hubbs To: Chris Brannon To: Kirk Reiser To: Samuel Thibault To: Paul Moore To: Stephen Smalley To: Ondrej Mosnacek To: Catalin Marinas To: Will Deacon To: Marc Zyngier To: Oliver Upton To: James Morse To: Suzuki K Poulose To: Zenghui Yu To: Greg Kroah-Hartman To: Jiri Slaby To: Nick Desaulniers To: Bill Wendling To: Justin Stitt Cc: linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org Cc: intel-xe@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Cc: speakup@linux-speakup.org Cc: selinux@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: kvmarm@lists.linux.dev Cc: linux-serial@vger.kernel.org Cc: llvm@lists.linux.dev Cc: Finn Behrens Cc: Daniel Gomez (Samsung) Cc: gost.dev@samsung.com Signed-off-by: Daniel Gomez --- Daniel Gomez (11): kbuild: add header_install dependency to scripts file2alias: fix uuid_t definitions for macos drm/xe: xe_gen_wa_oob: fix program_invocation_short_name for macos accessiblity/speakup: genmap and makemapdata require linux/version.h selinux/genheaders: include bitsperlong and posix_types headers selinux/mdp: include bitsperlong and posix_types headers include: add elf.h support include: add endian.h support scripts/mod: add byteswap support tty/vt: conmakehash requires linux/limits.h scripts/kallsyms: add compatibility support for macos Nick Desaulniers (1): scripts: subarch.include: fix SUBARCH on MacOS hosts Makefile | 2 +- arch/arm64/kernel/pi/Makefile | 1 + arch/arm64/kernel/vdso32/Makefile | 1 + arch/arm64/kvm/hyp/nvhe/Makefile | 2 +- drivers/accessibility/speakup/Makefile | 2 + drivers/gpu/drm/xe/xe_gen_wa_oob.c | 8 +- drivers/tty/vt/Makefile | 1 + include/byteswap/byteswap.h | 35 + include/elf/elf.h | 4491 ++++++++++++++++++++++++++++++++ include/endian/bits/uintn-identity.h | 48 + include/endian/endian.h | 63 + scripts/Makefile | 3 +- scripts/kallsyms.c | 4 + scripts/mod/Makefile | 6 + scripts/mod/file2alias.c | 3 + scripts/selinux/genheaders/Makefile | 3 +- scripts/selinux/mdp/Makefile | 3 +- scripts/subarch.include | 3 +- 18 files changed, 4672 insertions(+), 7 deletions(-) --- base-commit: 1e391b34f6aa043c7afa40a2103163a0ef06d179 change-id: 20240807-macos-build-support-9ca0d77adb17 Best regards,