Merge pull request #385 from NixOS/surface-kernel

Surface kernel
This commit is contained in:
Jörg Thalheim 2022-03-04 12:51:07 +00:00 committed by GitHub
commit 466eff0875
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 140 additions and 161 deletions

48
.editorconfig Normal file
View file

@ -0,0 +1,48 @@
# EditorConfig configuration for nixpkgs
# https://EditorConfig.org
# Top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file, utf-8 charset
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
# Ignore diffs/patches
[*.{diff,patch}]
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
# see https://nixos.org/nixpkgs/manual/#chap-conventions
# Match json/lockfiles/markdown/nix/perl/python/ruby/shell/docbook files, set indent to spaces
[*.{json,lock,md,nix,pl,pm,py,rb,sh,xml}]
indent_style = space
# Match docbook files, set indent width of one
[*.xml]
indent_size = 1
# Match json/lockfiles/markdown/nix/ruby files, set indent width of two
[*.{json,lock,md,nix,rb}]
indent_size = 2
# Match perl/python/shell scripts, set indent width of four
[*.{pl,pm,py,sh}]
indent_size = 4
# Match gemfiles, set indent to spaces with width of two
[Gemfile]
indent_size = 2
indent_style = space
# Disable file types or individual files
# some of these files may be auto-generated and/or require significant changes
[*.{c,h}]
insert_final_newline = unset
trim_trailing_whitespace = unset

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }:
{
boot.kernelPackages = pkgs.callPackage ./linux-5.13.4 { };
boot.kernelPackages = pkgs.callPackage ./linux-5.16.11.nix { };
}

View file

@ -1,126 +0,0 @@
{ config, lib, pkgs, ... }:
let
repos = (pkgs.callPackage ../../repos.nix { });
patches = repos.linux-surface + "/patches";
surface_kernelPatches = [
{
name = "microsoft-surface-patches-linux-5.13.4";
patch = null;
structuredExtraConfig = with lib.kernel; {
#
# Surface Aggregator Module
#
SURFACE_AGGREGATOR = module;
SURFACE_AGGREGATOR_ERROR_INJECTION = no;
SURFACE_AGGREGATOR_BUS = yes;
SURFACE_AGGREGATOR_CDEV = module;
SURFACE_AGGREGATOR_REGISTRY = module;
SURFACE_ACPI_NOTIFY = module;
SURFACE_DTX = module;
SURFACE_PLATFORM_PROFILE = module;
SURFACE_HID = module;
SURFACE_KBD = module;
BATTERY_SURFACE = module;
CHARGER_SURFACE = module;
#
# Surface laptop 1 keyboard
#
SERIAL_DEV_BUS = yes;
SERIAL_DEV_CTRL_TTYPORT = yes;
#
# Surface Hotplug
#
SURFACE_HOTPLUG = module;
#
# IPTS touchscreen
#
# This only enables the user interface for IPTS data.
# For the touchscreen to work, you need to install iptsd.
#
MISC_IPTS = module;
#
# Cameras: IPU3
#
VIDEO_IPU3_IMGU = module;
VIDEO_IPU3_CIO2 = module;
CIO2_BRIDGE = yes;
INTEL_SKL_INT3472 = module;
#
# Cameras: Sensor drivers
#
VIDEO_OV5693 = module;
VIDEO_OV8865 = module;
#
# ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7
#
APDS9960 = module;
#
# Other Drivers
#
INPUT_SOC_BUTTON_ARRAY = module;
SURFACE_3_BUTTON = module;
SURFACE_3_POWER_OPREGION = module;
SURFACE_PRO3_BUTTON = module;
SURFACE_GPE = module;
SURFACE_BOOK1_DGPU_SWITCH = module;
};
}
{
name = "ms-surface/0001-surface3-oemb";
patch = patches + "/5.13/0001-surface3-oemb.patch";
}
{
name = "ms-surface/0002-mwifiex";
patch = patches + "/5.13/0002-mwifiex.patch";
}
{
name = "ms-surface/0003-ath10k";
patch = patches + "/5.13/0003-ath10k.patch";
}
{
name = "ms-surface/0004-ipts";
patch = patches + "/5.13/0004-ipts.patch";
}
{
name = "ms-surface/0005-surface-sam-over-hid";
patch = patches + "/5.13/0005-surface-sam-over-hid.patch";
}
{
name = "ms-surface/0006-surface-sam";
patch = patches + "/5.13/0006-surface-sam.patch";
}
{
name = "ms-surface/0007-surface-hotplug";
patch = patches + "/5.13/0007-surface-hotplug.patch";
}
{
name = "ms-surface/0008-surface-typecover";
patch = patches + "/5.13/0008-surface-typecover.patch";
}
{
name = "ms-surface/0009-cameras";
patch = patches + "/5.13/0009-cameras.patch";
}
{
name = "ms-surface/0010-amd-gpio";
patch = patches + "/5.13/0010-amd-gpio.patch";
}
{
name = "ms-surface/0011-amd-s0ix";
patch = patches + "/5.13/0011-amd-s0ix.patch";
}
];
in (with pkgs;
recurseIntoAttrs (linuxPackagesFor (callPackage ./linux-5.13.4.nix {
kernelPatches = surface_kernelPatches;
})))

View file

@ -1,22 +0,0 @@
{ lib, stdenv, buildPackages, fetchurl, perl, buildLinux
, modDirVersionArg ? null, ... }@args:
with lib;
buildLinux (args // rec {
version = "5.13.4";
# modDirVersion needs to be x.y.z, will automatically add .0 if needed
modDirVersion = if (modDirVersionArg == null) then
concatStringsSep "." (take 3 (splitVersion "${version}.0"))
else
modDirVersionArg;
# branchVersion needs to be x.y
extraMeta.branch = versions.majorMinor version;
src = fetchurl {
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "7192cd2f654aa6083451dea01b80748fe1eebcf2476a589ef4146590030e7d6c";
};
} // (args.argsOverride or { }))

View file

@ -0,0 +1,87 @@
{ lib, callPackage, linuxPackagesFor, ... }:
# To test the kernel build:
# nix-build -E "with import <nixpkgs> {}; (pkgs.callPackage ./linux-5.16.11.nix {}).kernel"
let
repos = callPackage ../repos.nix {};
linuxPkg = { fetchurl, buildLinux, ... }@args:
buildLinux (args // rec {
version = "5.16.11";
modDirVersion = version;
extraMeta.branch = "5.16";
src = repos.linux-surface-kernel;
kernelPatches = [{
name = "microsoft-surface-patches-linux-5.16.2";
patch = null;
structuredExtraConfig = with lib.kernel; {
#
# Surface Aggregator Module
#
SURFACE_AGGREGATOR = module;
SURFACE_AGGREGATOR_ERROR_INJECTION = no;
SURFACE_AGGREGATOR_BUS = yes;
SURFACE_AGGREGATOR_CDEV = module;
SURFACE_AGGREGATOR_REGISTRY = module;
SURFACE_ACPI_NOTIFY = module;
SURFACE_DTX = module;
SURFACE_PLATFORM_PROFILE = module;
SURFACE_HID = module;
SURFACE_KBD = module;
BATTERY_SURFACE = module;
CHARGER_SURFACE = module;
#
# Surface laptop 1 keyboard
#
SERIAL_DEV_BUS = yes;
SERIAL_DEV_CTRL_TTYPORT = yes;
#
# Surface Hotplug
#
SURFACE_HOTPLUG = module;
#
# IPTS touchscreen
#
# This only enables the user interface for IPTS data.
# For the touchscreen to work, you need to install iptsd.
#
MISC_IPTS = module;
#
# Cameras: IPU3
#
VIDEO_IPU3_IMGU = module;
VIDEO_IPU3_CIO2 = module;
CIO2_BRIDGE = yes;
INTEL_SKL_INT3472 = module;
#
# Cameras: Sensor drivers
#
VIDEO_OV5693 = module;
VIDEO_OV8865 = module;
#
# ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7
#
APDS9960 = module;
#
# Other Drivers
#
INPUT_SOC_BUTTON_ARRAY = module;
SURFACE_3_BUTTON = module;
SURFACE_3_POWER_OPREGION = module;
SURFACE_PRO3_BUTTON = module;
SURFACE_GPE = module;
SURFACE_BOOK1_DGPU_SWITCH = module;
};
}];
} // (args.argsOverride or {}));
in lib.recurseIntoAttrs (linuxPackagesFor (callPackage linuxPkg {}))

View file

@ -1,9 +1,9 @@
{ lib, pkgs, fetchFromGitHub, fetchurl }: {
linux-surface = fetchFromGitHub {
linux-surface-kernel = fetchFromGitHub {
owner = "linux-surface";
repo = "linux-surface";
rev = "4130746c31606aebaccef58997b650beda9049f7";
sha256 = "0r74z0hj3rg8bn2arh2zj8p7awk7fi14gpyrs5h44lwxw4351xky";
repo = "kernel";
rev = "db94c89f56d6ceae03ca3802e11197f48e6c539f";
sha256 = "0c58ri0i9gdb4w7l361pnkvq6ap17kmgnxngh0bcdmgn4dc88wx2";
};
ath10k-firmware = fetchFromGitHub {
@ -13,12 +13,6 @@
sha256 = "16a67baxlga8vb43zbby2s7kpp4488vczg3manmr9g3wxnhhb9n3";
};
surface-go-ath10k-firmware_upstream = fetchurl {
url = "https://support.killernetworking.com/K1535_Debian/board.bin";
# url="https://www.killernetworking.com/support/K1535_Debian/board.bin";
sha256 = "0l8wfj8z4jbb31nzqkaxisby0n6061ix01c5di9bq66iby59j8py";
};
surface-go-ath10k-firmware_backup = fetchFromGitHub {
owner = "mexisme";
repo = "linux-surface_ath10k-firmware";

View file

@ -20,8 +20,6 @@
};
};
nix.buildCores = 4;
nixpkgs.config.platform = lib.systems.platforms.raspberrypi2;
# cpufrequtils doesn't build on ARM