1{ lib, stdenv, buildPackages, fetchurl, fetchpatch, zlib }:
2
3stdenv.mkDerivation rec {
4 pname = "kexec-tools";
5 version = "2.0.26";
6
7 src = fetchurl {
8 urls = [
9 "mirror://kernel/linux/utils/kernel/kexec/${pname}-${version}.tar.xz"
10 "http://horms.net/projects/kexec/kexec-tools/${pname}-${version}.tar.xz"
11 ];
12 sha256 = "sha256-f+NqBkEBzVxRXkGyvjk9zjyoitzlnW7maOCvfAxFcM0=";
13 };
14
15 patches = [
16 # Use ELFv2 ABI on ppc64be
17 (fetchpatch {
18 url = "https://raw.githubusercontent.com/void-linux/void-packages/6c1192cbf166698932030c2e3de71db1885a572d/srcpkgs/kexec-tools/patches/ppc64-elfv2.patch";
19 sha256 = "19wzfwb0azm932v0vhywv4221818qmlmvdfwpvvpfyw4hjsc2s1l";
20 })
21 ];
22
23 hardeningDisable = [ "format" "pic" "relro" "pie" ];
24
25 # Prevent kexec-tools from using uname to detect target, which is wrong in
26 # cases like compiling for aarch32 on aarch64
27 configurePlatforms = [ "build" "host" ];
28 configureFlags = [ "BUILD_CC=${buildPackages.stdenv.cc.targetPrefix}cc" ];
29 depsBuildBuild = [ buildPackages.stdenv.cc ];
30 buildInputs = [ zlib ];
31
32 meta = with lib; {
33 homepage = "http://horms.net/projects/kexec/kexec-tools";
34 description = "Tools related to the kexec Linux feature";
35 platforms = platforms.linux;
36 badPlatforms = [
37 "riscv64-linux" "riscv32-linux"
38 "sparc-linux" "sparc64-linux"
39 ];
40 license = licenses.gpl2;
41 };
42}