Merge branch 'master' into msi_z370

This commit is contained in:
liberodark 2026-05-18 18:44:15 +02:00 committed by GitHub
commit 2f39770ca4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 269 additions and 243 deletions

View file

@ -9,4 +9,5 @@
# reapplied by the auto-rebase script
# nixfmt-rfc-style formatting
51e51e601448705c0d2f92ef90ec7b680123077c #!autorebase cd tests && nix fmt ..
51e51e601448705c0d2f92ef90ec7b680123077c #!autorebase cd tests && nix fmt ..
166dee4f88a7e3ba1b7a243edb1aca822f00680e

View file

@ -4,3 +4,9 @@ updates:
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "nix"
directories:
- "/"
- "tests/"
schedule:
interval: "weekly"

View file

@ -211,6 +211,7 @@ See code for all available configurations.
| [Framework 12th Gen Intel Core](framework/13-inch/12th-gen-intel) | `<nixos-hardware/framework/13-inch/12th-gen-intel>` | `framework-12th-gen-intel` |
| [Framework 13th Gen Intel Core](framework/13-inch/13th-gen-intel) | `<nixos-hardware/framework/13-inch/13th-gen-intel>` | `framework-13th-gen-intel` |
| [Framework Intel Core Ultra Series 1](framework/13-inch/intel-core-ultra-series1) | `<nixos-hardware/framework/13-inch/intel-core-ultra-series1>` | `framework-intel-core-ultra-series1` |
| [Framework Intel Core Ultra Series 3](framework/13-inch/intel-core-ultra-series3) | `<nixos-hardware/framework/13-inch/intel-core-ultra-series3>` | `framework-intel-core-ultra-series3` |
| [Framework 13 AMD Ryzen 7040 Series](framework/13-inch/7040-amd) | `<nixos-hardware/framework/13-inch/7040-amd>` | `framework-13-7040-amd` |
| [Framework 13 AMD AI 300 Series](framework/13-inch/amd-ai-300-series) | `<nixos-hardware/framework/13-inch/amd-ai-300-series>` | `framework-amd-ai-300-series` |
| [Framework 12 13th Gen Intel Core](framework/12-inch/13th-gen-intel) | `<nixos-hardware/framework/12-inch/13th-gen-intel>` | `framework-12-13th-gen-intel` |
@ -231,6 +232,8 @@ See code for all available configurations.
| [GPD WIN Max 2 2023](gpd/win-max-2/2023) | `<nixos-hardware/gpd/win-max-2/2023>` | `gpd-win-max-2-2023` |
| [GPD WIN Mini 2024](gpd/win-mini/2024) | `<nixos-hardware/gpd/win-mini/2024>` | `gpd-win-mini-2024` |
| [Google Pixelbook](google/pixelbook) | `<nixos-hardware/google/pixelbook>` | `google-pixelbook` |
| [Google Brya](google/brya) | `<nixos-hardware/google/brya>` | `google-brya` |
| [Google Rex](google/rex) | `<nixos-hardware/google/rex>` | `google-rex` |
| [HP Elitebook 2560p](hp/elitebook/2560p) | `<nixos-hardware/hp/elitebook/2560p>` | `hp-elitebook-2560p` |
| [HP Elitebook 830g6](hp/elitebook/830/g6) | `<nixos-hardware/hp/elitebook/830/g6>` | `hp-elitebook-830g6` |
| [HP Elitebook 845g7](hp/elitebook/845/g7) | `<nixos-hardware/hp/elitebook/845/g7>` | `hp-elitebook-845g7` |
@ -245,6 +248,7 @@ See code for all available configurations.
| [Huawei Matebook X Pro (2020)](huawei/machc-wa) | `<nixos-hardware/huawei/machc-wa>` | `huawei-machc-wa` |
| [i.MX8QuadMax Multisensory Enablement Kit](nxp/imx8qm-mek/) | `<nixos-hardware/nxp/imx8qm-mek>` | `nxp-imx8qm-mek` |
| [Intel NUC 5i5RYB](intel/nuc/5i5ryb/) | `<nixos-hardware/intel/nuc/5i5ryb>` | `intel-nuc-5i5ryb` |
| [Intel NUC 7i3BNB](intel/nuc/7i3bnb/) | `<nixos-hardware/intel/nuc/7i3bnb>` | `intel-nuc-7i3bnb` |
| [Intel NUC 8i7BEH](intel/nuc/8i7beh/) | `<nixos-hardware/intel/nuc/8i7beh>` | `intel-nuc-8i7beh` |
| [Intel NUC 12WSHi7](intel/nuc/12wshi7/) | `<nixos-hardware/intel/nuc/12wshi7>` | `intel-nuc-12wshi7` |
| [Kobol Helios4](kobol/helios4) | `<nixos-hardware/kobol/helios4>` | `kobol-helios-4` |
@ -436,6 +440,7 @@ See code for all available configurations.
| [Purism Librem 13v3](purism/librem/13v3) | `<nixos-hardware/purism/librem/13v3>` | `purism-librem-13v3` |
| [Purism Librem 15v3](purism/librem/15v3) | `<nixos-hardware/purism/librem/15v3>` | `purism-librem-15v3` |
| [Purism Librem 5r4](purism/librem/5r4) | `<nixos-hardware/purism/librem/5r4>` | `purism-librem-5r4` |
| [Radxa ROCK 3C](radxa/rock-3c) | `<nixos-hardware/radxa/rock-3c>` | `radxa-rock-3c` |
| [Radxa ROCK 4C+](radxa/rock-4c-plus) | `<nixos-hardware/radxa/rock-4c-plus>` | `rock-4c-plus` |
| [Radxa ROCK 5 Model B](radxa/rock-5b) | `<nixos-hardware/radxa/rock-5b>` | `rock-5b` |
| [Radxa ROCK Pi 4](radxa/rock-pi-4) | `<nixos-hardware/radxa/rock-pi-4>` | `rock-pi-4` |

View file

@ -66,7 +66,7 @@ use on batter and which on power.
## More optimizations
You may also want to enable thermald and powertop for the optimizations mentioned in
https://nixos.wiki/wiki/Laptop.
https://wiki.nixos.org/wiki/Laptop.
```nix
services.thermald.enable = true;

View file

@ -177,6 +177,7 @@
framework-13th-gen-intel = import ./framework/13-inch/13th-gen-intel;
framework-12-13th-gen-intel = import ./framework/12-inch/13th-gen-intel;
framework-intel-core-ultra-series1 = import ./framework/13-inch/intel-core-ultra-series1;
framework-intel-core-ultra-series3 = import ./framework/13-inch/intel-core-ultra-series3;
framework-13-7040-amd = import ./framework/13-inch/7040-amd;
framework-amd-ai-300-series = import ./framework/13-inch/amd-ai-300-series;
framework-16-7040-amd = import ./framework/16-inch/7040-amd;
@ -191,6 +192,8 @@
gigabyte-b650 = import ./gigabyte/b650;
gmktec-nucbox-g3-plus = import ./gmktec/nucbox/g3-plus;
google-pixelbook = import ./google/pixelbook;
google-brya = import ./google/brya;
google-rex = import ./google/rex;
gpd-micropc = import ./gpd/micropc;
gpd-p2-max = import ./gpd/p2-max;
gpd-pocket-3 = import ./gpd/pocket-3;
@ -210,6 +213,7 @@
huawei-machc-wa = import ./huawei/machc-wa;
hp-notebook-14-df0023 = import ./hp/notebook/14-df0023;
intel-nuc-5i5ryb = import ./intel/nuc/5i5ryb;
intel-nuc-7i3bnb = import ./intel/nuc/7i3bnb;
intel-nuc-8i7beh = import ./intel/nuc/8i7beh;
intel-nuc-12wshi7 = import ./intel/nuc/12wshi7;
lenovo-ideacentre-k330 = import ./lenovo/ideacentre/k330;
@ -413,6 +417,7 @@
raspberry-pi-3 = import ./raspberry-pi/3;
raspberry-pi-4 = import ./raspberry-pi/4;
raspberry-pi-5 = import ./raspberry-pi/5;
radxa-rock-3c = import ./radxa/rock-3c;
rock-4c-plus = import ./radxa/rock-4c-plus;
rock-5b = import ./radxa/rock-5b;
rock-pi-4 = import ./radxa/rock-pi-4;
@ -500,6 +505,7 @@
imx93-boot = (pkgs.callPackage ./nxp/imx93-evk/bsp/imx93-boot.nix { }).imx93-boot;
imx8mp-boot = (pkgs.callPackage ./nxp/imx8mp-evk/bsp/imx8mp-boot.nix { }).imx8m-boot;
imx8mq-boot = (pkgs.callPackage ./nxp/imx8mq-evk/bsp/imx8mq-boot.nix { }).imx8m-boot;
purism-librem-5r4-uboot = pkgs.callPackage ./purism/librem/5r4/u-boot { };
# Raspberry Pi kernels (aarch64-linux only)
rpi2-kernel = (pkgs.callPackage ./raspberry-pi/common/kernel.nix { rpiVersion = 2; });
rpi3-kernel = (pkgs.callPackage ./raspberry-pi/common/kernel.nix { rpiVersion = 3; });

View file

@ -3,7 +3,6 @@
imports = [
../../../common/pc/laptop
../../../common/pc/ssd
../../bluetooth.nix
../../kmod.nix
../../framework-tool.nix
];

View file

@ -24,7 +24,8 @@ in
- Equalizer
- Slight compression
This option has been optimised for the Framework Laptop 13 AMD 7040 series, but should work on all models.
This option has been optimised for the classic Framework Laptop 13 chassis/speakers.
Framework Laptop 13 Pro needs different tuning.
Before applying, ensure the speakers are set to 100%,
because the volumes compound and the raw speaker device will be hidden by default.

View file

@ -3,10 +3,9 @@
imports = [
../../../common/pc/laptop
../../../common/pc/ssd
../../bluetooth.nix
../../kmod.nix
../../framework-tool.nix
./audio.nix
./classic-audio.nix
];
# Fix TRRS headphones missing a mic

View file

@ -0,0 +1,14 @@
# [Framework Laptop 13](https://frame.work/laptop13pro)
## Updating Firmware
Everything is updateable through fwupd, so it's enabled by default.
To get the latest firmware, run:
```sh
$ fwupdmgr refresh
$ fwupdmgr update
```
- [Latest Update](https://fwupd.org/lvfs/devices/work.frame.Laptop.PTL.BIOS.firmware)

View file

@ -0,0 +1,30 @@
{
config,
lib,
pkgs,
...
}:
{
imports = [
../common
../common/intel.nix
];
# Everything is updateable through fwupd
services.fwupd.enable = true;
# Absolute minimum
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.17") (
lib.mkDefault pkgs.linuxPackages_latest
);
# Additional modules for touchscreen/touchpad in initrd (for unl0kr on-screen keyboard)
boot.initrd.kernelModules = lib.optionals config.boot.initrd.unl0kr.enable [
"intel_lpss_pci"
"i2c_hid_acpi"
"i2c_hid"
"hid_multitouch"
"hid_generic"
];
}

View file

@ -3,7 +3,6 @@
imports = [
../../../common/pc/laptop
../../../common/pc/ssd
../../bluetooth.nix
../../kmod.nix
../../framework-tool.nix
];

View file

@ -1,55 +0,0 @@
# There is apparently a bug that affects Framework computers that causes black
# screen on resume from sleep or hibernate with kernel version 6.11. Framework
# have published a workaround; this applies that workaround.
#
# https://fosstodon.org/@frameworkcomputer/113406887743149089
# https://github.com/FrameworkComputer/linux-docs/blob/main/hibernation/kernel-6-11-workarounds/suspend-hibernate-bluetooth-workaround.md#workaround-for-suspendhibernate-black-screen-on-resume-kernel-611
{
config,
lib,
pkgs,
...
# TODO: drop this if linux 6.11 goes EOL
}:
lib.mkIf
(
(config.boot.kernelPackages.kernelAtLeast "6.11") && (config.boot.kernelPackages.kernelOlder "6.12")
)
{
systemd.services = {
bluetooth-rfkill-suspend = {
description = "Soft block Bluetooth on suspend/hibernate";
before = [ "sleep.target" ];
unitConfig.StopWhenUnneeded = true;
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.util-linux}/bin/rfkill block bluetooth";
ExecStartPost = "${pkgs.coreutils}/bin/sleep 3";
RemainAfterExit = true;
};
wantedBy = [
"suspend.target"
"hibernate.target"
"suspend-then-hibernate.target"
];
};
bluetooth-rfkill-resume = {
description = "Unblock Bluetooth on resume";
after = [
"suspend.target"
"hibernate.target"
"suspend-then-hibernate.target"
];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.util-linux}/bin/rfkill unblock bluetooth";
};
wantedBy = [
"suspend.target"
"hibernate.target"
"suspend-then-hibernate.target"
];
};
};
}

9
google/brya/default.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
../../common/pc/laptop
../../common/pc/ssd
../../common/cpu/intel/alder-lake
];
}

9
google/rex/default.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
imports = [
../../common/pc/laptop
../../common/pc/ssd
../../common/cpu/intel/meteor-lake
];
}

View file

@ -2,7 +2,7 @@
{
# https://www.intel.com/content/www/us/en/products/sku/124967/intel-core-i58250u-processor-6m-cache-up-to-3-40-ghz/specifications.html
# this one works: https://nixos.wiki/wiki/Accelerated_Video_Playback
# this one works: https://wiki.nixos.org/wiki/Accelerated_Video_Playback
imports = [
../../../common/cpu/intel/kaby-lake
../../../common/pc

View file

@ -0,0 +1,11 @@
{ lib, ... }:
{
imports = [
../../../common/cpu/intel/kaby-lake
../../../common/pc
../../../common/pc/ssd
];
services.thermald.enable = lib.mkDefault true;
}

View file

@ -1,79 +0,0 @@
{
pkgs,
}:
let
pkgsCross = import <nixpkgs> {
crossSystem = {
config = "aarch64-unknown-linux-gnu";
};
};
outdir = "out/arm-plat-imx/core";
python3 = pkgs.buildPackages.python3;
toolchain = pkgsCross.gcc9Stdenv.cc;
binutils = pkgsCross.gcc9Stdenv.cc.bintools.bintools_bin;
cpp = pkgs.buildPackages.gcc;
in
pkgs.stdenv.mkDerivation {
pname = "imx-optee-os";
version = "5.15.32_2.0.0";
buildInputs = [
python3
];
enableParallelBuilding = true;
propagatedBuildInputs = with python3.pkgs; [
pycryptodomex
pyelftools
cryptography
];
src = fetchGit {
url = "https://github.com/nxp-imx/imx-optee-os.git";
ref = "lf-5.15.32_2.0.0";
};
postPatch = ''
substituteInPlace scripts/arm32_sysreg.py \
--replace-fail '/usr/bin/env python3' '${python3}/bin/python'
substituteInPlace scripts/gen_tee_bin.py \
--replace-fail '/usr/bin/env python3' '${python3}/bin/python'
substituteInPlace scripts/pem_to_pub_c.py \
--replace-fail '/usr/bin/env python3' '${python3}/bin/python'
substituteInPlace ta/pkcs11/scripts/verify-helpers.sh \
--replace-fail '/bin/bash' '${pkgs.bash}/bin/bash'
substituteInPlace mk/gcc.mk \
--replace-fail "\$(CROSS_COMPILE_\$(sm))objcopy" ${binutils}/bin/${toolchain.targetPrefix}objcopy
substituteInPlace mk/gcc.mk \
--replace-fail "\$(CROSS_COMPILE_\$(sm))objdump" ${binutils}/bin/${toolchain.targetPrefix}objdump
substituteInPlace mk/gcc.mk \
--replace-fail "\$(CROSS_COMPILE_\$(sm))nm" ${binutils}/bin/${toolchain.targetPrefix}nm
substituteInPlace mk/gcc.mk \
--replace-fail "\$(CROSS_COMPILE_\$(sm))readelf" ${binutils}/bin/${toolchain.targetPrefix}readelf
substituteInPlace mk/gcc.mk \
--replace-fail "\$(CROSS_COMPILE_\$(sm))ar" ${binutils}/bin/${toolchain.targetPrefix}ar
substituteInPlace mk/gcc.mk \
--replace-fail "\$(CROSS_COMPILE_\$(sm))cpp" "${cpp}/bin/${toolchain.targetPrefix}cpp"
'';
makeFlags = [
"PLATFORM=imx"
"PLATFORM_FLAVOR=mx8qmmek"
"CFG_ARM64_core=y"
"CFG_TEE_TA_LOG_LEVEL=0"
"CFG_TEE_CORE_LOG_LEVEL=0"
"CROSS_COMPILE=${toolchain}/bin/${toolchain.targetPrefix}"
"CROSS_COMPILE64=${toolchain}/bin/${toolchain.targetPrefix}"
];
installPhase = ''
mkdir -p $out
cp ${outdir}/tee-raw.bin $out/tee.bin
'';
}

View file

@ -38,7 +38,7 @@ Note down this device path.
[`u-boot`]: ./u-boot
Provided you have a way to build Nix derivations for `aarch64-linux` (like a remote builder, [binfmt emulation], or you're building it on the phone itself), just run `nix-build u-boot/build.nix`.
Provided you have a way to build Nix derivations for `aarch64-linux` (like a remote builder, [binfmt emulation], or you're building it on the phone itself), just run `nix build .#purism-librem-5r4-uboot` from the root of this repository.
[binfmt emulation]: https://search.nixos.org/options?channel=22.11&show=boot.binfmt.emulatedSystems&from=0&size=50&sort=relevance&type=packages&query=binfmt

View file

@ -1 +0,0 @@
with import <nixpkgs> { system = "aarch64-linux"; }; callPackage ./. { }

22
radxa/rock-3c/default.nix Normal file
View file

@ -0,0 +1,22 @@
{
lib,
pkgs,
config,
...
}:
{
imports = [
../.
../../rockchip
];
config = {
hardware = {
radxa.enable = true;
rockchip = {
rk3566.enable = true;
platformFirmware = lib.mkDefault pkgs.ubootRock3C;
};
};
};
}

View file

@ -1,6 +1,10 @@
{ lib, pkgs, ... }:
{
imports = [
../common/default.nix
];
boot = {
kernelPackages = lib.mkDefault (
pkgs.linuxPackagesFor (pkgs.callPackage ../common/kernel.nix { rpiVersion = 3; })

View file

@ -27,17 +27,12 @@ with lib;
| xargs -0 cp -v --no-preserve=mode --target-directory "$out" --parents
for dtb in $(find "$out" -type f -name '*.dtb'); do
dtbCompat=$(fdtget -t s "$dtb" / compatible 2>/dev/null || true)
# skip files without `compatible` string
test -z "$dtbCompat" && continue
fdtget -t s "$dtb" / compatible 2>/dev/null || continue
${flip (concatMapStringsSep "\n") overlays (o: ''
overlayCompat="$(fdtget -t s "${o.dtboFile}" / compatible)"
# skip incompatible and non-matching overlays
if [[ ! "$dtbCompat" =~ "$overlayCompat" ]]; then
echo "Skipping overlay ${o.name}: incompatible with $(basename "$dtb")"
elif ${
# skip non-matching overlays
if ${
if ((o.filter or null) == null) then
"false"
else

View file

@ -12,6 +12,8 @@ in
imports = [ ../common/default.nix ];
boot = {
loader.grub.enable = lib.mkDefault false;
loader.generic-extlinux-compatible.enable = lib.mkDefault true;
kernelPackages = lib.mkDefault (
pkgs.linuxPackagesFor (pkgs.callPackage ../common/kernel.nix { rpiVersion = 5; })
);

View file

@ -95,7 +95,7 @@ in
(attrsOf molecule)
];
in
attrsOf molecule;
attrsOf molecule // { description = "config.txt setting type"; };
default = { };
description = ''
Structured configuration for the Raspberry Pi `config.txt` file.

View file

@ -1,4 +1,9 @@
{
imports = [
./config-txt.nix
./config-txt-defaults.nix
];
boot.initrd.availableKernelModules = [
"usb-storage"
"usbhid"

View file

@ -10,104 +10,129 @@
let
# NOTE: raspberryPiWirelessFirmware should be updated with this
modDirVersion = "6.12.47";
tag = "stable_20250916";
hash = "sha256-HG8Oc04V2t54l0SOn4gKmNJWQUrZfjWusgKcWvx74H0==";
modDirVersion = "6.12.75";
hash = "sha256-qrljd20n4tj/7C7gzNnxw7JIyEF2Ppf1PWm2a7vxh1w=";
inherit (lib.kernel) freeform yes no;
in
lib.overrideDerivation
(buildLinux (
args
// {
version = "${modDirVersion}-${tag}";
inherit modDirVersion;
pname = "linux-rpi";
(buildLinux (
args
// {
version = "${modDirVersion}-1+rpt1";
inherit modDirVersion;
pname = "linux-rpi";
src = fetchFromGitHub {
owner = "raspberrypi";
repo = "linux";
inherit tag hash;
};
src = fetchFromGitHub {
owner = "raspberrypi";
repo = "linux";
# https://github.com/RPi-Distro/linux-packaging/raw/refs/tags/pios/1%256.12.75-1+rpt1/debian/changelog
rev = "89050b1059997d38d55462b323b099a6436dc10d";
inherit hash;
};
defconfig =
{
"1" = "bcmrpi_defconfig";
"2" = "bcm2709_defconfig";
"3" = if stdenv.hostPlatform.isAarch64 then "bcm2711_defconfig" else "bcm2709_defconfig";
"4" = "bcm2711_defconfig";
"5" = "bcm2712_defconfig";
}
.${toString rpiVersion};
features = {
efiBootStub = false;
defconfig =
{
"1" = "bcmrpi_defconfig";
"2" = "bcm2709_defconfig";
"3" = if stdenv.hostPlatform.isAarch64 then "bcm2711_defconfig" else "bcm2709_defconfig";
"4" = "bcm2711_defconfig";
"5" = "bcm2712_defconfig";
}
// (args.features or { });
.${toString rpiVersion};
isLTS = true;
kernelPatches = with pkgs.kernelPatches; [
bridge_stp_helper
request_key_helper
];
extraMeta =
if (rpiVersion < 3) then
{
platforms = with lib.platforms; lib.intersectLists arm linux;
hydraPlatforms = [ ];
}
else
{
platforms = with lib.platforms; lib.intersectLists (arm ++ aarch64) linux;
hydraPlatforms = [ "aarch64-linux" ];
};
ignoreConfigErrors = true;
features = {
efiBootStub = false;
}
// (args.argsOverride or { })
))
(_oldAttrs: {
// (args.features or { });
isLTS = true;
kernelPatches = with pkgs.kernelPatches; [
bridge_stp_helper
request_key_helper
];
# Override nixpkgs common-config.nix defaults that conflict with the RPi vendor defconfigs.
# See: https://github.com/raspberrypi/linux/tree/rpi-6.12.y/arch/arm64/configs
structuredExtraConfig = {
# RPi has 4 cores; nixpkgs common-config sets 384
NR_CPUS = lib.mkForce (freeform "4");
# nixpkgs sets 32MB; RPi vendor defconfig uses 5MB
CMA_SIZE_MBYTES = lib.mkForce (freeform "5");
# NFS root boot support (common RPi use case)
NFS_FS = lib.mkForce yes;
NFS_V4 = yes;
ROOT_NFS = yes;
IP_PNP = lib.mkForce yes;
IP_PNP_DHCP = yes;
IP_PNP_RARP = yes;
# Match vendor defconfig: built-in instead of module
NET_CLS_BPF = lib.mkForce yes;
NLS_CODEPAGE_437 = lib.mkForce yes;
FB_SIMPLE = yes;
}
# arm64 vendor defconfigs (bcm2711, bcm2712) use full preempt;
# arm32 ones (bcmrpi, bcm2709) use voluntary preempt (nixpkgs default)
// lib.optionalAttrs (rpiVersion >= 3) {
PREEMPT = lib.mkForce yes;
PREEMPT_VOLUNTARY = lib.mkForce no;
};
extraMeta =
if (rpiVersion < 3) then
{
platforms = with lib.platforms; lib.intersectLists arm linux;
hydraPlatforms = [ ];
}
else
{
platforms = with lib.platforms; lib.intersectLists (arm ++ aarch64) linux;
hydraPlatforms = [ "aarch64-linux" ];
};
ignoreConfigErrors = true;
}
// (args.argsOverride or { })
)).overrideAttrs
{
# TODO: Put CONFIG_LOCALVERSION in `structuredExtraConfig` above once this is resolved:
# https://github.com/NixOS/nixpkgs/issues/516936
postConfigure = ''
# The v7 defconfig has this set to '-v7' which screws up our modDirVersion.
sed -i $buildRoot/.config -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
sed -i $buildRoot/include/config/auto.conf -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
'';
# Make copies of the DTBs named after the upstream names so that U-Boot finds them.
# This is ugly as heck, but I don't know a better solution so far.
postFixup = ''
dtbDir=${if stdenv.hostPlatform.isAarch64 then "$out/dtbs/broadcom" else "$out/dtbs"}
rm $dtbDir/bcm283*.dtb
copyDTB() {
cp -v "$dtbDir/$1" "$dtbDir/$2"
}
''
+ lib.optionalString (lib.elem stdenv.hostPlatform.system [ "armv6l-linux" ]) ''
copyDTB bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero.dtb
copyDTB bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero-w.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b-rev2.dtb
copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-a-plus.dtb
copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-b-plus.dtb
copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-zero.dtb
copyDTB bcm2708-rpi-cm.dtb bcm2835-rpi-cm.dtb
''
+ lib.optionalString (lib.elem stdenv.hostPlatform.system [ "armv7l-linux" ]) ''
copyDTB bcm2709-rpi-2-b.dtb bcm2836-rpi-2-b.dtb
''
+
lib.optionalString
(lib.elem stdenv.hostPlatform.system [
"armv7l-linux"
"aarch64-linux"
])
''
copyDTB bcm2710-rpi-zero-2.dtb bcm2837-rpi-zero-2.dtb
copyDTB bcm2710-rpi-zero-2-w.dtb bcm2837-rpi-zero-2-w.dtb
copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb
copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-a-plus.dtb
copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb
copyDTB bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb
copyDTB bcm2711-rpi-4-b.dtb bcm2838-rpi-4-b.dtb
'';
})
# The vendor kernel uses different DTB names (bcm2708/bcm2709/bcm2710) than what
# U-Boot expects (bcm2835/bcm2836/bcm2837). Starting with Pi 4, names match.
# See: https://github.com/u-boot/u-boot/blob/master/board/raspberrypi/rpi/rpi.c
postFixup = lib.optionalString (rpiVersion < 4) (
''
dtbDir=${if stdenv.hostPlatform.isAarch64 then "$out/dtbs/broadcom" else "$out/dtbs"}
rm $dtbDir/bcm283*.dtb
copyDTB() {
cp -v "$dtbDir/$1" "$dtbDir/$2"
}
''
+ lib.optionalString (rpiVersion == 1) ''
copyDTB bcm2708-rpi-zero.dtb bcm2835-rpi-zero.dtb
copyDTB bcm2708-rpi-zero-w.dtb bcm2835-rpi-zero-w.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b-rev2.dtb
copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-a-plus.dtb
copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-b-plus.dtb
copyDTB bcm2708-rpi-cm.dtb bcm2835-rpi-cm.dtb
''
+ lib.optionalString (rpiVersion == 2) ''
copyDTB bcm2709-rpi-2-b.dtb bcm2836-rpi-2-b.dtb
''
+ lib.optionalString (rpiVersion == 3) ''
copyDTB bcm2710-rpi-zero-2.dtb bcm2837-rpi-zero-2.dtb
copyDTB bcm2710-rpi-zero-2-w.dtb bcm2837-rpi-zero-2-w.dtb
copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb
copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-a-plus.dtb
copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb
copyDTB bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb
''
);
}

View file

@ -11,6 +11,7 @@ in
imports = [
./rk3328
./rk3399
./rk3566
./rk3588
];

View file

@ -0,0 +1,18 @@
{
lib,
pkgs,
config,
...
}:
let
cfg = config.hardware.rockchip.rk3566;
in
{
options.hardware.rockchip.rk3566 = {
enable = lib.mkEnableOption "Rockchip RK3566 support";
};
config = lib.mkIf cfg.enable {
hardware.rockchip.enable = true;
};
}