lmao perhaps
This commit is contained in:
@@ -33,6 +33,9 @@ let
|
|||||||
suffix = vars.suffix or "";
|
suffix = vars.suffix or "";
|
||||||
linux = {
|
linux = {
|
||||||
inherit (s.linux) version hash;
|
inherit (s.linux) version hash;
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs (s.linux ? fetcher && s.linux.fetcher == "github") {
|
||||||
|
inherit (s.linux) owner repo rev;
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
rev = s.config.rev;
|
rev = s.config.rev;
|
||||||
@@ -236,6 +239,9 @@ let
|
|||||||
withNTSync = false;
|
withNTSync = false;
|
||||||
withHDR = false;
|
withHDR = false;
|
||||||
|
|
||||||
|
# Enable Rust — required for DRM_ASAHI (AGX GPU) and APPLE_SEP
|
||||||
|
withRust = true;
|
||||||
|
|
||||||
# Disable module building extras that don't apply to aarch64 targets
|
# Disable module building extras that don't apply to aarch64 targets
|
||||||
packagesExtend =
|
packagesExtend =
|
||||||
_kernel: _final: prev:
|
_kernel: _final: prev:
|
||||||
|
|||||||
9
packages/linux-cachyos/lib/rust-pkgs.nix
Normal file
9
packages/linux-cachyos/lib/rust-pkgs.nix
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Resolve the Rust toolchain packages needed for CONFIG_RUST=y kernel builds.
|
||||||
|
# Uses buildPackages so cross-compilation works correctly (the compiler runs on
|
||||||
|
# the build machine but produces code for the host/target).
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
rustc = pkgs.buildPackages.rustc-unwrapped;
|
||||||
|
rustBindgen = pkgs.buildPackages.rust-bindgen-unwrapped;
|
||||||
|
rustLibSrc = pkgs.buildPackages.rustPlatform.rustLibSrc;
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
withHDR ? true,
|
withHDR ? true,
|
||||||
withoutDebug ? false,
|
withoutDebug ? false,
|
||||||
pageSize ? "4k",
|
pageSize ? "4k",
|
||||||
|
withRust ? false,
|
||||||
description ? "Linux EEVDF-BORE scheduler Kernel by CachyOS with other patches and improvements",
|
description ? "Linux EEVDF-BORE scheduler Kernel by CachyOS with other patches and improvements",
|
||||||
# For flakes
|
# For flakes
|
||||||
inputs ? { },
|
inputs ? { },
|
||||||
@@ -86,6 +87,7 @@ let
|
|||||||
description
|
description
|
||||||
withUpdateScript
|
withUpdateScript
|
||||||
pageSize
|
pageSize
|
||||||
|
withRust
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -93,15 +95,22 @@ let
|
|||||||
# - First we apply the changes fromt their PKGBUILD using kconfig;
|
# - First we apply the changes fromt their PKGBUILD using kconfig;
|
||||||
# - Then we NIXify it (in the update-script);
|
# - Then we NIXify it (in the update-script);
|
||||||
# - Last state is importing the NIXified version for building.
|
# - Last state is importing the NIXified version for building.
|
||||||
preparedConfigfile = callPackage ./prepare.nix {
|
rustPkgs = lib.optionalAttrs withRust (import ./lib/rust-pkgs.nix { inherit pkgs; });
|
||||||
inherit
|
|
||||||
cachyConfig
|
preparedConfigfile = callPackage ./prepare.nix (
|
||||||
stdenv
|
{
|
||||||
kernel
|
inherit
|
||||||
ogKernelConfigfile
|
cachyConfig
|
||||||
commonMakeFlags
|
stdenv
|
||||||
;
|
kernel
|
||||||
};
|
ogKernelConfigfile
|
||||||
|
commonMakeFlags
|
||||||
|
;
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs withRust {
|
||||||
|
inherit (rustPkgs) rustc rustBindgen rustLibSrc;
|
||||||
|
}
|
||||||
|
);
|
||||||
kconfigToNix = callPackage ./lib/kconfig-to-nix.nix {
|
kconfigToNix = callPackage ./lib/kconfig-to-nix.nix {
|
||||||
configfile = preparedConfigfile;
|
configfile = preparedConfigfile;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
kernel,
|
kernel,
|
||||||
ogKernelConfigfile,
|
ogKernelConfigfile,
|
||||||
commonMakeFlags,
|
commonMakeFlags,
|
||||||
|
# Rust toolchain — only injected when cachyConfig.withRust is true
|
||||||
|
rustc ? null,
|
||||||
|
rustBindgen ? null,
|
||||||
|
rustLibSrc ? null,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
version =
|
version =
|
||||||
@@ -148,7 +152,8 @@ let
|
|||||||
++ ntSyncConfig
|
++ ntSyncConfig
|
||||||
++ hdrConfig
|
++ hdrConfig
|
||||||
++ disableDebug
|
++ disableDebug
|
||||||
++ pageSizeConfig;
|
++ pageSizeConfig
|
||||||
|
++ asahiPlatformConfig;
|
||||||
|
|
||||||
# _cachy_config, defaults to "y"
|
# _cachy_config, defaults to "y"
|
||||||
basicCachyConfig = lib.optional cachyConfig.basicCachy "-e CACHY";
|
basicCachyConfig = lib.optional cachyConfig.basicCachy "-e CACHY";
|
||||||
@@ -406,6 +411,84 @@ let
|
|||||||
else
|
else
|
||||||
throw "Unsupported cachyos _hugepage";
|
throw "Unsupported cachyos _hugepage";
|
||||||
|
|
||||||
|
# Apple Silicon (Asahi) platform drivers
|
||||||
|
# Mirrors the options set in the asahi-alarm/PKGBUILDs linux-asahi config.
|
||||||
|
# ARCH_APPLE is the root Kconfig symbol; everything else gates on it.
|
||||||
|
# olddefconfig will auto-select most sub-options once ARCH_APPLE is on,
|
||||||
|
# but the hardware-specific drivers are listed explicitly so they aren't
|
||||||
|
# left as =m when we want them built-in, or omitted entirely.
|
||||||
|
asahiPlatformConfig = lib.optionals (cachyConfig.taste == "linux-cachyos-asahi") [
|
||||||
|
# Rust support — must come before any symbol that depends on it
|
||||||
|
"-e RUST"
|
||||||
|
|
||||||
|
# SoC platform — root symbol; must come first
|
||||||
|
"-e ARCH_APPLE"
|
||||||
|
|
||||||
|
# Interrupt controller
|
||||||
|
"-e APPLE_AIC"
|
||||||
|
|
||||||
|
# IOMMU (required for PCIe, GPU, and NVMe)
|
||||||
|
"-e APPLE_DART"
|
||||||
|
|
||||||
|
# RTKit coprocessor framework (required by GPU, audio, SEP)
|
||||||
|
"-e APPLE_RTKIT"
|
||||||
|
"-e APPLE_RTKIT_HELPER"
|
||||||
|
"-e APPLE_MAILBOX"
|
||||||
|
# Rust-based mailbox/rtkit (present in 6.18 Asahi tree)
|
||||||
|
"-e RUST_APPLE_MAILBOX"
|
||||||
|
"-e RUST_APPLE_RTKIT"
|
||||||
|
|
||||||
|
# Power management
|
||||||
|
"-e APPLE_PMGR_PWRSTATE"
|
||||||
|
"-e APPLE_PMGR_MISC"
|
||||||
|
|
||||||
|
# DMA controller (required by audio)
|
||||||
|
"-e APPLE_ADMAC"
|
||||||
|
|
||||||
|
# Security / SART (required by NVMe)
|
||||||
|
"-e APPLE_SART"
|
||||||
|
"-e APPLE_SEP"
|
||||||
|
|
||||||
|
# Storage
|
||||||
|
"-e NVME_APPLE"
|
||||||
|
|
||||||
|
# PCIe
|
||||||
|
"-e PCIE_APPLE"
|
||||||
|
|
||||||
|
# CPU frequency / idle
|
||||||
|
"-e ARM_APPLE_SOC_CPUFREQ"
|
||||||
|
"-e ARM_APPLE_CPUIDLE"
|
||||||
|
|
||||||
|
# Pin control
|
||||||
|
"-e PINCTRL_APPLE_GPIO"
|
||||||
|
|
||||||
|
# Display (DCP)
|
||||||
|
"-m DRM_APPLE"
|
||||||
|
"-e DRM_APPLE_AUDIO"
|
||||||
|
|
||||||
|
# GPU (Asahi AGX Rust driver)
|
||||||
|
"-e DRM_ASAHI"
|
||||||
|
|
||||||
|
# Audio
|
||||||
|
"-m SND_SOC_APPLE_MCA"
|
||||||
|
"-m SND_SOC_APPLE_MACAUDIO"
|
||||||
|
"-m SND_SOC_APPLE_AOP_AUDIO"
|
||||||
|
|
||||||
|
# Misc Apple SoC peripherals
|
||||||
|
"-e APPLE_DOCKCHANNEL"
|
||||||
|
"-e APPLE_WATCHDOG"
|
||||||
|
"-m APPLE_SIO"
|
||||||
|
"-m APPLE_AOP"
|
||||||
|
"-e APPLE_M1_CPU_PMU"
|
||||||
|
|
||||||
|
# 16K pages — Apple Silicon runs with 16K page granule
|
||||||
|
"-d ARM64_4K_PAGES"
|
||||||
|
"-e ARM64_16K_PAGES"
|
||||||
|
|
||||||
|
# NR_CPUS: Apple Silicon has at most ~16 cores; 64 is the Asahi default
|
||||||
|
"--set-val NR_CPUS 64"
|
||||||
|
];
|
||||||
|
|
||||||
# _damon, defaults to empty
|
# _damon, defaults to empty
|
||||||
damonConfig = lib.optionals cachyConfig.withDAMON [
|
damonConfig = lib.optionals cachyConfig.withDAMON [
|
||||||
"-e DAMON"
|
"-e DAMON"
|
||||||
@@ -449,11 +532,19 @@ let
|
|||||||
configTaste =
|
configTaste =
|
||||||
if cachyConfig.taste == "linux-cachyos-asahi" then "linux-cachyos-lts" else cachyConfig.taste;
|
if cachyConfig.taste == "linux-cachyos-asahi" then "linux-cachyos-lts" else cachyConfig.taste;
|
||||||
|
|
||||||
|
# Rust toolchain — needed so `make olddefconfig` can probe rustc and set
|
||||||
|
# RUSTC_VERSION correctly, which gates CONFIG_RUST and all rust-dependent
|
||||||
|
# symbols (DRM_ASAHI, APPLE_SEP, etc.)
|
||||||
|
rustNativeBuildInputs = lib.optionals cachyConfig.withRust [
|
||||||
|
rustc
|
||||||
|
rustBindgen
|
||||||
|
];
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
inherit src patches;
|
inherit src patches;
|
||||||
name = "linux-cachyos-config";
|
name = "linux-cachyos-config";
|
||||||
nativeBuildInputs = kernel.nativeBuildInputs ++ kernel.buildInputs;
|
nativeBuildInputs = kernel.nativeBuildInputs ++ kernel.buildInputs ++ rustNativeBuildInputs;
|
||||||
|
|
||||||
# Apply each patch with --forward (skip already-applied/reversed hunks) and
|
# Apply each patch with --forward (skip already-applied/reversed hunks) and
|
||||||
# --fuzz=3 (tolerate minor context differences due to kernel version skew).
|
# --fuzz=3 (tolerate minor context differences due to kernel version skew).
|
||||||
@@ -470,6 +561,11 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
|
|
||||||
makeFlags = commonMakeFlags;
|
makeFlags = commonMakeFlags;
|
||||||
|
|
||||||
|
env = lib.optionalAttrs cachyConfig.withRust {
|
||||||
|
RUST_LIB_SRC = rustLibSrc;
|
||||||
|
KRUSTFLAGS = "--remap-path-prefix ${rustLibSrc}=/";
|
||||||
|
};
|
||||||
|
|
||||||
postPhase = ''
|
postPhase = ''
|
||||||
${finalAttrs.passthru.extraVerPatch}
|
${finalAttrs.passthru.extraVerPatch}
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in New Issue
Block a user