diff --git a/README.md b/README.md index 1c5ffe1b..f572ee4c 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,7 @@ See code for all available configurations. | [Dell Inspiron 7559](dell/inspiron/7559) | `` | `dell-inspiron-7559` | | [Dell Latitude 3340](dell/latitude/3340) | `` | `dell-latitude-3340` | | [Dell Latitude 3480](dell/latitude/3480) | `` | `dell-latitude-3480` | +| [Dell Latitude 3530](dell/latitude/3530) | `` | `dell-latitude-3530` | | [Dell Latitude 5490](dell/latitude/5490) | `` | `dell-latitude-5490` | | [Dell Latitude 5520](dell/latitude/5520) | `` | `dell-latitude-5520` | | [Dell Latitude 7280](dell/latitude/7280) | `` | `dell-latitude-7280` | @@ -460,6 +461,7 @@ See code for all available configurations. | [Radxa ROCK Pi 4](radxa/rock-pi-4) | `` | `rock-pi-4` | | [Radxa ROCK Pi E](radxa/rock-pi-e) | `` | `rock-pi-e` | | [Razer Blade 14 (RZ09-0530)](razer/blade/14/RZ09-0530) | `` | `razer-blade-14-RZ09-0530` | +| [Raspberry Pi 1](raspberry-pi/1) | `` | `raspberry-pi-1` | | [Raspberry Pi 2](raspberry-pi/2) | `` | `raspberry-pi-2` | | [Raspberry Pi 3](raspberry-pi/3) | `` | `raspberry-pi-3` | | [Raspberry Pi 4](raspberry-pi/4) | `` | `raspberry-pi-4` | diff --git a/asus/proart/px13/hn7306eac/default.nix b/asus/proart/px13/hn7306eac/default.nix index 9472d98a..d55dee72 100644 --- a/asus/proart/px13/hn7306eac/default.nix +++ b/asus/proart/px13/hn7306eac/default.nix @@ -1,4 +1,5 @@ { + config, pkgs, lib, ... @@ -7,9 +8,17 @@ { imports = [ ../default.nix + # no effect at Linux 7.2 as patches are merged ./tas2783-kernel-patches.nix ]; + assertions = [ + { + assertion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "7.0"; + message = "ASUS ProArt PX13 (HN7306EAC) hardware requires Linux ≥ 7.0 (current ${config.boot.kernelPackages.kernel.version})"; + } + ]; + hardware = { alsa.enablePersistence = lib.mkDefault true; firmware = lib.optional (lib.versionOlder pkgs.linux-firmware.version "20260519") ( diff --git a/asus/proart/px13/hn7306eac/tas2783-kernel-patches.nix b/asus/proart/px13/hn7306eac/tas2783-kernel-patches.nix index 0eed3c6b..17e308c2 100644 --- a/asus/proart/px13/hn7306eac/tas2783-kernel-patches.nix +++ b/asus/proart/px13/hn7306eac/tas2783-kernel-patches.nix @@ -1,7 +1,7 @@ { + config, pkgs, lib, - config, ... }: @@ -18,34 +18,29 @@ let }; in { - assertions = [ - { - assertion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "7.0"; - message = "tas2783 patches require Linux ≥ 7.0 (found ${config.boot.kernelPackages.kernel.version})"; - } - ]; - - boot.kernelPatches = [ - (mkPatch "0001-ALSA-tas2783-sdw-add-Playback-to-volume-control" "sha512-IdIy81PXtmQAQ+MVChYDYkoa5RDhQwP2L5efN8cz+tST3nM0Oc0x4SJ4sBnVL7QDJc/WBB0OEnFfTkEt9Id+cQ==") - (mkPatch "0002-Names-to-match-snd_soc_dai_driver-playback-capturest" "sha512-SrCgzceh3rhyYz5tNWHY2jNWyG/qgmU7ZVLtV71iir8HwOrSES7JsunV2E7mb8R66dShY+loV8ovNeMkyuDB7w==") - (mkPatch "0003-removed-unused-fields" "sha512-mWKqFg8AG00TE3oPy5usPPxWf6aIvhxMLDGI+/0+vvjBIFwWv6qh9jSUeid6CAKgAcluPSA8Sag4ESguCeinyw==") - (mkPatch "0004-SOC_SINGLE_RANGE_TLV-uses-snd_soc_get_volsw-snd_soc_" "sha512-G51v725q17UHvfPg4H8V92eSbZ5lcuiF97Zt1EbAtuwrhXefeaZy+hl79sSpVlzzY8pvzIwf6wodAuvp44M01A==") - (mkPatch "0005-dev_set_drvdata-already-called-intas_sdw_probe" "sha512-zk+rKZ/l0oB7JdABtb89x6tUzggP99TSy+3cr+q6QjZFdjGsLPXHxre0YACuKBNx6+JazZE/zEilIvahS4wOLQ==") - (mkPatch "0006-refactor-setting-sa_func_data" "sha512-8djgIJV1LCzDhFLFn/PNfDkE+U0mh2h4Rm2LJMeLUYKQlwzgPMbICh5B3HhCgEVTaUd54OGOSFEf0i6AIm2SIQ==") - (mkPatch "0007-check-AF01-for-init-data" "sha512-gjpdnJDzve37MnyVE52+E9sRkXF9+HtA4XTrBZQiV8ozFwWgIzhO2ZDKSpWbE/kd23PdaUcKX/fPj3J7ZD5YqA==") - (mkPatch "0008-setup-ports" "sha512-uuDa92VXlCsszswv8PHcDbbyfseL6Jt7DWPc5ajG1WSM/FGojRIbbl/2smQyGfE2jPquy5GQfJps7k1cRfpl8w==") - (mkPatch "0009-Already-set-by-SOC_SINGLE_RANGE_TLV-Speaker-Playback" "sha512-qBveCsmwezD13oWF5jBlUybdns5OsDDZji0y0smaKWi9GPAvhw/v66WUnEyC77UF1mvq+OyrWpA4yXwxAFza3Q==") - (mkPatch "0010-control-to-set-channel" "sha512-pL8Ol1ml2QhyKnzZvD+oTaVUPyqOO49uuiEUzyKdnskFwVH+jIluY3IDsmzWv5wTg/9D+CTGC4J8gW55xKwWfg==") - (mkPatch "0011-mute-unmute-using-SND_SOC_DAPM_SWITCH" "sha512-6aB8mBACTIQxU7CTrpR3UXJFdR4KbUOT9/AymyGiuV/9PfWdXZoW/0A09SHFptxRwCv4FG5tZSDZRtKvvYNQdQ==") - (mkPatch "0012-use-SND_SOC_DAPM_REG-to-power-on-off" "sha512-mJ93TxZQ1GuDGar0/6tBd/dlJ3B/41AVhRsViuSaEhykPC4NlIAOWaN9eJj4bxjEEyEQ3REfjHXVnJ3wdCRK9w==") - (mkPatch "0013-reattach-after-resume" "sha512-OdkYPzRDkd4FCd1OTOAfRrQW6JQ9D3Opic/X+sg+pLNGoEEXfph/sLXVYGo9u6DGPJndQZNrXyS4qhJMGPWVMw==") - (mkPatch "0014-defer-check" "sha512-ABSrwsOB+KU39LMxh3N47Ji+edhu5rDQMKMi5rEVXtCU8W56qANpU+ui+bJmOLYyq8c9H1qme+b5nQ6u9zv01w==") - (mkPatch "0015-to-help-alsa-find-them" "sha512-gVJ+0ZO9Oz15/rC08moVSlVglbishJctjH5SnDdI8m3s9hkEY56o8v+R/PlRS3rL+mOa9q3VuO5J40+LrcxDKw==") - (mkPatch "0016-cleanup-controls" "sha512-Jkp7kdi0FmVMlBL/VVzq7hYkCmKoELO0epnExP7ggQuopCzRbVpUQ3giMlj10O69aUBZJ4z3gaMkb1HTYjIXmA==") - # Upstream linux-firmware took a different naming approach to the original patches - { - name = "0017-fix-tas2783-fw-name-0x"; - patch = ./fix-tas2783-fw-name-0x.patch; - } - ]; + boot.kernelPatches = + lib.optionals (lib.versionOlder config.boot.kernelPackages.kernel.version "7.2") + [ + (mkPatch "0001-ALSA-tas2783-sdw-add-Playback-to-volume-control" "sha512-IdIy81PXtmQAQ+MVChYDYkoa5RDhQwP2L5efN8cz+tST3nM0Oc0x4SJ4sBnVL7QDJc/WBB0OEnFfTkEt9Id+cQ==") + (mkPatch "0002-Names-to-match-snd_soc_dai_driver-playback-capturest" "sha512-SrCgzceh3rhyYz5tNWHY2jNWyG/qgmU7ZVLtV71iir8HwOrSES7JsunV2E7mb8R66dShY+loV8ovNeMkyuDB7w==") + (mkPatch "0003-removed-unused-fields" "sha512-mWKqFg8AG00TE3oPy5usPPxWf6aIvhxMLDGI+/0+vvjBIFwWv6qh9jSUeid6CAKgAcluPSA8Sag4ESguCeinyw==") + (mkPatch "0004-SOC_SINGLE_RANGE_TLV-uses-snd_soc_get_volsw-snd_soc_" "sha512-G51v725q17UHvfPg4H8V92eSbZ5lcuiF97Zt1EbAtuwrhXefeaZy+hl79sSpVlzzY8pvzIwf6wodAuvp44M01A==") + (mkPatch "0005-dev_set_drvdata-already-called-intas_sdw_probe" "sha512-zk+rKZ/l0oB7JdABtb89x6tUzggP99TSy+3cr+q6QjZFdjGsLPXHxre0YACuKBNx6+JazZE/zEilIvahS4wOLQ==") + (mkPatch "0006-refactor-setting-sa_func_data" "sha512-8djgIJV1LCzDhFLFn/PNfDkE+U0mh2h4Rm2LJMeLUYKQlwzgPMbICh5B3HhCgEVTaUd54OGOSFEf0i6AIm2SIQ==") + (mkPatch "0007-check-AF01-for-init-data" "sha512-gjpdnJDzve37MnyVE52+E9sRkXF9+HtA4XTrBZQiV8ozFwWgIzhO2ZDKSpWbE/kd23PdaUcKX/fPj3J7ZD5YqA==") + (mkPatch "0008-setup-ports" "sha512-uuDa92VXlCsszswv8PHcDbbyfseL6Jt7DWPc5ajG1WSM/FGojRIbbl/2smQyGfE2jPquy5GQfJps7k1cRfpl8w==") + (mkPatch "0009-Already-set-by-SOC_SINGLE_RANGE_TLV-Speaker-Playback" "sha512-qBveCsmwezD13oWF5jBlUybdns5OsDDZji0y0smaKWi9GPAvhw/v66WUnEyC77UF1mvq+OyrWpA4yXwxAFza3Q==") + (mkPatch "0010-control-to-set-channel" "sha512-pL8Ol1ml2QhyKnzZvD+oTaVUPyqOO49uuiEUzyKdnskFwVH+jIluY3IDsmzWv5wTg/9D+CTGC4J8gW55xKwWfg==") + (mkPatch "0011-mute-unmute-using-SND_SOC_DAPM_SWITCH" "sha512-6aB8mBACTIQxU7CTrpR3UXJFdR4KbUOT9/AymyGiuV/9PfWdXZoW/0A09SHFptxRwCv4FG5tZSDZRtKvvYNQdQ==") + (mkPatch "0012-use-SND_SOC_DAPM_REG-to-power-on-off" "sha512-mJ93TxZQ1GuDGar0/6tBd/dlJ3B/41AVhRsViuSaEhykPC4NlIAOWaN9eJj4bxjEEyEQ3REfjHXVnJ3wdCRK9w==") + (mkPatch "0013-reattach-after-resume" "sha512-OdkYPzRDkd4FCd1OTOAfRrQW6JQ9D3Opic/X+sg+pLNGoEEXfph/sLXVYGo9u6DGPJndQZNrXyS4qhJMGPWVMw==") + (mkPatch "0014-defer-check" "sha512-ABSrwsOB+KU39LMxh3N47Ji+edhu5rDQMKMi5rEVXtCU8W56qANpU+ui+bJmOLYyq8c9H1qme+b5nQ6u9zv01w==") + (mkPatch "0015-to-help-alsa-find-them" "sha512-gVJ+0ZO9Oz15/rC08moVSlVglbishJctjH5SnDdI8m3s9hkEY56o8v+R/PlRS3rL+mOa9q3VuO5J40+LrcxDKw==") + (mkPatch "0016-cleanup-controls" "sha512-Jkp7kdi0FmVMlBL/VVzq7hYkCmKoELO0epnExP7ggQuopCzRbVpUQ3giMlj10O69aUBZJ4z3gaMkb1HTYjIXmA==") + # Upstream linux-firmware took a different naming approach to the original patches + { + name = "0017-fix-tas2783-fw-name-0x"; + patch = ./fix-tas2783-fw-name-0x.patch; + } + ]; } diff --git a/asus/zephyrus/shared/backlight.nix b/asus/zephyrus/shared/backlight.nix index 938ce4ac..770efbfb 100644 --- a/asus/zephyrus/shared/backlight.nix +++ b/asus/zephyrus/shared/backlight.nix @@ -4,6 +4,6 @@ boot.kernelParams = [ "i915.enable_dpcd_backlight=1" "nvidia.NVreg_EnableBacklightHandler=0" - "nvidia.NVReg_RegistryDwords=EnableBrightnessControl=0" + "nvidia.NVreg_RegistryDwords=EnableBrightnessControl=0" ]; } diff --git a/bananapi/bpi-sm10/default.nix b/bananapi/bpi-sm10/default.nix new file mode 100644 index 00000000..4b3825f6 --- /dev/null +++ b/bananapi/bpi-sm10/default.nix @@ -0,0 +1,12 @@ +{ + lib, + ... +}: + +{ + # The BPI-SM10 (K3-CoM260) shares the same SoC, firmware and boot flow as the + # K3 Pico-ITX. Only the device tree differs. + imports = [ ../../spacemit/k3-pico-itx ]; + + hardware.deviceTree.name = lib.mkForce "spacemit/k3-com260-ifx.dtb"; +} diff --git a/bananapi/bpi-sm10/sd-image.nix b/bananapi/bpi-sm10/sd-image.nix new file mode 100644 index 00000000..2b47b6fd --- /dev/null +++ b/bananapi/bpi-sm10/sd-image.nix @@ -0,0 +1,114 @@ +{ + config, + lib, + modulesPath, + pkgs, + ... +}: + +{ + imports = [ + "${modulesPath}/profiles/base.nix" + "${modulesPath}/installer/sd-card/sd-image.nix" + ./default.nix + ]; + + hardware.enableAllHardware = lib.mkForce false; + + fileSystems."/" = lib.mkForce { + device = "/dev/disk/by-partlabel/nixos-rootfs"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-label/ESP"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; + + image.fileName = "${config.image.baseName}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}-bpi-sm10.img"; + + sdImage = { + expandOnBoot = true; + firmwarePartitionOffset = 12; + firmwarePartitionName = "ESP"; + firmwareSize = 256; + + populateFirmwareCommands = + let + systemdBoot = "${pkgs.systemd}/lib/systemd/boot/efi/systemd-bootriscv64.efi"; + kernel = "${config.system.build.kernel}/${config.system.boot.loader.kernelFile}"; + initrd = "${config.system.build.initialRamdisk}/${config.system.boot.loader.initrdFile}"; + dtb = "${config.hardware.deviceTree.package}/${config.hardware.deviceTree.name}"; + kernelParams = lib.concatStringsSep " " config.boot.kernelParams; + in + '' + mkdir -p firmware/EFI/BOOT firmware/EFI/systemd firmware/EFI/nixos + mkdir -p firmware/loader/entries + + cp ${systemdBoot} firmware/EFI/BOOT/BOOTRISCV64.EFI + cp ${systemdBoot} firmware/EFI/systemd/systemd-bootriscv64.efi + + cp ${kernel} firmware/EFI/nixos/kernel.efi + cp ${initrd} firmware/EFI/nixos/initrd + cp ${dtb} firmware/EFI/nixos/k3_com260_ifx.dtb + + cat > firmware/loader/loader.conf < firmware/loader/entries/nixos.conf < firmware/startup.nsh <; - __overlay__ { - pwm_pins: pwm_pins { - brcm,pins = <18>; - brcm,function = <2>; /* Alt5 */ - }; + { + boot.loader.generic-extlinux-compatible.useGenerationDeviceTree = false; + hardware.raspberry-pi.configtxt.deviceTreeOverlays.pi4 = [ + { + pwm = { + pin = 18; + func = 2; + clock = 100000000; }; - }; + } + ]; + } - fragment@1 { - target = <&pwm>; - __overlay__ { - pinctrl-names = "default"; - assigned-clock-rates = <100000000>; - status = "okay"; - pinctrl-0 = <&pwm_pins>; - }; - }; + The removed pwm0 module explicitly assigned a 100 MHz clock. + Keep clock = 100000000 to preserve that assignment. + Without clock, the pwm overlay leaves the base clock configuration unchanged: + https://github.com/raspberrypi/linux/blob/rpi-6.18.y/arch/arm/boot/dts/overlays/pwm-overlay.dts - }; - ''; - } - ]; - }; - }; + Before switching, migrate any remaining hardware.deviceTree.overlays used only in generation DTBs. + For firmware installation, read "Device tree overlays" in raspberry-pi/README.md. + '' + ) + ]; } diff --git a/raspberry-pi/README.md b/raspberry-pi/README.md index 4d894b18..8f7fa228 100644 --- a/raspberry-pi/README.md +++ b/raspberry-pi/README.md @@ -5,8 +5,9 @@ NixOS profiles and modules for Raspberry Pi boards. ## What's here - `common/` has the shared bits: the `linux-rpi` kernel build (vendor defconfig, matching firmware), the `config.txt` generation module, a pinned wireless firmware, and the firmware-partition install module. -- `2/`, `3/`, `4/`, `5/` are the board profiles. Each one picks the right kernel and kernel params. Pi 4 and 5 also set DT filters and the initrd modules they need. +- `1/`, `2/`, `3/`, `4/`, `5/` are the board profiles. They select vendor kernels and configure board-specific boot and hardware settings. Pi 4 and 5 also set DT filters and the initrd modules they need. - The extra files under `4/` are opt-in toggles for Pi 4 hardware: audio, GPIO, I2C, LEDs, touchscreens, and so on. +- Where provided, `sd-image.nix` and `sd-image-installer.nix` combine a board profile with nixpkgs' SD-image builder, optionally adding the NixOS installation environment. ## Using a board profile @@ -24,7 +25,7 @@ These profiles assume the `generic-extlinux-compatible` bootloader (the NixOS mo `hardware.raspberry-pi.firmware` stages the files the Pi firmware needs before Linux starts onto the firmware partition (default `/boot/firmware`): GPU boot code (`bootcode.bin`, `start*.elf`, `fixup*.dat`), vendor device trees and overlays, the rendered `config.txt`, and optionally U-Boot. It is not a new boot method; it just supplies the files the existing `generic-extlinux-compatible` + U-Boot path needs. -When you build an SD image, the module sets `sdImage.populateFirmwareCommands` itself, so the firmware partition is populated at build time with no extra configuration. +When you build an SD image, the module sets `sdImage.populateFirmwareCommands` itself, so the firmware partition is populated at build time with no extra configuration. For cross-compilation, set `nixpkgs.buildPlatform` to the build machine's architecture and `nixpkgs.hostPlatform` to the target board's architecture, unless the profile already selects it. For a running system, set `hardware.raspberry-pi.firmware.enable = true`. An activation script then repopulates the firmware partition on every `nixos-rebuild switch`. It is off by default. @@ -39,11 +40,11 @@ To chainload U-Boot from the firmware, enable `uboot.enable`. It copies `u-boot. } ``` -`uboot.enable` defaults `uboot.package` to nixpkgs' `pkgs.ubootRaspberryPiAarch64`, built from the upstream `rpi_arm64_defconfig`, which covers every 64-bit board (Pi 3/4/5). For a 32-bit board, override `uboot.package` with the matching U-Boot build. On the Pi 5 this boots from SD, but U-Boot can't drive USB/PCIe/RP1 yet, so USB boot, NVMe boot, and a USB keyboard at the U-Boot prompt don't work until Linux takes over. +The shared firmware module defaults `uboot.package` to `pkgs.ubootRaspberryPiAarch64`, built from `rpi_arm64_defconfig` for 64-bit Pi 3/4/5 systems. Board profiles can override this default. For 32-bit systems, use the package matching the board: `pkgs.ubootRaspberryPi` for Pi 1, `pkgs.ubootRaspberryPi2` for Pi 2, or `pkgs.ubootRaspberryPi3_32bit` for Pi 3. On the Pi 5 this boots from SD, but U-Boot can't drive USB/PCIe/RP1 yet, so USB boot, NVMe boot, and a USB keyboard at the U-Boot prompt don't work until Linux takes over. ## `config.txt` -Board profiles import `hardware.raspberry-pi.configtxt`, which renders `config.txt` from Nix options. The defaults track the Raspberry Pi OS pi-gen image: camera and display autodetect, KMS, audio on, `arm_boost`. +Board profiles import `hardware.raspberry-pi.configtxt`, which renders `config.txt` from Nix options. The Pi 2–5 profiles also import `common/config-txt-defaults.nix`, which tracks the Raspberry Pi OS pi-gen image: camera and display autodetect, KMS, audio on, `arm_boost`. ```nix { @@ -174,4 +175,4 @@ To supply your own file, set `configtxt.file`. The module then ignores `settings - No bootloader module: There's no `boot.loader.raspberry-pi` here. Boards rely on `generic-extlinux-compatible` plus U-Boot. Raspberry Pi OS has the GPU firmware load the kernel directly; we go through U-Boot so it reads `extlinux.conf`, which is what gives you the NixOS boot-generation menu and rollbacks. The firmware install module just stages the boot code and (optionally) U-Boot; it doesn't add a firmware-level direct-boot path. Pi 5 boots from SD via U-Boot, but USB, PCIe, and the RP1 don't come up until Linux takes over, so a USB keyboard at the U-Boot prompt won't work on Pi 5 today. - Single pinned kernel: `common/kernel.nix` pins one `linux-rpi` version rather than matching each kernel to its firmware release. -- No Pi 0/02/1 board profiles: `common/kernel.nix` accepts `rpiVersion = 1`, but there's no `0/`, `02/`, or `1/` directory wiring that kernel up into a profile you can import via ``. +- No Pi Zero or Zero 2 board profiles. diff --git a/raspberry-pi/common/kernel.nix b/raspberry-pi/common/kernel.nix index 92b73547..641bce6c 100644 --- a/raspberry-pi/common/kernel.nix +++ b/raspberry-pi/common/kernel.nix @@ -83,6 +83,18 @@ in PREEMPT = lib.mkForce no; PREEMPT_LAZY = lib.mkForce no; PREEMPT_VOLUNTARY = lib.mkForce yes; + } + # These controllers are absent on Pi 1. Nixpkgs' automatic module selection + # enables them, but they use division helpers unavailable to 32-bit modules. + # https://github.com/NixOS/nixpkgs/issues/464515 + // lib.optionalAttrs (rpiVersion == 1) { + PWM_RP1 = no; + I2C_DESIGNWARE_CORE = no; + I2C_DESIGNWARE_SLAVE = no; + I2C_DESIGNWARE_PLATFORM = no; + I2C_DESIGNWARE_PCI = no; + VIDEO_RP1_CFE = no; + VIDEO_RP1_CFE_DOWNSTREAM = no; }; extraMeta = diff --git a/tests/nixos-tests.nix b/tests/nixos-tests.nix index f4c2b423..6a633f32 100644 --- a/tests/nixos-tests.nix +++ b/tests/nixos-tests.nix @@ -9,6 +9,8 @@ let blackList = [ # does import-from-derivation "toshiba-swanky" + # ARMv6 is not covered by the test platforms + "raspberry-pi-1" # uses custom nixpkgs config "raspberry-pi-2" # deprecated profiles