1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 elfutils,
6 pcre,
7}:
8
9stdenv.mkDerivation (finalAttrs: {
10 pname = "mkbootimage";
11 version = "2.3-unstable-2022-05-26";
12
13 src = fetchFromGitHub {
14 owner = "antmicro";
15 repo = "zynq-mkbootimage";
16 rev = "872363ce32c249f8278cf107bc6d3bdeb38d849f";
17 hash = "sha256-5FPyAhUWZDwHbqmp9J2ZXTmjaXPz+dzrJMolaNwADHs=";
18 };
19
20 # Using elfutils because libelf is being discontinued
21 # See https://github.com/NixOS/nixpkgs/pull/271568
22 buildInputs = [
23 elfutils
24 pcre
25 ];
26
27 postPatch = ''
28 substituteInPlace Makefile --replace "git rev-parse --short HEAD" "echo ${finalAttrs.src.rev}"
29 '';
30
31 installPhase = ''
32 runHook preInstall
33
34 install -Dm755 mkbootimage -t $out/bin
35 install -Dm755 exbootimage -t $out/bin
36
37 runHook postInstall
38 '';
39
40 hardeningDisable = [ "fortify" ];
41
42 meta = with lib; {
43 description = "Open source replacement of the Xilinx bootgen application";
44 homepage = "https://github.com/antmicro/zynq-mkbootimage";
45 license = licenses.bsd2;
46 platforms = platforms.linux;
47 maintainers = [ maintainers.fsagbuya ];
48 mainProgram = "mkbootimage";
49 };
50})