2022-06-25 17:37:18 +02:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildLinux
|
2022-07-09 05:28:56 +02:00
|
|
|
, vendor-kernel
|
2022-06-25 17:37:18 +02:00
|
|
|
, ... } @ args:
|
|
|
|
|
|
|
|
let
|
2022-07-09 05:28:56 +02:00
|
|
|
kernelVersion = rec {
|
|
|
|
# Fully constructed string, example: "5.10.0-rc5".
|
|
|
|
string = "${version + "." + patchlevel + "." + sublevel + (lib.optionalString (extraversion != "") extraversion)}";
|
|
|
|
file = "${vendor-kernel}/Makefile";
|
|
|
|
version = toString (builtins.match ".+VERSION = ([0-9]+).+" (builtins.readFile file));
|
|
|
|
patchlevel = toString (builtins.match ".+PATCHLEVEL = ([0-9]+).+" (builtins.readFile file));
|
|
|
|
sublevel = toString (builtins.match ".+SUBLEVEL = ([0-9]+).+" (builtins.readFile file));
|
|
|
|
# rc, next, etc.
|
|
|
|
extraversion = toString (builtins.match ".+EXTRAVERSION = ([a-z0-9-]+).+" (builtins.readFile file));
|
|
|
|
};
|
|
|
|
modDirVersion = "${kernelVersion.string}";
|
2022-06-25 17:37:18 +02:00
|
|
|
in buildLinux (args // {
|
|
|
|
inherit modDirVersion;
|
|
|
|
version = "${modDirVersion}-visionfive";
|
|
|
|
|
2022-07-09 05:28:56 +02:00
|
|
|
src = vendor-kernel;
|
2022-06-25 17:37:18 +02:00
|
|
|
|
|
|
|
kernelPatches = [];
|
|
|
|
|
|
|
|
defconfig = "starfive_jh7100_fedora_defconfig";
|
|
|
|
|
|
|
|
structuredExtraConfig = with lib.kernel; {
|
2022-07-09 05:28:56 +02:00
|
|
|
KEXEC = yes;
|
2022-06-25 17:37:18 +02:00
|
|
|
SERIAL_8250_DW = yes;
|
|
|
|
PINCTRL_STARFIVE = yes;
|
|
|
|
|
|
|
|
# Doesn't build as a module
|
|
|
|
DW_AXI_DMAC_STARFIVE = yes;
|
|
|
|
|
|
|
|
# stmmac hangs when built as a module
|
2024-01-17 15:00:51 +01:00
|
|
|
#PTP_1588_CLOCK = yes;
|
|
|
|
#STMMAC_ETH = yes;
|
|
|
|
#STMMAC_PCI = yes;
|
2023-11-29 10:48:59 +01:00
|
|
|
|
|
|
|
# For qemu
|
|
|
|
BLOCK = yes;
|
|
|
|
BLK_DEV = yes;
|
|
|
|
DEVTMPFS = yes;
|
|
|
|
VIRTIO_MENU = yes;
|
|
|
|
VIRTIO_BLK = yes;
|
|
|
|
|
|
|
|
# For 9P: https://wiki.qemu.org/Documentation/9psetup
|
|
|
|
NET_9P = yes;
|
|
|
|
NET_9P_VIRTIO = yes;
|
|
|
|
NET_9P_DEBUG = yes;
|
|
|
|
"9P_FS" = yes;
|
|
|
|
"9P_FS_POSIX_ACL" = yes;
|
|
|
|
PCI = yes;
|
|
|
|
VIRTIO_PCI = yes;
|
|
|
|
PCI_HOST_GENERIC = yes;
|
2022-06-25 17:37:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extraMeta = {
|
|
|
|
description = "Linux kernel for StarFive's JH7100 RISC-V SoC (VisionFive)";
|
|
|
|
platforms = [ "riscv64-linux" ];
|
|
|
|
hydraPlatforms = [ "riscv64-linux" ];
|
|
|
|
};
|
|
|
|
} // (args.argsOverride or { }))
|