summary refs log tree commit diff
path: root/pkgs/build-support/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/kernel')
-rw-r--r--pkgs/build-support/kernel/make-initrd.nix9
-rw-r--r--pkgs/build-support/kernel/make-initrd.sh5
-rw-r--r--pkgs/build-support/kernel/modules-closure.sh2
3 files changed, 13 insertions, 3 deletions
diff --git a/pkgs/build-support/kernel/make-initrd.nix b/pkgs/build-support/kernel/make-initrd.nix
index b62ed984045..92142b5ef43 100644
--- a/pkgs/build-support/kernel/make-initrd.nix
+++ b/pkgs/build-support/kernel/make-initrd.nix
@@ -12,12 +12,17 @@
 # `contents = {object = ...; symlink = /init;}' is a typical
 # argument.
 
-{stdenv, perl, cpio, contents}:
+{stdenv, perl, cpio, contents, uboot ? null}:
+
+assert stdenv.system == "armv5tel-linux" -> uboot != null;
 
 stdenv.mkDerivation {
   name = "initrd";
   builder = ./make-initrd.sh;
-  buildInputs = [perl cpio];
+  buildInputs = [perl cpio]
+    ++ stdenv.lib.optional (stdenv.system == "armv5tel-linux") [ uboot ];
+
+  makeUInitrd = if (stdenv.system == "armv5tel-linux") then true else false;
 
   # !!! should use XML.
   objects = map (x: x.object) contents;
diff --git a/pkgs/build-support/kernel/make-initrd.sh b/pkgs/build-support/kernel/make-initrd.sh
index d930e51a03f..69931bad113 100644
--- a/pkgs/build-support/kernel/make-initrd.sh
+++ b/pkgs/build-support/kernel/make-initrd.sh
@@ -37,3 +37,8 @@ storePaths=$(perl $pathsFromGraph closure-*)
 # Put the closure in a gzipped cpio archive.
 ensureDir $out
 (cd root && find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd)
+
+if [ -n "$makeUInitrd" ]; then
+    mv $out/initrd $out/initrd.gz
+    mkimage -A arm -O linux -T ramdisk -C gzip -d $out/initrd.gz $out/initrd
+fi
diff --git a/pkgs/build-support/kernel/modules-closure.sh b/pkgs/build-support/kernel/modules-closure.sh
index e75ef927baa..af1faa7708c 100644
--- a/pkgs/build-support/kernel/modules-closure.sh
+++ b/pkgs/build-support/kernel/modules-closure.sh
@@ -22,7 +22,7 @@ for module in $rootModules; do
 done
 
 echo "closure:"
-ensureDir $out
+ensureDir $out/lib/modules/"$version"
 for module in $closure; do
     target=$(echo $module | sed "s^/nix/store/.*/lib/modules/^$out/lib/modules/^")
     if test -e "$target"; then continue; fi