Linux kernel: Difference between revisions

imported>Zimbatm
m ws
imported>SteveeJ
Add custom kernel sources example
Line 135: Line 135:
- arch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/config?h=packages/linux
- arch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/config?h=packages/linux
- debian: https://salsa.debian.org/kernel-team/linux/blob/master/debian/config/config and the ARCH specific ones
- debian: https://salsa.debian.org/kernel-team/linux/blob/master/debian/config/config and the ARCH specific ones
== Booting a kernel from a custom source ==
The following example shows how to configure NixOS to compile and boot a kernel from a custom source, and with custom configuration options.
<syntaxHighlight lang=nix>
{ pkgs, ... }:
{
  boot.kernelPackages = let
      linux_sgx_pkg = { stdenv, fetchurl, buildLinux, ... } @ args:
        with stdenv.lib;
        buildLinux (args // rec {
          version = "5.4.0-rc3";
          modDirVersion = "5.4.0-rc3";
          src = fetchurl {
            url = "https://github.com/jsakkine-intel/linux-sgx/archive/v23.tar.gz";
            sha256 = "11rwlwv7s071ia889dk1dgrxprxiwgi7djhg47vi56dj81jgib20";
          };
          kernelPatches = [];
          extraConfig = ''
            INTEL_SGX y
          '';
          extraMeta.branch = "5.4";
        } // (args.argsOverride or {}));
      linux_sgx = pkgs.callPackage linux_sgx_pkg{};
    in
      pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_sgx);
}
</syntaxHighlight>