Skip to content

Commit 69bc87c

Browse files
committed
raspberry-pi: add structuredExtraConfig for vendor kernel
Override nixpkgs common-config.nix defaults that conflict with RPi vendor defconfigs (bcmrpi/bcm2709/bcm2711/bcm2712): - NR_CPUS: 4 (nixpkgs sets 384; RPi has 4 cores) - CMA_SIZE_MBYTES: 5 (nixpkgs sets 32; vendor default is 5) - PREEMPT/PREEMPT_VOLUNTARY: full preempt per vendor defconfig (Pi 3+ only; arm32 defconfigs use voluntary preempt which matches nixpkgs default) - NFS root boot: NFS_FS, NFS_V4, ROOT_NFS, IP_PNP, IP_PNP_DHCP, IP_PNP_RARP - NET_CLS_BPF, NLS_CODEPAGE_437: built-in instead of module - FB_SIMPLE: simple framebuffer Ref: https://github.com/raspberrypi/linux/tree/rpi-6.12.y/arch/arm64/configs
1 parent 2096f3f commit 69bc87c

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

raspberry-pi/common/kernel.nix

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,39 @@ lib.overrideDerivation
5050
request_key_helper
5151
];
5252

53+
# Override nixpkgs common-config.nix defaults that conflict with the RPi vendor defconfigs.
54+
# See: https://github.com/raspberrypi/linux/tree/rpi-6.12.y/arch/arm64/configs
55+
structuredExtraConfig =
56+
with lib.kernel;
57+
{
58+
# RPi has 4 cores; nixpkgs common-config sets 384
59+
NR_CPUS = lib.mkForce (freeform "4");
60+
# nixpkgs sets 32MB; RPi vendor defconfig uses 5MB
61+
CMA_SIZE_MBYTES = lib.mkForce (freeform "5");
62+
63+
# NFS root boot support (common RPi use case)
64+
NFS_FS = lib.mkForce yes;
65+
NFS_V4 = lib.mkForce yes;
66+
ROOT_NFS = yes;
67+
IP_PNP = lib.mkForce yes;
68+
IP_PNP_DHCP = yes;
69+
IP_PNP_RARP = yes;
70+
71+
# Match vendor defconfig: built-in instead of module
72+
NET_CLS_BPF = lib.mkForce yes;
73+
NLS_CODEPAGE_437 = lib.mkForce yes;
74+
FB_SIMPLE = yes;
75+
}
76+
# arm64 vendor defconfigs (bcm2711, bcm2712) use full preempt;
77+
# arm32 ones (bcmrpi, bcm2709) use voluntary preempt (nixpkgs default)
78+
// lib.optionalAttrs (rpiVersion >= 3) (
79+
with lib.kernel;
80+
{
81+
PREEMPT = lib.mkForce yes;
82+
PREEMPT_VOLUNTARY = lib.mkForce no;
83+
}
84+
);
85+
5386
extraMeta =
5487
if (rpiVersion < 3) then
5588
{

0 commit comments

Comments
 (0)