add zImage output

This commit is contained in:
Daniel Barlow 2023-12-07 22:31:26 +00:00
parent a8891461aa
commit 03b17fa3ed
2 changed files with 17 additions and 2 deletions

View file

@ -30,6 +30,16 @@ in
Kernel vmlinux file (usually ELF) Kernel vmlinux file (usually ELF)
''; '';
}; };
zimage = mkOption {
type = types.package;
internal = true;
description = ''
zimage
******
Kernel in compressed self-extracting package
'';
};
dtb = mkOption { dtb = mkOption {
type = types.package; type = types.package;
internal = true; internal = true;
@ -80,6 +90,10 @@ in
kernel = liminix.builders.kernel.override { kernel = liminix.builders.kernel.override {
inherit (config.kernel) config src extraPatchPhase; inherit (config.kernel) config src extraPatchPhase;
}; };
zimage = liminix.builders.kernel.override {
targets = ["arch/arm/boot/zImage"];
inherit (config.kernel) config src extraPatchPhase;
};
dtb = liminix.builders.dtb { dtb = liminix.builders.dtb {
inherit (config.boot) commandLine; inherit (config.boot) commandLine;
dts = config.hardware.dts.src; dts = config.hardware.dts.src;

View file

@ -7,6 +7,7 @@
, config , config
, src , src
, extraPatchPhase ? "echo" , extraPatchPhase ? "echo"
, targets ? ["vmlinux"]
} : } :
let let
writeConfig = import ./write-kconfig.nix { inherit lib writeText; }; writeConfig = import ./write-kconfig.nix { inherit lib writeText; };
@ -90,12 +91,12 @@ stdenv.mkDerivation rec {
''; '';
buildPhase = '' buildPhase = ''
make vmlinux modules_prepare -j$NIX_BUILD_CORES make ${lib.concatStringsSep " " (map baseNameOf targets)} modules_prepare -j$NIX_BUILD_CORES
''; '';
installPhase = '' installPhase = ''
${CROSS_COMPILE}strip -d vmlinux ${CROSS_COMPILE}strip -d vmlinux
cp vmlinux $out cp ${lib.concatStringsSep " " targets} $out
mkdir -p $headers mkdir -p $headers
cp -a include .config $headers/ cp -a include .config $headers/
mkdir -p $modulesupport mkdir -p $modulesupport