Merge branch 'master' into msi_z370
This commit is contained in:
commit
e3230fe3cb
20 changed files with 378 additions and 88 deletions
|
|
@ -32,7 +32,14 @@ the following:
|
|||
```nix
|
||||
{
|
||||
description = "NixOS configuration with flakes";
|
||||
inputs.nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
||||
nixos-hardware = {
|
||||
url = "github:NixOS/nixos-hardware";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixos-hardware }: {
|
||||
# replace <your-hostname> with your actual hostname
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Configuration for the ScreenPad is unable to be provided here at this time, due
|
|||
inputs = {
|
||||
|
||||
nixpkgs = {
|
||||
url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
||||
};
|
||||
|
||||
screenpad-driver={
|
||||
|
|
|
|||
|
|
@ -1,24 +1,17 @@
|
|||
{
|
||||
callPackage,
|
||||
fetchFromGitHub,
|
||||
stdenv,
|
||||
clang,
|
||||
git,
|
||||
dtc,
|
||||
glibc,
|
||||
zlib,
|
||||
vim,
|
||||
pkgs,
|
||||
}:
|
||||
let
|
||||
bp = pkgs.buildPackages;
|
||||
|
||||
imx95-atf = callPackage ./ucm-imx95-atf.nix { };
|
||||
imx95-firmware = callPackage ./ucm-imx95-firmware.nix { };
|
||||
imx95-uboot = callPackage ./ucm-imx95-uboot.nix { };
|
||||
imx95-optee-os = callPackage ./ucm-imx95-optee-os.nix { };
|
||||
imx95-sm-fw = callPackage ./ucm-imx95-sm-fw.nix { };
|
||||
imx95-oei-ddr = callPackage ./ucm-imx95-oei-ddr.nix { };
|
||||
imx95-oei-tcm = callPackage ./ucm-imx95-oei-tcm.nix { };
|
||||
src = fetchFromGitHub {
|
||||
imx95-atf = pkgs.callPackage ./ucm-imx95-atf.nix { };
|
||||
imx95-firmware = pkgs.callPackage ./ucm-imx95-firmware.nix { };
|
||||
imx95-uboot = pkgs.callPackage ./ucm-imx95-uboot.nix { };
|
||||
imx95-optee-os = pkgs.callPackage ./ucm-imx95-optee-os.nix { };
|
||||
imx95-sm-fw = pkgs.callPackage ./ucm-imx95-sm-fw.nix { };
|
||||
imx95-oei-ddr = pkgs.callPackage ./ucm-imx95-oei-ddr.nix { };
|
||||
imx95-oei-tcm = pkgs.callPackage ./ucm-imx95-oei-tcm.nix { };
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "nxp-imx";
|
||||
repo = "imx-mkimage";
|
||||
#tag: lf-6.6.52-2.2.1
|
||||
|
|
@ -28,7 +21,8 @@ let
|
|||
shortRev = builtins.substring 0 8 src.rev;
|
||||
in
|
||||
{
|
||||
imx95-boot = stdenv.mkDerivation rec {
|
||||
# mkimage runs on the build machine; use buildPackages when cross-compiling.
|
||||
imx95-boot = bp.stdenv.mkDerivation {
|
||||
inherit src;
|
||||
name = "imx95-mkimage";
|
||||
version = "lf-6.6.52-2.2.1";
|
||||
|
|
@ -36,27 +30,22 @@ in
|
|||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail 'git rev-parse --short=8 HEAD' 'echo ${shortRev}'
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail 'CC = gcc' 'CC = clang'
|
||||
substituteInPlace iMX95/soc.mak \
|
||||
--replace-fail 'xxd' "${vim.xxd}/bin/xxd"
|
||||
--replace-fail 'xxd' "${bp.vim.xxd}/bin/xxd"
|
||||
substituteInPlace scripts/fspi_fcb_gen.sh \
|
||||
--replace-fail 'xxd' "${vim.xxd}/bin/xxd"
|
||||
--replace-fail 'xxd' "${bp.vim.xxd}/bin/xxd"
|
||||
substituteInPlace scripts/fspi_packer.sh \
|
||||
--replace-fail 'xxd' "${vim.xxd}/bin/xxd"
|
||||
--replace-fail 'xxd' "${bp.vim.xxd}/bin/xxd"
|
||||
patchShebangs scripts
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
clang
|
||||
git
|
||||
dtc
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
glibc.static
|
||||
zlib
|
||||
zlib.static
|
||||
bp.stdenv.cc
|
||||
bp.git
|
||||
bp.dtc
|
||||
bp.glibc.static
|
||||
bp.zlib
|
||||
bp.zlib.static
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
final: _prev: {
|
||||
inherit (final.callPackage ./bsp/ucm-imx95-boot.nix { }) imx95-boot;
|
||||
inherit (final.callPackage ./bsp/ucm-imx95-boot.nix { pkgs = final; }) imx95-boot;
|
||||
}
|
||||
|
|
|
|||
19
flake.lock
generated
19
flake.lock
generated
|
|
@ -1,6 +1,23 @@
|
|||
{
|
||||
"nodes": {
|
||||
"root": {}
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1767892417,
|
||||
"narHash": "sha256-8bW3q88CEg2u4hSP66Vf4lpbLonHz7hqDNBMcCY7E9U=",
|
||||
"rev": "3497aa5c9457a9d88d71fa93a4a8368816fbeeba",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre924538.3497aa5c9457/nixexprs.tar.xz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
|
|
|
|||
21
flake.nix
21
flake.nix
|
|
@ -1,13 +1,17 @@
|
|||
{
|
||||
description = "nixos-hardware";
|
||||
|
||||
inputs.nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
||||
|
||||
outputs =
|
||||
{ self, ... }:
|
||||
{ self, nixpkgs, ... }:
|
||||
let
|
||||
# Import private inputs (for development)
|
||||
privateInputs =
|
||||
(import ./tests/flake-compat.nix {
|
||||
src = ./tests;
|
||||
src = {
|
||||
outPath = self.outPath + "/tests";
|
||||
};
|
||||
}).defaultNix;
|
||||
|
||||
systems = [
|
||||
|
|
@ -23,17 +27,10 @@
|
|||
];
|
||||
|
||||
# Helper to iterate over systems
|
||||
eachSystem =
|
||||
f:
|
||||
privateInputs.nixos-unstable-small.lib.genAttrs systems (
|
||||
system: f privateInputs.nixos-unstable-small.legacyPackages.${system} system
|
||||
);
|
||||
eachSystem = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system} system);
|
||||
|
||||
eachSystemFormat =
|
||||
f:
|
||||
privateInputs.nixos-unstable-small.lib.genAttrs formatSystems (
|
||||
system: f privateInputs.nixos-unstable-small.legacyPackages.${system} system
|
||||
);
|
||||
f: nixpkgs.lib.genAttrs formatSystems (system: f nixpkgs.legacyPackages.${system} system);
|
||||
in
|
||||
{
|
||||
|
||||
|
|
@ -498,6 +495,8 @@
|
|||
run-tests = pkgs.callPackage ./tests/run-tests.nix {
|
||||
inherit self;
|
||||
};
|
||||
|
||||
mnt-reform-kernel-patches = pkgs.callPackage ./mnt/reform/updateKernelPatches.nix { };
|
||||
}
|
||||
// pkgs.lib.optionalAttrs (system == "aarch64-linux") {
|
||||
# Boot images for NXP i.MX boards (aarch64-linux only)
|
||||
|
|
|
|||
|
|
@ -10,8 +10,11 @@ To create an initial SD card image for installation:
|
|||
# flake.nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixos-hardware.url = "github:nixos/nixos-hardware/master";
|
||||
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
||||
nixos-hardware = {
|
||||
url = "github:NixOS/nixos-hardware";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
outputs = { self, nixpkgs, nixos-hardware }: rec {
|
||||
nixosConfigurations.m1 = nixpkgs.lib.nixosSystem {
|
||||
|
|
@ -80,8 +83,11 @@ flake:
|
|||
# flake.nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixos-hardware.url = "github:nixos/nixos-hardware/master";
|
||||
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
||||
nixos-hardware = {
|
||||
url = "github:NixOS/nixos-hardware";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
outputs = { nixpkgs, nixos-hardware, ... }: {
|
||||
nixosConfigurations.m1 = nixpkgs.lib.nixosSystem {
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ let
|
|||
supportedKernels =
|
||||
let
|
||||
lts-kernel = {
|
||||
version = "6.18.13";
|
||||
hash = "sha256-7Sw8Vf045oNsCU/ONW8lZ/lRYTC3M1SimFeWA2jFaH8=";
|
||||
version = "6.19.8";
|
||||
hash = "sha256-qtpHItuLz6C5cyhRhW1AUIK2pPouOrBnvo2xfN0RWzg=";
|
||||
};
|
||||
|
||||
in
|
||||
|
|
@ -38,8 +38,8 @@ let
|
|||
linux-surface = pkgs.fetchFromGitHub {
|
||||
owner = "linux-surface";
|
||||
repo = "linux-surface";
|
||||
rev = "829ceccd5970ed3621a30d9fcfb2fe6584a3aab7";
|
||||
hash = "sha256-H/qjP2dR5yjUvHUhI6pis+EHHSRXxc4+c4zir/pDA54=";
|
||||
rev = "bf1921fc63f33d03a007fb38c4f88ff7e7bc1a55";
|
||||
hash = "sha256-AV+J1iKpA4PEsX9oVUTGlzGerTWTermia3aJSZxuu/w=";
|
||||
};
|
||||
|
||||
# Fetch and build the kernel
|
||||
|
|
|
|||
197
microsoft/surface/common/kernel/6.19/patches.nix
Normal file
197
microsoft/surface/common/kernel/6.19/patches.nix
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
{
|
||||
lib,
|
||||
kernel ? lib.kernel,
|
||||
patchSrc,
|
||||
version,
|
||||
}:
|
||||
|
||||
[
|
||||
{
|
||||
name = "microsoft-surface-patches-linux-${version}";
|
||||
patch = null;
|
||||
structuredExtraConfig = with kernel; {
|
||||
##
|
||||
## Surface Aggregator Module
|
||||
##
|
||||
CONFIG_SURFACE_AGGREGATOR = module;
|
||||
# CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION is not set
|
||||
CONFIG_SURFACE_AGGREGATOR_BUS = yes;
|
||||
CONFIG_SURFACE_AGGREGATOR_CDEV = module;
|
||||
CONFIG_SURFACE_AGGREGATOR_HUB = module;
|
||||
CONFIG_SURFACE_AGGREGATOR_REGISTRY = module;
|
||||
CONFIG_SURFACE_AGGREGATOR_TABLET_SWITCH = module;
|
||||
|
||||
CONFIG_SURFACE_ACPI_NOTIFY = module;
|
||||
CONFIG_SURFACE_DTX = module;
|
||||
CONFIG_SURFACE_PLATFORM_PROFILE = module;
|
||||
|
||||
CONFIG_SURFACE_HID = module;
|
||||
CONFIG_SURFACE_KBD = module;
|
||||
|
||||
CONFIG_BATTERY_SURFACE = module;
|
||||
CONFIG_CHARGER_SURFACE = module;
|
||||
|
||||
CONFIG_SENSORS_SURFACE_TEMP = module;
|
||||
CONFIG_SENSORS_SURFACE_FAN = module;
|
||||
|
||||
CONFIG_RTC_DRV_SURFACE = module;
|
||||
|
||||
##
|
||||
## Surface Hotplug
|
||||
##
|
||||
CONFIG_SURFACE_HOTPLUG = module;
|
||||
|
||||
##
|
||||
## IPTS and ITHC touchscreen
|
||||
##
|
||||
## This only enables the user interface for IPTS/ITHC data.
|
||||
## For the touchscreen to work, you need to install iptsd.
|
||||
##
|
||||
CONFIG_HID_IPTS = module;
|
||||
CONFIG_HID_ITHC = module;
|
||||
CONFIG_INTEL_THC_HID = module;
|
||||
CONFIG_INTEL_QUICKSPI = module;
|
||||
|
||||
##
|
||||
## Cameras: IPU3
|
||||
##
|
||||
CONFIG_VIDEO_DW9719 = module;
|
||||
CONFIG_VIDEO_IPU3_IMGU = module;
|
||||
CONFIG_VIDEO_IPU3_CIO2 = module;
|
||||
CONFIG_IPU_BRIDGE = module;
|
||||
CONFIG_INTEL_SKL_INT3472 = module;
|
||||
CONFIG_REGULATOR_TPS68470 = module;
|
||||
CONFIG_COMMON_CLK_TPS68470 = module;
|
||||
CONFIG_LEDS_TPS68470 = module;
|
||||
|
||||
##
|
||||
## Cameras: Sensor drivers
|
||||
##
|
||||
CONFIG_VIDEO_OV5693 = module;
|
||||
CONFIG_VIDEO_OV7251 = module;
|
||||
CONFIG_VIDEO_OV8865 = module;
|
||||
|
||||
##
|
||||
## Surface 3: atomisp causes problems (see issue #1095). Disable it for now.
|
||||
##
|
||||
# CONFIG_INTEL_ATOMISP is not set
|
||||
|
||||
##
|
||||
## ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7
|
||||
##
|
||||
CONFIG_APDS9960 = module;
|
||||
|
||||
##
|
||||
## Other Drivers
|
||||
##
|
||||
CONFIG_INPUT_SOC_BUTTON_ARRAY = module;
|
||||
CONFIG_SURFACE_3_POWER_OPREGION = module;
|
||||
CONFIG_SURFACE_PRO3_BUTTON = module;
|
||||
CONFIG_SURFACE_GPE = module;
|
||||
CONFIG_SURFACE_BOOK1_DGPU_SWITCH = module;
|
||||
CONFIG_HID_SURFACE = module;
|
||||
|
||||
##
|
||||
## HOTFIX FOR CVE-2026-31431
|
||||
##
|
||||
|
||||
# CONFIG_CRYPTO_USER_API_AEAD is not set
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0001-secureboot";
|
||||
patch = patchSrc + "/0001-secureboot.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0002-surface3";
|
||||
patch = patchSrc + "/0002-surface3.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0003-mwifiex";
|
||||
patch = patchSrc + "/0003-mwifiex.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0004-ath10k";
|
||||
patch = patchSrc + "/0004-ath10k.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0005-ipts";
|
||||
patch = patchSrc + "/0005-ipts.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0006-ithc";
|
||||
patch = patchSrc + "/0006-ithc.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0007-surface-sam";
|
||||
patch = patchSrc + "/0007-surface-sam.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0008-surface-sam-over-hid";
|
||||
patch = patchSrc + "/0008-surface-sam-over-hid.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0009-surface-button";
|
||||
patch = patchSrc + "/0009-surface-button.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0010-surface-typecover";
|
||||
patch = patchSrc + "/0010-surface-typecover.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0011-surface-shutdown";
|
||||
patch = patchSrc + "/0011-surface-shutdown.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0012-surface-gpe";
|
||||
patch = patchSrc + "/0012-surface-gpe.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0013-cameras";
|
||||
patch = patchSrc + "/0013-cameras.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0014-amd-gpio";
|
||||
patch = patchSrc + "/0014-amd-gpio.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0015-rtc";
|
||||
patch = patchSrc + "/0015-rtc.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0016-hid-surface";
|
||||
patch = patchSrc + "/0016-hid-surface.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0017-dirtyfrag-xfrm-esp-avoid-in-place-decrypt-on-shared-skb-frags";
|
||||
patch = patchSrc + "/0017-dirtyfrag-xfrm-esp-avoid-in-place-decrypt-on-shared-skb-frags.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0018-dirtyfrag-rxrpc-Fix-potential-UAF-after-skb_unshare-failure";
|
||||
patch = patchSrc + "/0018-dirtyfrag-rxrpc-Fix-potential-UAF-after-skb_unshare-failure.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0019-dirtyfrag-rxrpc-Fix-rxrpc_input_call_event-to-only-unshare-DAT";
|
||||
patch = patchSrc + "/0019-dirtyfrag-rxrpc-Fix-rxrpc_input_call_event-to-only-unshare-DAT.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0020-dirtyfrag-rxrpc-Fix-use-of-wrong-skb-when-comparing-queued-RES";
|
||||
patch = patchSrc + "/0020-dirtyfrag-rxrpc-Fix-use-of-wrong-skb-when-comparing-queued-RES.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0021-dirtyfrag-rxrpc-only-handle-RESPONSE-during-service-challenge";
|
||||
patch = patchSrc + "/0021-dirtyfrag-rxrpc-only-handle-RESPONSE-during-service-challenge.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0022-dirtyfrag-rxrpc-Fix-conn-level-packet-handling-to-unshare-RESP";
|
||||
patch = patchSrc + "/0022-dirtyfrag-rxrpc-Fix-conn-level-packet-handling-to-unshare-RESP.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0023-dirtyfrag-rxrpc-Fix-re-decryption-of-RESPONSE-packets";
|
||||
patch = patchSrc + "/0023-dirtyfrag-rxrpc-Fix-re-decryption-of-RESPONSE-packets.patch";
|
||||
}
|
||||
{
|
||||
name = "ms-surface/0024-dirtyfrag-rxrpc-Also-unshare-DATA-RESPONSE-packets-when-paged-";
|
||||
patch = patchSrc + "/0024-dirtyfrag-rxrpc-Also-unshare-DATA-RESPONSE-packets-when-paged-.patch";
|
||||
}
|
||||
]
|
||||
|
|
@ -5,8 +5,11 @@ Create and customize a `flake.nix` file:
|
|||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixos-hardware.url = "github:nixos/nixos-hardware";
|
||||
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
||||
nixos-hardware = {
|
||||
url = "github:NixOS/nixos-hardware";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, nixos-hardware, ... }:
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@
|
|||
Create and configure the `flake.nix` file:
|
||||
``` nix
|
||||
{
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
inputs.nixos-hardware.url = "github:nixos/nixos-hardware";
|
||||
inputs.nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
||||
inputs.nixos-hardware = {
|
||||
url = "github:NixOS/nixos-hardware";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { self, nixpkgs, nixos-hardware, flake-utils, ... }:
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
{
|
||||
lib,
|
||||
fetchFromGitLab,
|
||||
}:
|
||||
|
||||
let
|
||||
nixpkgs = import <nixpkgs> { };
|
||||
pkgs = nixpkgs.pkgs;
|
||||
lib = nixpkgs.lib;
|
||||
sources = lib.importJSON ./sources.json;
|
||||
reformDebianPackages = pkgs.fetchFromGitLab sources.reformDebianPackages;
|
||||
reformDebianPackages = fetchFromGitLab sources.reformDebianPackages;
|
||||
in
|
||||
map (lib.removePrefix "${reformDebianPackages}/") (
|
||||
lib.filesystem.listFilesRecursive "${reformDebianPackages}/linux/patches${lib.versions.majorMinor sources.modDirVersion}"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
nix eval --file updateKernelPatches.nix > kernelPatches.nix
|
||||
nix eval .#mnt-reform-kernel-patches > kernelPatches.nix
|
||||
nix fmt kernelPatches.nix
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
lib,
|
||||
fetchgit,
|
||||
fetchpatch,
|
||||
stdenv,
|
||||
buildPackages,
|
||||
pkgsCross,
|
||||
|
|
@ -22,6 +23,14 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "sha256-a8F+Lf8pwML+tCwawS0N/mrSXWPmFhlUeOg0MCRK3VE=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(fetchpatch {
|
||||
name = "imx93-trdc-header-guard.patch";
|
||||
url = "https://github.com/nxp-imx/imx-atf/commit/e194a14ec55f13386babc80c90098874367ab3d6.patch";
|
||||
sha256 = "sha256-K1JECateo4mUrOaV41PUmCXHn7DfmgRQXx4KdcIALqE=";
|
||||
})
|
||||
];
|
||||
|
||||
# Compiler dependencies
|
||||
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||
nativeBuildInputs = [ pkgsCross.aarch64-embedded.stdenv.cc ];
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
pkgs,
|
||||
}:
|
||||
with pkgs;
|
||||
let
|
||||
bp = pkgs.buildPackages;
|
||||
|
||||
imx93-atf = pkgs.callPackage ./imx93-atf.nix { };
|
||||
imx93-firmware = pkgs.callPackage ./imx93-firmware.nix { };
|
||||
|
|
@ -17,7 +17,8 @@ let
|
|||
shortRev = builtins.substring 0 8 src.rev;
|
||||
in
|
||||
{
|
||||
imx93-boot = pkgs.stdenv.mkDerivation rec {
|
||||
# mkimage runs on the build machine; use buildPackages when cross-compiling.
|
||||
imx93-boot = bp.stdenv.mkDerivation {
|
||||
inherit src;
|
||||
name = "imx93-mkimage";
|
||||
version = "lf-6.12.3";
|
||||
|
|
@ -25,28 +26,22 @@ in
|
|||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace 'git rev-parse --short=8 HEAD' 'echo ${shortRev}'
|
||||
substituteInPlace Makefile \
|
||||
--replace 'CC = gcc' 'CC = clang'
|
||||
substituteInPlace iMX93/soc.mak \
|
||||
--replace 'xxd' "${pkgs.vim.xxd}/bin/xxd"
|
||||
--replace 'xxd' "${bp.vim.xxd}/bin/xxd"
|
||||
substituteInPlace scripts/fspi_fcb_gen.sh \
|
||||
--replace 'xxd' "${pkgs.vim.xxd}/bin/xxd"
|
||||
--replace 'xxd' "${bp.vim.xxd}/bin/xxd"
|
||||
substituteInPlace scripts/fspi_packer.sh \
|
||||
--replace 'xxd' "${pkgs.vim.xxd}/bin/xxd"
|
||||
--replace 'xxd' "${bp.vim.xxd}/bin/xxd"
|
||||
patchShebangs scripts
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
clang
|
||||
git
|
||||
dtc
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
git
|
||||
glibc.static
|
||||
zlib
|
||||
zlib.static
|
||||
bp.stdenv.cc
|
||||
bp.git
|
||||
bp.dtc
|
||||
bp.glibc.static
|
||||
bp.zlib
|
||||
bp.zlib.static
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ Create and configure the `flake.nix` file:
|
|||
|
||||
``` nix
|
||||
{
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
inputs.nixos-hardware.url = "github:nixos/nixos-hardware";
|
||||
inputs.nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
||||
inputs.nixos-hardware = {
|
||||
url = "github:NixOS/nixos-hardware";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
|
||||
outputs = { self, nixpkgs, nixos-hardware, ... }:
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ Below is an annoated flake example to create the initial boot image.
|
|||
disko.url = "github:nix-community/disko";
|
||||
disko.inputs.nixpkgs.follows = "nixpkgs";
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
nixos-hardware.inputs.nixpkgs.follows = "nixpkgs";
|
||||
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
||||
nixpkgs-unfree.url = "github:numtide/nixpkgs-unfree/nixos-unstable";
|
||||
};
|
||||
|
||||
|
|
|
|||
56
raspberry-pi/README.md
Normal file
56
raspberry-pi/README.md
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
# Raspberry Pi
|
||||
|
||||
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, and a pinned wireless firmware.
|
||||
- `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.
|
||||
- The extra files under `4/` are opt-in toggles for Pi 4 hardware: audio, dwc2, GPIO, I2C, LEDs, the PoE HATs, touchscreens, and so on.
|
||||
|
||||
## Using a board profile
|
||||
|
||||
```nix
|
||||
{
|
||||
imports = [
|
||||
<nixos-hardware/raspberry-pi/4>
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
These profiles assume the `generic-extlinux-compatible` bootloader (the NixOS module that writes an `extlinux.conf` for U-Boot to read), which is what aarch64 NixOS SD images use by default. There is no `boot.loader.raspberry-pi` module here. U-Boot itself still has to land on the boot partition somehow. Either your image builder does it, or you do. Nothing in here writes to `/boot/firmware/`. See [Current limits](#current-limits).
|
||||
|
||||
## `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`.
|
||||
|
||||
```nix
|
||||
{
|
||||
hardware.raspberry-pi.configtxt.settings = {
|
||||
all = {
|
||||
dtparam = [ "audio=on" ];
|
||||
dtoverlay = [
|
||||
"vc4-kms-v3d"
|
||||
"disable-bt"
|
||||
];
|
||||
};
|
||||
pi5.arm_freq = 2400;
|
||||
cm4.otg_mode = true;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
List values become repeated keys in the rendered file, so the `dtoverlay` above expands to:
|
||||
|
||||
```
|
||||
dtoverlay=vc4-kms-v3d
|
||||
dtoverlay=disable-bt
|
||||
```
|
||||
|
||||
Top-level attrs are conditional sections (`all`, `pi4`, `pi5`, `cm4`, and so on). Nesting stacks filters. To drop a default, set the key to `null` with `mkForce`.
|
||||
|
||||
## Current limits
|
||||
|
||||
- No firmware install: Nothing writes `start*.elf`, `bootcode.bin`, `fixup*.dat`, vendor DTBs, overlays, or `config.txt` to `/boot/firmware/`. The rendered config.txt is exposed at `hardware.raspberry-pi.configtxt.file`, but nothing on disk reads it yet. You either rely on the SD-image populate step or stage those files yourself.
|
||||
- No bootloader module: There's no `boot.loader.raspberry-pi` here. Boards rely on `generic-extlinux-compatible` plus U-Boot. 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.
|
||||
- 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 `<nixos-hardware/raspberry-pi/...>`.
|
||||
|
|
@ -3,8 +3,11 @@
|
|||
Create and configure the `flake.nix` file:
|
||||
``` nix
|
||||
{
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
inputs.nixos-hardware.url = "github:nixos/nixos-hardware";
|
||||
inputs.nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz";
|
||||
inputs.nixos-hardware = {
|
||||
url = "github:NixOS/nixos-hardware";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Some dependencies of this flake are not yet available on non linux systems
|
||||
inputs.systems.url = "github:nix-systems/x86_64-linux";
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
description = "Private dev inputs for nixos-hardware";
|
||||
|
||||
inputs = {
|
||||
nixos-unstable-small.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
||||
nixos-stable.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||
nixos-unstable-small.url = "https://channels.nixos.org/nixos-unstable-small/nixexprs.tar.xz";
|
||||
nixos-stable.url = "https://channels.nixos.org/nixos-25.11/nixexprs.tar.xz";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
treefmt-nix.inputs.nixpkgs.follows = "nixos-unstable-small";
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue