* [PATCH v2 0/8] Enable build system on macOS hosts
@ 2024-09-06 11:01 Daniel Gomez via B4 Relay
2024-09-06 11:01 ` [PATCH v2 1/8] scripts: subarch.include: fix SUBARCH " Daniel Gomez via B4 Relay
` (8 more replies)
0 siblings, 9 replies; 33+ messages in thread
From: Daniel Gomez via B4 Relay @ 2024-09-06 11:01 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Daniel Gomez, Nick Desaulniers
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>
^ permalink raw reply [flat|nested] 33+ messages in thread
* [PATCH v2 1/8] scripts: subarch.include: fix SUBARCH on macOS hosts
2024-09-06 11:01 [PATCH v2 0/8] Enable build system on macOS hosts Daniel Gomez via B4 Relay
@ 2024-09-06 11:01 ` Daniel Gomez via B4 Relay
2024-09-08 14:05 ` Masahiro Yamada
2024-09-06 11:01 ` [PATCH v2 2/8] file2alias: fix uuid_t definitions for macos Daniel Gomez via B4 Relay
` (7 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Daniel Gomez via B4 Relay @ 2024-09-06 11:01 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Daniel Gomez, Nick Desaulniers
From: Nick Desaulniers <nick.desaulniers@gmail.com>
When building the Linux kernel on an aarch64 macOS based host, if we don't
specify a value for ARCH when invoking make, we default to arm and thus
multi_v7_defconfig rather than the expected arm64 and arm64's defconfig.
This is because subarch.include invokes `uname -m` which on MacOS hosts
evaluates to `arm64` but on Linux hosts evaluates to `aarch64`,
This allows us to build ARCH=arm64 natively on macOS (as in ARCH need
not be specified on an aarch64-based system).
Avoid matching arm64 by excluding it from the arm.* sed expression.
Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
scripts/subarch.include | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/subarch.include b/scripts/subarch.include
index 4bd327d0ae42..c4592d59d69b 100644
--- a/scripts/subarch.include
+++ b/scripts/subarch.include
@@ -6,7 +6,7 @@
SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
-e s/sun4u/sparc64/ \
- -e s/arm.*/arm/ -e s/sa110/arm/ \
+ -e /^arm64$$/!s/arm.*/arm/ -e s/sa110/arm/ \
-e s/s390x/s390/ \
-e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
-e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
--
2.46.0
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v2 2/8] file2alias: fix uuid_t definitions for macos
2024-09-06 11:01 [PATCH v2 0/8] Enable build system on macOS hosts Daniel Gomez via B4 Relay
2024-09-06 11:01 ` [PATCH v2 1/8] scripts: subarch.include: fix SUBARCH " Daniel Gomez via B4 Relay
@ 2024-09-06 11:01 ` Daniel Gomez via B4 Relay
2024-09-07 23:56 ` Masahiro Yamada
2024-10-03 22:32 ` Andy Shevchenko
2024-09-06 11:01 ` [PATCH v2 3/8] drm/xe: xe_gen_wa_oob: fix program_invocation_short_name " Daniel Gomez via B4 Relay
` (6 subsequent siblings)
8 siblings, 2 replies; 33+ messages in thread
From: Daniel Gomez via B4 Relay @ 2024-09-06 11:01 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Daniel Gomez
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"
/* We use the ELF typedefs for kernel_ulong_t but bite the bullet and
--
2.46.0
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v2 3/8] drm/xe: xe_gen_wa_oob: fix program_invocation_short_name for macos
2024-09-06 11:01 [PATCH v2 0/8] Enable build system on macOS hosts Daniel Gomez via B4 Relay
2024-09-06 11:01 ` [PATCH v2 1/8] scripts: subarch.include: fix SUBARCH " Daniel Gomez via B4 Relay
2024-09-06 11:01 ` [PATCH v2 2/8] file2alias: fix uuid_t definitions for macos Daniel Gomez via B4 Relay
@ 2024-09-06 11:01 ` Daniel Gomez via B4 Relay
2024-09-06 14:39 ` Masahiro Yamada
2024-09-06 11:01 ` [PATCH v2 4/8] arm64: nvhe: add bee-headers support Daniel Gomez via B4 Relay
` (5 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Daniel Gomez via B4 Relay @ 2024-09-06 11:01 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
Use getprogname() [1] instead of program_invocation_short_name() [2]
for macOS hosts.
[1]:
https://www.gnu.org/software/gnulib/manual/html_node/
program_005finvocation_005fshort_005fname.html
[2]:
https://developer.apple.com/library/archive/documentation/System/
Conceptual/ManPages_iPhoneOS/man3/getprogname.3.html
Fixes build error for macOS hosts:
drivers/gpu/drm/xe/xe_gen_wa_oob.c:34:3: error: use of
undeclared identifier 'program_invocation_short_name' 34 |
program_invocation_short_name); | ^ 1 error
generated.
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
drivers/gpu/drm/xe/xe_gen_wa_oob.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
index 904cf47925aa..0d933644d8a0 100644
--- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
+++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
@@ -8,6 +8,7 @@
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#define HEADER \
@@ -30,6 +31,9 @@
static void print_usage(FILE *f)
{
+#ifdef __APPLE__
+ const char *program_invocation_short_name = getprogname();
+#endif
fprintf(f, "usage: %s <input-rule-file> <generated-c-source-file> <generated-c-header-file>\n",
program_invocation_short_name);
}
--
2.46.0
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v2 4/8] arm64: nvhe: add bee-headers support
2024-09-06 11:01 [PATCH v2 0/8] Enable build system on macOS hosts Daniel Gomez via B4 Relay
` (2 preceding siblings ...)
2024-09-06 11:01 ` [PATCH v2 3/8] drm/xe: xe_gen_wa_oob: fix program_invocation_short_name " Daniel Gomez via B4 Relay
@ 2024-09-06 11:01 ` Daniel Gomez via B4 Relay
2024-09-06 14:02 ` Masahiro Yamada
2024-09-06 11:01 ` [PATCH v2 5/8] scripts: " Daniel Gomez via B4 Relay
` (4 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Daniel Gomez via B4 Relay @ 2024-09-06 11:01 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Daniel Gomez
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
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v2 5/8] scripts: add bee-headers support
2024-09-06 11:01 [PATCH v2 0/8] Enable build system on macOS hosts Daniel Gomez via B4 Relay
` (3 preceding siblings ...)
2024-09-06 11:01 ` [PATCH v2 4/8] arm64: nvhe: add bee-headers support Daniel Gomez via B4 Relay
@ 2024-09-06 11:01 ` Daniel Gomez via B4 Relay
2024-09-06 14:02 ` Masahiro Yamada
2024-09-06 11:01 ` [PATCH v2 6/8] selinux: do not include <linux/*.h> headers from host programs Daniel Gomez via B4 Relay
` (3 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Daniel Gomez via B4 Relay @ 2024-09-06 11:01 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Daniel Gomez
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__)
--
2.46.0
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v2 6/8] selinux: do not include <linux/*.h> headers from host programs
2024-09-06 11:01 [PATCH v2 0/8] Enable build system on macOS hosts Daniel Gomez via B4 Relay
` (4 preceding siblings ...)
2024-09-06 11:01 ` [PATCH v2 5/8] scripts: " Daniel Gomez via B4 Relay
@ 2024-09-06 11:01 ` Daniel Gomez via B4 Relay
2024-09-06 14:56 ` Paul Moore
2024-09-06 11:01 ` [PATCH v2 7/8] selinux: move genheaders to security/selinux/ Daniel Gomez via B4 Relay
` (2 subsequent siblings)
8 siblings, 1 reply; 33+ messages in thread
From: Daniel Gomez via B4 Relay @ 2024-09-06 11:01 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Daniel Gomez
From: Masahiro Yamada <masahiroy@kernel.org>
Commit bfc5e3a6af39 ("selinux: use the kernel headers when building
scripts/selinux") is not the right thing to do.
It is clear from the warning in include/uapi/linux/types.h:
#ifndef __EXPORTED_HEADERS__
#warning "Attempt to use kernel headers from user space, see https://kernelnewbies.org/KernelHeaders"
#endif /* __EXPORTED_HEADERS__ */
If you are inclined to define __EXPORTED_HEADERS__, you are likely doing
wrong.
Adding the comment:
/* NOTE: we really do want to use the kernel headers here */
does not justify the hack in any way.
Currently, <linux/*.h> headers are included for the following purposes:
- <linux/capability.h> is included to check CAP_LAST_CAP
- <linux/socket.h> in included to check PF_MAX
We can skip these checks when building host programs, as they will
be eventually tested when building the kernel space.
I got rid of <linux/stddef.h> from initial_sid_to_string.h because
it is likely that NULL is already defined. If you insist on making
it self-contained, you can add the following:
#ifdef __KERNEL__
#include <linux/stddef.h>
#else
#include <stddef.h>
#endif
scripts/selinux/mdp/mdp.c still includes <linux/kconfig.h>, which is
also discouraged and should be fixed by a follow-up refactoring.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
| 4 +---
| 3 ---
scripts/selinux/mdp/Makefile | 2 +-
scripts/selinux/mdp/mdp.c | 4 ----
security/selinux/include/classmap.h | 19 ++++++++++++-------
security/selinux/include/initial_sid_to_string.h | 2 --
6 files changed, 14 insertions(+), 20 deletions(-)
--git a/scripts/selinux/genheaders/Makefile b/scripts/selinux/genheaders/Makefile
index 1faf7f07e8db..866f60e78882 100644
--- a/scripts/selinux/genheaders/Makefile
+++ b/scripts/selinux/genheaders/Makefile
@@ -1,5 +1,3 @@
# SPDX-License-Identifier: GPL-2.0
hostprogs-always-y += genheaders
-HOST_EXTRACFLAGS += \
- -I$(srctree)/include/uapi -I$(srctree)/include \
- -I$(srctree)/security/selinux/include
+HOST_EXTRACFLAGS += -I$(srctree)/security/selinux/include
--git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c
index 15520806889e..3834d7eb0af6 100644
--- a/scripts/selinux/genheaders/genheaders.c
+++ b/scripts/selinux/genheaders/genheaders.c
@@ -1,8 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
-/* NOTE: we really do want to use the kernel headers here */
-#define __EXPORTED_HEADERS__
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/scripts/selinux/mdp/Makefile b/scripts/selinux/mdp/Makefile
index d61058ddd15c..673782e3212f 100644
--- a/scripts/selinux/mdp/Makefile
+++ b/scripts/selinux/mdp/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
hostprogs-always-y += mdp
HOST_EXTRACFLAGS += \
- -I$(srctree)/include/uapi -I$(srctree)/include \
+ -I$(srctree)/include \
-I$(srctree)/security/selinux/include -I$(objtree)/include
clean-files := policy.* file_contexts
diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c
index 1415604c3d24..52365921c043 100644
--- a/scripts/selinux/mdp/mdp.c
+++ b/scripts/selinux/mdp/mdp.c
@@ -11,10 +11,6 @@
* Authors: Serge E. Hallyn <serue@us.ibm.com>
*/
-
-/* NOTE: we really do want to use the kernel headers here */
-#define __EXPORTED_HEADERS__
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/security/selinux/include/classmap.h b/security/selinux/include/classmap.h
index 7229c9bf6c27..518209e1beb0 100644
--- a/security/selinux/include/classmap.h
+++ b/security/selinux/include/classmap.h
@@ -1,8 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
-#include <linux/capability.h>
-#include <linux/socket.h>
-
#define COMMON_FILE_SOCK_PERMS \
"ioctl", "read", "write", "create", "getattr", "setattr", "lock", \
"relabelfrom", "relabelto", "append", "map"
@@ -36,10 +33,6 @@
"mac_override", "mac_admin", "syslog", "wake_alarm", "block_suspend", \
"audit_read", "perfmon", "bpf", "checkpoint_restore"
-#if CAP_LAST_CAP > CAP_CHECKPOINT_RESTORE
-#error New capability defined, please update COMMON_CAP2_PERMS.
-#endif
-
/*
* Note: The name for any socket class should be suffixed by "socket",
* and doesn't contain more than one substr of "socket".
@@ -181,6 +174,18 @@ const struct security_class_mapping secclass_map[] = {
{ NULL }
};
+#ifdef __KERNEL__ /* avoid this check when building host programs */
+
+#include <linux/capability.h>
+
+#if CAP_LAST_CAP > CAP_CHECKPOINT_RESTORE
+#error New capability defined, please update COMMON_CAP2_PERMS.
+#endif
+
+#include <linux/socket.h>
+
#if PF_MAX > 46
#error New address family defined, please update secclass_map.
#endif
+
+#endif /* __KERNEL__ */
diff --git a/security/selinux/include/initial_sid_to_string.h b/security/selinux/include/initial_sid_to_string.h
index 99b353b2abb4..f683a78b21fd 100644
--- a/security/selinux/include/initial_sid_to_string.h
+++ b/security/selinux/include/initial_sid_to_string.h
@@ -1,7 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
-#include <linux/stddef.h>
-
static const char *const initial_sid_to_string[] = {
NULL, /* zero placeholder, not used */
"kernel", /* kernel / SECINITSID_KERNEL */
--
2.46.0
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v2 7/8] selinux: move genheaders to security/selinux/
2024-09-06 11:01 [PATCH v2 0/8] Enable build system on macOS hosts Daniel Gomez via B4 Relay
` (5 preceding siblings ...)
2024-09-06 11:01 ` [PATCH v2 6/8] selinux: do not include <linux/*.h> headers from host programs Daniel Gomez via B4 Relay
@ 2024-09-06 11:01 ` Daniel Gomez via B4 Relay
2024-09-06 14:54 ` Paul Moore
2024-09-06 11:01 ` [PATCH v2 8/8] Documentation: add howto build in macos Daniel Gomez via B4 Relay
2024-09-12 12:02 ` [PATCH v2 0/8] Enable build system on macOS hosts Jeff Xie
8 siblings, 1 reply; 33+ messages in thread
From: Daniel Gomez via B4 Relay @ 2024-09-06 11:01 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Daniel Gomez
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 +-
| 2 --
| 3 ---
security/selinux/.gitignore | 1 +
security/selinux/Makefile | 7 +++++--
| 0
7 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/scripts/remove-stale-files b/scripts/remove-stale-files
index 8fc55a749ccc..6e39fa8540df 100755
--- a/scripts/remove-stale-files
+++ b/scripts/remove-stale-files
@@ -20,6 +20,9 @@ set -e
# yard. Stale files stay in this file for a while (for some release cycles?),
# then will be really dead and removed from the code base entirely.
+# moved to security/selinux/genheaders
+rm -f scripts/selinux/genheaders/genheaders
+
rm -f *.spec
rm -f lib/test_fortify.log
diff --git a/scripts/selinux/Makefile b/scripts/selinux/Makefile
index 59494e14989b..4b1308fa5732 100644
--- a/scripts/selinux/Makefile
+++ b/scripts/selinux/Makefile
@@ -1,2 +1,2 @@
# SPDX-License-Identifier: GPL-2.0-only
-subdir-y := mdp genheaders
+subdir-y := mdp
diff --git a/scripts/selinux/genheaders/.gitignore b/scripts/selinux/genheaders/.gitignore
deleted file mode 100644
index 5fcadd307908..000000000000
--- a/scripts/selinux/genheaders/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-genheaders
diff --git a/scripts/selinux/genheaders/Makefile b/scripts/selinux/genheaders/Makefile
deleted file mode 100644
index 866f60e78882..000000000000
--- a/scripts/selinux/genheaders/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-hostprogs-always-y += genheaders
-HOST_EXTRACFLAGS += -I$(srctree)/security/selinux/include
diff --git a/security/selinux/.gitignore b/security/selinux/.gitignore
index 168fae13ca5a..01c0df8ab009 100644
--- a/security/selinux/.gitignore
+++ b/security/selinux/.gitignore
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
av_permissions.h
flask.h
+/genheaders
diff --git a/security/selinux/Makefile b/security/selinux/Makefile
index c47519ed8156..86f0575f670d 100644
--- a/security/selinux/Makefile
+++ b/security/selinux/Makefile
@@ -36,7 +36,10 @@ quiet_cmd_genhdrs = GEN $(addprefix $(obj)/,$(genhdrs))
# see the note above, replace the $targets and 'flask.h' rule with the lines
# below:
# targets += $(genhdrs)
-# $(addprefix $(obj)/,$(genhdrs)) &: scripts/selinux/...
+# $(addprefix $(obj)/,$(genhdrs)) &: $(obj)/genheaders FORCE
targets += flask.h
-$(obj)/flask.h: scripts/selinux/genheaders/genheaders FORCE
+$(obj)/flask.h: $(obj)/genheaders FORCE
$(call if_changed,genhdrs)
+
+hostprogs := genheaders
+HOST_EXTRACFLAGS += -I$(srctree)/security/selinux/include
diff --git a/scripts/selinux/genheaders/genheaders.c b/security/selinux/genheaders.c
similarity index 100%
rename from scripts/selinux/genheaders/genheaders.c
rename to security/selinux/genheaders.c
--
2.46.0
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [PATCH v2 8/8] Documentation: add howto build in macos
2024-09-06 11:01 [PATCH v2 0/8] Enable build system on macOS hosts Daniel Gomez via B4 Relay
` (6 preceding siblings ...)
2024-09-06 11:01 ` [PATCH v2 7/8] selinux: move genheaders to security/selinux/ Daniel Gomez via B4 Relay
@ 2024-09-06 11:01 ` Daniel Gomez via B4 Relay
2024-09-07 8:33 ` Masahiro Yamada
2024-09-12 12:02 ` [PATCH v2 0/8] Enable build system on macOS hosts Jeff Xie
8 siblings, 1 reply; 33+ messages in thread
From: Daniel Gomez via B4 Relay @ 2024-09-06 11:01 UTC (permalink / raw)
To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
Add documentation under kbuild/llvm to inform about the experimental
support for building the Linux kernel in macOS hosts environments.
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
Documentation/kbuild/llvm.rst | 78 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst
index 6dc66b4f31a7..de3bde925793 100644
--- a/Documentation/kbuild/llvm.rst
+++ b/Documentation/kbuild/llvm.rst
@@ -186,6 +186,84 @@ yet. Bug reports are always welcome at the issue tracker below!
- Supported
- ``LLVM=1``
+Experimental Build in macOS
+---------------------------
+
+Building on macOS with LLVM is experimental. This section provides steps to
+install dependencies via Homebrew, set up the environment, and start the build
+process.
+
+1. **Create a Case-Sensitive Volume**
+
+ For fetching and building the project, you need a case-sensitive volume. Use the following
+ command to create one:
+
+ .. code-block:: shell
+
+ diskutil apfs addVolume /dev/disk<N> "Case-sensitive APFS" linux
+
+ Replace `/dev/disk<N>` with the appropriate disk identifier.
+
+2. **Install Build Dependencies**
+
+Use Homebrew to install the required build dependencies.
+
+- **Core Utilities**: `coreutils`, `findutils`, `gnu-sed`, `gnu-tar`, `grep`,
+ `llvm`, `make`, and `pkg-config`.
+
+ .. code-block:: shell
+
+ brew install coreutils findutils gnu-sed gnu-tar grep llvm make pkg-config
+
+- **Bee Headers**: Install byteswap, elf and endian headers using the
+ `Bee Headers Project <https://github.com/bee-headers/headers>`_.
+
+ .. code-block:: shell
+
+ brew tap bee-headers/bee-headers
+ brew install bee-headers/bee-headers/bee-headers
+
+ After installation, verify the `CFLAGS` with `pkg-config`:
+
+ .. code-block:: shell
+
+ pkg-config --cflags bee-headers
+ -I/opt/homebrew/Cellar/bee-headers/0.1/include
+
+3. **Configure the PATH**
+
+ Include all the required GNU tools and LLVM in your `PATH`. This ensures that
+ the necessary tools are available during the build process.
+
+ .. code-block:: shell
+
+ 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"
+
+Building the Project
+--------------------
+
+Once the environment is set up, you can start the build process using LLVM. Run
+the following commands to initiate the build:
+
+.. code-block:: shell
+
+ make LLVM=1 allyesconfig
+ make LLVM=1 -j$(nproc)
+
+Supported in macOS
+~~~~~~~~~~~~~~~~~~
+
+At the moment, only arm64 is supported and tested with `allyesconfig` Makefile
+configuration target. Other Kconfig options not included in `allyesconfig`
+target and architectures may be supported as well as support in macOS is based
+on LLVM effort and maintenance.
+
Getting Help
------------
--
2.46.0
^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [PATCH v2 4/8] arm64: nvhe: add bee-headers support
2024-09-06 11:01 ` [PATCH v2 4/8] arm64: nvhe: add bee-headers support Daniel Gomez via B4 Relay
@ 2024-09-06 14:02 ` Masahiro Yamada
2024-09-07 9:27 ` Daniel Gomez (Samsung)
0 siblings, 1 reply; 33+ messages in thread
From: Masahiro Yamada @ 2024-09-06 14:02 UTC (permalink / raw)
To: da.gomez
Cc: Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev
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.
You need to do it outside.
$ HOSTCFLAGS=$(pkg-config --cflags bee-headers) make
or
$ export HOSTCFLAGS=$(pkg-config --cflags bee-headers)
$ make
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 5/8] scripts: add bee-headers support
2024-09-06 11:01 ` [PATCH v2 5/8] scripts: " Daniel Gomez via B4 Relay
@ 2024-09-06 14:02 ` Masahiro Yamada
0 siblings, 0 replies; 33+ messages in thread
From: Masahiro Yamada @ 2024-09-06 14:02 UTC (permalink / raw)
To: da.gomez
Cc: Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 3/8] drm/xe: xe_gen_wa_oob: fix program_invocation_short_name for macos
2024-09-06 11:01 ` [PATCH v2 3/8] drm/xe: xe_gen_wa_oob: fix program_invocation_short_name " Daniel Gomez via B4 Relay
@ 2024-09-06 14:39 ` Masahiro Yamada
2024-09-06 15:32 ` Jani Nikula
2024-09-19 19:12 ` Daniel Gomez
0 siblings, 2 replies; 33+ messages in thread
From: Masahiro Yamada @ 2024-09-06 14:39 UTC (permalink / raw)
To: da.gomez
Cc: Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev
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>
>
> Use getprogname() [1] instead of program_invocation_short_name() [2]
> for macOS hosts.
>
> [1]:
> https://www.gnu.org/software/gnulib/manual/html_node/
> program_005finvocation_005fshort_005fname.html
>
> [2]:
> https://developer.apple.com/library/archive/documentation/System/
> Conceptual/ManPages_iPhoneOS/man3/getprogname.3.html
>
> Fixes build error for macOS hosts:
>
> drivers/gpu/drm/xe/xe_gen_wa_oob.c:34:3: error: use of
> undeclared identifier 'program_invocation_short_name' 34 |
> program_invocation_short_name); | ^ 1 error
> generated.
>
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
> drivers/gpu/drm/xe/xe_gen_wa_oob.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> index 904cf47925aa..0d933644d8a0 100644
> --- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> +++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> @@ -8,6 +8,7 @@
> #include <errno.h>
> #include <stdbool.h>
> #include <stdio.h>
> +#include <stdlib.h>
> #include <string.h>
>
> #define HEADER \
> @@ -30,6 +31,9 @@
>
> static void print_usage(FILE *f)
> {
> +#ifdef __APPLE__
> + const char *program_invocation_short_name = getprogname();
> +#endif
> fprintf(f, "usage: %s <input-rule-file> <generated-c-source-file> <generated-c-header-file>\n",
> program_invocation_short_name);
> }
>
> --
> 2.46.0
>
>
Before adding such #ifdef, you should check how other programs do.
Solution 1 : hard-code the program name
diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
index 106ee2b027f0..9e9a29e2cecf 100644
--- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
+++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
@@ -30,8 +30,7 @@
static void print_usage(FILE *f)
{
- fprintf(f, "usage: %s <input-rule-file>
<generated-c-source-file> <generated-c-header-file>\n",
- program_invocation_short_name);
+ fprintf(f, "usage: xe_gen_wa_oob <input-rule-file>
<generated-c-source-file> <generated-c-header-file>\n");
}
static void print_parse_error(const char *err_msg, const char *line,
Solution 2: use argv[0]
diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
index 106ee2b027f0..600c63e88e46 100644
--- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
+++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
@@ -28,10 +28,10 @@
"\n" \
"#endif\n"
-static void print_usage(FILE *f)
+static void print_usage(FILE *f, const char *progname)
{
fprintf(f, "usage: %s <input-rule-file>
<generated-c-source-file> <generated-c-header-file>\n",
- program_invocation_short_name);
+ progname);
}
static void print_parse_error(const char *err_msg, const char *line,
@@ -136,7 +136,7 @@ int main(int argc, const char *argv[])
if (argc < 3) {
fprintf(stderr, "ERROR: wrong arguments\n");
- print_usage(stderr);
+ print_usage(stderr, argv[0]);
return 1;
}
--
Best Regards
Masahiro Yamada
^ permalink raw reply related [flat|nested] 33+ messages in thread
* Re: [PATCH v2 7/8] selinux: move genheaders to security/selinux/
2024-09-06 11:01 ` [PATCH v2 7/8] selinux: move genheaders to security/selinux/ Daniel Gomez via B4 Relay
@ 2024-09-06 14:54 ` Paul Moore
2024-09-06 15:06 ` Daniel Gomez (Samsung)
2024-09-06 15:37 ` Masahiro Yamada
0 siblings, 2 replies; 33+ messages in thread
From: Paul Moore @ 2024-09-06 14:54 UTC (permalink / raw)
To: da.gomez
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
William Hubbs, Chris Brannon, Kirk Reiser, Samuel Thibault,
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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev
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.
--
paul-moore.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 6/8] selinux: do not include <linux/*.h> headers from host programs
2024-09-06 11:01 ` [PATCH v2 6/8] selinux: do not include <linux/*.h> headers from host programs Daniel Gomez via B4 Relay
@ 2024-09-06 14:56 ` Paul Moore
2024-09-06 15:07 ` Daniel Gomez (Samsung)
0 siblings, 1 reply; 33+ messages in thread
From: Paul Moore @ 2024-09-06 14:56 UTC (permalink / raw)
To: da.gomez
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
William Hubbs, Chris Brannon, Kirk Reiser, Samuel Thibault,
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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev
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>
>
> Commit bfc5e3a6af39 ("selinux: use the kernel headers when building
> scripts/selinux") is not the right thing to do.
>
> It is clear from the warning in include/uapi/linux/types.h:
>
> #ifndef __EXPORTED_HEADERS__
> #warning "Attempt to use kernel headers from user space, see https://kernelnewbies.org/KernelHeaders"
> #endif /* __EXPORTED_HEADERS__ */
>
> If you are inclined to define __EXPORTED_HEADERS__, you are likely doing
> wrong.
>
> Adding the comment:
>
> /* NOTE: we really do want to use the kernel headers here */
>
> does not justify the hack in any way.
>
> Currently, <linux/*.h> headers are included for the following purposes:
>
> - <linux/capability.h> is included to check CAP_LAST_CAP
> - <linux/socket.h> in included to check PF_MAX
>
> We can skip these checks when building host programs, as they will
> be eventually tested when building the kernel space.
>
> I got rid of <linux/stddef.h> from initial_sid_to_string.h because
> it is likely that NULL is already defined. If you insist on making
> it self-contained, you can add the following:
>
> #ifdef __KERNEL__
> #include <linux/stddef.h>
> #else
> #include <stddef.h>
> #endif
>
> scripts/selinux/mdp/mdp.c still includes <linux/kconfig.h>, which is
> also discouraged and should be fixed by a follow-up refactoring.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> scripts/selinux/genheaders/Makefile | 4 +---
> scripts/selinux/genheaders/genheaders.c | 3 ---
> scripts/selinux/mdp/Makefile | 2 +-
> scripts/selinux/mdp/mdp.c | 4 ----
> security/selinux/include/classmap.h | 19 ++++++++++++-------
> security/selinux/include/initial_sid_to_string.h | 2 --
> 6 files changed, 14 insertions(+), 20 deletions(-)
Similar to patch 7/8, please read my comments on your previous posting
of this patch, it doesn't appear that you've made any of the changes I
asked for in your previous posting.
https://lore.kernel.org/selinux/317c7d20ab8a72975571cb554589522b@paul-moore.com
--
paul-moore.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 7/8] selinux: move genheaders to security/selinux/
2024-09-06 14:54 ` Paul Moore
@ 2024-09-06 15:06 ` Daniel Gomez (Samsung)
2024-09-06 15:37 ` Masahiro Yamada
1 sibling, 0 replies; 33+ messages in thread
From: Daniel Gomez (Samsung) @ 2024-09-06 15:06 UTC (permalink / raw)
To: Paul Moore
Cc: da.gomez, Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
William Hubbs, Chris Brannon, Kirk Reiser, Samuel Thibault,
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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
gost.dev
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 6/8] selinux: do not include <linux/*.h> headers from host programs
2024-09-06 14:56 ` Paul Moore
@ 2024-09-06 15:07 ` Daniel Gomez (Samsung)
0 siblings, 0 replies; 33+ messages in thread
From: Daniel Gomez (Samsung) @ 2024-09-06 15:07 UTC (permalink / raw)
To: Paul Moore
Cc: da.gomez, Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellström, Rodrigo Vivi,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
William Hubbs, Chris Brannon, Kirk Reiser, Samuel Thibault,
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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
gost.dev
On Fri, Sep 6, 2024 at 4:56 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>
> >
> > Commit bfc5e3a6af39 ("selinux: use the kernel headers when building
> > scripts/selinux") is not the right thing to do.
> >
> > It is clear from the warning in include/uapi/linux/types.h:
> >
> > #ifndef __EXPORTED_HEADERS__
> > #warning "Attempt to use kernel headers from user space, see https://kernelnewbies.org/KernelHeaders"
> > #endif /* __EXPORTED_HEADERS__ */
> >
> > If you are inclined to define __EXPORTED_HEADERS__, you are likely doing
> > wrong.
> >
> > Adding the comment:
> >
> > /* NOTE: we really do want to use the kernel headers here */
> >
> > does not justify the hack in any way.
> >
> > Currently, <linux/*.h> headers are included for the following purposes:
> >
> > - <linux/capability.h> is included to check CAP_LAST_CAP
> > - <linux/socket.h> in included to check PF_MAX
> >
> > We can skip these checks when building host programs, as they will
> > be eventually tested when building the kernel space.
> >
> > I got rid of <linux/stddef.h> from initial_sid_to_string.h because
> > it is likely that NULL is already defined. If you insist on making
> > it self-contained, you can add the following:
> >
> > #ifdef __KERNEL__
> > #include <linux/stddef.h>
> > #else
> > #include <stddef.h>
> > #endif
> >
> > scripts/selinux/mdp/mdp.c still includes <linux/kconfig.h>, which is
> > also discouraged and should be fixed by a follow-up refactoring.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> > scripts/selinux/genheaders/Makefile | 4 +---
> > scripts/selinux/genheaders/genheaders.c | 3 ---
> > scripts/selinux/mdp/Makefile | 2 +-
> > scripts/selinux/mdp/mdp.c | 4 ----
> > security/selinux/include/classmap.h | 19 ++++++++++++-------
> > security/selinux/include/initial_sid_to_string.h | 2 --
> > 6 files changed, 14 insertions(+), 20 deletions(-)
>
> Similar to patch 7/8, please read my comments on your previous posting
> of this patch, it doesn't appear that you've made any of the changes I
> asked for in your previous posting.
Sorry for the noise, Paul. I’ll review this one as well.
>
> https://lore.kernel.org/selinux/317c7d20ab8a72975571cb554589522b@paul-moore.com
>
> --
> paul-moore.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 3/8] drm/xe: xe_gen_wa_oob: fix program_invocation_short_name for macos
2024-09-06 14:39 ` Masahiro Yamada
@ 2024-09-06 15:32 ` Jani Nikula
2024-09-19 19:12 ` Daniel Gomez
1 sibling, 0 replies; 33+ messages in thread
From: Jani Nikula @ 2024-09-06 15:32 UTC (permalink / raw)
To: Masahiro Yamada, da.gomez
Cc: Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev
On Fri, 06 Sep 2024, 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>
>>
>> Use getprogname() [1] instead of program_invocation_short_name() [2]
>> for macOS hosts.
>>
>> [1]:
>> https://www.gnu.org/software/gnulib/manual/html_node/
>> program_005finvocation_005fshort_005fname.html
>>
>> [2]:
>> https://developer.apple.com/library/archive/documentation/System/
>> Conceptual/ManPages_iPhoneOS/man3/getprogname.3.html
>>
>> Fixes build error for macOS hosts:
>>
>> drivers/gpu/drm/xe/xe_gen_wa_oob.c:34:3: error: use of
>> undeclared identifier 'program_invocation_short_name' 34 |
>> program_invocation_short_name); | ^ 1 error
>> generated.
>>
>> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
>> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_gen_wa_oob.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
>> index 904cf47925aa..0d933644d8a0 100644
>> --- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
>> +++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
>> @@ -8,6 +8,7 @@
>> #include <errno.h>
>> #include <stdbool.h>
>> #include <stdio.h>
>> +#include <stdlib.h>
>> #include <string.h>
>>
>> #define HEADER \
>> @@ -30,6 +31,9 @@
>>
>> static void print_usage(FILE *f)
>> {
>> +#ifdef __APPLE__
>> + const char *program_invocation_short_name = getprogname();
>> +#endif
>> fprintf(f, "usage: %s <input-rule-file> <generated-c-source-file> <generated-c-header-file>\n",
>> program_invocation_short_name);
>> }
>>
>> --
>> 2.46.0
>>
>>
>
>
>
> Before adding such #ifdef, you should check how other programs do.
IMO either option is preferred over adding #ifdefs.
BR,
Jani.
>
>
>
>
>
>
>
>
>
> Solution 1 : hard-code the program name
>
>
> diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> index 106ee2b027f0..9e9a29e2cecf 100644
> --- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> +++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> @@ -30,8 +30,7 @@
>
> static void print_usage(FILE *f)
> {
> - fprintf(f, "usage: %s <input-rule-file>
> <generated-c-source-file> <generated-c-header-file>\n",
> - program_invocation_short_name);
> + fprintf(f, "usage: xe_gen_wa_oob <input-rule-file>
> <generated-c-source-file> <generated-c-header-file>\n");
> }
>
> static void print_parse_error(const char *err_msg, const char *line,
>
>
>
>
>
>
>
>
> Solution 2: use argv[0]
>
>
> diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> index 106ee2b027f0..600c63e88e46 100644
> --- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> +++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> @@ -28,10 +28,10 @@
> "\n" \
> "#endif\n"
>
> -static void print_usage(FILE *f)
> +static void print_usage(FILE *f, const char *progname)
> {
> fprintf(f, "usage: %s <input-rule-file>
> <generated-c-source-file> <generated-c-header-file>\n",
> - program_invocation_short_name);
> + progname);
> }
>
> static void print_parse_error(const char *err_msg, const char *line,
> @@ -136,7 +136,7 @@ int main(int argc, const char *argv[])
>
> if (argc < 3) {
> fprintf(stderr, "ERROR: wrong arguments\n");
> - print_usage(stderr);
> + print_usage(stderr, argv[0]);
> return 1;
> }
--
Jani Nikula, Intel
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 7/8] selinux: move genheaders to security/selinux/
2024-09-06 14:54 ` Paul Moore
2024-09-06 15:06 ` Daniel Gomez (Samsung)
@ 2024-09-06 15:37 ` Masahiro Yamada
2024-09-06 15:47 ` Paul Moore
1 sibling, 1 reply; 33+ messages in thread
From: Masahiro Yamada @ 2024-09-06 15:37 UTC (permalink / raw)
To: Paul Moore
Cc: da.gomez, Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellström, Rodrigo Vivi, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, William Hubbs,
Chris Brannon, Kirk Reiser, Samuel Thibault, 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, linux-kernel, linux-kbuild, intel-xe,
dri-devel, speakup, selinux, linux-arm-kernel, kvmarm,
linux-serial, llvm, Finn Behrens, Daniel Gomez (Samsung),
gost.dev
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 will reword it as follows:
--------------->8--------------------
selinux: move genheaders to security/selinux/
This tool is only used in security/selinux/Makefile.
Move it to security/selinux/ so that 'make clean' can clean it up.
Please note 'make clean' does not visit scripts/ because tools under
scripts/ are often used for external module builds. Obviously, genheaders
is not the case here.
--------------->8--------------------
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 7/8] selinux: move genheaders to security/selinux/
2024-09-06 15:37 ` Masahiro Yamada
@ 2024-09-06 15:47 ` Paul Moore
0 siblings, 0 replies; 33+ messages in thread
From: Paul Moore @ 2024-09-06 15:47 UTC (permalink / raw)
To: Masahiro Yamada
Cc: da.gomez, Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellström, Rodrigo Vivi, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, David Airlie, William Hubbs,
Chris Brannon, Kirk Reiser, Samuel Thibault, 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, linux-kernel, linux-kbuild, intel-xe,
dri-devel, speakup, selinux, linux-arm-kernel, kvmarm,
linux-serial, llvm, Finn Behrens, Daniel Gomez (Samsung),
gost.dev
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.
--
paul-moore.com
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 8/8] Documentation: add howto build in macos
2024-09-06 11:01 ` [PATCH v2 8/8] Documentation: add howto build in macos Daniel Gomez via B4 Relay
@ 2024-09-07 8:33 ` Masahiro Yamada
2024-09-07 9:32 ` Daniel Gomez (Samsung)
0 siblings, 1 reply; 33+ messages in thread
From: Masahiro Yamada @ 2024-09-07 8:33 UTC (permalink / raw)
To: da.gomez
Cc: Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev
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>
>
> Add documentation under kbuild/llvm to inform about the experimental
> support for building the Linux kernel in macOS hosts environments.
>
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Instead, you can add this instruction to:
https://github.com/bee-headers/homebrew-bee-headers/blob/main/README.md
> ---
> Documentation/kbuild/llvm.rst | 78 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 78 insertions(+)
>
> diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst
> index 6dc66b4f31a7..de3bde925793 100644
> --- a/Documentation/kbuild/llvm.rst
> +++ b/Documentation/kbuild/llvm.rst
> @@ -186,6 +186,84 @@ yet. Bug reports are always welcome at the issue tracker below!
> - Supported
> - ``LLVM=1``
>
> +Experimental Build in macOS
> +---------------------------
> +
> +Building on macOS with LLVM is experimental. This section provides steps to
> +install dependencies via Homebrew, set up the environment, and start the build
> +process.
> +
> +1. **Create a Case-Sensitive Volume**
> +
> + For fetching and building the project, you need a case-sensitive volume. Use the following
> + command to create one:
> +
> + .. code-block:: shell
> +
> + diskutil apfs addVolume /dev/disk<N> "Case-sensitive APFS" linux
> +
> + Replace `/dev/disk<N>` with the appropriate disk identifier.
> +
> +2. **Install Build Dependencies**
> +
> +Use Homebrew to install the required build dependencies.
> +
> +- **Core Utilities**: `coreutils`, `findutils`, `gnu-sed`, `gnu-tar`, `grep`,
> + `llvm`, `make`, and `pkg-config`.
> +
> + .. code-block:: shell
> +
> + brew install coreutils findutils gnu-sed gnu-tar grep llvm make pkg-config
> +
> +- **Bee Headers**: Install byteswap, elf and endian headers using the
> + `Bee Headers Project <https://github.com/bee-headers/headers>`_.
> +
> + .. code-block:: shell
> +
> + brew tap bee-headers/bee-headers
> + brew install bee-headers/bee-headers/bee-headers
> +
> + After installation, verify the `CFLAGS` with `pkg-config`:
> +
> + .. code-block:: shell
> +
> + pkg-config --cflags bee-headers
> + -I/opt/homebrew/Cellar/bee-headers/0.1/include
> +
> +3. **Configure the PATH**
> +
> + Include all the required GNU tools and LLVM in your `PATH`. This ensures that
> + the necessary tools are available during the build process.
> +
> + .. code-block:: shell
> +
> + 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"
> +
> +Building the Project
> +--------------------
> +
> +Once the environment is set up, you can start the build process using LLVM. Run
> +the following commands to initiate the build:
> +
> +.. code-block:: shell
> +
> + make LLVM=1 allyesconfig
> + make LLVM=1 -j$(nproc)
> +
> +Supported in macOS
> +~~~~~~~~~~~~~~~~~~
> +
> +At the moment, only arm64 is supported and tested with `allyesconfig` Makefile
> +configuration target. Other Kconfig options not included in `allyesconfig`
> +target and architectures may be supported as well as support in macOS is based
> +on LLVM effort and maintenance.
> +
> Getting Help
> ------------
>
>
> --
> 2.46.0
>
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 4/8] arm64: nvhe: add bee-headers support
2024-09-06 14:02 ` Masahiro Yamada
@ 2024-09-07 9:27 ` Daniel Gomez (Samsung)
2024-09-08 1:17 ` Masahiro Yamada
0 siblings, 1 reply; 33+ messages in thread
From: Daniel Gomez (Samsung) @ 2024-09-07 9:27 UTC (permalink / raw)
To: Masahiro Yamada
Cc: da.gomez, Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
gost.dev
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 8/8] Documentation: add howto build in macos
2024-09-07 8:33 ` Masahiro Yamada
@ 2024-09-07 9:32 ` Daniel Gomez (Samsung)
2024-09-08 1:29 ` Masahiro Yamada
2024-09-08 9:03 ` Marc Zyngier
0 siblings, 2 replies; 33+ messages in thread
From: Daniel Gomez (Samsung) @ 2024-09-07 9:32 UTC (permalink / raw)
To: Masahiro Yamada
Cc: da.gomez, Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
gost.dev
On Sat, Sep 7, 2024 at 10:33 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>
> >
> > Add documentation under kbuild/llvm to inform about the experimental
> > support for building the Linux kernel in macOS hosts environments.
> >
> > Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
>
>
> Instead, you can add this instruction to:
>
> https://github.com/bee-headers/homebrew-bee-headers/blob/main/README.md
Sure, that can be done as well. But the effort here is to have this
integrated. So, I think documentation should be in-tree.
>
>
>
>
>
> > ---
> > Documentation/kbuild/llvm.rst | 78 +++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 78 insertions(+)
> >
> > diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst
> > index 6dc66b4f31a7..de3bde925793 100644
> > --- a/Documentation/kbuild/llvm.rst
> > +++ b/Documentation/kbuild/llvm.rst
> > @@ -186,6 +186,84 @@ yet. Bug reports are always welcome at the issue tracker below!
> > - Supported
> > - ``LLVM=1``
> >
> > +Experimental Build in macOS
> > +---------------------------
> > +
> > +Building on macOS with LLVM is experimental. This section provides steps to
> > +install dependencies via Homebrew, set up the environment, and start the build
> > +process.
> > +
> > +1. **Create a Case-Sensitive Volume**
> > +
> > + For fetching and building the project, you need a case-sensitive volume. Use the following
> > + command to create one:
> > +
> > + .. code-block:: shell
> > +
> > + diskutil apfs addVolume /dev/disk<N> "Case-sensitive APFS" linux
> > +
> > + Replace `/dev/disk<N>` with the appropriate disk identifier.
> > +
> > +2. **Install Build Dependencies**
> > +
> > +Use Homebrew to install the required build dependencies.
> > +
> > +- **Core Utilities**: `coreutils`, `findutils`, `gnu-sed`, `gnu-tar`, `grep`,
> > + `llvm`, `make`, and `pkg-config`.
> > +
> > + .. code-block:: shell
> > +
> > + brew install coreutils findutils gnu-sed gnu-tar grep llvm make pkg-config
> > +
> > +- **Bee Headers**: Install byteswap, elf and endian headers using the
> > + `Bee Headers Project <https://github.com/bee-headers/headers>`_.
> > +
> > + .. code-block:: shell
> > +
> > + brew tap bee-headers/bee-headers
> > + brew install bee-headers/bee-headers/bee-headers
> > +
> > + After installation, verify the `CFLAGS` with `pkg-config`:
> > +
> > + .. code-block:: shell
> > +
> > + pkg-config --cflags bee-headers
> > + -I/opt/homebrew/Cellar/bee-headers/0.1/include
> > +
> > +3. **Configure the PATH**
> > +
> > + Include all the required GNU tools and LLVM in your `PATH`. This ensures that
> > + the necessary tools are available during the build process.
> > +
> > + .. code-block:: shell
> > +
> > + 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"
> > +
> > +Building the Project
> > +--------------------
> > +
> > +Once the environment is set up, you can start the build process using LLVM. Run
> > +the following commands to initiate the build:
> > +
> > +.. code-block:: shell
> > +
> > + make LLVM=1 allyesconfig
> > + make LLVM=1 -j$(nproc)
> > +
> > +Supported in macOS
> > +~~~~~~~~~~~~~~~~~~
> > +
> > +At the moment, only arm64 is supported and tested with `allyesconfig` Makefile
> > +configuration target. Other Kconfig options not included in `allyesconfig`
> > +target and architectures may be supported as well as support in macOS is based
> > +on LLVM effort and maintenance.
> > +
> > Getting Help
> > ------------
> >
> >
> > --
> > 2.46.0
> >
> >
>
>
> --
> Best Regards
> Masahiro Yamada
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 2/8] file2alias: fix uuid_t definitions for macos
2024-09-06 11:01 ` [PATCH v2 2/8] file2alias: fix uuid_t definitions for macos Daniel Gomez via B4 Relay
@ 2024-09-07 23:56 ` Masahiro Yamada
2024-09-08 17:40 ` Daniel Gomez (Samsung)
2024-10-03 22:32 ` Andy Shevchenko
1 sibling, 1 reply; 33+ messages in thread
From: Masahiro Yamada @ 2024-09-07 23:56 UTC (permalink / raw)
To: da.gomez
Cc: Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev
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
>
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 4/8] arm64: nvhe: add bee-headers support
2024-09-07 9:27 ` Daniel Gomez (Samsung)
@ 2024-09-08 1:17 ` Masahiro Yamada
0 siblings, 0 replies; 33+ messages in thread
From: Masahiro Yamada @ 2024-09-08 1:17 UTC (permalink / raw)
To: Daniel Gomez (Samsung)
Cc: da.gomez, Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
gost.dev
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 8/8] Documentation: add howto build in macos
2024-09-07 9:32 ` Daniel Gomez (Samsung)
@ 2024-09-08 1:29 ` Masahiro Yamada
2024-09-08 9:03 ` Marc Zyngier
1 sibling, 0 replies; 33+ messages in thread
From: Masahiro Yamada @ 2024-09-08 1:29 UTC (permalink / raw)
To: Daniel Gomez (Samsung)
Cc: da.gomez, Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
gost.dev
On Sat, Sep 7, 2024 at 6:32 PM Daniel Gomez (Samsung)
<d+samsung@kruces.com> wrote:
>
> On Sat, Sep 7, 2024 at 10:33 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>
> > >
> > > Add documentation under kbuild/llvm to inform about the experimental
> > > support for building the Linux kernel in macOS hosts environments.
> > >
> > > Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> >
> >
> > Instead, you can add this instruction to:
> >
> > https://github.com/bee-headers/homebrew-bee-headers/blob/main/README.md
>
> Sure, that can be done as well. But the effort here is to have this
> integrated. So, I think documentation should be in-tree.
I do not think so.
Most people are not compile-testing on macOS.
This is an unofficial tip, which you can advertise
somewhere else.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 8/8] Documentation: add howto build in macos
2024-09-07 9:32 ` Daniel Gomez (Samsung)
2024-09-08 1:29 ` Masahiro Yamada
@ 2024-09-08 9:03 ` Marc Zyngier
2024-09-24 8:51 ` Daniel Gomez
1 sibling, 1 reply; 33+ messages in thread
From: Marc Zyngier @ 2024-09-08 9:03 UTC (permalink / raw)
To: Daniel Gomez (Samsung)
Cc: Masahiro Yamada, da.gomez, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, Oliver Upton, James Morse, Suzuki K Poulose,
Zenghui Yu, Greg Kroah-Hartman, Jiri Slaby, Nick Desaulniers,
Bill Wendling, Justin Stitt, Simona Vetter, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
gost.dev
On Sat, 07 Sep 2024 10:32:20 +0100,
"Daniel Gomez (Samsung)" <d+samsung@kruces.com> wrote:
>
> On Sat, Sep 7, 2024 at 10:33 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>
> > >
> > > Add documentation under kbuild/llvm to inform about the experimental
> > > support for building the Linux kernel in macOS hosts environments.
> > >
> > > Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> >
> >
> > Instead, you can add this instruction to:
> >
> > https://github.com/bee-headers/homebrew-bee-headers/blob/main/README.md
>
> Sure, that can be done as well. But the effort here is to have this
> integrated. So, I think documentation should be in-tree.
I think this ship sailed the moment you ended-up with an external
dependency.
Having looked at this series (and in particular patch #4 which falls
under my remit), I can't help but think that the whole thing should
simply live as a wrapper around the pristine build system instead of
hacking things inside of it. You already pull external dependencies
(the include files). Just add a script that sets things up
(environment variables that already exist) and calls 'make' in the
kernel tree.
I also dislike that this is forcing "native" developers to cater for
an operating system they are unlikely to have access to. If I break
this hack tomorrow by adding a new dependency that MacOS doesn't
provide, how do I fix it? Should I drop my changes on the floor?
As an alternative, and since you already have to create a special
file-system to contain your kernel tree, you may as well run Linux in
a VM, which I am told works pretty well (QEMU supports HVF, and there
are plenty of corporate-friendly alternatives). This would solve your
problem once and for all.
Please don't take the above the wrong way. I'm sympathetic to what you
are trying to do. But this is IMO going in the wrong direction.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 1/8] scripts: subarch.include: fix SUBARCH on macOS hosts
2024-09-06 11:01 ` [PATCH v2 1/8] scripts: subarch.include: fix SUBARCH " Daniel Gomez via B4 Relay
@ 2024-09-08 14:05 ` Masahiro Yamada
0 siblings, 0 replies; 33+ messages in thread
From: Masahiro Yamada @ 2024-09-08 14:05 UTC (permalink / raw)
To: da.gomez
Cc: Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Nick Desaulniers
On Fri, Sep 6, 2024 at 8:01 PM Daniel Gomez via B4 Relay
<devnull+da.gomez.samsung.com@kernel.org> wrote:
>
> From: Nick Desaulniers <nick.desaulniers@gmail.com>
>
> When building the Linux kernel on an aarch64 macOS based host, if we don't
> specify a value for ARCH when invoking make, we default to arm and thus
> multi_v7_defconfig rather than the expected arm64 and arm64's defconfig.
>
> This is because subarch.include invokes `uname -m` which on MacOS hosts
> evaluates to `arm64` but on Linux hosts evaluates to `aarch64`,
>
> This allows us to build ARCH=arm64 natively on macOS (as in ARCH need
> not be specified on an aarch64-based system).
>
> Avoid matching arm64 by excluding it from the arm.* sed expression.
>
> Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
> ---
Applied to linux-kbuild with
Suggested-by: Nicolas Schier <nicolas@fjasle.eu>
Thanks.
> scripts/subarch.include | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/subarch.include b/scripts/subarch.include
> index 4bd327d0ae42..c4592d59d69b 100644
> --- a/scripts/subarch.include
> +++ b/scripts/subarch.include
> @@ -6,7 +6,7 @@
>
> SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
> -e s/sun4u/sparc64/ \
> - -e s/arm.*/arm/ -e s/sa110/arm/ \
> + -e /^arm64$$/!s/arm.*/arm/ -e s/sa110/arm/ \
> -e s/s390x/s390/ \
> -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
> -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
>
> --
> 2.46.0
>
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 2/8] file2alias: fix uuid_t definitions for macos
2024-09-07 23:56 ` Masahiro Yamada
@ 2024-09-08 17:40 ` Daniel Gomez (Samsung)
2024-09-09 5:40 ` Masahiro Yamada
0 siblings, 1 reply; 33+ messages in thread
From: Daniel Gomez (Samsung) @ 2024-09-08 17:40 UTC (permalink / raw)
To: Masahiro Yamada
Cc: da.gomez, Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
gost.dev
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
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 2/8] file2alias: fix uuid_t definitions for macos
2024-09-08 17:40 ` Daniel Gomez (Samsung)
@ 2024-09-09 5:40 ` Masahiro Yamada
0 siblings, 0 replies; 33+ messages in thread
From: Masahiro Yamada @ 2024-09-09 5:40 UTC (permalink / raw)
To: Daniel Gomez (Samsung)
Cc: da.gomez, Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
gost.dev
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
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 0/8] Enable build system on macOS hosts
2024-09-06 11:01 [PATCH v2 0/8] Enable build system on macOS hosts Daniel Gomez via B4 Relay
` (7 preceding siblings ...)
2024-09-06 11:01 ` [PATCH v2 8/8] Documentation: add howto build in macos Daniel Gomez via B4 Relay
@ 2024-09-12 12:02 ` Jeff Xie
8 siblings, 0 replies; 33+ messages in thread
From: Jeff Xie @ 2024-09-12 12:02 UTC (permalink / raw)
To: da.gomez
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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,
linux-kernel, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev, Nick Desaulniers
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>
>
>
>
--
Thanks,
JeffXie
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 3/8] drm/xe: xe_gen_wa_oob: fix program_invocation_short_name for macos
2024-09-06 14:39 ` Masahiro Yamada
2024-09-06 15:32 ` Jani Nikula
@ 2024-09-19 19:12 ` Daniel Gomez
1 sibling, 0 replies; 33+ messages in thread
From: Daniel Gomez @ 2024-09-19 19:12 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Nathan Chancellor, Nicolas Schier, Lucas De Marchi,
Thomas Hellströ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, linux-kernel,
linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev
On 9/6/2024 4:39 PM, Masahiro Yamada 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>
>>
>> Use getprogname() [1] instead of program_invocation_short_name() [2]
>> for macOS hosts.
>>
>> [1]:
>> https://www.gnu.org/software/gnulib/manual/html_node/
>> program_005finvocation_005fshort_005fname.html
>>
>> [2]:
>> https://developer.apple.com/library/archive/documentation/System/
>> Conceptual/ManPages_iPhoneOS/man3/getprogname.3.html
>>
>> Fixes build error for macOS hosts:
>>
>> drivers/gpu/drm/xe/xe_gen_wa_oob.c:34:3: error: use of
>> undeclared identifier 'program_invocation_short_name' 34 |
>> program_invocation_short_name); | ^ 1 error
>> generated.
>>
>> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
>> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_gen_wa_oob.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
>> index 904cf47925aa..0d933644d8a0 100644
>> --- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
>> +++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
>> @@ -8,6 +8,7 @@
>> #include <errno.h>
>> #include <stdbool.h>
>> #include <stdio.h>
>> +#include <stdlib.h>
>> #include <string.h>
>>
>> #define HEADER \
>> @@ -30,6 +31,9 @@
>>
>> static void print_usage(FILE *f)
>> {
>> +#ifdef __APPLE__
>> + const char *program_invocation_short_name = getprogname();
>> +#endif
>> fprintf(f, "usage: %s <input-rule-file> <generated-c-source-file> <generated-c-header-file>\n",
>> program_invocation_short_name);
>> }
>>
>> --
>> 2.46.0
>>
>>
>
>
>
> Before adding such #ifdef, you should check how other programs do.
>
>
>
>
>
>
>
>
>
> Solution 1 : hard-code the program name
>
>
> diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> index 106ee2b027f0..9e9a29e2cecf 100644
> --- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> +++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> @@ -30,8 +30,7 @@
>
> static void print_usage(FILE *f)
> {
> - fprintf(f, "usage: %s <input-rule-file>
> <generated-c-source-file> <generated-c-header-file>\n",
> - program_invocation_short_name);
> + fprintf(f, "usage: xe_gen_wa_oob <input-rule-file>
> <generated-c-source-file> <generated-c-header-file>\n");
> }
>
> static void print_parse_error(const char *err_msg, const char *line,
>
>
>
>
>
>
>
>
> Solution 2: use argv[0]
>
>
> diff --git a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> index 106ee2b027f0..600c63e88e46 100644
> --- a/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> +++ b/drivers/gpu/drm/xe/xe_gen_wa_oob.c
> @@ -28,10 +28,10 @@
> "\n" \
> "#endif\n"
>
> -static void print_usage(FILE *f)
> +static void print_usage(FILE *f, const char *progname)
> {
> fprintf(f, "usage: %s <input-rule-file>
> <generated-c-source-file> <generated-c-header-file>\n",
> - program_invocation_short_name);
> + progname);
> }
>
> static void print_parse_error(const char *err_msg, const char *line,
> @@ -136,7 +136,7 @@ int main(int argc, const char *argv[])
>
> if (argc < 3) {
> fprintf(stderr, "ERROR: wrong arguments\n");
> - print_usage(stderr);
> + print_usage(stderr, argv[0]);
> return 1;
> }
This approach looks good to me. I will drop Lucas' tag in favor to this.
Please, Lucas let me know if you disagree any of the proposals here or
if you have any preference. Otherwise, I'll resend this with solution 2.
>
>
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 8/8] Documentation: add howto build in macos
2024-09-08 9:03 ` Marc Zyngier
@ 2024-09-24 8:51 ` Daniel Gomez
0 siblings, 0 replies; 33+ messages in thread
From: Daniel Gomez @ 2024-09-24 8:51 UTC (permalink / raw)
To: Marc Zyngier
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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, Oliver Upton, James Morse, Suzuki K Poulose,
Zenghui Yu, Greg Kroah-Hartman, Jiri Slaby, Nick Desaulniers,
Bill Wendling, Justin Stitt, Simona Vetter,
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,
gost.dev@samsung.com, Daniel Gomez (Samsung)
On 9/8/2024 11:03 AM, Marc Zyngier wrote:
> On Sat, 07 Sep 2024 10:32:20 +0100,
> "Daniel Gomez (Samsung)" <d+samsung@kruces.com> wrote:
>>
>> On Sat, Sep 7, 2024 at 10:33 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>
>>>>
>>>> Add documentation under kbuild/llvm to inform about the experimental
>>>> support for building the Linux kernel in macOS hosts environments.
>>>>
>>>> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
>>>
>>>
>>> Instead, you can add this instruction to:
>>>
>>> https://protect2.fireeye.com/v1/url?k=f33af8a2-92b1ed94-f33b73ed-74fe485cbff1-7d382b34bfd617fc&q=1&e=c7a3e869-d48e-4168-88a9-03cd717797f0&u=https%3A%2F%2Fgithub.com%2Fbee-headers%2Fhomebrew-bee-headers%2Fblob%2Fmain%2FREADME.md
>>
>> Sure, that can be done as well. But the effort here is to have this
>> integrated. So, I think documentation should be in-tree.
>
> I think this ship sailed the moment you ended-up with an external
> dependency.
The external dependency is not different in Linux hosts. We depend on
byteswap.h, elf.h and endian.h headers. However, these are provided by
glibc and musl, and macOS (at least in arm64/Homebrew) does not provide
any of these.
To fix the dependency with these missing headers, it was suggested in v1
[1][2] to create a "development kit" for this hosts. And that is what
Bee Headers [3][4] aims to provide.
[1]https://lore.kernel.org/all/20240807-mottled-stoic-degu-d1e4cb@lindesnes/
[2]https://lore.kernel.org/all/ZrSoOM9z4VnqhOf2@fjasle.eu/
[3] https://github.com/bee-headers/headers
[4] https://github.com/bee-headers/homebrew-bee-headers
I don't see any other alternative to provide the missing headers other
than the suggested. Please let me know if you think other paths can be
explored and tested.
>
> Having looked at this series (and in particular patch #4 which falls
> under my remit), I can't help but think that the whole thing should
> simply live as a wrapper around the pristine build system instead of
> hacking things inside of it. You already pull external dependencies
> (the include files). Just add a script that sets things up
> (environment variables that already exist) and calls 'make' in the
> kernel tree.
Agree. This aligns very well with other feedback.
I've added a script to the Bee Headers [5] to help users init their
shell/Makefile environment.
[5]
https://github.com/bee-headers/homebrew-bee-headers/blob/main/bee-headers.rb#L28
>
> I also dislike that this is forcing "native" developers to cater for
> an operating system they are unlikely to have access to. If I break
> this hack tomorrow by adding a new dependency that MacOS doesn't
> provide, how do I fix it? Should I drop my changes on the floor?
>
> As an alternative, and since you already have to create a special
> file-system to contain your kernel tree, you may as well run Linux in
> a VM, which I am told works pretty well (QEMU supports HVF, and there
> are plenty of corporate-friendly alternatives). This would solve your
> problem once and for all.
This is a use case I'm trying to avoid with this series. QEMU HVF works
very well indeed but extracting the built objects/vmlinux/*.ko etc is
tedious and slow. Building natively allows users to boot a VM with QEMU
and -kernel argument directly. This is way faster than the suggested
alternative. In addition, lldb can be used to debug the kernel from the
host.
>
> Please don't take the above the wrong way. I'm sympathetic to what you
> are trying to do. But this is IMO going in the wrong direction.
First patch has been merged already and after some fixes in the build
system from Masahiro, this series only requires a small change in
xe_gen_wa_oob to make this work if users of this provide the missing
headers and set up the build environment properly.
I will send a v3 later today with the remaining patch.
Thanks Marc for sharing your views!
>
> Thanks,
>
> M.
>
^ permalink raw reply [flat|nested] 33+ messages in thread
* Re: [PATCH v2 2/8] file2alias: fix uuid_t definitions for macos
2024-09-06 11:01 ` [PATCH v2 2/8] file2alias: fix uuid_t definitions for macos Daniel Gomez via B4 Relay
2024-09-07 23:56 ` Masahiro Yamada
@ 2024-10-03 22:32 ` Andy Shevchenko
1 sibling, 0 replies; 33+ messages in thread
From: Andy Shevchenko @ 2024-10-03 22:32 UTC (permalink / raw)
To: Daniel Gomez
Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier,
Lucas De Marchi, Thomas Hellströ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,
linux-kernel, linux-kbuild, intel-xe, dri-devel, speakup, selinux,
linux-arm-kernel, kvmarm, linux-serial, llvm, Finn Behrens,
Daniel Gomez (Samsung), gost.dev
Fri, Sep 06, 2024 at 01:01:29PM +0200, Daniel Gomez kirjoitti:
> 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__)
> | ^~~~~~~~~~~
Please, shrink this to the valuable ~3-5 lines. No need to repeat the same for
each case!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 33+ messages in thread
end of thread, other threads:[~2024-10-03 22:33 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 11:01 [PATCH v2 0/8] Enable build system on macOS hosts Daniel Gomez via B4 Relay
2024-09-06 11:01 ` [PATCH v2 1/8] scripts: subarch.include: fix SUBARCH " Daniel Gomez via B4 Relay
2024-09-08 14:05 ` Masahiro Yamada
2024-09-06 11:01 ` [PATCH v2 2/8] file2alias: fix uuid_t definitions for macos Daniel Gomez via B4 Relay
2024-09-07 23:56 ` Masahiro Yamada
2024-09-08 17:40 ` Daniel Gomez (Samsung)
2024-09-09 5:40 ` Masahiro Yamada
2024-10-03 22:32 ` Andy Shevchenko
2024-09-06 11:01 ` [PATCH v2 3/8] drm/xe: xe_gen_wa_oob: fix program_invocation_short_name " Daniel Gomez via B4 Relay
2024-09-06 14:39 ` Masahiro Yamada
2024-09-06 15:32 ` Jani Nikula
2024-09-19 19:12 ` Daniel Gomez
2024-09-06 11:01 ` [PATCH v2 4/8] arm64: nvhe: add bee-headers support Daniel Gomez via B4 Relay
2024-09-06 14:02 ` Masahiro Yamada
2024-09-07 9:27 ` Daniel Gomez (Samsung)
2024-09-08 1:17 ` Masahiro Yamada
2024-09-06 11:01 ` [PATCH v2 5/8] scripts: " Daniel Gomez via B4 Relay
2024-09-06 14:02 ` Masahiro Yamada
2024-09-06 11:01 ` [PATCH v2 6/8] selinux: do not include <linux/*.h> headers from host programs Daniel Gomez via B4 Relay
2024-09-06 14:56 ` Paul Moore
2024-09-06 15:07 ` Daniel Gomez (Samsung)
2024-09-06 11:01 ` [PATCH v2 7/8] selinux: move genheaders to security/selinux/ Daniel Gomez via B4 Relay
2024-09-06 14:54 ` Paul Moore
2024-09-06 15:06 ` Daniel Gomez (Samsung)
2024-09-06 15:37 ` Masahiro Yamada
2024-09-06 15:47 ` Paul Moore
2024-09-06 11:01 ` [PATCH v2 8/8] Documentation: add howto build in macos Daniel Gomez via B4 Relay
2024-09-07 8:33 ` Masahiro Yamada
2024-09-07 9:32 ` Daniel Gomez (Samsung)
2024-09-08 1:29 ` Masahiro Yamada
2024-09-08 9:03 ` Marc Zyngier
2024-09-24 8:51 ` Daniel Gomez
2024-09-12 12:02 ` [PATCH v2 0/8] Enable build system on macOS hosts Jeff Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).