Commit graph

90 commits

Author SHA1 Message Date
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
Vladimír Čunát
ae040525d8
linux-*: build with gcc7, but allow overriding it
I expect we will revert this after general upgrade to gcc7.
See https://github.com/NixOS/nixpkgs/issues/34383
2018-02-11 18:55:18 +01:00
Tuomas Tynkkynen
4c6c919a31 Merge remote-tracking branch 'upstream/master' into HEAD
Conflicts:
	pkgs/os-specific/linux/kernel/generic.nix
2018-02-07 03:41:24 +02:00
Tuomas Tynkkynen
685ceb999e kernel: Fix missing config options from platform
common-config.nix has:

${kernelPlatform.kernelExtraConfig or ""}

and indeed kernelExtraConfig is in hostPlatform.platform, and not in
hostPlatform. (Ugh.).
2018-02-06 22:13:57 +02:00
Matthieu Coudron
f620b1b693 kernel: buildLinux replaces import ./generic.nix
- defined buildLinux as generic.nix instead of manual-config.nix. This
makes kernel derivations a tad more similar to your typical derivations.
- moved $buildRoot to within the source folder, this way it doesn't have to be created before the unpackPhase
and make it easier to work on kernel source without running the unpackPhase
2018-02-07 10:07:13 +09:00
Ben Wolsieffer
7bb3a044be kernel: fix dependencies 2018-01-15 22:28:45 -05:00
Ben Wolsieffer
285181a1db kernel: remove leftover remnants of old cross compiling system 2018-01-15 12:48:51 -05:00
Ben Wolsieffer
a09709bf2a kernel: don't force ignoreConfigErrors when cross compiling, only set the
default
2018-01-15 12:39:45 -05:00
Ben Gamari
7a9b6ac39a kernel: Enable cross compiling 2018-01-15 11:55:06 -05:00
Jan Malakhovski
85cd22cf7d treewide: replace addPassthru 2018-01-14 19:53:57 +00:00
Jan Malakhovski
8606dd8556 lib: change the order of arguments of addPassthru 2018-01-14 13:24:30 +00:00
Vladimír Čunát
13797ff522
linux-4.13: mark as insecure (+required generic changes)
extraMeta was being fed as passthru without being processed by stdenv,
so without those changes, adding the security attribute would be useless.
2017-12-04 09:33:39 +01:00
Tuomas Tynkkynen
0d9f2f0bb4 platforms.nix: Clean up more 'uboot' legacy
For a while now, the only thing the 'uboot' attribute does is to tell
whether to add ubootTools to kernel/initrd builds. That can be
determined with platform.kernelTarget == "uImage" just as well.
2017-11-05 17:06:59 +02:00
Jan Malakhovski
8525b78d05
linuxPackages: properly propagate features and extraConfig
`kernel.override { features = ... }` didn't work before, now it works as
expected.
2017-09-17 16:33:47 +02:00
Vladimír Čunát
7c7c83e233
buildLinux: allow overriding stdenv on each call 2017-08-20 08:24:52 +02:00
hsloan
459d07d41c kernel generic: Don't use stdenv.cross 2017-06-28 20:22:59 -04:00
Nikolay Amiantov
c0e77dba0e linux: add kernelPreferBuiltin platform option
This allows to use kernelAutoModules but still compile in any options that are set so in template config.
It's helpful for ARM and maybe other platforms where defaul configurations are useful because they compile in
modules that we and udev cannot autodetect now.
2017-04-09 22:46:07 +03:00
Eelco Dolstra
72a30ae66f linux: Use $SOURCE_DATE_EPOCH as the build timestamp 2016-02-01 18:19:23 +01:00
Dan Peebles
8f9aea9ccc grsecurity: fix kernel config and uncomment grsecurity kernels 2016-01-23 16:58:44 +00:00
Vladimír Čunát
6671aff83e linux kernel determinism: unify timestamp style
Testing showed the linux build is sensitive to /usr/include/ncursesw
unless chrooted (on non-nixos).
On a single chrooted nixos machine, -A linux is binary reproducible.

CC #2281 & @alexanderkjeldaas.
2015-01-03 13:54:32 +01:00
Vladimír Čunát
d8c5d95330 determinism: change some fixed timestamp to != (time_t)0
vcunat removed the unrelated glib change.
Conflicts:
	pkgs/development/libraries/glib/default.nix
	pkgs/os-specific/linux/kernel/generic.nix
	pkgs/os-specific/linux/kernel/manual-config.nix
2014-12-30 17:03:39 +01:00
Eelco Dolstra
ce6b86cc68 Fix various evaluation problems
http://hydra.nixos.org/build/13616685
2014-08-22 11:57:40 +02:00
Michael Raskin
efb0c56db4 Update linux_testing and enable parallel build of Linux kernel 2014-06-30 10:52:33 +04:00
Austin Seipp
80d0e31a94 kernel: allow features to be used in common-config
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2014-05-18 08:49:32 -05:00
Shea Levy
cb9cc87a39 kernel.passthru: Don't include meta to be consistent with stdenv.mkDerivation
Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-21 21:12:58 -05:00
Shea Levy
fd999ed570 Linux: Set passthru attr to contain full passthru
This fixes #1566, thanks @wizeman

Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-21 21:06:27 -05:00
Shea Levy
d18bc25b95 Rename linuxManualConfig to buildLinux
Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-21 20:05:55 -05:00
Shea Levy
ac2035287f Greatly reduce kernel closure size
Based on access analysis with strace, I determined an essentially
minimal required set of files from the kernel source that was needed to
build all current kernel packages on 3.10, which ultimately resulted in
keeping 30M of source. Generalizing from that minimal set, which
required ad-hoc specifications of which headers outside of include/ and
arch/*/include and which files in the scripts/ directory should be kept,
to a policy of keeping all non-arch-specific headers that aren't part of
the drivers/ directory and the entire scripts/ directory added an
additional 17M, but there was nothing in the analysis that indicated
that that ad-hoc specification was at all complete so I think the extra
hit is worth the likely greater compatibility.

For reference, we now keep:

* All headers that are NOT in arch/${notTargetArch}/include or drivers/
* The scripts/ directory
* Makefile
* arch/${targetArch}/Makefile

IMO the most likely cause of future problems are the headers in
drivers/, but hopefully they won't actually be needed as they add 50M
Ideally kernel packages would only use include and
arch/${targetArch}/include, but alas this is observably not the case.

master:
  * $out
    * size: 234M
    * references-closure: linux-headers, glibc, attr, acl, zlib, gcc,
      coreutils, perl, bash
merge-kernel-builds:
  * $out
    * size: 152M
    * references-closure: none
  * $dev
    * size: 57M
    * references-closure: linux-headers, glibc, zlib, gcc

So even with the non-minimal set we still beat out master. Keeping the
drivers headers would make us only slightly bigger.

Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-05 06:55:47 -05:00
Shea Levy
2c38df1c5b kernel build: limit dev output footprint
This makes the disk usage footprint of building the kernel smaller in 3
ways:

1) There is no separate kernel source derivation
2) Rather than using the entire build tree, only the output of make
modules_prepare is kept in the $dev output (plus the module symbol
versioning file generated during the build)
3) Only the subset of the source tree known to be needed for external
builds is kept in $dev

Note that while 2) is supported by official kernel documentation, I
couldn't find any source describing what we need to keep for 3). I've
started with the bare minimum (the main Makefile is called by the
Makefile generated by make modules_prepare) and we can/should add more
as needed for kernelPackages.

Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-01 23:56:24 -05:00
Shea Levy
f95d214cfd Implement generic kernel build via manual-config
This has three major benefits:

1. We no longer have two kernel build processes to maintain

2. The build process is (IMO) cleaner and cleaves more closely to
upstream. In partuclar, we use make install to install the kernel and
development source/build trees, eliminating the guesswork about which
files to copy.

3. The derivation has multiple outputs: the kernel and modules are in
the default `out' output, while the build and source trees are in a
`dev' output. This makes it possible for the full source and build tree
to be kept (which is expected by out-of-tree modules) without bloating
the closure of the system derivation.

In addition, if a solution for how to handle queries in the presence of
imports from derivations ever makes it into nix, a framework for
querying the full configuration of the kernel in nix expressions is
already in place.

Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-01 09:21:25 -05:00
Eelco Dolstra
a2cbc77e4f Only show/build a package on the platforms listed in meta.platforms
The function ‘mkDerivation’ now checks whether the current platform
type is included in a package's meta.platform field.  If not, it
throws an exception:

  $ nix-build -A linux --argstr system x86_64-darwin
  error: user-thrown exception: the package ‘linux-3.10.15’ is not supported on ‘x86_64-darwin’

These packages also no longer show up in ‘nix-env -qa’ output.  This
means, for instance, that the number of packages shown on
x86_64-freebsd has dropped from 9268 to 4764.

Since meta.platforms was also used to prevent Hydra from building some
packages, there now is a new attribute meta.hydraPlatforms listing the
platforms on which Hydra should build the package (which defaults to
meta.platforms).
2013-11-05 00:06:10 +01:00
Eelco Dolstra
d9a4706f73 linux: Use kmod instead of module-init-tools 2013-08-09 18:48:51 +02:00
Eelco Dolstra
7ce325f3e0 Unify the Linux kernel configurations
Having N different copies of the NixOS kernel configuration is bad
because these copies tend to diverge.  For instance, our 3.10 config
lacked some modules that were enabled in older configs, probably
because the 3.10 config had been copied off an earlier version of some
older kernel config.

So now there is a single kernel config in common-config.nix.  It has a
few conditionals to deal with new/removed kernel options, but
otherwise it's pretty straightforward.

Also, a lot of cut&paste boilerplate between the kernel Nix
expressions is gone (such as preConfigure).
2013-08-01 01:40:40 +02:00
Eelco Dolstra
dccbdcf520 linux: Don't put the kernel version in meta 2013-08-01 01:40:40 +02:00
Eelco Dolstra
674c51af3c Merge remote-tracking branch 'origin/master' into stdenv-updates 2013-03-07 19:33:52 +01:00
Michael Raskin
b72134dc11 Linux: Add 3.9-rc1 as lowPrio (it has a regression fix 3.8.2 lacks) 2013-03-06 23:59:49 +04:00
Peter Simons
5f32207dfc Merge remote-tracking branch 'origin/master' into stdenv-updates. 2013-02-24 19:27:08 +01:00
Shea Levy
afe3758b1b Remove myself from kernel maintainers.
I use manual config now.
2013-02-21 12:39:25 -05:00
Eelco Dolstra
ab3eeabfed Rename buildNativeInputs -> nativeBuildInputs
Likewise for propagatedBuildNativeInputs, etc.  "buildNativeInputs"
sounds like an imperative rather than a noun phrase.
2012-12-28 19:20:09 +01:00
Eelco Dolstra
5be0a9acd7 Rename hostDrv -> crossDrv, buildDrv -> nativeDrv
This is for consistency with terminology in stdenv (and the terms
"hostDrv" and "buildDrv" are not very intuitive, even if they're
consistent with GNU terminology).
2012-12-28 19:08:19 +01:00
Shea Levy
9ddd1cc78b Linux 3.7
Kernel configuration succeeds, I'll let hydra test the build
2012-12-11 11:57:04 -05:00
Eelco Dolstra
0874615fcc Remove User Mode Linux
It hasn't built in a long time and it's obsolete IMHO.
2012-09-21 13:32:37 -04:00
Nicolas Pierron
82b308bf11 Add armv7l support.
svn path=/nixpkgs/trunk/; revision=33798
2012-04-15 23:41:25 +00:00