Init at 5.15.43-rt45
This commit is contained in:
46
README.md
Normal file
46
README.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Raspberry Pi 4 PREEMPT_RT Kernel for NixOS
|
||||
This flake provides packages to build the [Raspberry Pi supplied kernel](https://github.com/raspberrypi/linux) with `PREEMPT_RT` enabled.
|
||||
|
||||
### Usage
|
||||
Add the overlay and set `boot.kernelPackages` to `pkgs.linuxPackages_rpi4_rt`
|
||||
|
||||
An example flake based system config with `boot.loader.raspberryPi` and `nixos-hardware`:
|
||||
|
||||
``` nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
nixos-hardware.url = "github:mattywillo/linux_rpi4_rt-nix";
|
||||
rpi4_rt.url = "github:this/url";
|
||||
};
|
||||
outputs = { self, nixpkgs, nixos-hardware, rpi4_rt }: {
|
||||
nixosConfigurations.rpi = nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
({pkgs, lib, ...}: {
|
||||
nixpkgs.overlays = [ rpi4_rt.overlay ];
|
||||
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
nixos-hardware.nixosModules.raspberry-pi-4
|
||||
];
|
||||
|
||||
boot.kernelPackages = pkgs.linux_rpi4_rt.linuxPackages;
|
||||
|
||||
boot.loader.grub.enable = false;
|
||||
boot.loader.grub.device = "nodev";
|
||||
|
||||
# Recent NixOS versions enforce uniqueness on installBootLoader
|
||||
# making nixos-hardware.raspberry-pi-4' and 'boot.loader.raspberryPi'
|
||||
# conflict, this line prevents nixos-hardware setting the bootloader
|
||||
boot.loader.generic-extlinux-compatible.enable = lib.mkForce false;
|
||||
|
||||
boot.loader.raspberryPi.enable = true;
|
||||
boot.loader.raspberryPi.version = 4;
|
||||
|
||||
#...regular system configuration...
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
10
default.nix
Normal file
10
default.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
(import
|
||||
(
|
||||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
)
|
||||
{ src = ./.; }
|
||||
).defaultNix
|
||||
43
flake.lock
generated
Normal file
43
flake.lock
generated
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1650374568,
|
||||
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1653845079,
|
||||
"narHash": "sha256-7ghaQZ+7JXLI9FgNH8+RQHAt3/ubT92j8NtjZleP6t4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b62ada430501de88dfbb08cea4eb98ead3a5e3e7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
31
flake.nix
Normal file
31
flake.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
flake-compat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
outputs = { self, nixpkgs, flake-compat }@inputs:
|
||||
let
|
||||
systems = nixpkgs.lib.platforms.linux;
|
||||
lib = nixpkgs.lib;
|
||||
packagePaths = rec {
|
||||
rpi4_rt_5_15 = ./packages/linux_rpi4_rt_5_15;
|
||||
rpi4_rt = rpi4_rt_5_15;
|
||||
};
|
||||
in rec {
|
||||
packages = lib.genAttrs systems (system:
|
||||
let
|
||||
pkgs = (lib.mapAttrs (n: v:
|
||||
lib.callPackageWith ((lib.recursiveUpdate packages.${system}
|
||||
nixpkgs.legacyPackages.${system}) // { inherit inputs; }) v { }) packagePaths);
|
||||
in (lib.mapAttrs' (n: v: lib.nameValuePair "linux_${n}" v) pkgs)
|
||||
// (lib.mapAttrs' (n: v: lib.nameValuePair "linuxPackages_${n}" v.linuxPackages) pkgs));
|
||||
legacyPackages = packages;
|
||||
overlay = final: prev:
|
||||
(lib.mapAttrs' (n: v: lib.nameValuePair "linux_${n}" (prev.callPackage v { raspberrypifw = prev.raspberrypifw; })) packagePaths)
|
||||
// (lib.mapAttrs' (n: v: lib.nameValuePair "linuxPackages_${n}" final."linux_${n}") packagePaths)
|
||||
// { raspberrypifw = final.linux_rpi4_rt.firmware; };
|
||||
};
|
||||
}
|
||||
40
packages/linux_rpi4_rt_5_15/default.nix
Normal file
40
packages/linux_rpi4_rt_5_15/default.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{ lib, linuxKernel, linuxPackagesFor, writeText, buildPackages, fetchurl, fetchFromGitHub, raspberrypifw, ... }: rec {
|
||||
kernel = linuxKernel.kernels.linux_rpi4.override {
|
||||
argsOverride = rec {
|
||||
modDirVersion = "5.15.43-rt45";
|
||||
version = "${modDirVersion}-notag";
|
||||
src = fetchFromGitHub {
|
||||
owner = "raspberrypi";
|
||||
repo = "linux";
|
||||
rev = "97be5486aeff2253079e75fc3222fbe66118cf12";
|
||||
sha256 = "7D4B68n3diMYU/1ugQ/8nESR5dRIsYfmGSNmbq3rKkM=";
|
||||
};
|
||||
kernelPatches = [{
|
||||
name = "rt";
|
||||
patch = fetchurl {
|
||||
url = "https://cdn.kernel.org/pub/linux/kernel/projects/rt/5.15/older/patch-5.15.43-rt45.patch.xz";
|
||||
sha256 = "veAJl5zb5SEYQoGzoZtURFncHD42hQ8cX7zeS36CQvk=";
|
||||
};
|
||||
}] ++ linuxKernel.kernels.linux_rpi4.kernelPatches;
|
||||
structuredExtraConfig = with lib.kernel; {
|
||||
KVM = lib.mkForce no; # Not compatible with PREEMPT_RT. NOTE: this conflict shoulb be fixed in 5.16
|
||||
PREEMPT_RT = yes;
|
||||
EXPERT = yes; # PREEMPT_RT depends on it (in kernel/Kconfig.preempt)
|
||||
PREEMPT_VOLUNTARY = lib.mkForce no; # PREEMPT_RT deselects it.
|
||||
RT_GROUP_SCHED = lib.mkForce (option no); # Removed by sched-disable-rt-group-sched-on-rt.patch.
|
||||
} // linuxKernel.kernels.linux_rpi4.structuredExtraConfig;
|
||||
};
|
||||
};
|
||||
|
||||
linuxPackages = (linuxPackagesFor kernel);
|
||||
|
||||
firmware = raspberrypifw.overrideAttrs (old: rec {
|
||||
version = "notag";
|
||||
src = fetchFromGitHub {
|
||||
owner = "raspberrypi";
|
||||
repo = "firmware";
|
||||
rev = "f145afcfdc76157622588d5c58b95da24acea1e8";
|
||||
sha256 = "dvUl3su9brcZ9Xamr/0UJWXuJG1FyDFPS5x5tYcJkl8=";
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user