Test with random patches
cover Test with random patches
From: jw910731 <[email protected]>
Test message with some random untested patch.
jw910731 (1):
[WIP] Try compile linux on macOS with the help of nix
flake.lock | 82 ++++++++++++++++++++++++++++++++ flake.nix | 43 +++++++++++++++++ scripts/Kconfig.include | 2 +- scripts/install.sh | 2 +- scripts/macos-include/byteswap.h | 4 ++ scripts/macos-include/elf.h | 24 ++++++++++ scripts/macos-include/endian.h | 8 ++++ scripts/mod/file2alias.c | 3 ++ usr/gen_init_cpio.c | 4 +- 9 files changed, 168 insertions(+), 4 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 scripts/macos-include/byteswap.h create mode 100644 scripts/macos-include/elf.h create mode 100644 scripts/macos-include/endian.h
Signature · 1 line
2.51.2
PATCH 1/1 Try compile linux on macOS with the help of nix
From: jw910731 <[email protected]>
--- flake.lock | 82 ++++++++++++++++++++++++++++++++ flake.nix | 43 +++++++++++++++++ scripts/Kconfig.include | 2 +- scripts/install.sh | 2 +- scripts/macos-include/byteswap.h | 4 ++ scripts/macos-include/elf.h | 24 ++++++++++ scripts/macos-include/endian.h | 8 ++++ scripts/mod/file2alias.c | 3 ++ usr/gen_init_cpio.c | 4 +- 9 files changed, 168 insertions(+), 4 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 scripts/macos-include/byteswap.h create mode 100644 scripts/macos-include/elf.h create mode 100644 scripts/macos-include/endian.h
flake.lock new file +82 -0
@@ -0,0 +1,82 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1772963539, + "narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9dcb002ca1690658be4a04645215baea8b95f31d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay", + "utils": "utils" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1773115373, + "narHash": "sha256-bfK9FJFcQth6f3ydYggS5m0z2NRGF/PY6Y2XgZDJ6pg=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "1924b4672a2b8e4aee6e6652ec2e59a8d3c5648e", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +}
flake.nix new file +43 -0
44 lines not on this page · raw message
scripts/Kconfig.include +1 -1
@@ -54,7 +54,7 @@ as-version := $(shell,set -- $(as-info) && echo $2) # Get the linker name, version, and error out if it is not supported. ld-info := $(shell,$(srctree)/scripts/ld-version.sh $(LD)) -$(error-if,$(success,test -z "$(ld-info)"),Sorry$(comma) this linker is not supported.) +$(error-if,$(success,test -z "$(ld-info)"),Sorry$(comma) this linker $(LD) is not supported.) ld-name := $(shell,set -- $(ld-info) && echo $1) ld-version := $(shell,set -- $(ld-info) && echo $2)
scripts/install.sh +1 -1
@@ -6,7 +6,7 @@ # Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin # Common code factored out by Masahiro Yamada -set -e +set -xe # Make sure the files actually exist for file in "${KBUILD_IMAGE}" System.map
scripts/macos-include/byteswap.h new file +4 -0
@@ -0,0 +1,4 @@ +#pragma once +#define bswap_16 __builtin_bswap16 +#define bswap_32 __builtin_bswap32 +#define bswap_64 __builtin_bswap64
scripts/macos-include/elf.h new file +24 -0
@@ -0,0 +1,24 @@ +#pragma once +#include <libelf/gelf.h> + +#define STT_SPARC_REGISTER 3 +#define R_386_32 1 +#define R_386_PC32 2 +#define R_MIPS_HI16 5 +#define R_MIPS_LO16 6 +#define R_MIPS_26 4 +#define R_MIPS_32 2 +#define R_ARM_ABS32 2 +#define R_ARM_REL32 3 +#define R_ARM_PC24 1 +#define R_ARM_CALL 28 +#define R_ARM_JUMP24 29 +#define R_ARM_THM_JUMP24 30 +#define R_ARM_THM_PC22 10 +#define R_ARM_MOVW_ABS_NC 43 +#define R_ARM_MOVT_ABS 44 +#define R_ARM_THM_MOVW_ABS_NC 47 +#define R_ARM_THM_MOVT_ABS 48 +#define R_ARM_THM_JUMP19 51 +#define R_AARCH64_ABS64 257 +#define R_AARCH64_PREL64 260
scripts/macos-include/endian.h new file +8 -0
@@ -0,0 +1,8 @@ +#pragma once +#include <machine/endian.h> +#include <libkern/OSByteOrder.h> + +#define le16toh (x) OSSwapLittleToHostInt16(x) +#define le32toh (x) OSSwapLittleToHostInt32(x) +#define le64toh (x) OSSwapLittleToHostInt64(x) +#define EM_AARCH64 183
scripts/mod/file2alias.c +3 -0
@@ -16,7 +16,10 @@#include "list.h" #include "xalloc.h" +#define _UUID_T +#define uuid_t int#include "modpost.h" +#undef uuid_t#include "devicetable-offsets.h" /* We use the ELF typedefs for kernel_ulong_t but bite the bullet and
usr/gen_init_cpio.c +2 -2
@@ -457,7 +457,7 @@ static int cpio_mkfile(const char *name, const char *location, goto error;if (size) { - this_read =copy_file_range (file,NULL , outfd,NULL , size,0 ); +// this_read = copy_file_range(file, NULL, outfd, NULL, size, 0); if (this_read >0 ) {if (this_read > size) goto error;
@@ -674,7 +674,7 @@ int main (int argc, char *argv[])break ;case 'o' : outfd =open (optarg, -O_WRONLY |O_CREAT |O_LARGEFILE |O_TRUNC , +O_WRONLY |O_CREAT |O_TRUNC ,0600 );if (outfd <0 ) {fprintf (stderr,"failed to open %s\n" , optarg);
Signature · 1 line
2.51.2
Re: [PATCH] [TEST 1/1] [WIP] Try compile linux on macOS with the help of nix
<[email protected]> 於 2026年4月12日週日 下午2:13寫道:
Quoted 4 lines
From: jw910731 <[email protected]>
Signed-off-by jw910731 <[email protected]>
Hi jw910731
The alias "jw910731" cannot be used for the Signed-off-by line because it violates the Developer's Certificate of Origin (DCO). According to the DCO, contributions must not be anonymous; the signer must use their legal name to establish a clear chain of responsibility and verify their right to submit the code under an open-source license.
--
Regards,
Nick Huang
scripts/install.sh
Quoted 169 lines
--- flake.lock | 82 ++++++++++++++++++++++++++++++++ flake.nix | 43 +++++++++++++++++ scripts/Kconfig.include | 2 +- scripts/install.sh | 2 +- scripts/macos-include/byteswap.h | 4 ++ scripts/macos-include/elf.h | 24 ++++++++++ scripts/macos-include/endian.h | 8 ++++ scripts/mod/file2alias.c | 3 ++ usr/gen_init_cpio.c | 4 +- 9 files changed, 168 insertions(+), 4 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 scripts/macos-include/byteswap.h create mode 100644 scripts/macos-include/elf.h create mode 100644 scripts/macos-include/endian.hflake.lock new file +82
-0@@ -0,0 +1,82 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1772963539, + "narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9dcb002ca1690658be4a04645215baea8b95f31d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay", + "utils": "utils" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1773115373, + "narHash": "sha256-bfK9FJFcQth6f3ydYggS5m0z2NRGF/PY6Y2XgZDJ6pg=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "1924b4672a2b8e4aee6e6652ec2e59a8d3c5648e", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +}flake.nix new file +43
-0@@ -0,0 +1,43 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + utils.url = "github:numtide/flake-utils"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + }; + outputs = { self, nixpkgs, utils, rust-overlay }: utils.lib.eachDefaultSystem (system: + let + overlays = [ (import rust-overlay) ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + pkgsCross = pkgs.pkgsCross.aarch64-multiplatform; + in + { + devShell = pkgsCross.mkShell { + nativeBuildInputs = with pkgsCross; [ + gnumake + ncurses + flex + bison + lld + rustc + rust-bindgen + rustfmt + clippy + pahole + ]; + buildInputs = []; + HOSTCC="${pkgs.lib.getBin pkgs.clang}/bin/clang"; + HOSTLD="${pkgs.lib.getBin pkgs.lld}/bin/lld"; + HOSTCFLAGS="-I${pkgs.lib.getLib pkgs.libelf}/include -Iscripts/macos-include"; + NIX_CFLAGS_COMPILE="-march=armv8-a+crypto"; + RUST_LIB_SRC = "${pkgsCross.rust.packages.stable.rustPlatform.rustLibSrc}"; + }; + } + ); +}scripts/Kconfig.include +1
-1@@ -54,7 +54,7 @@ as-version := $(shell,set -- $(as-info) && echo $2) # Get the linker name, version, and error out if it is not supported. ld-info := $(shell,$(srctree)/scripts/ld-version.sh $(LD)) -$(error-if,$(success,test -z "$(ld-info)"),Sorry$(comma) this linker is not supported.) +$(error-if,$(success,test -z "$(ld-info)"),Sorry$(comma) this linker $(LD) is not supported.) ld-name := $(shell,set -- $(ld-info) && echo $1) ld-version := $(shell,set -- $(ld-info) && echo $2)scripts/install.sh +0
-0
This revision could include a more detailed explanation of why this change was made.
Quoted 106 lines
index
05d62ac51..b99183bb8100755scripts/install.sh +1
-1@@ -6,7 +6,7 @@ # Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin # Common code factored out by Masahiro Yamada -set -e +set -xe # Make sure the files actually exist for file in "${KBUILD_IMAGE}" System.mapscripts/macos-include/byteswap.h new file +4
-0@@ -0,0 +1,4 @@ +#pragma once +#define bswap_16 __builtin_bswap16 +#define bswap_32 __builtin_bswap32 +#define bswap_64 __builtin_bswap64scripts/macos-include/elf.h new file +24
-0@@ -0,0 +1,24 @@ +#pragma once +#include <libelf/gelf.h> + +#define STT_SPARC_REGISTER 3 +#define R_386_32 1 +#define R_386_PC32 2 +#define R_MIPS_HI16 5 +#define R_MIPS_LO16 6 +#define R_MIPS_26 4 +#define R_MIPS_32 2 +#define R_ARM_ABS32 2 +#define R_ARM_REL32 3 +#define R_ARM_PC24 1 +#define R_ARM_CALL 28 +#define R_ARM_JUMP24 29 +#define R_ARM_THM_JUMP24 30 +#define R_ARM_THM_PC22 10 +#define R_ARM_MOVW_ABS_NC 43 +#define R_ARM_MOVT_ABS 44 +#define R_ARM_THM_MOVW_ABS_NC 47 +#define R_ARM_THM_MOVT_ABS 48 +#define R_ARM_THM_JUMP19 51 +#define R_AARCH64_ABS64 257 +#define R_AARCH64_PREL64 260scripts/macos-include/endian.h new file +8
-0@@ -0,0 +1,8 @@ +#pragma once +#include <machine/endian.h> +#include <libkern/OSByteOrder.h> + +#define le16toh (x) OSSwapLittleToHostInt16(x) +#define le32toh (x) OSSwapLittleToHostInt32(x) +#define le64toh (x) OSSwapLittleToHostInt64(x) +#define EM_AARCH64 183scripts/mod/file2alias.c +3
-0@@ -16,7 +16,10 @@#include "list.h" #include "xalloc.h" +#define _UUID_T +#define uuid_t int#include "modpost.h" +#undef uuid_t#include "devicetable-offsets.h" /* We use the ELF typedefs for kernel_ulong_t but bite the bullet and usr/gen_init_cpio.c +2
-3@@ -457,7 +457,7 @@ static int cpio_mkfile(const char *name, const char *location, goto error;if (size) { - this_read =copy_file_range (file,NULL , outfd,NULL , size,0 ); +// this_read = copy_file_range(file, NULL, outfd, NULL, size, 0); if (this_read >0 ) {if (this_read > size) goto error;@@ -674,7 +674,7 @@ int main (int argc, char *argv[])break ;case 'o' : outfd =open (optarg, -O_WRONLY |O_CREAT |O_LARGEFILE |O_TRUNC , +O_WRONLY |O_CREAT |O_TRUNC ,0600 );if (outfd <0 ) {fprintf (stderr,"failed to open %s\n" , optarg); --2.51.2