Commit Graph

132 Commits

Author SHA1 Message Date
Alyssa Ross
8ee5a6fcbf
linuxManualConfig: don't ignore cross config errors
All "pc" kernel configurations in lib.systems.examples build fine
without errors when cross compiling.
2023-05-19 19:45:40 +00:00
Naïm Favier
a8fd50b79c
nixos/doc: update custom kernel instructions
Document the `linux.override` way first, then `linuxManualConfig`.

Add a `linux.configEnv` passthru attribute for quickly getting a
`make nconfig`-ready shell.
2022-12-22 01:42:15 +01:00
Naïm Favier
6c563f30fe
linuxManualConfig: don't require lib and stdenv arguments
Reverts 7c7c83e233 which was
only needed for the minimal-kernel.nix test module and clutters the call site.

stdenv can still be overridden with `linuxManualConfig.override { stdenv = ...; }`.
2022-12-22 01:42:15 +01:00
Naïm Favier
fc346c5e62
linux: use lib.versions.pad for modDirVersion 2022-12-21 13:23:28 +01:00
Sandro Jäckel
000e115d02 kernel: move prePatch to postPatch to not mess with patches 2022-10-14 23:56:28 +02:00
K900
6cd9a388df linux: provide pahole when configuring
The kernel checks the version of pahole at configuration time to know
if it supports features like split BTFs. If pahole doesn't exist,
all of that gets disabled in the config file, so the kernel ends up
built without split BTFs, despite having a working pahole for the actual
build.
2022-08-02 16:23:00 +03:00
Atemu
712db36fa2 kernel/generic: remove redundant kernelOlder/kernelAtLeast 2021-11-22 02:11:16 +00:00
Maximilian Bosch
63185299f4
linux: make sure that src/version actually refer to the declaring file
With this change it's ensured that `builtins.unsafeGetAttrPos` actually
points to `<nixpkgs/pkgs/os-specific/linux/kernel/linux-x.y.nix>` when
retrieving the position of `src` or `version` of
`linuxPackages.kernel`.

This is relevant to make sure that ofborg pinging maintainers on kernel updates
actually works[1]. While the underlying issue should be fixed in ofborg
or Nix itself, this is IMHO a pragmatic change to ensure that all kernel
maintainers are automatically notified on updates.

[1] https://github.com/NixOS/nixpkgs/pull/143113#issuecomment-953319957
2021-11-01 10:06:00 +01:00
Atemu
0a43b6d5e9 kernel/generic: add kernelTests automatically
Unfortunately, there seems to be no way of referencing an overridable version of
the package you're in, so it had to be stubed to work at all.

This isn't important for our current, very basic kernel nixosTests but might
become important when we add more sophisticated ones.
2021-08-23 19:57:49 +02:00
Ben Siraphob
b63a54f81c
Merge pull request #110742 from siraben/deprecate-fold 2021-07-27 15:13:31 +07:00
Bernardo Meurer
290aeb344f
buildLinux: pass buildPackages to linuxManualConfig
We should be using the _same_ buildPackages when we generate the
configuration (which happens in buildLinux) as when we actually build
the kernel (which happens in linuxManualConfig).

This change enforces that when we callPackage `manual-config.nix` we
pass on whatever `buildPackages` that `buildLinux` itself was called
with.
2021-07-17 18:57:35 -07:00
Bernardo Meurer
e21183a95d
buildLinux: preserve structuredExtraConfig and extraMakeFlags in passthru
This allows users to override custom kernel packages (e.g. linux_xanmod)
that set their own structuredExtraConfig with ease.
2021-07-13 18:35:39 -07:00
Bernardo Meurer
ea167e8ccb
buildLinux: take and propagate extraMakeFlags
This is just for practicity, as it allows users of buildLinux to pass
along extra flags they need in the kernel's make invocation. This makes,
for example, supporting LLVM _much_ easier, and could enable us in the
future to provide clang-built kernels.
2021-07-12 10:39:52 -07:00
Bernardo Meurer
89deec5623
buildLinux: apply hostPlatform.linux-kernel.makeFlags to generate-config.pl
This enforces that the configuration generated will obey any/all flags
set in the platform/stdenv configuration. This is crucial, for example,
if you'd like to build a kernel using clang.

Without this patch, anything you set in
`stdenv.hostPlatform.linux-kernel.makeFlags` is wholly ignored during
config generation, causing (for example) any changes in the desired
toolchain (e.g. `LLVM`, `LLVM_IAS`) to not be reflected in the generated
config, and for the subsequent build to fail.
2021-07-12 10:39:51 -07:00
Jörg Thalheim
6d1287860d
Merge pull request #113225 from mroi/patch-linux
linux: improve cross compilation with clang
2021-05-11 09:46:01 +01:00
Michael Roitzsch
270ee17d41 linux: improve cross compilation with clang
set HOST* variables for host build tools
* do not assume the host compiler is gcc
* pass all build tools to make
2021-05-10 10:24:24 +02:00
Dmitry Kalinkin
219590673c
Merge branch 'staging-next' into staging
Conflicts:
	pkgs/development/python-modules/panel/default.nix
	pkgs/os-specific/linux/kernel/generic.nix
	pkgs/servers/home-assistant/default.nix
2021-04-08 22:42:26 -04:00
Tim Steinbach
d3d40b09fd kernel: Add test for RC kernels 2021-04-08 09:00:15 -04:00
Tim Steinbach
bd7fed9a2f kernel: Add tests to passthru.tests 2021-04-08 09:00:15 -04:00
Alyssa Ross
52cd3538ff linux: remove remnants of grsecurity
Nixpkgs hasn't supported grsecurity kernels since 2017, so unless
anybody is manually enabling the grsecurity feature to make these
small kernel tweaks this is dead code.

This means we don't actually support any "features" in the kernel
common-config any more, but I've left the argument there because it's
conceivable we could have some again in future.
2021-04-06 09:48:56 +00:00
Alyssa Ross
25208eeaba linux: remove xen_dom0 feature entirely
Xen is now enabled unconditionally on kernels that support it, so the
xen_dom0 feature doesn't do anything.  The isXen attribute will now
produce a deprecation warning and unconditionally return true.
Passing in a custom value for isXen is no longer supported.
2021-04-05 09:25:39 +00:00
Ben Siraphob
1c2a2b0a08 treewide: fold -> foldr 2021-01-26 10:57:07 +07:00
John Ericson
9c213398b3 lib: Clean up how linux and gcc config is specified
Second attempt of 8929989614589ee3acd070a6409b2b9700c92d65; see that
commit for details.

This reverts commit 0bc275e634.
2021-01-23 10:01:28 -05:00
Jonathan Ringer
0bc275e634
Revert "lib: Clean up how linux and gcc config is specified"
This is a stdenv-rebuild, and should not be merged
into master

This reverts commit 8929989614.
2021-01-22 14:07:06 -08:00
John Ericson
8929989614 lib: Clean up how linux and gcc config is specified
The `platform` field is pointless nesting: it's just stuff that happens
to be defined together, and that should be an implementation detail.

This instead makes `linux-kernel` and `gcc` top level fields in platform
configs. They join `rustc` there [all are optional], which was put there
and not in `platform` in anticipation of a change like this.

`linux-kernel.arch` in particular also becomes `linuxArch`, to match the
other `*Arch`es.

The next step after is this to combine the *specific* machines from
`lib.systems.platforms` with `lib.systems.examples`, keeping just the
"multiplatform" ones for defaulting.
2021-01-21 22:44:09 -05:00
Ben Siraphob
16d91ee628 pkgs/os-specific: stdenv.lib -> lib 2021-01-17 23:26:08 +07:00
Jonathan Ringer
e6db435973 linux: add flavor metadata 2020-10-30 09:40:12 -07:00
Matthew Bauer
d0677e6d45 treewide: add warning comment to “boot” packages
This adds a warning to the top of each “boot” package that reads:

  Note: this package is used for bootstrapping fetchurl, and thus cannot
  use fetchpatch! All mutable patches (generated by GitHub or cgit) that
  are needed here should be included directly in Nixpkgs as files.

This makes it clear to maintainer that they may need to treat this
package a little differently than others. Importantly, we can’t use
fetchpatch here due to using <nix/fetchurl.nix>. To avoid having stale
hashes, we need to include patches that are subject to changing
overtime (for instance, gitweb’s patches contain a version number at
the bottom).
2020-07-31 08:56:53 +02:00
Matthieu Coudron
b9a4e6953d kernel: fix config generation
Addresses https://github.com/NixOS/nixpkgs/issues/71803:
Kernel options are not merged as described, especially the "optional"
aspects. The error silences legitimate warnings.
2020-04-01 22:25:57 +02:00
Matthieu Coudron
2207378c9e linux: clearer origin for settings configuration
adds _file so that nix may have a chance to display what file the conflictings settings come
from.
2019-09-04 17:04:16 +09:00
volth
c814d72b51 treewide: name -> pname 2019-08-17 10:54:38 +00:00
volth
f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00
Joachim F
d7da5e2af2
Merge pull request #53826 from delroth/randstruct-custom-seed
nixos: allow customizing the kernel RANDSTRUCT seed
2019-04-16 17:49:19 +00:00
Matthieu Coudron
a5a796222b linux: (re)take into account extraConfig
PR #42838 wrongly started to ignore extraConfig. This fixes that.
2019-01-31 13:34:42 +09:00
Matthieu Coudron
3bb7b3f02e linux: ability to merge structured configs
This should make the composability of kernel configurations more straigthforward.

- now distinguish freeform options from tristate ones
- will look for a structured config in kernelPatches too
one can now access the structuredConfig from a kernel via linux_test.configfile.structuredConfig
in order to reinject it into another kernel, no need to rewrite the config from scratch

The following merge strategies are used in case of conflict:
-- freeform items must be equal or they conflict (mergeEqualOption)
-- for tristate (y/m/n) entries, I use the mergeAnswer strategy which takes the best available value, "best" being defined by the user (by default "y" > "m" > "n", e.g. if one entry is both marked "y" and "n", "y" wins)
-- if one item is both marked optional/mandatory, mandatory wins (mergeFalseByDefault)
2019-01-28 09:06:33 +09:00
Joachim F
f6414428ed
Merge pull request #53511 from joachifm/kernel-32bit-emu-feature-flag
linux: flag to indicate 32bit emulation support
2019-01-25 14:13:45 +00:00
Pierre Bourdon
a258015d3a
kernel: extend the RANDSTRUCT seed with a user-configurable section 2019-01-24 01:42:16 +01:00
Joachim Fasting
6eea9ac868
linux: add feature flag to indicate support for 32bit emulation
Motivated by the need to warn users trying to build configurations that depend
on being able to run 32bit apps on 64bit kernels.
2019-01-06 19:52:03 +01:00
Pierre Bourdon
c789f642f0
kernel/generic.nix: provide required dependencies for GCC plugins builds 2019-01-04 22:24:50 +01:00
John Ericson
0828e2d8c3 treewide: Remove usage of remaining redundant platform compatability stuff
Want to get this out of here for 18.09, so it can be deprecated
thereafter.
2018-08-30 17:20:32 -04:00
Tuomas Tynkkynen
e0ce4bee57 kernel: Remove empty preUnpack 2018-07-24 23:36:05 +03:00
volth
dda95bae35 [bot] treewide: remove unused 'args@' in lambdas 2018-07-20 19:54:05 +00:00
Matthieu Coudron
e4fe7b31be linux: fix features system 2018-06-30 16:01:41 +03:00
Dan Peebles
ff9999ad1b linux: translate config to structured config
Instead of using a string to describe kernel config, use a nix
attribute set, then converted to a string.
- allows to override the config, aka convert 'yes' into 'modules' or
vice-versa
- while for now merging different configs is still crude (last spec wins),
at least there should be only one CONFIG_XYZ value compared to the current string
config where the first defined would be used and others ignored.

[initial idea by copumpkin in 2016, a major rebase to 2018 by teto]
2018-06-30 16:01:41 +03:00
Tuomas Tynkkynen
87a68c455e kernel: Allow kernel packages to specify a custom default defconfig 2018-05-31 18:06:09 +03:00
Dominique Martinet
b64f407c45 linux kernel generic: use passAsFile for kernelConfig
Otherwise get the error 'Argument list too long' when running builder
with a very long kernelConfig
2018-04-09 18:23:52 +09:00
Matthieu Coudron
3ccc65a36c buildLinux: allow to override arch/modules/builtin
- Easy override of autoModules and preferBuiltin and kernelArch parameters (currently living in `hostSystem` set).
2018-03-08 12:47:06 +09:00
Matthieu Coudron
600e977898 buildLinux: removes unnecessary parameters
and passes parameters in a single set
2018-03-08 12:45:39 +09:00
Vladimír Čunát
7d19d7ee18
Revert "linux-*: build with gcc7, but allow overriding it"
This reverts commit ae040525d8.
gcc7 is the default now.
2018-02-17 16:30:26 +01:00
Tuomas Tynkkynen
64fa0d5b97 kernel: Add deps for building 4.16 2018-02-16 01:13:30 +02:00