Commit graph

73 commits

Author SHA1 Message Date
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
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