Unverified Commit f88a2238 authored by K900's avatar K900 Committed by GitHub
Browse files

linux/common-config: Adjust some options unavailable on i686 (#384588)

parents 7296c7ff d0d4a8ca
Loading
Loading
Loading
Loading
+19 −10
Original line number Diff line number Diff line
@@ -43,16 +43,25 @@ let
  );

  forceRust = features.rust or false;
  kernelSupportsRust = lib.versionAtLeast version "6.7";
  # Architecture support collected from HAVE_RUST Kconfig definitions and the following table:
  # https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/rust/arch-support.rst
  rustByDefault = (
    lib.versionAtLeast version "6.12"
    && (
      stdenv.hostPlatform.isx86_64
      || stdenv.hostPlatform.isLoongArch64
      || stdenv.hostPlatform.isAarch64
      || (stdenv.hostPlatform.isRiscV64 && !stdenv.cc.isGNU)
    )
  );

  # Currently only enabling Rust by default on kernel 6.12+,
  # which actually has features that use Rust that we want.
  defaultRust = lib.versionAtLeast version "6.12" && rustAvailable;
  withRust =
    assert lib.assertMsg (!(forceRust && !kernelSupportsRust)) ''
      Kernels below 6.7 (the kernel being built is ${version}) don't support Rust.
    '';
    (forceRust || defaultRust) && kernelSupportsRust;
    lib.warnIfNot (forceRust -> rustAvailable)
      "force-enabling Rust for Linux without an available rustc"
      lib.warnIfNot
      (forceRust -> rustByDefault)
      "force-enabling Rust for Linux on an unsupported kernel version, host platform or compiler"
      (forceRust || (rustAvailable && rustByDefault));

  options = {

@@ -1054,7 +1063,7 @@ let
        HIDRAW = yes;

        # Enable loading HID fixups as eBPF from userspace
        HID_BPF = whenAtLeast "6.3" yes;
        HID_BPF = whenAtLeast "6.3" (whenPlatformHasEBPFJit yes);

        HID_ACRUX_FF = yes;
        DRAGONRISE_FF = yes;
@@ -1281,7 +1290,7 @@ let
        LIRC = yes;

        SCHED_CORE = whenAtLeast "5.14" yes;
        SCHED_CLASS_EXT = whenAtLeast "6.12" yes;
        SCHED_CLASS_EXT = whenAtLeast "6.12" (whenPlatformHasEBPFJit yes);

        LRU_GEN = whenAtLeast "6.1" yes;
        LRU_GEN_ENABLED = whenAtLeast "6.1" yes;
+1 −5
Original line number Diff line number Diff line
@@ -109,11 +109,7 @@ let

  commonStructuredConfig = import ./common-config.nix {
    inherit lib stdenv version;
    rustAvailable =
      lib.any (lib.meta.platformMatch stdenv.hostPlatform) rustc.targetPlatforms
      && lib.all (p: !lib.meta.platformMatch stdenv.hostPlatform p) rustc.badTargetPlatforms
      # Known to be broken: https://lore.kernel.org/lkml/31885EDD-EF6D-4EF1-94CA-276BA7A340B7@kernel.org/T/
      && !(stdenv.hostPlatform.isRiscV && stdenv.cc.isGNU);
    rustAvailable = lib.meta.availableOn stdenv.hostPlatform rustc;

    features = kernelFeatures; # Ensure we know of all extra patches, etc.
  };