Commit Graph

96 Commits

Author SHA1 Message Date
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 57b2d1e9b0dcdd1d25bd2d450174764b9417ffc1, reversing
changes made to 760b2b9048ea775c319cb348d74447a20dea513e.
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 48f51f118506 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