Added working macbook m1 config
This commit is contained in:
parent
753d9c0e96
commit
6ffdf4a0ee
33 changed files with 9639 additions and 46 deletions
|
|
@ -0,0 +1,40 @@
|
|||
From 0fcdbacd8b06c24f5761a0cf9cb0c43cad05c19b Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Watson <twatson52@icloud.com>
|
||||
Date: Mon, 26 Feb 2024 19:51:12 -0600
|
||||
Subject: [PATCH] fs/fcntl: accept more values as F_DUPFD_CLOEXEC args
|
||||
|
||||
libwebrtc doesn't pass anything as the arg to this function so the
|
||||
minimum fd ends up as random garbage. If it's bigger than the maximum
|
||||
fd, which is likely, then the duplication fails, and libwebrtc breaks.
|
||||
|
||||
The previous patch (081abc5fa701738699705a6c0a41c824df77cb37) rejects
|
||||
args >= 1024 (the default soft max fd) and instead subtitutes a minimum
|
||||
fd of 0 to allow such requests to succeed.
|
||||
|
||||
However, gnulib's test suite can pass the following values and expects
|
||||
them to fail; this patch prevents those from succeeding:
|
||||
* -1 (hard-coded)
|
||||
* 1024 (`ulimit -n` value by default)
|
||||
* 1048576 (`ulimit -n` value in Nix build sandbox)
|
||||
|
||||
Hopefully the garbage values libwebrtc passes do not match very often.
|
||||
---
|
||||
fs/fcntl.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fs/fcntl.c b/fs/fcntl.c
|
||||
index f18f87419445..65a6861476ec 100644
|
||||
--- a/fs/fcntl.c
|
||||
+++ b/fs/fcntl.c
|
||||
@@ -326,7 +326,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
|
||||
err = f_dupfd(argi, filp, 0);
|
||||
break;
|
||||
case F_DUPFD_CLOEXEC:
|
||||
- if (arg >= 1024)
|
||||
+ if ((arg > 1024) && (argi != 1048576) && (argi != -1))
|
||||
argi = 0; /* Lol libwebrtc */
|
||||
err = f_dupfd(argi, filp, O_CLOEXEC);
|
||||
break;
|
||||
--
|
||||
2.43.0
|
||||
|
||||
7852
nixos/macos/apple-silicon-support/packages/linux-asahi/config
Normal file
7852
nixos/macos/apple-silicon-support/packages/linux-asahi/config
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,126 @@
|
|||
{ lib
|
||||
, pkgs
|
||||
, callPackage
|
||||
, writeShellScriptBin
|
||||
, writeText
|
||||
, linuxPackagesFor
|
||||
, withRust ? false
|
||||
, _kernelPatches ? [ ]
|
||||
}:
|
||||
|
||||
let
|
||||
i = builtins.elemAt;
|
||||
|
||||
# parse <OPT> [ymn]|foo style configuration as found in a patch's extraConfig
|
||||
# into a list of k, v tuples
|
||||
parseExtraConfig = config:
|
||||
let
|
||||
lines =
|
||||
builtins.filter (s: s != "") (lib.strings.splitString "\n" config);
|
||||
parseLine = line: let
|
||||
t = lib.strings.splitString " " line;
|
||||
join = l: builtins.foldl' (a: b: "${a} ${b}")
|
||||
(builtins.head l) (builtins.tail l);
|
||||
v = if (builtins.length t) > 2 then join (builtins.tail t) else (i t 1);
|
||||
in [ "CONFIG_${i t 0}" v ];
|
||||
in map parseLine lines;
|
||||
|
||||
# parse <OPT>=lib.kernel.(yes|module|no)|lib.kernel.freeform "foo"
|
||||
# style configuration as found in a patch's extraStructuredConfig into
|
||||
# a list of k, v tuples
|
||||
parseExtraStructuredConfig = config: lib.attrsets.mapAttrsToList
|
||||
(k: v: [ "CONFIG_${k}" (v.tristate or v.freeform) ] ) config;
|
||||
|
||||
parsePatchConfig = { extraConfig ? "", extraStructuredConfig ? {}, ... }:
|
||||
(parseExtraConfig extraConfig) ++
|
||||
(parseExtraStructuredConfig extraStructuredConfig);
|
||||
|
||||
# parse CONFIG_<OPT>=[ymn]|"foo" style configuration as found in a config file
|
||||
# into a list of k, v tuples
|
||||
parseConfig = config:
|
||||
let
|
||||
parseLine = builtins.match ''(CONFIG_[[:upper:][:digit:]_]+)=(([ymn])|"([^"]*)")'';
|
||||
# get either the [ymn] option or the "foo" option; whichever matched
|
||||
t = l: let v = (i l 2); in [ (i l 0) (if v != null then v else (i l 3)) ];
|
||||
lines = lib.strings.splitString "\n" config;
|
||||
in map t (builtins.filter (l: l != null) (map parseLine lines));
|
||||
|
||||
origConfigfile = ./config;
|
||||
|
||||
linux-asahi-pkg = { stdenv, lib, fetchFromGitHub, fetchpatch, linuxKernel,
|
||||
rustPlatform, rustc, rustfmt, rust-bindgen, ... } @ args:
|
||||
let
|
||||
origConfigText = builtins.readFile origConfigfile;
|
||||
|
||||
# extraConfig from all patches in order
|
||||
extraConfig =
|
||||
lib.fold (patch: ex: ex ++ (parsePatchConfig patch)) [] _kernelPatches;
|
||||
# config file text for above
|
||||
extraConfigText = let
|
||||
text = k: v: if (v == "y") || (v == "m") || (v == "n")
|
||||
then "${k}=${v}" else ''${k}="${v}"'';
|
||||
in (map (t: text (i t 0) (i t 1)) extraConfig);
|
||||
|
||||
# final config as a text file path
|
||||
configfile = if extraConfig == [] then origConfigfile else
|
||||
writeText "config" ''
|
||||
${origConfigText}
|
||||
|
||||
# Patches
|
||||
${lib.strings.concatStringsSep "\n" extraConfigText}
|
||||
'';
|
||||
# final config as an attrset
|
||||
configAttrs = let
|
||||
makePair = t: lib.nameValuePair (i t 0) (i t 1);
|
||||
configList = (parseConfig origConfigText) ++ extraConfig;
|
||||
in builtins.listToAttrs (map makePair (lib.lists.reverseList configList));
|
||||
|
||||
# used to (ostensibly) keep compatibility for those running stable versions of nixos
|
||||
rustOlder = version: withRust && (lib.versionOlder rustc.version version);
|
||||
bindgenOlder = version: withRust && (lib.versionOlder rust-bindgen.unwrapped.version version);
|
||||
|
||||
# used to fix issues when nixpkgs gets ahead of the kernel
|
||||
rustAtLeast = version: withRust && (lib.versionAtLeast rustc.version version);
|
||||
bindgenAtLeast = version: withRust && (lib.versionAtLeast rust-bindgen.unwrapped.version version);
|
||||
in
|
||||
(linuxKernel.manualConfig rec {
|
||||
inherit stdenv lib;
|
||||
|
||||
version = "6.10.6-asahi";
|
||||
modDirVersion = version;
|
||||
extraMeta.branch = "6.10";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
# tracking: https://github.com/AsahiLinux/linux/tree/asahi-wip (w/ fedora verification)
|
||||
owner = "AsahiLinux";
|
||||
repo = "linux";
|
||||
rev = "asahi-6.10.6-1";
|
||||
hash = "sha256-qm+0YYHehR2GP/MNAnTSPCBhb1vpnR50bbpfap74BRc=";
|
||||
};
|
||||
|
||||
kernelPatches = [
|
||||
{ name = "coreutils-fix";
|
||||
patch = ./0001-fs-fcntl-accept-more-values-as-F_DUPFD_CLOEXEC-args.patch;
|
||||
}
|
||||
] ++ lib.optionals (rustAtLeast "1.82.0") [
|
||||
{ name = "rustc_1.82.0";
|
||||
patch = ./rustc_1.82.0.patch;
|
||||
}
|
||||
] ++ _kernelPatches;
|
||||
|
||||
inherit configfile;
|
||||
# hide Rust support from the nixpkgs infra to avoid it re-adding the rust packages.
|
||||
# we can't use it until it's in stable and until we've evaluated the cross-compilation impact.
|
||||
config = configAttrs // { "CONFIG_RUST" = "n"; };
|
||||
} // (args.argsOverride or {})).overrideAttrs (old: if withRust then {
|
||||
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [
|
||||
rust-bindgen
|
||||
rustfmt
|
||||
rustc
|
||||
];
|
||||
RUST_LIB_SRC = rustPlatform.rustLibSrc;
|
||||
} else {});
|
||||
|
||||
linux-asahi = (callPackage linux-asahi-pkg { });
|
||||
in lib.recurseIntoAttrs (linuxPackagesFor linux-asahi)
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
|
||||
index f56e077b8f53..5e0625b41dad 100644
|
||||
--- a/rust/kernel/lib.rs
|
||||
+++ b/rust/kernel/lib.rs
|
||||
@@ -23,6 +23,7 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![feature(unsize)]
|
||||
#![warn(clippy::undocumented_unsafe_blocks)]
|
||||
+#![feature(box_uninit_write)]
|
||||
|
||||
// Ensure conditional compilation based on the kernel configuration works;
|
||||
// otherwise we may silently break things like initcall handling.
|
||||
Loading…
Add table
Add a link
Reference in a new issue