From patchwork Fri Sep 6 11:01:27 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: 13793945 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 0EBCECD5BDD for ; Fri, 6 Sep 2024 11:05:53 +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=/aYnkHTsuvlMiDXLOIZyYRsHOr9SINQH7ickpg4nVfc=; b=zALfEc2qfxD5YZg5R22YSFNaua hixwU3Y2PyPezH6mwY3hl5UjHQsE9wHN0hUSZqQ/zHgc6XNojCbY05ox10ZiBNnn0CPhUsMrHFYCv Ca1G2OHRtg+C3ThgrLqSURskv8jy4t0Qkt1nwO4IMkgsq9iT59gDxXvJ3/kzbOYGNbkmqT9w3TvS+ umKPrDwA9cNy408OcFoCq2KphrtsCqGmMvgdEWhTR/mGnwOm/nnETgecvV7cmBbh2z35SuJLbpnRM CNPDJNv/cxDtKSC5gXvcuhXdMrTvdvUfcckdsFBbL8vdeZeEzP/H++IzmctIFpzSFyjAEfXj1zfx4 na39pcaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smWmc-0000000BtS3-2TsG; Fri, 06 Sep 2024 11:05:42 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smWik-0000000BsKU-1dU0 for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 11:01:44 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 077B3A44EA9; Fri, 6 Sep 2024 11:01:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id CF6A7C4CECB; Fri, 6 Sep 2024 11:01:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725620499; bh=TZ+5SMHrhrYlL8TOlFpYxPkfKpZGWI5ka+ne8BNKBYU=; h=From:Subject:Date:To:Cc:Reply-To:From; b=EsPz/rSiQlXGQJZAplFuV7djjKI0Bk3bxrXy/Ay04/nanHb0TmgO15cuYyvw/wTfe CMOiE+R6NxyJr3sgSNw9QXoW1Rpm0l2pkUfRrcOSmLmvMZXdDHkXWqZJFEBywNO7pd wLX/gscdGoFd8hOxSWeUerNYUdkAWf+r0pTtseDDOcRR6h730Tv4BF5e08xtvnfLO3 DLF6b/U//YCKX29CEQu1WnDy4LqXIxoYMnYBod5HKshud7A1bjVZ4bO2DJ+19Geizy pzJgizOSL+pWSuakTm3zDKxt8KiQszMHHmQwFe69lNmwQm2VjGOGJIBC8DOxzWnNAz EFaqTkw9EHZKA== 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 B0AA8CD5BDD; Fri, 6 Sep 2024 11:01:39 +0000 (UTC) From: Daniel Gomez via B4 Relay Subject: [PATCH v2 0/8] Enable build system on macOS hosts Date: Fri, 06 Sep 2024 13:01:27 +0200 Message-Id: <20240906-macos-build-support-v2-0-06beff418848@samsung.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAAfh2mYC/32NQQ6CMBBFr0Jm7ZiWoAVX3sOwKJ0KkwglHUo0h LtbOYDL95L//gbiI3uBW7FB9CsLhylDeSrADXbqPTJlhlKVlaqVwdG6INglfhFKmucQF2ycVWS MpU4byMs5+ie/j+qjzTywLCF+jpNV/+z/3qpRYeVIk6f6cm2qu9hR0tSfXRih3ff9C2+x1CC4A AAA 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 , 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 , Simona Vetter 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=1725620498; l=6996; i=da.gomez@samsung.com; s=20240621; h=from:subject:message-id; bh=TZ+5SMHrhrYlL8TOlFpYxPkfKpZGWI5ka+ne8BNKBYU=; b=ayL2MPQnBtEx4lGC0G1crXfF8O4KlaX6OFWn5S6fsN4KlxD3Qdnjil/2zTLO/l2WVayP0UXIO ZVoNG/cKjqEDiiR+0GxTIYS6rNsNoRuqaX/hj9danc0NcoamLKkrxlf 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-20240906_040142_584964_EEC85EC2 X-CRM114-Status: GOOD ( 21.09 ) 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 the Linux kernel build system on macOS hosts. macOS does not provide certain headers that are available in a GNU/Linux distribution with development headers installed, usually provided by the GNU C Library (glibc) and/or other projects. These missing headers are needed as build dependencies. To address this, the patches depend on a new Bee Headers Homebrew Tap formula [6][7][8] that provides them together with a pkg-config file to locate the include directory. To locate them, Makefiles include something like: $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null) [6] Project: https://github.com/bee-headers [7] Headers repository: https://github.com/bee-headers/headers.git [8] Homebrew Tap formula: https://github.com/bee-headers/homebrew-bee-headers.git To set up the environment, documentation is provided via last patch in this series. More configurations and architectures as well as support for Rust (from Finn Behrens [4] [5]) can be added in the future to extend build support. [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 Tested-by: Jeff Xie --- Changes in v2: - Add documentation and set this 'feature' as experimental. - Update cover letter. - Drop unnecessary changes. Patches removed: - kbuild: add header_install dependency to scripts - include: add endian.h support - include: add elf.h support - Update Makefiles to find Bee Headers with pkg-config. - Update file2alias to solve uuid_t conflicts inside Makefile as suggested by Nicolas Schier. - Adapt xe_gen_wa_oob to solve getprogname()/ program_invocation_short_name in runtime. as suggested by Lucas De Marchi. - Remove linux/version.h in accessibility/speakup as suggested by Masahiro Yamada. - Replace selinux patches with new Masahiro Yamada's patches: Message-id: 20240809122007.1220219-1-masahiroy@kernel.org Link: https://lore.kernel.org/all/20240809122007.1220219-1-masahiroy@kernel.org/ - Replace tty/vt with new Masahiro Yamada's patch: Message-id: 20240809160853.1269466-1-masahiroy@kernel.org Link: https://lore.kernel.org/all/20240809160853.1269466-1-masahiroy@kernel.org/ (Already merged in the linux-next tag used) - Replace scripts/kallsyms patch with Masahiro Yamada's patch: Message-id: 20240807181148.660157-1-masahiroy@kernel.org Link: https://lore.kernel.org/all/20240807181148.660157-1-masahiroy@kernel.org/ (Already merged in the linux-next tag used) - Link to v1: https://lore.kernel.org/r/20240807-macos-build-support-v1-0-4cd1ded85694@samsung.com --- Daniel Gomez (5): file2alias: fix uuid_t definitions for macos drm/xe: xe_gen_wa_oob: fix program_invocation_short_name for macos arm64: nvhe: add bee-headers support scripts: add bee-headers support Documentation: add howto build in macos Masahiro Yamada (2): selinux: do not include headers from host programs selinux: move genheaders to security/selinux/ Nick Desaulniers (1): scripts: subarch.include: fix SUBARCH on macOS hosts Documentation/kbuild/llvm.rst | 78 ++++++++++++++++++++++ arch/arm64/kernel/pi/Makefile | 1 + arch/arm64/kernel/vdso32/Makefile | 1 + arch/arm64/kvm/hyp/nvhe/Makefile | 3 +- drivers/gpu/drm/xe/xe_gen_wa_oob.c | 4 ++ scripts/Makefile | 4 +- scripts/mod/Makefile | 7 ++ scripts/mod/file2alias.c | 3 + scripts/remove-stale-files | 3 + scripts/selinux/Makefile | 2 +- scripts/selinux/genheaders/.gitignore | 2 - scripts/selinux/genheaders/Makefile | 5 -- scripts/selinux/mdp/Makefile | 2 +- scripts/selinux/mdp/mdp.c | 4 -- scripts/subarch.include | 2 +- security/selinux/.gitignore | 1 + security/selinux/Makefile | 7 +- .../genheaders => security/selinux}/genheaders.c | 3 - security/selinux/include/classmap.h | 19 ++++-- security/selinux/include/initial_sid_to_string.h | 2 - 20 files changed, 123 insertions(+), 30 deletions(-) --- base-commit: ad40aff1edffeccc412cde93894196dca7bc739e change-id: 20240807-macos-build-support-9ca0d77adb17 Best regards,