|
|
@ -3,8 +3,13 @@
|
|
|
|
# initramfs-formatted `cpio` archive from their contents.
|
|
|
|
# initramfs-formatted `cpio` archive from their contents.
|
|
|
|
{ nixpkgsOnBuildForHost
|
|
|
|
{ nixpkgsOnBuildForHost
|
|
|
|
, nixpkgsOnBuildForBuild
|
|
|
|
, nixpkgsOnBuildForBuild
|
|
|
|
|
|
|
|
, lib
|
|
|
|
, userspace
|
|
|
|
, userspace
|
|
|
|
, kernel
|
|
|
|
, kernel
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# a list of paths (relative to ${kernel}/lib/modules/*/kernel) to modules .ko
|
|
|
|
|
|
|
|
# files which should be included in the initrd
|
|
|
|
|
|
|
|
, modules ? [ ]
|
|
|
|
}:
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
|
|
nixpkgsOnBuildForHost.stdenv.mkDerivation {
|
|
|
|
nixpkgsOnBuildForHost.stdenv.mkDerivation {
|
|
|
@ -12,12 +17,14 @@ nixpkgsOnBuildForHost.stdenv.mkDerivation {
|
|
|
|
nativeBuildInputs = with nixpkgsOnBuildForBuild; [ findutils cpio ];
|
|
|
|
nativeBuildInputs = with nixpkgsOnBuildForBuild; [ findutils cpio ];
|
|
|
|
srcs = [ ];
|
|
|
|
srcs = [ ];
|
|
|
|
dontUnpack = true;
|
|
|
|
dontUnpack = true;
|
|
|
|
|
|
|
|
modulesList = (lib.concatMapStringsSep "\n" (m: "${kernel.version}/kernel/" + m) modules)+"\n";
|
|
|
|
|
|
|
|
passAsFile = [ "modulesList" ];
|
|
|
|
buildPhase = ''
|
|
|
|
buildPhase = ''
|
|
|
|
mkdir build
|
|
|
|
mkdir build
|
|
|
|
mkdir -p build/lib/modules
|
|
|
|
mkdir -p build/lib/modules
|
|
|
|
BUILD=$(pwd)/build
|
|
|
|
BUILD=$(pwd)/build
|
|
|
|
pushd ${kernel}/lib/modules/
|
|
|
|
pushd ${kernel}/lib/modules/
|
|
|
|
cat ${userspace}/modules-insmod.txt | cpio -p -d $BUILD/lib/modules
|
|
|
|
cat $modulesListPath | cpio -p -d $BUILD/lib/modules
|
|
|
|
popd
|
|
|
|
popd
|
|
|
|
pushd ${userspace}
|
|
|
|
pushd ${userspace}
|
|
|
|
find . | cpio -p -d $BUILD/
|
|
|
|
find . | cpio -p -d $BUILD/
|
|
|
|