Commit Graph

242 Commits

Author SHA1 Message Date
Samuel Dionne-Riel
e25f5c1e86 linux: Makes the -dev output reproducible 2019-05-04 17:51:44 +02:00
Pierre Bourdon
a258015d3a
kernel: extend the RANDSTRUCT seed with a user-configurable section 2019-01-24 01:42:16 +01:00
Pierre Bourdon
1b9bf8fa75
kernel: make the RANDSTRUCT seed deterministic 2019-01-11 12:35:16 +01:00
Patrick Hilhorst
ffd47d5b16
Revert "linux: inside nix-shell, allow make menuconfig" 2018-12-10 15:50:36 +01:00
Matthew Bauer
76c956be5c treewide: disable pie in more places
Some packages don’t work correctly with pie. Here I disable it for:

- busybox
- linux kernel
- kexectools

I also get rid of the Musl conditional for disabling pie in GCC and
Binutils. Some day we might want to enable PIE without Musl and it
will be useful to have the *just* work with our compiler and linkers.
2018-11-13 07:03:31 -06:00
Matthieu Coudron
e80324c625 linux: inside nix-shell, allow make menuconfig
Use stdenv.lib.inNixShell to check for nix-shell and potentially bring pkgconfig/ncurses.
2018-10-05 18:00:15 +09:00
xeji
83fd9785f6
linux kernel: increase build timeout from 2 to 4 hrs (#47564)
We've recently seen a lot of kernel build timeouts on hydra,
so let's increase the timeout.
2018-10-01 17:40:29 +02:00
Wael M. Nasreddine
4f8a248b23 kernel: increase build timeout to two hours 2018-09-04 20:12:18 -04: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
CrystalGamma
72d161f548 [RFC] ppc64le enablement (#45340)
* ppc64le enablement

* gcc, glibc: properly handle __float128

* lib/systems, stdenv: syntax cleanup

* gcc7: remove ugly hack

* gcc: add/update __float128 flags

* stdenv: add another pair of quotes for consistency

* gcc: move __float128 flag for ppc64le-glibc into common/platform-flags.nix
2018-08-21 15:31:34 -04:00
Tuomas Tynkkynen
29b84841d2 kernel: Reduce peak disk usage during build
Since commit f620b1b693, the build directory is located inside the
source directory. Thus, the `cp -dpR` copies gigabytes worth of .o files
only to be deleted later on when we trim all non-essential files from
`$dev/lib/modules/${modDirVersion}/source/` thus causing a significant
amount of wasted I/O and peak disk usage.

As `cp` doesn't come with a `--exclude` flag, use rsync. And throw out
the Documentation folder while at it.
2018-07-24 23:36:06 +03:00
Tuomas Tynkkynen
4cec65482a kernel: Respect makeFlagsArray in more places
It's used two lines above, so be consistent.
2018-07-24 23:36:06 +03:00
Tuomas Tynkkynen
c6ed851fe2 kernel: Remove dead code
It's set in the same phase
2018-07-24 23:36:06 +03:00
Tuomas Tynkkynen
e0ce4bee57 kernel: Remove empty preUnpack 2018-07-24 23:36:05 +03:00
volth
52f53c69ce pkgs/*: remove unreferenced function arguments 2018-07-21 02:48:04 +00: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
Robert Hensing
7f25b26511 linuxPackages_custom: fix missing argument and add test
The required argument 'hostPlatform' was missing from linuxPackages_custom's
call to linuxManualConfig.

In order to prevent this in the future, this commit adds
linuxPackages_custom_tinyconfig_kernel so linuxPackages_custom gets tested.

This also adds linuxConfig, to derivate default linux configurations
via make defconfig, make tinyconfig, etc.

Closes #38034.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2018-04-07 16:40:25 -05:00
Shea Levy
bd7d5b3657
linux: Don't try to install firmware on newer kernels.
This was disabled in torvalds/linux@5620a0d1aa
2018-02-19 17:08:24 -05:00
Shea Levy
7ce1f0b8ae
linuxManualConfig: Fix build on non-modular kernels 2018-02-19 15:16:29 -05:00
Tuomas Tynkkynen
64fa0d5b97 kernel: Add deps for building 4.16 2018-02-16 01:13:30 +02:00
Vladimír Čunát
3d24c5eecc linux: use absolute paths for compilers
HOSTCC was taking precedence before stdenv's normal CC,
at least in case of non-cross build.
2018-02-12 14:00:51 -05:00
Vladimír Čunát
169216fe14
linuxPackages: build by kernel's stdenv 2018-02-11 18:55:21 +01:00
Tuomas Tynkkynen
6d8c1fe01c linux: Use concatStringsSep 2018-02-11 00:17:47 +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
80f6b8e2ba kernel: revert seemingly incorrect change to extraMeta merging 2018-01-15 12:55:24 -05:00
Ben Gamari
b4b04dd29f kernel: Fix cross-compilation 2018-01-15 11:55:23 -05:00
Ben Gamari
50e2bb12f6 kernel: Use build kmod 2018-01-15 11:55:23 -05:00
Ben Gamari
7a9b6ac39a kernel: Enable cross compiling 2018-01-15 11:55:06 -05:00
David Guibert
1e77d0b975 kernel 4.14 require libelf to compile modules.
[...]
make modules -C /nix/store/h1vzl6bq4wif3m8dd1bw2p3fv4shjg3n-linux-4.14.9-dev/lib/modules/4.14.9/build EXTRA_CFLAGS=-Werror-implicit-function-declaration M=/tmp/nix-build-spl-kernel-2017-11-16-4.14.9.drv-0/source/build
/nix/store/h1vzl6bq4wif3m8dd1bw2p3fv4shjg3n-linux-4.14.9-dev/lib/modules/4.14.9/source/Makefile:939: *** "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel". Stop.

This patch introduces kernel.moduleBuildDependencies to avoid the logic "stdenv.lib.optional (stdenv.lib.versionAtLeast kernel.version "4.14") libelf" in multiple places.

[dezgeg did some minor tweaks on top]
2017-12-29 23:08:17 +02:00
Andreas Rammhold
63e3eae02f
linux: 4.14.8 -> 4.14.9
Besides fixes for the recent BPF issues there is also a patch included
that fixes booting on aarch64 (e.g. RPi3) ;-)
2017-12-26 15:24:49 +01: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
Philipp Steinpass
e8fcced76e linux-testing: 4.14-rc8 -> 4.15-rc1
Closes #32137
2017-11-28 15:19:23 +02:00
Matthieu Coudron
28f9262092
kernel: improve modDirVersion error message
Now prints the current modDirVersion.  Close #31887.
2017-11-21 20:42:41 +01:00
Tuomas Tynkkynen
eb85761137 kernel: Fix out-of-tree modules on aarch64
https://hydra.nixos.org/build/62813493
2017-11-17 17:06:52 +02: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
Tuomas Tynkkynen
b50693d16c kernel, initrd: Remove legacy ubootChooser 2017-11-05 15:11:12 +02:00
Vladimír Čunát
7c7c83e233
buildLinux: allow overriding stdenv on each call 2017-08-20 08:24:52 +02:00
mimadrid
09e0cc7cc7
Update homepage attributes: http -> https
Homepage link "http://.../" is a permanent redirect to "https://.../" and should be updated
https://repology.org/repository/nix_stable/problems
2017-08-03 11:56:15 +02:00
hsloan
1e3b45cfdb kernel manual-config: Don't use stdenv.cross 2017-06-28 20:23:09 -04:00
Joachim Fasting
a04d8532c2
linux: support using gcc plugins
linux 4.8 onwards support gcc plugins.  This patch adds build inputs
required to make use of gcc plugins to the generic kernel build
environment.
2017-05-06 19:47:27 +02:00
Volth
b78f16b337 kernel: do not remove .o files on installPhase 2017-04-01 16:05:17 +03:00
Tuomas Tynkkynen
b2c96062ca kernel: Add a validity check for modDirVersion
Because if you get it wrong, you get a very confusing error message at
the end of the kernel build, which is quite painful as the build can
take a long time.
2017-03-13 18:47:21 +02:00
Nathan Zadoks
fcc51d3256 linux: fix installTargets for AArch64
[dezgeg: note that we are currently using just 'Image' instead of
'Image.gz' as U-Boot doesn't support the latter yet. We might switch
once it does since the kernel images are quite big]
2017-01-25 00:01:54 +02:00
Tuomas Tynkkynen
bdab6fe5a1 kernel: Use built-in dtbs_install target instead of rolling our own
In particular, on aarch64 all the .dtb files will be in subdirectories
and *.dtb won't match anything.
2016-12-10 20:24:08 +02:00
Tuomas Tynkkynen
0e26cf84fc kernel: Remove propagatedBuildOutputs
Not needed after the shuffle.
2016-08-29 14:49:52 +03:00
obadz
24a9183f90 Merge branch 'hardened-stdenv' into staging
Closes #12895

Amazing work by @globin & @fpletz getting hardened compiler flags by
enabled default on the whole package set
2016-08-22 01:19:35 +01:00
Nikolay Amiantov
ff22705793 treewide: replace several /sbin paths by /bin 2016-08-19 17:56:45 +03:00
Shea Levy
9adad8612b Revert "Merge branch 'modprobe-fix' of git://github.com/abbradar/nixpkgs"
Was meant to go into staging, sorry

This reverts commit 57b2d1e9b0, reversing
changes made to 760b2b9048.
2016-08-15 19:05:52 -04:00
Nikolay Amiantov
1afd250676 treewide: replace several /sbin paths by /bin 2016-08-16 00:19:25 +03:00
Franz Pletz
f8d481754c
Merge remote-tracking branch 'origin/master' into hardened-stdenv 2016-05-18 17:10:02 +02:00
Lluís Batlle i Rossell
53a4582552 Adding vmlinux to linux kernel 'dev' derivation.
It takes some extra 13MB (and in dev, not out), but allows perf to show kernel
symbols when profiling. I think it is worth it.

In my NixOS, I refer to it in the system derivation, for easy telling to perf
through /run/booted-system/vmlinux:

  system.extraSystemBuilderCmds = ''
    ln -s ${config.boot.kernelPackages.kernel.dev}/vmlinux $out/vmlinux
  '';
2016-05-06 18:11:03 +02:00
Eelco Dolstra
1f84e43239 Do some large, concurrency-capable builds on dedicated machines 2016-05-04 18:16:27 +02:00
Robin Gloster
b59a6aa93a kernel: turn off bindnow hardening 2016-04-19 02:21:57 +00:00
Robin Gloster
d020caa5b2 Merge remote-tracking branch 'upstream/master' into hardened-stdenv 2016-04-18 13:49:22 +00:00
Vladimír Čunát
30f14243c3 Merge branch 'master' into closure-size
Comparison to master evaluations on Hydra:
  - 1255515 for nixos
  - 1255502 for nixpkgs
2016-04-10 11:17:52 +02:00
Robin Gloster
3e68106afd Merge remote-tracking branch 'upstream/master' into hardened-stdenv 2016-04-07 21:52:26 +00:00
Tuomas Tynkkynen
b95274cc90 kernel: Don't patchELF manually
AFAICT this is done by stdenv nowadays:

bde82098b8/pkgs/development/tools/misc/patchelf/setup-hook.sh (L5)
bde82098b8/pkgs/stdenv/generic/setup.sh (L737)

Might help /be somehow related to these mysterious errors that seem to
occur sometimes (?):

http://hydra.nixos.org/build/34131589/nixlog/1/raw
2016-04-06 17:19:43 +03:00
Robin Gloster
5ca99ae7a7 kernel.i686-linux: disable bindnow hardening 2016-04-06 14:16:42 +00:00
Franz Pletz
aff1f4ab94 Use general hardening flag toggle lists
The following parameters are now available:

  * hardeningDisable
    To disable specific hardening flags
  * hardeningEnable
    To enable specific hardening flags

Only the cc-wrapper supports this right now, but these may be reused by
other wrappers, builders or setup hooks.

cc-wrapper supports the following flags:

  * fortify
  * stackprotector
  * pie (disabled by default)
  * pic
  * strictoverflow
  * format
  * relro
  * bindnow
2016-03-05 18:55:26 +01:00
Vladimír Čunát
d039c87984 Merge branch 'master' into closure-size 2016-02-14 08:33:51 +01:00
Robin Gloster
9229e9c656 Merge remote-tracking branch 'upstream/master' into hardened-stdenv 2016-02-07 11:17:57 +00:00
Tuomas Tynkkynen
7db1cba057 kernel: Let the kernel build system strip modules
Since commit 48f51f1185 we let the kernel build system compress the
modules, which makes the original strip expression not work. Let the
kernel build system strip them as well so they get stripped.
2016-02-02 22:47:32 +02:00
Eelco Dolstra
72a30ae66f linux: Use $SOURCE_DATE_EPOCH as the build timestamp 2016-02-01 18:19:23 +01:00
Robin Gloster
f6d3b7a2ae switch hardening flags 2016-01-30 16:36:57 +00:00
Franz Pletz
954e9903ad Use a hardened stdenv by default 2016-01-30 16:36:57 +00:00
Luca Bruno
e289717414 rename moveToOutput and propagatedBuildInputs 2015-12-02 10:05:36 +01:00
Vladimír Čunát
333d69a5f0 Merge staging into closure-size
The most complex problems were from dealing with switches reverted in
the meantime (gcc5, gmp6, ncurses6).
It's likely that darwin is (still) broken nontrivially.
2015-11-20 14:32:58 +01:00
Eelco Dolstra
50ab972b5a linux: Pass through configuration file
This enables "nix-build -A linux.configfile" to get the generated
kernel config.
2015-10-26 16:20:01 +01:00
Tuomas Tynkkynen
09637ac363 kernel: Don't propagate the dev output
The current default multiple-output propagation rules don't seem to work
too well if the dev output isn't the first one; without this we get an
unnecessary runtime reference to the kernel headers.
2015-10-03 14:08:55 +02:00
William A. Kennington III
9fbbbd5b68 linux-testing: Update to 4.3.0-rc2 2015-09-21 14:38:49 -07:00
Shea Levy
145768bf9b Unmaintain a bunch of packages 2015-07-01 08:11:05 -04:00
Tuomas Tynkkynen
9fc72c8ab8 kernel: Install DTBs into a subdirectory
This avoids the pollution of the top-level kernel output directory and
also simplifies the boot entry generator script I will be using on ARM.
2015-05-07 06:04:10 +03:00
Lluís Batlle i Rossell
0c5be7164c sheevaplug: fix kernel build.
I added platform.kernelMakeFlags. This allows setting the required
parameter to make the required kernel uImage for the sheevaplug,
since it became a platform with devicetree (3.10).

I have tried it with linux 3.18 and it built fine.
2015-05-06 09:50:51 +02:00
Jookia
98d77cd1a5 Fixed zImage installation when building Linux.
When building kernels outputting a zImage, the zImage wasn't correctly copied in
to the installation. This broke the build process entirely, at least on my ARM
machine.
2015-04-16 22:00:58 -04:00
Lluís Batlle i Rossell
cfd9b77e82 kernel: I hope to fix the dtbs thing
I thought $arch was defined. Now I'm using karch, that should serve for cross
building as well.
2015-03-05 09:10:19 +00:00
Lluís Batlle i Rossell
31cccd88ed kernel: Trying to fix makeflags of 'make dtbs' 2015-03-05 09:10:17 +00:00
Lluís Batlle i Rossell
42c6115872 kernel: I forgot $makeFlags in make dtbs 2015-03-05 09:10:15 +00:00
Lluís Batlle i Rossell
3e92c4e0ff Trying to make DTBs if set in platform. 2015-03-05 09:09:34 +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
Domen Kožar
c510f3da49 fix eval /cc @vcunat 2015-01-02 13:55:19 +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
Mateusz Kowalczyk
7a45996233 Turn some license strings into lib.licenses values 2014-07-28 11:31:14 +02:00
Eelco Dolstra
73b4b287bb linux: Don't use underscores in the timestamp 2014-04-14 21:06:04 +02:00
Alexander Kjeldaas
c69eb7c2c1 Remove timestamp from the kernel. 2014-04-05 08:40:55 +02:00
Austin Seipp
1459896be1 kernel: add myself to maintainer list
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2014-04-01 02:59:20 -05:00
Shea Levy
0f72effdd9 The derivation primop doesn't play well with null outputs attribute 2014-03-13 15:05:15 -04:00
Evgeny Egorochkin
69f4bdac6e linux: add git repository and branch meta 2014-02-14 10:45:36 +02:00
Shea Levy
053e029ee6 Some arches have multiple Makefiles
Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-05 16:07:32 -05:00
Shea Levy
adb57a0cc4 kernel: Fix depmod references
Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-05 10:31:16 -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
a589bfae17 Update and fix kernel packages to new kernel build
In most cases, this just meant changing kernelDev (now removed from
linuxPackagesFor) to kernel.dev. Some packages needed more work (though
whether that was because of my changes or because they were already
broken, I'm not sure). Specifics:

* psmouse-alps builds on 3.4 but not 3.10, as noted in the comments that
  were already there
* blcr builds on 3.4 but not 3.10, as noted in comments that were
  already there
* open-iscsi, ati-drivers, wis-go7007, and openafsClient don't build on
  3.4 or 3.10 on this branch or on master, so they're marked broken
* A version-specific kernelHeaders package was added

The following packages were removed:

* atheros/madwifi is superceded by official ath*k modules
* aufs is no longer used by any of our kernels
* broadcom-sta v6 (which was already packaged) replaces broadcom-sta
* exmap has not been updated since 2011 and doesn't build
* iscis-target has not been updated since 2010 and doesn't build
* iwlwifi is part of mainline now and doesn't build
* nivida-x11-legacy-96 hasn't been updated since 2008 and doesn't build

Everything not specifically mentioned above builds successfully on 3.10.
I haven't yet tested on 3.4, but will before opening a pull request.

Signed-off-by: Shea Levy <shea@shealevy.com>
2014-01-04 21:17:04 -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
Shea Levy
a87b1f36e0 manual-config: Fully general cross-compiling
In the most general case, the cross and native kernel may differ in
patches and configuration file as well as architecture, kernel target,
etc. It's probably overkill to support that case, but since it was
doable without much duplication and it will make integrating with the
existing cross-compilation support in the generic kernel I decided to
implement it anyway.

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-31 23:09:42 -05:00
Shea Levy
784c6d320c manual-config: Put `source' before the version in the sourceRoot name
nix's version parsing treats the previous name as a package named
`linux' with version `${version}-source', when we really want a package
named `linux-source' with version `${version}'

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-31 22:50:41 -05:00
Shea Levy
0c5776bc0f manual-config: Patch conf.c for generate-config.pl
This only affects the `oldaskconfig' make target, so it shouldn't really
affect current manual-config users, but it does make it more
straightforward to implement the generic kernel build on top of
manual-config.

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-31 22:49:12 -05:00
Shea Levy
fe185f0a18 manual-config: Always add config query functions
If the config attrset is manually specified, we still want isYes,
isModule, etc. to work. But we let the passed in config attrset take
precedence, if for some reason the caller wants to provide their own
implementation of one or more of these functions.

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-31 22:46:43 -05:00
Shea Levy
008992619f linux/manual-config: Cross-compiling support
With this, I was able to successfully compile a defconfig kernel for the
sheevaplug, though I didn't actually try to run it (not having a
sheevaplug myself).

For native compiles, the most significant difference is that the
platform's kernel target is built directly rather than hoping the
default make target will pull it in.

Also some stylistic improvements along the way.

Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-31 22:38:06 -05:00
Shea Levy
d2de64cc66 Fix broken meta.platforms for manual-config kernel
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-11-05 07:19:38 -05:00
Eelco Dolstra
262c21ed46 Enable __ignoreNulls globally 2013-03-07 19:42:01 +01:00
Eelco Dolstra
674c51af3c Merge remote-tracking branch 'origin/master' into stdenv-updates 2013-03-07 19:33:52 +01:00
Shea Levy
0bdd926a32 linux/manual-config: put build and source trees into a separate 'dev' output.
This makes it possible to still build out-of-tree modules without making a system using this kernel depend on the full source and build tree at runtime.

Note that references to the source tree are removed from kernel modules after build.
Ideally, this would be accomplished by modifying the Makefile that puts the reference there in the first place, but I haven't tracked that down yet.
2013-03-02 09:54:08 -05:00
Shea Levy
b90b62e33b linux/manual-config: Move configfile symlinking to configurePhase.
It makes more semantic sense there than in unpackPhase, as that symlink is _how_ we configure the kernel
2013-03-02 07:55:07 -05:00
Shea Levy
8ce1295ad3 linux/manual-config: ignore nulls.
There's no need to set the postFixup env var at all if we're not modular.
2013-03-02 07:51:12 -05:00
Vladimír Čunát
26af997d41 Merge branch 'master' into stdenv-updates
Conflicts (simple):
	pkgs/applications/networking/browsers/chromium/default.nix
	pkgs/development/libraries/libsoup/default.nix
	pkgs/os-specific/linux/kernel/manual-config.nix
	pkgs/os-specific/linux/qemu-kvm/default.nix
2013-03-02 10:41:53 +01:00
aszlig
94fe64b3eb
manual-kernel: Add bc to buildNativeInputs.
As timeconst.pl was replaced by a bc script in the merge window for kernel 3.9,
we also need bc during build time, for more information about the reasons,
please have a look at the following commit:

torvalds/linux@70730bca13

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2013-02-28 18:57:03 +01:00
Lluís Batlle i Rossell
b58780c43d Merge remote-tracking branch 'eelco/master' into stdenv-updates
Conflicts:
	pkgs/development/compilers/gcc/4.7/default.nix

Trivial solution.
2012-12-28 23:28:16 +01: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
aszlig
639edcb829
manual-kernel: Fix handling spaces in readConfig.
The previos version did a for loop over the output of set, which spits out _all_
defined variables and their contents. This not only is dangerous if there is a
variable starting with CONFIG_ but also can't handle whitespace, as the IFS is
set to any (horizontal _and_ vertical) whitespace by default.

So, imagine (actually don't imagine, something like this is the case in a lot of
kernel configuration files) you have the following variable:

CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi ..."

A loop with for and the default IFS would result in the following variable
pieces:

0: CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi
1: -fcall-saved-rsi
2: ..."

This obviously leads to the problem that this config variable is being cut off
at the first whitespace.

Another downside of this approach is that set not only returns variables but
functions as well. This could lead to quite a lot of unexpected behaviour and
confusion.

So the new approach doesn't source the kernel configuration anymore but uses
`read` to parse the file line-by line, setting IFS to '=', thus splitting all
configuration lines into key/value pairs.

Using parameter expansion, we ensure that we only read lines starting with
"CONFIG_". This particularily has the advantage of not being bash-specific,
should we choose to change to a different default shell someday.

Now, after we got a correct "CONFIG_" line, we're using a temporary variable to
split off the first quote from the result. Particularily the reason behind this
is shell compatibility again, as ${${foo#"}%"} only works in Bash, Zsh and
whatnot but not in plain SH.

And within the next line we obviously insert the no_firstquote variable without
it's last quote removed.

But, what about escaping?

First of all, if we'd just eval the $val variable, we would correctly unescape
the value, but this has the downside that variables within the content would be
expanded, for example look at this:

CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

Well, obviously this is a bad example at the Nix sense, but just to show that
variables within kernel configuration entries aren't impossible.

And second, which would have been a show stopper if \" would be within $val: It
simply would end up being an invalid Nix expression, because \" would end up as
a ploin " within a double quoted string.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2012-12-13 22:54:57 +01:00
Shea Levy
839c58f5b1 linux/manual-config: Cleanup 2012-08-11 21:21:06 -04:00
Shea Levy
9ac776ab22 linux/manual-config.nix: Set sourceRoot directly to the pre-unpacked source rather than using a symlink 2012-08-11 21:07:37 -04:00
Shea Levy
0c18551c93 linux/manual-config: Do source unpacking/patching in a separate derivation.
Since we keep the source in the kernel build anyway, no space is wasted by having a separate store path for the unpacked source. The upside is that the same source can be used to build the kernel multiple times, or generate configurations for later kernel builds, without going through the (fairly long) unpack and patch process multiple times.
2012-08-11 21:02:30 -04:00
Shea Levy
21a200d6b2 linux/manual-config: Fix depmod step, remove false comment 2012-08-07 06:36:50 -04:00
Shea Levy
1935f7e5b8 linux/manual-config: Add informative comment 2012-08-03 08:33:31 -04:00
Shea Levy
1b7264d349 linux/manual-config.nix: When stripping, use xargs -r in case CONFIG_MODULES=y but no modules are actually installed 2012-08-01 23:32:02 -04:00
Shea Levy
4aba2bb3f5 linux/manual-config: Use kernelPatches like generic.nix, not a plain patches list 2012-08-01 23:02:17 -04:00
Shea Levy
fd330e9315 linux/manual-config: Install the kernel with the name given in stdenv.platform.kernelTarget 2012-08-01 15:39:49 -04:00
Shea Levy
ad49d92899 linux/manual-config: When installing firmware, create the firmware directory prior to make *_install.
It is probably a kernel build system bug that this is necessary, but it's not really a big deal either.
2012-08-01 11:56:12 -04:00
Shea Levy
3f4fd55c63 linux/manual-config: Remove unnecessary quotation 2012-08-01 11:26:30 -04:00
Shea Levy
443b9bc936 linux/kernel/manual-config: use isDisabled instead of isNo in case FIRMWARE_IN_KERNEL is left unspecified 2012-08-01 11:21:32 -04:00
Shea Levy
3dbfca0d7f linux/manual-config: Change from 'features' to 'config' and fix build when firmware is installed.
Instead of manually adding which 'features' a kernel has based on its config here, just generate a nixexpr representation of the whole config and let places that need it (e.g. NixOS modules) decide how to map config options to features.

Note that if your kernel requires firmware whose hex file sits directly in ${src}/firmware rather than in a subdirectory thereof, you may need this patch for now: https://lkml.org/lkml/2012/7/31/724
2012-08-01 06:18:03 -04:00
Shea Levy
da4c64026a linux/kernel/manual-config: Greatly simplify config parser 2012-07-29 15:54:31 -04:00
Shea Levy
298b5ccdab linux/kernel/manual-config: Only import from derivation when explicitly asked to 2012-07-29 13:26:39 -04:00
Shea Levy
f0694a3151 linux/kernel/manual-config: Do all of the config file parsing in the imported-from derivation 2012-07-29 13:24:05 -04:00
Shea Levy
6585646d41 linux/kernel/manual-config: Add meta 2012-07-29 04:59:38 -04:00
Shea Levy
46fa5ab105 linux/kernel/manual-config: Relink the symlink from the build directory to the source directory after the source directory is moved 2012-07-29 04:56:56 -04:00
Shea Levy
f7b6f01da1 linux/kernel/manual-config: Cleanup 2012-07-29 04:52:34 -04:00
Shea Levy
98341e0bda linux/kernel/manual-config: Use the kernel's make install 2012-07-29 04:48:50 -04:00
Shea Levy
a9a7085684 linux/kernel/manual-config: Allow manually specifying features, cleanup 2012-07-29 04:31:40 -04:00
Shea Levy
6bb20c7ba2 linux/kernel/manual-config: Strip modules after install 2012-07-29 04:23:28 -04:00
Shea Levy
6b18ab5365 linux/kernel/manual-config: Remove useless INSTALL_MOD_STRIP variable 2012-07-29 04:07:43 -04:00
Shea Levy
6e3b17feec linux/kernel/manual-config: Run depmod after build 2012-07-29 04:01:40 -04:00
Shea Levy
48b5e8eee7 linux/kernel/manual-config: Build in a separate directory and move the build and source trees into $out 2012-07-29 03:49:52 -04:00
Shea Levy
e42a6c5f46 linux/kernel/manual-config: Move the build directory to $out instead of symlinking it 2012-07-29 03:27:09 -04:00
Shea Levy
a36456ca25 linux/kernel-manual-config: Simplify the lines.nix runCommand now that I know how to escape properly 2012-07-29 03:09:44 -04:00
Shea Levy
5a9d9f4f45 linux/kernel/manual-config: Properly escape makeFlagsArray and installFlagsArray 2012-07-29 02:57:58 -04:00
Shea Levy
471b4bc9bb MODLIB needs to be passed directly to make 2012-07-29 02:49:31 -04:00
Shea Levy
aa40e0ff59 linux/kernel/manual-config: The default 'make install' tries to do something with LILO, so install the kernel manually 2012-07-29 01:57:59 -04:00
Shea Levy
dfa750732d linux/kernel/manual-config: Properly set env vars referencing $out 2012-07-29 01:34:27 -04:00
Shea Levy
ff728a6365 The kernel build needs hostname and perl 2012-07-29 01:29:56 -04:00
Shea Levy
bf7467cbb1 Add first attempt at linux/kernel/manual-config.
The goal of this function is to make it possible to build a kernel with a user provided .config.
As a secondary goal, it will extract NixOS-relevant features from the config automatically.
As a tertiary goal, the build will aim to be simpler than the current generic kernel builder.sh.

Unfortunately, that simplicity is offset by the complexity of the feature extraction, especially since nix segfaults when trying to split the file into lines (so an import from a derivation is used)
2012-07-29 01:23:51 -04:00