The Linux kernel mailing list has published a set of patches enabling the building of the Linux kernel for the ARM64 architecture in a macOS environment using the standard LLVM-based build tools. In addition to modifying the kernel build scripts and including extra header files in several code files, it also requires the installation of a package in macOS containing Linux-specific header files (byteswap.h, elf.h, and endian.h) for the build process.
Source: opennet.ru