Skip to content

raspberry-pi: add structuredExtraConfig for vendor kernel - #1841

Merged
doronbehar merged 2 commits into
NixOS:masterfrom
JamieMagee:raspberry-pi/structuredExtraConfig-only
May 4, 2026
Merged

doronbehar merged 2 commits into
NixOS:masterfrom
JamieMagee:raspberry-pi/structuredExtraConfig-only

Conversation

@JamieMagee

@JamieMagee JamieMagee commented Apr 24, 2026 •

Copy link
Copy Markdown
Member

The RPi vendor kernel is built from bcm{rpi,2709,2711,2712}_defconfig, but several values in nixpkgs common-config.nix override those defconfigs. Set them back via structuredExtraConfig.

Two commits:

  1. Replace the postConfigure sed hack with LOCALVERSION = freeform "";.
  2. Add the remaining vendor-defconfig overrides.

mkForce is used only where nixpkgs sets a conflicting value at normal priority; everything else is plain assignment.

Config Value Forced? Why
LOCALVERSION "" no vendor sets -v7/-v8/-v8-16k, breaks modDirVersion
NR_CPUS 4 yes nixpkgs sets 384
CMA_SIZE_MBYTES 5 yes nixpkgs sets 32
PREEMPT (Pi 3+) yes yes nixpkgs sets no; arm64 vendor defconfigs use full preempt
PREEMPT_VOLUNTARY (Pi 3+) no no nixpkgs only sets it via mkOptionDefault
NFS_FS yes yes nixpkgs sets module
NFS_V4, ROOT_NFS, IP_PNP_DHCP, IP_PNP_RARP yes no not set by nixpkgs
IP_PNP yes yes nixpkgs sets no
NET_CLS_BPF, NLS_CODEPAGE_437 yes yes nixpkgs sets module
FB_SIMPLE yes no only set by nixpkgs on <5.15

Ref: https://github.com/raspberrypi/linux/tree/rpi-6.12.y/arch/arm64/configs

Things done
  • Tested the changes in your own NixOS Configuration
  • Tested the changes end-to-end by using your fork of nixos-hardware and importing it via `` or Flake input

Comment thread raspberry-pi/common/kernel.nix Resolved
Comment thread raspberry-pi/common/kernel.nix Resolved
Comment thread raspberry-pi/common/kernel.nix Resolved
@JamieMagee
JamieMagee force-pushed the raspberry-pi/structuredExtraConfig-only branch 4 times, most recently from 9a75471 to 55d3dd0 Compare May 4, 2026 03:03

@doronbehar doronbehar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more small review comment. Also note the merge conflicts 🙏 - probably from #1822 .

Comment thread raspberry-pi/common/kernel.nix Resolved
JamieMagee added 2 commits May 4, 2026 08:49
Set CONFIG_LOCALVERSION via structuredExtraConfig instead of patching
.config and auto.conf with sed after configure. The vendor defconfigs
set -v7, -v8, -v8-16k which breaks modDirVersion.
Override the nixpkgs common-config.nix values that conflict with the RPi
vendor defconfigs. Without these the kernel config silently differs from
the vendor defconfig.

mkForce is used only on options where nixpkgs common-config sets a
conflicting value at normal priority.

Ref: https://github.com/raspberrypi/linux/tree/rpi-6.12.y/arch/arm64/configs
@JamieMagee
JamieMagee force-pushed the raspberry-pi/structuredExtraConfig-only branch from 55d3dd0 to 88cd2fa Compare May 4, 2026 15:51
@JamieMagee
JamieMagee requested a review from doronbehar May 4, 2026 15:52
@doronbehar
doronbehar added this pull request to the merge queue May 4, 2026
Merged via the queue into NixOS:master with commit df77831 May 4, 2026
2 checks passed
@JamieMagee
JamieMagee deleted the raspberry-pi/structuredExtraConfig-only branch May 4, 2026 18:22
JamieMagee added a commit to JamieMagee/nixos-hardware that referenced this pull request May 5, 2026
freeform "" can't emit an empty string through nixpkgs mkValue; it renders as the literal "", so CONFIG_LOCALVERSION ends up two chars and modDirVersion becomes 6.12.75"". Bring back the sed from before NixOS#1841.

Fixes NixOS#1859.
Gigahawk pushed a commit to Gigahawk/nixos-hardware that referenced this pull request May 6, 2026
freeform "" can't emit an empty string through nixpkgs mkValue; it renders as the literal "", so CONFIG_LOCALVERSION ends up two chars and modDirVersion becomes 6.12.75"". Bring back the sed from before NixOS#1841.

Fixes NixOS#1859.
JamieMagee added a commit to JamieMagee/nixos-hardware that referenced this pull request May 12, 2026
freeform "" can't emit an empty string through nixpkgs mkValue; it renders as the literal "", so CONFIG_LOCALVERSION ends up two chars and modDirVersion becomes 6.12.75"". Bring back the sed from before NixOS#1841.

Fixes NixOS#1859.
cjdell pushed a commit to cjdell/nixos-hardware that referenced this pull request Aug 3, 2026
freeform "" can't emit an empty string through nixpkgs mkValue; it renders as the literal "", so CONFIG_LOCALVERSION ends up two chars and modDirVersion becomes 6.12.75"". Bring back the sed from before NixOS#1841.

Fixes NixOS#1859.
kubajanusz pushed a commit to kubajanusz/nixos-hardware that referenced this pull request Oct 17, 2026
freeform "" can't emit an empty string through nixpkgs mkValue; it renders as the literal "", so CONFIG_LOCALVERSION ends up two chars and modDirVersion becomes 6.12.75"". Bring back the sed from before NixOS#1841.

Fixes NixOS#1859.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants