Add kernel build

This commit is contained in:
Samuel Dionne-Riel 2020-01-06 15:21:57 -05:00
parent fdbecb02b6
commit 0658481977
2 changed files with 75 additions and 1 deletions

47
kernel/default.nix Normal file
View File

@ -0,0 +1,47 @@
{ stdenv
, buildPackages
, fetchFromGitLab
, perl
, buildLinux
, modDirVersionArg ? null
, ... } @ args:
let
inherit (stdenv.lib)
concatStrings
intersperse
take
splitString
optionalString
;
in
(
buildLinux (args // rec {
version = "5.4.0";
# modDirVersion needs to be x.y.z, will automatically add .0 if needed
modDirVersion = if (modDirVersionArg == null) then concatStrings (intersperse "." (take 3 (splitString "." "${version}.0"))) else modDirVersionArg;
# branchVersion needs to be x.y
extraMeta.branch = concatStrings (intersperse "." (take 2 (splitString "." version)));
src = fetchFromGitLab {
domain = "gitlab.manjaro.org";
owner = "tsys";
repo = "linux-pinebook-pro";
rev = "877ca0e7283596f37845de50dc36bff5b88b91e1";
sha256 = "1g1ysnd25d5b8rv437n6cbjb9496aj2ljzk7zkqgdjllk66yipl4";
};
postInstall = (optionalString (args ? postInstall) args.postInstall) + ''
mkdir -p "$out/nix-support"
cp -v "$buildRoot/.config" "$out/nix-support/build.config"
'';
} // (args.argsOverride or {}))
)
#).overrideAttrs(args: {
# postInstall = (optionalString (args ? postInstall) args.postInstall) + ''
# mkdir -p "$out/nix-support"
# cp -v "$buildRoot/.config" "$out/nix-support/build.config"
# '';
#})

View File

@ -1,10 +1,37 @@
final: super:
let
inherit (final) callPackage;
inherit (final) callPackage kernelPatches linuxPackagesFor;
in
{
# Alternative BSP u-boot, with nvme support if desired
# * https://gitlab.manjaro.org/manjaro-arm/packages/core/uboot-pinebookpro
u-boot-pinebookpro = callPackage ./u-boot {};
linux-pinebookpro = callPackage ./kernel {
kernelPatches = [
kernelPatches.bridge_stp_helper
#kernelPatches.export_kernel_fpu_functions
{
name = "pinebookpro-config-fixes";
patch = null;
extraConfig = ''
PCIE_ROCKCHIP y
PCIE_ROCKCHIP_HOST y
PCIE_DW_PLAT y
PCIE_DW_PLAT_HOST y
PHY_ROCKCHIP_PCIE y
PHY_ROCKCHIP_INNO_HDMI y
PHY_ROCKCHIP_DP y
ROCKCHIP_MBOX y
STAGING_MEDIA y
VIDEO_HANTRO y
VIDEO_HANTRO_ROCKCHIP y
USB_DWC2_PCI y
ROCKCHIP_LVDS y
ROCKCHIP_RGB y
'';
}
];
};
linuxPackages-pinebookpro = linuxPackagesFor final.linux-pinebookpro;
}