From cbcd0302c724608acbdbc6d1350c75014bcec272 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Sat, 1 Jun 2024 22:39:18 +0200 Subject: [PATCH 1/2] starfive visionfive2: use mainline kernel Co-authored-by: NickCao --- starfive/visionfive/v2/default.nix | 35 ++++++++++++++++++++-------- starfive/visionfive/v2/linux-6.6.nix | 26 --------------------- 2 files changed, 25 insertions(+), 36 deletions(-) delete mode 100644 starfive/visionfive/v2/linux-6.6.nix diff --git a/starfive/visionfive/v2/default.nix b/starfive/visionfive/v2/default.nix index 973db41..3807b6b 100644 --- a/starfive/visionfive/v2/default.nix +++ b/starfive/visionfive/v2/default.nix @@ -1,21 +1,36 @@ -{ config, lib, pkgs, ... }: { +{ + config, + lib, + pkgs, + ... +}: +{ boot = { - # Force no ZFS (from nixos/modules/profiles/base.nix) until updated to kernel 6.0 - supportedFilesystems = - lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" ]; consoleLogLevel = lib.mkDefault 7; - kernelPackages = lib.mkDefault (pkgs.callPackage ./linux-6.6.nix { - inherit (config.boot) kernelPatches; - }); - - kernelParams = - lib.mkDefault [ "console=tty0" "console=ttyS0,115200n8" "earlycon=sbi" ]; + # Switch to default as soon they reach >= 6.11 + kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; initrd.availableKernelModules = [ "dw_mmc_starfive" ]; + # Support booting SD-image from NVME SSD + initrd.kernelModules = [ + "clk-starfive-jh7110-aon" + "clk-starfive-jh7110-stg" + "phy-jh7110-pcie" + "pcie-starfive" + "nvme" + ]; + loader = { grub.enable = lib.mkDefault false; generic-extlinux-compatible.enable = lib.mkDefault true; }; }; + + assertions = [ + { + assertion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.11"; + message = "The VisionFive 2 requires at least mainline kernel version 6.11 for minimum hardware support."; + } + ]; } diff --git a/starfive/visionfive/v2/linux-6.6.nix b/starfive/visionfive/v2/linux-6.6.nix deleted file mode 100644 index 5999dd6..0000000 --- a/starfive/visionfive/v2/linux-6.6.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ lib, callPackage, linuxPackagesFor, kernelPatches, ... }: - -let - modDirVersion = "6.6.0"; - linuxPkg = { lib, fetchFromGitHub, buildLinux, ... }@args: - buildLinux (args // { - version = "${modDirVersion}-starfive-visionfive2"; - - src = fetchFromGitHub { - owner = "starfive-tech"; - repo = "linux"; - rev = "13eb70da2a73187c8c7aece13d23d68928aa8210"; - hash = "sha256-bwB7Pc+Z+MWXPfWYdgtRGuhqjiNHLDGNCY62e4lBGvE="; - }; - - inherit modDirVersion kernelPatches; - - structuredExtraConfig = with lib.kernel; { - PINCTRL_STARFIVE_JH7110_SYS = yes; - SERIAL_8250_DW = yes; - }; - - extraMeta.branch = "JH7110_VisionFive2_upstream"; - } // (args.argsOverride or { })); - -in lib.recurseIntoAttrs (linuxPackagesFor (callPackage linuxPkg { })) From 230536ce884a14aab03518da71d417f57461805b Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Sat, 21 Sep 2024 10:54:01 +0000 Subject: [PATCH 2/2] update tests flake lock --- tests/flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/flake.lock b/tests/flake.lock index 3e59550..ac0ed66 100644 --- a/tests/flake.lock +++ b/tests/flake.lock @@ -22,11 +22,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1726724509, - "narHash": "sha256-sVeAM1tgVi52S1e29fFBTPUAFSzgQwgLon3CrztXGm8=", + "lastModified": 1726905744, + "narHash": "sha256-xyNtG5C+xvfsnOVEamFe9zCCnuNwk93K/TlFC/4DmCI=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "10d5e0ecc32984c1bf1a9a46586be3451c42fd94", + "rev": "b493dfd4a8cf9552932179e56ff3b5819a9b8381", "type": "github" }, "original": { @@ -37,11 +37,11 @@ }, "nixos-stable": { "locked": { - "lastModified": 1726688310, - "narHash": "sha256-Xc9lEtentPCEtxc/F1e6jIZsd4MPDYv4Kugl9WtXlz0=", + "lastModified": 1726838390, + "narHash": "sha256-NmcVhGElxDbmEWzgXsyAjlRhUus/nEqPC5So7BOJLUM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "dbebdd67a6006bb145d98c8debf9140ac7e651d0", + "rev": "944b2aea7f0a2d7c79f72468106bc5510cbf5101", "type": "github" }, "original": {