mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-11 16:23:26 +00:00
linux-packages: init at ${linuxHeaders.version}
This exports the standalone scripts from the Linux tree as usable
package. For example, they are helpful for OS-space developers and
virtualization engineers.
For the beginning, this includes:
`$ extract-vmlinux path/to/bzImage > vmlinux`
`$ extract-ikconfig path/to/bzImage > .config`
(cherry picked from commit 185f7b4b15
)
This commit is contained in:
parent
0f8e5a078a
commit
835cf2d3f3
64
pkgs/by-name/li/linux-scripts/package.nix
Normal file
64
pkgs/by-name/li/linux-scripts/package.nix
Normal file
@ -0,0 +1,64 @@
|
||||
{ lib
|
||||
, linuxHeaders # Linux source tree
|
||||
, makeWrapper
|
||||
, stdenvNoCC
|
||||
|
||||
, binutils
|
||||
, coreutils
|
||||
, gnugrep
|
||||
|
||||
# decompressors for possible kernel image formats
|
||||
, bzip2
|
||||
, gzip
|
||||
, lz4
|
||||
, lzop
|
||||
, xz
|
||||
, zstd
|
||||
}:
|
||||
|
||||
let
|
||||
commonDeps = [
|
||||
binutils
|
||||
coreutils
|
||||
gnugrep
|
||||
gzip
|
||||
xz
|
||||
bzip2
|
||||
lzop
|
||||
lz4
|
||||
zstd
|
||||
];
|
||||
|
||||
toWrapScriptLines = scriptName: ''
|
||||
install -Dm 0755 scripts/${scriptName} $out/bin/${scriptName}
|
||||
wrapProgram $out/bin/${scriptName} --prefix PATH : ${lib.makeBinPath commonDeps}
|
||||
'';
|
||||
in
|
||||
stdenvNoCC.mkDerivation
|
||||
{
|
||||
inherit (linuxHeaders) version;
|
||||
pname = "linux-scripts";
|
||||
|
||||
# These scripts will rarely change and are usually not bound to a specific
|
||||
# version of Linux. So it is okay to just use whatever Linux version comes
|
||||
# from `linuxHeaders.
|
||||
src = linuxHeaders.src;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
${toWrapScriptLines "extract-ikconfig"}
|
||||
${toWrapScriptLines "extract-vmlinux"}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Standalone scripts from <linux>/scripts";
|
||||
homepage = "https://www.kernel.org/";
|
||||
license = licenses.gpl2Only;
|
||||
maintainers = [ maintainers.phip1611 ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user