mbox series

[v2,0/8] Enable build system on macOS hosts

Message ID 20240906-macos-build-support-v2-0-06beff418848@samsung.com
Headers show
Series Enable build system on macOS hosts | expand

Message

Daniel Gomez via B4 Relay Sept. 6, 2024, 11:01 a.m. UTC
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 <masahiroy@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
To: Nicolas Schier <nicolas@fjasle.eu>
To: Lucas De Marchi <lucas.demarchi@intel.com>
To: Thomas Hellström <thomas.hellstrom@linux.intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Maxime Ripard <mripard@kernel.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
To: David Airlie <airlied@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>
To: William Hubbs <w.d.hubbs@gmail.com>
To: Chris Brannon <chris@the-brannons.com>
To: Kirk Reiser <kirk@reisers.ca>
To: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Paul Moore <paul@paul-moore.com>
To: Stephen Smalley <stephen.smalley.work@gmail.com>
To: Ondrej Mosnacek <omosnace@redhat.com>
To: Catalin Marinas <catalin.marinas@arm.com>
To: Will Deacon <will@kernel.org>
To: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
To: James Morse <james.morse@arm.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Zenghui Yu <yuzenghui@huawei.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jiri Slaby <jirislaby@kernel.org>
To: Nick Desaulniers <ndesaulniers@google.com>
To: Bill Wendling <morbo@google.com>
To: Justin Stitt <justinstitt@google.com>
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 <me@kloenk.dev>
Cc: Daniel Gomez (Samsung) <d+samsung@kruces.com>
Cc: gost.dev@samsung.com

Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
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 <linux/*.h> 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,

Comments

Masahiro Yamada Sept. 6, 2024, 2:02 p.m. UTC | #1
On Fri, Sep 6, 2024 at 8:01 PM Daniel Gomez via B4 Relay
<devnull+da.gomez.samsung.com@kernel.org> wrote:
>
> From: Daniel Gomez <da.gomez@samsung.com>
>
> endian.h header is not provided by default in macOS. Use pkg-config with
> the new development package 'bee-headers' [1] to find the path where the
> headers are installed.
>
> [1] Bee Headers Project links:
> https://github.com/bee-headers/headers
> https://github.com/bee-headers/homebrew-bee-headers
>
> It requires to install bee-headers Homebrew Tap:
>   brew tap bee-headers/bee-headers
>   brew install bee-headers/bee-headers/bee-headers
>
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> ---
>  scripts/Makefile     | 4 +++-
>  scripts/mod/Makefile | 5 +++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/Makefile b/scripts/Makefile
> index 6bcda4b9d054..40f6a9159f8c 100644
> --- a/scripts/Makefile
> +++ b/scripts/Makefile
> @@ -25,8 +25,10 @@ generate_rust_target-rust := y
>  rustdoc_test_builder-rust := y
>  rustdoc_test_gen-rust := y
>
> -HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include
> +HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include \
> +       $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
>  HOSTLDLIBS_sorttable = -lpthread
> +HOSTCFLAGS_insert-sys-cert.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
>  HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include
>  HOSTCFLAGS_sign-file.o = $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null)
>  HOSTLDLIBS_sign-file = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto)
> diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
> index 75c12c045f21..33bb032039ba 100644
> --- a/scripts/mod/Makefile
> +++ b/scripts/mod/Makefile
> @@ -9,6 +9,11 @@ modpost-objs   := modpost.o file2alias.o sumversion.o symsearch.o
>  devicetable-offsets-file := devicetable-offsets.h
>
>  HOSTCFLAGS_file2alias.o += -D_UUID_T -D__GETHOSTUUID_H
> +HOSTCFLAGS_modpost.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
> +HOSTCFLAGS_file2alias.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
> +HOSTCFLAGS_sumversion.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
> +HOSTCFLAGS_symsearch.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
> +HOSTCFLAGS_mk_elfconfig.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
>
>  $(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s FORCE
>         $(call filechk,offsets,__DEVICETABLE_OFFSETS_H__)



Same as 4/8.

NACK.




--
Best Regards

Masahiro Yamada
Paul Moore Sept. 6, 2024, 2:54 p.m. UTC | #2
On Fri, Sep 6, 2024 at 7:01 AM Daniel Gomez via B4 Relay
<devnull+da.gomez.samsung.com@kernel.org> wrote:
>
> From: Masahiro Yamada <masahiroy@kernel.org>
>
> This tool is only used in security/selinux/Makefile.
>
> There is no reason to keep it under scripts/.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>  scripts/remove-stale-files                                    | 3 +++
>  scripts/selinux/Makefile                                      | 2 +-
>  scripts/selinux/genheaders/.gitignore                         | 2 --
>  scripts/selinux/genheaders/Makefile                           | 3 ---
>  security/selinux/.gitignore                                   | 1 +
>  security/selinux/Makefile                                     | 7 +++++--
>  {scripts/selinux/genheaders => security/selinux}/genheaders.c | 0
>  7 files changed, 10 insertions(+), 8 deletions(-)

Did you read my comments on your previous posting of this patch?  Here
is a lore link in case you missed it or it was swallowed by your
inbox:

https://lore.kernel.org/selinux/3447459d08dd7ebb58972129cddf1c44@paul-moore.com

Unless there is an serious need for this relocation, and I don't see
one explicitly documented either in this patchset or the previous, I
don't want to see this patch go upstream.
Daniel Gomez (Samsung) Sept. 6, 2024, 3:06 p.m. UTC | #3
On Fri, Sep 6, 2024 at 4:54 PM Paul Moore <paul@paul-moore.com> wrote:
>
> On Fri, Sep 6, 2024 at 7:01 AM Daniel Gomez via B4 Relay
> <devnull+da.gomez.samsung.com@kernel.org> wrote:
> >
> > From: Masahiro Yamada <masahiroy@kernel.org>
> >
> > This tool is only used in security/selinux/Makefile.
> >
> > There is no reason to keep it under scripts/.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >  scripts/remove-stale-files                                    | 3 +++
> >  scripts/selinux/Makefile                                      | 2 +-
> >  scripts/selinux/genheaders/.gitignore                         | 2 --
> >  scripts/selinux/genheaders/Makefile                           | 3 ---
> >  security/selinux/.gitignore                                   | 1 +
> >  security/selinux/Makefile                                     | 7 +++++--
> >  {scripts/selinux/genheaders => security/selinux}/genheaders.c | 0
> >  7 files changed, 10 insertions(+), 8 deletions(-)
>
> Did you read my comments on your previous posting of this patch?  Here
> is a lore link in case you missed it or it was swallowed by your
> inbox:
>
> https://lore.kernel.org/selinux/3447459d08dd7ebb58972129cddf1c44@paul-moore.com

Apologies for the unnecessary noise. I’ll review your feedback and
revisit the patch accordingly.

Daniel

>
> Unless there is an serious need for this relocation, and I don't see
> one explicitly documented either in this patchset or the previous, I
> don't want to see this patch go upstream.
>
> --
> paul-moore.com
Paul Moore Sept. 6, 2024, 3:47 p.m. UTC | #4
On Fri, Sep 6, 2024 at 11:37 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Fri, Sep 6, 2024 at 11:54 PM Paul Moore <paul@paul-moore.com> wrote:
> >
> > On Fri, Sep 6, 2024 at 7:01 AM Daniel Gomez via B4 Relay
> > <devnull+da.gomez.samsung.com@kernel.org> wrote:
> > >
> > > From: Masahiro Yamada <masahiroy@kernel.org>
> > >
> > > This tool is only used in security/selinux/Makefile.
> > >
> > > There is no reason to keep it under scripts/.
> > >
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > > ---
> > >  scripts/remove-stale-files                                    | 3 +++
> > >  scripts/selinux/Makefile                                      | 2 +-
> > >  scripts/selinux/genheaders/.gitignore                         | 2 --
> > >  scripts/selinux/genheaders/Makefile                           | 3 ---
> > >  security/selinux/.gitignore                                   | 1 +
> > >  security/selinux/Makefile                                     | 7 +++++--
> > >  {scripts/selinux/genheaders => security/selinux}/genheaders.c | 0
> > >  7 files changed, 10 insertions(+), 8 deletions(-)
> >
> > Did you read my comments on your previous posting of this patch?  Here
> > is a lore link in case you missed it or it was swallowed by your
> > inbox:
> >
> > https://lore.kernel.org/selinux/3447459d08dd7ebb58972129cddf1c44@paul-moore.com
> >
> > Unless there is an serious need for this relocation, and I don't see
> > one explicitly documented either in this patchset or the previous, I
> > don't want to see this patch go upstream.
>
>
> I commented on the previous thread.

I already responded there.
Daniel Gomez (Samsung) Sept. 7, 2024, 9:27 a.m. UTC | #5
On Fri, Sep 6, 2024 at 4:03 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Fri, Sep 6, 2024 at 8:01 PM Daniel Gomez via B4 Relay
> <devnull+da.gomez.samsung.com@kernel.org> wrote:
> >
> > From: Daniel Gomez <da.gomez@samsung.com>
> >
> > endian.h header is not provided by default in macOS. Use pkg-config with
> > the new development package 'bee-headers' [1] to find the path where the
> > headers are installed.
> >
> > [1] Bee Headers Project links:
> > https://github.com/bee-headers/headers
> > https://github.com/bee-headers/homebrew-bee-headers
> >
> > It requires to install bee-headers Homebrew Tap:
> >
> >   brew tap bee-headers/bee-headers
> >   brew install bee-headers/bee-headers/bee-headers
> >
> > Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> > ---
> >  arch/arm64/kernel/pi/Makefile     | 1 +
> >  arch/arm64/kernel/vdso32/Makefile | 1 +
> >  arch/arm64/kvm/hyp/nvhe/Makefile  | 3 ++-
> >  3 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/kernel/pi/Makefile b/arch/arm64/kernel/pi/Makefile
> > index 4d11a8c29181..259c9a45fba0 100644
> > --- a/arch/arm64/kernel/pi/Makefile
> > +++ b/arch/arm64/kernel/pi/Makefile
> > @@ -20,6 +20,7 @@ KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS))
> >  KBUILD_CFLAGS  := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS))
> >
> >  hostprogs      := relacheck
> > +HOSTCFLAGS_relacheck.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
> >
> >  quiet_cmd_piobjcopy = $(quiet_cmd_objcopy)
> >        cmd_piobjcopy = $(cmd_objcopy) && $(obj)/relacheck $(@) $(<)
> > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
> > index 25a2cb6317f3..6cb8a04bd829 100644
> > --- a/arch/arm64/kernel/vdso32/Makefile
> > +++ b/arch/arm64/kernel/vdso32/Makefile
> > @@ -107,6 +107,7 @@ VDSO_LDFLAGS += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)
> >  # $(hostprogs) with $(obj)
> >  munge := ../../../arm/vdso/vdsomunge
> >  hostprogs := $(munge)
> > +HOSTCFLAGS_$(munge).o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
> >
> >  c-obj-vdso := note.o
> >  c-obj-vdso-gettimeofday := vgettimeofday.o
> > diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile
> > index b43426a493df..d20a440b6964 100644
> > --- a/arch/arm64/kvm/hyp/nvhe/Makefile
> > +++ b/arch/arm64/kvm/hyp/nvhe/Makefile
> > @@ -15,7 +15,8 @@ ccflags-y += -fno-stack-protector     \
> >              $(DISABLE_STACKLEAK_PLUGIN)
> >
> >  hostprogs := gen-hyprel
> > -HOST_EXTRACFLAGS += -I$(objtree)/include
> > +HOST_EXTRACFLAGS += -I$(objtree)/include \
> > +       $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
> >
> >  lib-objs := clear_page.o copy_page.o memcpy.o memset.o
> >  lib-objs := $(addprefix ../../../lib/, $(lib-objs))
> >
> > --
> > 2.46.0
> >
> >
>
> NACK.
>
> Developers working on Linux distributions have no interest
> in your homebrew setup.
>
> For 99% of users, pkg-config does not do anything good.
> It is a waste of process forks.

I didn't think of this, and I agree with you.

>
>
>
> You need to do it outside.
>
>
>  $ HOSTCFLAGS=$(pkg-config --cflags bee-headers) make
>
> or
>
>  $ export HOSTCFLAGS=$(pkg-config --cflags bee-headers)
>  $ make

Would a Makefile variable be suitable for this use case to make it
easier in the command-line?

We can detect we are in a non-linux based environment and enable a
Makefile <VAR> (e.g., NOLINUX=1) and handle the NOLINUX build case
(with pkg-config/bee-headers) inside the Makefiles for these non-linux
cases.


>
>
>
>
>
> --
> Best Regards
> Masahiro Yamada
Masahiro Yamada Sept. 7, 2024, 11:56 p.m. UTC | #6
On Fri, Sep 6, 2024 at 8:01 PM Daniel Gomez via B4 Relay
<devnull+da.gomez.samsung.com@kernel.org> wrote:
>
> From: Daniel Gomez <da.gomez@samsung.com>
>
> The uuid_t struct defined in sys/types.h on macOS hosts conflicts with
> the one defined in file2alias, resulting in the typedef redefinition
> error below. To resolve this conflict, define the _UUID_T and
> __GETHOSTUUID_ in file2alias HOSTCFLAGS.
>
> Error:
>   HOSTCC  scripts/mod/file2alias.o scripts/mod/file2alias.c:45:3:
> error: typedef redefinition with different types ('struct uuid_t' vs
> '__darwin_uuid_t' (aka 'unsigned char[16]'))    45 | } uuid_t;       |
> ^
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    sys/_types/_uuid_t.h:31:25: note: previous definition is here 31 |
>    typedef __darwin_uuid_t uuid_t;    |                         ^
> scripts/mod/file2alias.c:1354:7: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1354 |
>  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1354:19: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1354 |
>  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1354:31: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1354 |
>  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1354:43: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1354 |
>  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1354:55: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1354 |
>  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1355:7: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1355 |
>  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1355:19: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1355 |
>  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1355:31: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1355 |
>  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1355:43: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1355 |
>  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1355:55: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1355 |
>  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1356:7: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1356 |
>  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1356:20: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1356 |
>  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1356:33: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1356 |
>  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1356:46: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1356 |
>  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1356:59: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1356 |
>  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
>  ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> scripts/mod/file2alias.c:1357:7: error: member reference base
>  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
>  'unsigned char[16]') is not a structure or union 1357 |
>  uuid->b[15]);      |                 ~~~~^ ~
> /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
>    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
>    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
>    |                                                        ^~~~~~~~~~~
> 17 errors generated.
>
> Suggested-by: Nicolas Schier <nicolas@fjasle.eu>
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> ---
>  scripts/mod/Makefile     | 2 ++
>  scripts/mod/file2alias.c | 3 +++
>  2 files changed, 5 insertions(+)
>
> diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
> index c729bc936bae..75c12c045f21 100644
> --- a/scripts/mod/Makefile
> +++ b/scripts/mod/Makefile
> @@ -8,6 +8,8 @@ modpost-objs    := modpost.o file2alias.o sumversion.o symsearch.o
>
>  devicetable-offsets-file := devicetable-offsets.h
>
> +HOSTCFLAGS_file2alias.o += -D_UUID_T -D__GETHOSTUUID_H
> +
>  $(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s FORCE
>         $(call filechk,offsets,__DEVICETABLE_OFFSETS_H__)
>
> diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> index 99dce93a4188..ab743f6d60ef 100644
> --- a/scripts/mod/file2alias.c
> +++ b/scripts/mod/file2alias.c
> @@ -11,6 +11,9 @@
>   */
>
>  #include "modpost.h"
> +#ifdef __APPLE__
> +#define uuid_t sys_uuid_t
> +#endif
>  #include "devicetable-offsets.h"




Is this what Nicolas suggested?
https://lore.kernel.org/lkml/20240807-sexy-roadrunner-of-acceptance-a84bbf@lindesnes/


I thought he suggested replacing #ifdef __APPLE__
with -D_UUID_T -D__GETHOSTUUID_H.


You added -D_UUID_T -D__GETHOSTUUID_H,
keeping #ifdef __APPLE__.









>  /* We use the ELF typedefs for kernel_ulong_t but bite the bullet and
>
> --
> 2.46.0
>
>
Masahiro Yamada Sept. 8, 2024, 1:17 a.m. UTC | #7
On Sat, Sep 7, 2024 at 6:28 PM Daniel Gomez (Samsung)
<d+samsung@kruces.com> wrote:
>
> On Fri, Sep 6, 2024 at 4:03 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > On Fri, Sep 6, 2024 at 8:01 PM Daniel Gomez via B4 Relay
> > <devnull+da.gomez.samsung.com@kernel.org> wrote:
> > >
> > > From: Daniel Gomez <da.gomez@samsung.com>
> > >
> > > endian.h header is not provided by default in macOS. Use pkg-config with
> > > the new development package 'bee-headers' [1] to find the path where the
> > > headers are installed.
> > >
> > > [1] Bee Headers Project links:
> > > https://github.com/bee-headers/headers
> > > https://github.com/bee-headers/homebrew-bee-headers
> > >
> > > It requires to install bee-headers Homebrew Tap:
> > >
> > >   brew tap bee-headers/bee-headers
> > >   brew install bee-headers/bee-headers/bee-headers
> > >
> > > Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> > > ---
> > >  arch/arm64/kernel/pi/Makefile     | 1 +
> > >  arch/arm64/kernel/vdso32/Makefile | 1 +
> > >  arch/arm64/kvm/hyp/nvhe/Makefile  | 3 ++-
> > >  3 files changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/arch/arm64/kernel/pi/Makefile b/arch/arm64/kernel/pi/Makefile
> > > index 4d11a8c29181..259c9a45fba0 100644
> > > --- a/arch/arm64/kernel/pi/Makefile
> > > +++ b/arch/arm64/kernel/pi/Makefile
> > > @@ -20,6 +20,7 @@ KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS))
> > >  KBUILD_CFLAGS  := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS))
> > >
> > >  hostprogs      := relacheck
> > > +HOSTCFLAGS_relacheck.o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
> > >
> > >  quiet_cmd_piobjcopy = $(quiet_cmd_objcopy)
> > >        cmd_piobjcopy = $(cmd_objcopy) && $(obj)/relacheck $(@) $(<)
> > > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
> > > index 25a2cb6317f3..6cb8a04bd829 100644
> > > --- a/arch/arm64/kernel/vdso32/Makefile
> > > +++ b/arch/arm64/kernel/vdso32/Makefile
> > > @@ -107,6 +107,7 @@ VDSO_LDFLAGS += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL)
> > >  # $(hostprogs) with $(obj)
> > >  munge := ../../../arm/vdso/vdsomunge
> > >  hostprogs := $(munge)
> > > +HOSTCFLAGS_$(munge).o = $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
> > >
> > >  c-obj-vdso := note.o
> > >  c-obj-vdso-gettimeofday := vgettimeofday.o
> > > diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile
> > > index b43426a493df..d20a440b6964 100644
> > > --- a/arch/arm64/kvm/hyp/nvhe/Makefile
> > > +++ b/arch/arm64/kvm/hyp/nvhe/Makefile
> > > @@ -15,7 +15,8 @@ ccflags-y += -fno-stack-protector     \
> > >              $(DISABLE_STACKLEAK_PLUGIN)
> > >
> > >  hostprogs := gen-hyprel
> > > -HOST_EXTRACFLAGS += -I$(objtree)/include
> > > +HOST_EXTRACFLAGS += -I$(objtree)/include \
> > > +       $(shell $(HOSTPKG_CONFIG) --cflags bee-headers 2> /dev/null)
> > >
> > >  lib-objs := clear_page.o copy_page.o memcpy.o memset.o
> > >  lib-objs := $(addprefix ../../../lib/, $(lib-objs))
> > >
> > > --
> > > 2.46.0
> > >
> > >
> >
> > NACK.
> >
> > Developers working on Linux distributions have no interest
> > in your homebrew setup.
> >
> > For 99% of users, pkg-config does not do anything good.
> > It is a waste of process forks.
>
> I didn't think of this, and I agree with you.
>
> >
> >
> >
> > You need to do it outside.
> >
> >
> >  $ HOSTCFLAGS=$(pkg-config --cflags bee-headers) make
> >
> > or
> >
> >  $ export HOSTCFLAGS=$(pkg-config --cflags bee-headers)
> >  $ make
>
> Would a Makefile variable be suitable for this use case to make it
> easier in the command-line?



HOSTCFLAGS is an environment variable.


See Documentation/kbuild/kbuild.rst


  HOSTCFLAGS
  ----------
  Additional flags to be passed to $(HOSTCC) when building host programs.




If you do not want to type it every time,
add the following to ~/.profile or ~/.bashrc, etc.


export HOSTCFLAGS="$(pkg-config --cflags bee-headers) -D_UUID_T
-D__GETHOSTUUID_H"




Or, if you want to limit this HOSTCFLAGS definition
only to a specific kernel tree, you can add GNUmakefile
to wrap Makefile.

This is how people often add local setups without
typing a long command.



GNUmakefile:

  export HOSTCFLAGS = $(shell pkg-config --cflags bee-headers)
-D_UUID_T -D__GETHOSTUUID_H
  include Makefile




Then, you do not need to bother the upstream kernel.







> We can detect we are in a non-linux based environment and enable a
> Makefile <VAR> (e.g., NOLINUX=1) and handle the NOLINUX build case
> (with pkg-config/bee-headers) inside the Makefiles for these non-linux
> cases.


NACK.



>
> >
> >
> >
> >
> >
> > --
> > Best Regards
> > Masahiro Yamada



--
Best Regards
Masahiro Yamada
Daniel Gomez (Samsung) Sept. 8, 2024, 5:40 p.m. UTC | #8
On Sun, Sep 8, 2024 at 1:56 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Fri, Sep 6, 2024 at 8:01 PM Daniel Gomez via B4 Relay
> <devnull+da.gomez.samsung.com@kernel.org> wrote:
> >
> > From: Daniel Gomez <da.gomez@samsung.com>
> >
> > The uuid_t struct defined in sys/types.h on macOS hosts conflicts with
> > the one defined in file2alias, resulting in the typedef redefinition
> > error below. To resolve this conflict, define the _UUID_T and
> > __GETHOSTUUID_ in file2alias HOSTCFLAGS.
> >
> > Error:
> >   HOSTCC  scripts/mod/file2alias.o scripts/mod/file2alias.c:45:3:
> > error: typedef redefinition with different types ('struct uuid_t' vs
> > '__darwin_uuid_t' (aka 'unsigned char[16]'))    45 | } uuid_t;       |
> > ^
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    sys/_types/_uuid_t.h:31:25: note: previous definition is here 31 |
> >    typedef __darwin_uuid_t uuid_t;    |                         ^
> > scripts/mod/file2alias.c:1354:7: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1354 |
> >  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1354:19: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1354 |
> >  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1354:31: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1354 |
> >  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1354:43: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1354 |
> >  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1354:55: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1354 |
> >  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1355:7: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1355 |
> >  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1355:19: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1355 |
> >  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1355:31: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1355 |
> >  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1355:43: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1355 |
> >  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1355:55: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1355 |
> >  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1356:7: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1356 |
> >  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1356:20: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1356 |
> >  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1356:33: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1356 |
> >  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1356:46: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1356 |
> >  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1356:59: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1356 |
> >  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
> >  ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > scripts/mod/file2alias.c:1357:7: error: member reference base
> >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> >  'unsigned char[16]') is not a structure or union 1357 |
> >  uuid->b[15]);      |                 ~~~~^ ~
> > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> >    |                                                        ^~~~~~~~~~~
> > 17 errors generated.
> >
> > Suggested-by: Nicolas Schier <nicolas@fjasle.eu>
> > Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> > ---
> >  scripts/mod/Makefile     | 2 ++
> >  scripts/mod/file2alias.c | 3 +++
> >  2 files changed, 5 insertions(+)
> >
> > diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
> > index c729bc936bae..75c12c045f21 100644
> > --- a/scripts/mod/Makefile
> > +++ b/scripts/mod/Makefile
> > @@ -8,6 +8,8 @@ modpost-objs    := modpost.o file2alias.o sumversion.o symsearch.o
> >
> >  devicetable-offsets-file := devicetable-offsets.h
> >
> > +HOSTCFLAGS_file2alias.o += -D_UUID_T -D__GETHOSTUUID_H
> > +
> >  $(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s FORCE
> >         $(call filechk,offsets,__DEVICETABLE_OFFSETS_H__)
> >
> > diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> > index 99dce93a4188..ab743f6d60ef 100644
> > --- a/scripts/mod/file2alias.c
> > +++ b/scripts/mod/file2alias.c
> > @@ -11,6 +11,9 @@
> >   */
> >
> >  #include "modpost.h"
> > +#ifdef __APPLE__
> > +#define uuid_t sys_uuid_t
> > +#endif
> >  #include "devicetable-offsets.h"
>
>
>
>
> Is this what Nicolas suggested?
> https://lore.kernel.org/lkml/20240807-sexy-roadrunner-of-acceptance-a84bbf@lindesnes/
>
>
> I thought he suggested replacing #ifdef __APPLE__
> with -D_UUID_T -D__GETHOSTUUID_H.
>
>
> You added -D_UUID_T -D__GETHOSTUUID_H,
> keeping #ifdef __APPLE__.

I forgot to remove this.

Based on your suggestion in the other thread to use/overwrite
HOSTCFLAGS via the command line, it seems I should drop this patch.
Can you confirm?

>
>
>
>
>
>
>
>
>
> >  /* We use the ELF typedefs for kernel_ulong_t but bite the bullet and
> >
> > --
> > 2.46.0
> >
> >
>
>
> --
> Best Regards
> Masahiro Yamada
Masahiro Yamada Sept. 9, 2024, 5:40 a.m. UTC | #9
On Mon, Sep 9, 2024 at 2:41 AM Daniel Gomez (Samsung)
<d+samsung@kruces.com> wrote:
>
> On Sun, Sep 8, 2024 at 1:56 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > On Fri, Sep 6, 2024 at 8:01 PM Daniel Gomez via B4 Relay
> > <devnull+da.gomez.samsung.com@kernel.org> wrote:
> > >
> > > From: Daniel Gomez <da.gomez@samsung.com>
> > >
> > > The uuid_t struct defined in sys/types.h on macOS hosts conflicts with
> > > the one defined in file2alias, resulting in the typedef redefinition
> > > error below. To resolve this conflict, define the _UUID_T and
> > > __GETHOSTUUID_ in file2alias HOSTCFLAGS.
> > >
> > > Error:
> > >   HOSTCC  scripts/mod/file2alias.o scripts/mod/file2alias.c:45:3:
> > > error: typedef redefinition with different types ('struct uuid_t' vs
> > > '__darwin_uuid_t' (aka 'unsigned char[16]'))    45 | } uuid_t;       |
> > > ^
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    sys/_types/_uuid_t.h:31:25: note: previous definition is here 31 |
> > >    typedef __darwin_uuid_t uuid_t;    |                         ^
> > > scripts/mod/file2alias.c:1354:7: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1354 |
> > >  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1354:19: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1354 |
> > >  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1354:31: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1354 |
> > >  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1354:43: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1354 |
> > >  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1354:55: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1354 |
> > >  uuid->b[0], uuid->b[1], uuid->b[2], uuid->b[3], uuid->b[4],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1355:7: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1355 |
> > >  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1355:19: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1355 |
> > >  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1355:31: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1355 |
> > >  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1355:43: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1355 |
> > >  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1355:55: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1355 |
> > >  uuid->b[5], uuid->b[6], uuid->b[7], uuid->b[8], uuid->b[9],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1356:7: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1356 |
> > >  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1356:20: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1356 |
> > >  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1356:33: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1356 |
> > >  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1356:46: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1356 |
> > >  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1356:59: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1356 |
> > >  uuid->b[10], uuid->b[11], uuid->b[12], uuid->b[13], uuid->b[14],      |
> > >  ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > scripts/mod/file2alias.c:1357:7: error: member reference base
> > >  type 'typeof (((struct tee_client_device_id *)0)->uuid)' (aka
> > >  'unsigned char[16]') is not a structure or union 1357 |
> > >  uuid->b[15]);      |                 ~~~~^ ~
> > > /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/
> > >    secure/_stdio.h:47:56: note: expanded from macro 'sprintf' 47 |
> > >    __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
> > >    |                                                        ^~~~~~~~~~~
> > > 17 errors generated.
> > >
> > > Suggested-by: Nicolas Schier <nicolas@fjasle.eu>
> > > Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> > > ---
> > >  scripts/mod/Makefile     | 2 ++
> > >  scripts/mod/file2alias.c | 3 +++
> > >  2 files changed, 5 insertions(+)
> > >
> > > diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile
> > > index c729bc936bae..75c12c045f21 100644
> > > --- a/scripts/mod/Makefile
> > > +++ b/scripts/mod/Makefile
> > > @@ -8,6 +8,8 @@ modpost-objs    := modpost.o file2alias.o sumversion.o symsearch.o
> > >
> > >  devicetable-offsets-file := devicetable-offsets.h
> > >
> > > +HOSTCFLAGS_file2alias.o += -D_UUID_T -D__GETHOSTUUID_H
> > > +
> > >  $(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s FORCE
> > >         $(call filechk,offsets,__DEVICETABLE_OFFSETS_H__)
> > >
> > > diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> > > index 99dce93a4188..ab743f6d60ef 100644
> > > --- a/scripts/mod/file2alias.c
> > > +++ b/scripts/mod/file2alias.c
> > > @@ -11,6 +11,9 @@
> > >   */
> > >
> > >  #include "modpost.h"
> > > +#ifdef __APPLE__
> > > +#define uuid_t sys_uuid_t
> > > +#endif
> > >  #include "devicetable-offsets.h"
> >
> >
> >
> >
> > Is this what Nicolas suggested?
> > https://lore.kernel.org/lkml/20240807-sexy-roadrunner-of-acceptance-a84bbf@lindesnes/
> >
> >
> > I thought he suggested replacing #ifdef __APPLE__
> > with -D_UUID_T -D__GETHOSTUUID_H.
> >
> >
> > You added -D_UUID_T -D__GETHOSTUUID_H,
> > keeping #ifdef __APPLE__.
>
> I forgot to remove this.
>
> Based on your suggestion in the other thread to use/overwrite
> HOSTCFLAGS via the command line, it seems I should drop this patch.
> Can you confirm?


Yes, I think this patch is unnecessary because:

 [1] You can feed "-D_UUID_T -D__GETHOSTUUID_H"
     from the HOSTCFLAGS env variable
 [2] uuid_t may be dropped if I succeed in
     refactoring modpost in the future
Jeff Xie Sept. 12, 2024, 12:02 p.m. UTC | #10
Thank you for submitting this patchset. This problem has troubled me
for two years.
I have always built the kernel in the docker container. I have tested
this patchset and it is very good.
Tested-by: Jeff Xie <xiehuan09@gmail.com>

On Fri, Sep 6, 2024 at 7:04 PM Daniel Gomez via B4 Relay
<devnull+da.gomez.samsung.com@kernel.org> wrote:
>
> 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 <masahiroy@kernel.org>
> To: Nathan Chancellor <nathan@kernel.org>
> To: Nicolas Schier <nicolas@fjasle.eu>
> To: Lucas De Marchi <lucas.demarchi@intel.com>
> To: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> To: Rodrigo Vivi <rodrigo.vivi@intel.com>
> To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> To: Maxime Ripard <mripard@kernel.org>
> To: Thomas Zimmermann <tzimmermann@suse.de>
> To: David Airlie <airlied@gmail.com>
> To: Daniel Vetter <daniel@ffwll.ch>
> To: William Hubbs <w.d.hubbs@gmail.com>
> To: Chris Brannon <chris@the-brannons.com>
> To: Kirk Reiser <kirk@reisers.ca>
> To: Samuel Thibault <samuel.thibault@ens-lyon.org>
> To: Paul Moore <paul@paul-moore.com>
> To: Stephen Smalley <stephen.smalley.work@gmail.com>
> To: Ondrej Mosnacek <omosnace@redhat.com>
> To: Catalin Marinas <catalin.marinas@arm.com>
> To: Will Deacon <will@kernel.org>
> To: Marc Zyngier <maz@kernel.org>
> To: Oliver Upton <oliver.upton@linux.dev>
> To: James Morse <james.morse@arm.com>
> To: Suzuki K Poulose <suzuki.poulose@arm.com>
> To: Zenghui Yu <yuzenghui@huawei.com>
> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> To: Jiri Slaby <jirislaby@kernel.org>
> To: Nick Desaulniers <ndesaulniers@google.com>
> To: Bill Wendling <morbo@google.com>
> To: Justin Stitt <justinstitt@google.com>
> 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 <me@kloenk.dev>
> Cc: Daniel Gomez (Samsung) <d+samsung@kruces.com>
> Cc: gost.dev@samsung.com
>
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> ---
> 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 <linux/*.h> 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,
> --
> Daniel Gomez <da.gomez@samsung.com>
>
>
>