This repository has no description
1.6 kB
60 lines
1{
2 lib,
3 stdenvNoCC,
4 fetchgit,
5 python3,
6}:
7
8stdenvNoCC.mkDerivation {
9 pname = "mkbootimg";
10 version = "2025-02-10";
11
12 src = fetchgit {
13 url = "https://android.googlesource.com/platform/system/tools/mkbootimg";
14 rev = "d2bb0af5ba6d3198a3e99529c97eda1be0b5a093";
15 hash = "sha256-z7KklKf0dTyt7ZoUiZrMYRzU3h+WuLnc355LRtFMs2s=";
16 };
17
18 nativeBuildInputs = [ python3 ];
19
20 installPhase = ''
21 runHook preInstall
22
23 mkdir -p $out/bin $out/lib/mkbootimg
24
25 # Copy Python scripts and modules
26 cp mkbootimg.py unpack_bootimg.py repack_bootimg.py $out/lib/mkbootimg/
27 cp -r gki $out/lib/mkbootimg/
28
29 # Create wrapper scripts with PYTHONPATH set
30 cat > $out/bin/mkbootimg << EOF
31 #!/bin/sh
32 export PYTHONPATH="$out/lib/mkbootimg:\$PYTHONPATH"
33 exec ${python3}/bin/python3 $out/lib/mkbootimg/mkbootimg.py "\$@"
34 EOF
35 chmod +x $out/bin/mkbootimg
36
37 cat > $out/bin/unpack_bootimg << EOF
38 #!/bin/sh
39 export PYTHONPATH="$out/lib/mkbootimg:\$PYTHONPATH"
40 exec ${python3}/bin/python3 $out/lib/mkbootimg/unpack_bootimg.py "\$@"
41 EOF
42 chmod +x $out/bin/unpack_bootimg
43
44 cat > $out/bin/repack_bootimg << EOF
45 #!/bin/sh
46 export PYTHONPATH="$out/lib/mkbootimg:\$PYTHONPATH"
47 exec ${python3}/bin/python3 $out/lib/mkbootimg/repack_bootimg.py "\$@"
48 EOF
49 chmod +x $out/bin/repack_bootimg
50
51 runHook postInstall
52 '';
53
54 meta = with lib; {
55 description = "Android boot image creation tool from AOSP";
56 homepage = "https://android.googlesource.com/platform/system/tools/mkbootimg";
57 license = licenses.asl20;
58 platforms = platforms.all;
59 };
60}