2023-03-02 09:43:49 +00:00
|
|
|
# Based on https://github.com/Snektron/nixos-vf2/blob/master/pkgs/linux-vf2.nix
|
|
|
|
{
|
|
|
|
lib,
|
|
|
|
fetchFromGitHub,
|
|
|
|
buildLinux,
|
|
|
|
fetchpatch,
|
|
|
|
...
|
|
|
|
} @ args: let
|
2023-06-13 15:09:28 +00:00
|
|
|
modDirVersion = "6.4.0-rc6";
|
2023-03-02 09:43:49 +00:00
|
|
|
source = builtins.fromJSON (builtins.readFile ./source.json);
|
|
|
|
in
|
2023-06-25 15:58:48 +00:00
|
|
|
buildLinux (args
|
|
|
|
// {
|
|
|
|
inherit modDirVersion;
|
|
|
|
version = "${modDirVersion}-vf2";
|
2023-03-02 09:43:49 +00:00
|
|
|
|
2023-06-25 15:58:48 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "starfive-tech";
|
|
|
|
repo = "linux";
|
|
|
|
inherit (source) rev sha256;
|
|
|
|
};
|
2023-03-02 09:43:49 +00:00
|
|
|
|
2023-06-25 15:58:48 +00:00
|
|
|
kernelPatches = [
|
|
|
|
# https://lore.kernel.org/all/20230524000012.15028-1-andre.przywara@arm.com/
|
|
|
|
rec {
|
|
|
|
name = "axp15060-1.patch";
|
|
|
|
patch = fetchpatch {
|
|
|
|
inherit name;
|
|
|
|
url = "https://lore.kernel.org/all/20230524000012.15028-2-andre.przywara@arm.com/raw";
|
|
|
|
hash = "sha256-kj4vQaT4CV29EHv8MtuTgM/semIPDdv2dmveo/X27vU=";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rec {
|
|
|
|
name = "axp15060-2.patch";
|
|
|
|
patch = fetchpatch {
|
|
|
|
inherit name;
|
|
|
|
url = "https://lore.kernel.org/all/20230524000012.15028-3-andre.przywara@arm.com/raw";
|
|
|
|
hash = "sha256-QCPQyKqoapMtqEDB9QgAuXA7n8e1OtG+YlIgeSQBxXM=";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
rec {
|
|
|
|
name = "axp15060-3.patch";
|
|
|
|
patch = fetchpatch {
|
|
|
|
inherit name;
|
|
|
|
url = "https://lore.kernel.org/all/20230524000012.15028-4-andre.przywara@arm.com/raw";
|
|
|
|
hash = "sha256-SpKDm4PXR6qs7kX5SGVpFF/EPBijMhX1NsFUHrlCynM=";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
2023-03-02 09:43:49 +00:00
|
|
|
|
2023-06-25 15:58:48 +00:00
|
|
|
structuredExtraConfig = with lib.kernel; {
|
|
|
|
CPU_FREQ = yes;
|
|
|
|
CPUFREQ_DT = yes;
|
|
|
|
CPUFREQ_DT_PLATDEV = yes;
|
|
|
|
DMADEVICES = yes;
|
|
|
|
GPIO_SYSFS = yes;
|
|
|
|
HIBERNATION = yes;
|
|
|
|
NO_HZ_IDLE = yes;
|
|
|
|
POWER_RESET_GPIO_RESTART = yes;
|
|
|
|
PROC_KCORE = yes;
|
|
|
|
PWM = yes;
|
|
|
|
PWM_STARFIVE_PTC = yes;
|
|
|
|
RD_GZIP = yes;
|
|
|
|
SENSORS_SFCTEMP = yes;
|
|
|
|
SERIAL_8250_DW = yes;
|
|
|
|
SIFIVE_CCACHE = yes;
|
|
|
|
SIFIVE_PLIC = yes;
|
2023-03-02 09:43:49 +00:00
|
|
|
|
2023-06-25 15:58:48 +00:00
|
|
|
RTC_DRV_STARFIVE = yes;
|
|
|
|
SPI_PL022 = yes;
|
|
|
|
SPI_PL022_STARFIVE = yes;
|
2023-06-16 05:40:20 +00:00
|
|
|
|
2023-06-25 15:58:48 +00:00
|
|
|
I2C = yes;
|
|
|
|
MFD_AXP20X = yes;
|
|
|
|
MFD_AXP20X_I2C = yes;
|
|
|
|
REGULATOR_AXP20X = yes;
|
2023-06-16 05:40:20 +00:00
|
|
|
|
2023-06-25 15:58:48 +00:00
|
|
|
# FATAL: modpost: drivers/gpu/drm/verisilicon/vs_drm: struct of_device_id is not terminated with a NULL entry!
|
|
|
|
DRM_VERISILICON = no;
|
2023-03-02 09:43:49 +00:00
|
|
|
|
2023-06-25 15:58:48 +00:00
|
|
|
PL330_DMA = no;
|
|
|
|
};
|
2023-03-02 09:43:49 +00:00
|
|
|
|
2023-06-25 15:58:48 +00:00
|
|
|
preferBuiltin = true;
|
2023-06-16 05:40:20 +00:00
|
|
|
|
2023-06-25 15:58:48 +00:00
|
|
|
extraMeta = {
|
|
|
|
branch = "JH7110_VisionFive2_upstream";
|
|
|
|
description = "Linux kernel for StarFive's VisionFive2";
|
|
|
|
platforms = ["riscv64-linux"];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// (args.argsOverride or {}))
|