mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	starfive visionfive2: use mainline kernel
Co-authored-by: NickCao <nickcao@nichi.co>
This commit is contained in:
		@@ -1,21 +1,36 @@
 | 
				
			|||||||
{ config, lib, pkgs, ... }: {
 | 
					{
 | 
				
			||||||
 | 
					  config,
 | 
				
			||||||
 | 
					  lib,
 | 
				
			||||||
 | 
					  pkgs,
 | 
				
			||||||
 | 
					  ...
 | 
				
			||||||
 | 
					}:
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
  boot = {
 | 
					  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;
 | 
					    consoleLogLevel = lib.mkDefault 7;
 | 
				
			||||||
    kernelPackages = lib.mkDefault (pkgs.callPackage ./linux-6.6.nix {
 | 
					    # Switch to default as soon they reach >= 6.11
 | 
				
			||||||
      inherit (config.boot) kernelPatches;
 | 
					    kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    kernelParams =
 | 
					 | 
				
			||||||
      lib.mkDefault [ "console=tty0" "console=ttyS0,115200n8" "earlycon=sbi" ];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    initrd.availableKernelModules = [ "dw_mmc_starfive" ];
 | 
					    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 = {
 | 
					    loader = {
 | 
				
			||||||
      grub.enable = lib.mkDefault false;
 | 
					      grub.enable = lib.mkDefault false;
 | 
				
			||||||
      generic-extlinux-compatible.enable = lib.mkDefault true;
 | 
					      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.";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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 { }))
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user