1{
2 lib,
3 python3Packages,
4 fetchPypi,
5 makeWrapper,
6
7 armTrustedFirmwareTools,
8 bzip2,
9 cbfstool,
10 gzip,
11 lz4,
12 lzop,
13 openssl,
14 ubootTools,
15 vboot_reference,
16 xilinx-bootgen,
17 xz,
18 zstd,
19}:
20
21let
22 # We are fetching from PyPI because the code in the repository seems to be
23 # lagging behind the PyPI releases somehow...
24 version = "0.0.7";
25in
26rec {
27
28 u_boot_pylib = python3Packages.buildPythonPackage rec {
29 pname = "u_boot_pylib";
30 inherit version;
31 pyproject = true;
32
33 src = fetchPypi {
34 inherit pname version;
35 hash = "sha256-A5r20Y8mgxhOhaKMpd5MJN5ubzPbkodAO0Tr0RN1SRA=";
36 };
37
38 build-system = with python3Packages; [
39 setuptools
40 ];
41
42 checkPhase = ''
43 ${python3Packages.python.interpreter} "src/$pname/__main__.py"
44 # There are some tests in other files, but they are broken
45 '';
46
47 pythonImportsCheck = [ "u_boot_pylib" ];
48 };
49
50 dtoc = python3Packages.buildPythonPackage rec {
51 pname = "dtoc";
52 inherit version;
53 pyproject = true;
54
55 src = fetchPypi {
56 inherit pname version;
57 hash = "sha256-NA96CznIxjqpw2Ik8AJpJkJ/ei+kQTCUExwFgssV+CM=";
58 };
59
60 build-system = with python3Packages; [
61 setuptools
62 ];
63
64 dependencies =
65 (with python3Packages; [
66 libfdt
67 ])
68 ++ [
69 u_boot_pylib
70 ];
71
72 pythonImportsCheck = [ "dtoc" ];
73 };
74
75 binman =
76 let
77 btools = [
78 armTrustedFirmwareTools
79 bzip2
80 cbfstool
81 # TODO: cst
82 gzip
83 lz4
84 # TODO: lzma_alone
85 lzop
86 openssl
87 ubootTools
88 vboot_reference
89 xilinx-bootgen
90 xz
91 zstd
92 ];
93 in
94 python3Packages.buildPythonApplication rec {
95 pname = "binary_manager";
96 inherit version;
97 pyproject = true;
98
99 src = fetchPypi {
100 inherit pname version;
101 hash = "sha256-llEBBhUoW5jTEQeoaTCjZN8y6Kj+PGNUSB3cKpgD06w=";
102 };
103
104 patches = [
105 ./binman-resources.patch
106 ];
107 patchFlags = [
108 "-p2"
109 "-d"
110 "src"
111 ];
112
113 build-system = with python3Packages; [
114 setuptools
115 ];
116
117 nativeBuildInputs = [ makeWrapper ];
118
119 dependencies =
120 (with python3Packages; [
121 jsonschema
122 pycryptodomex
123 pyelftools
124 yamllint
125 ])
126 ++ [
127 dtoc
128 u_boot_pylib
129 ];
130
131 preFixup = ''
132 wrapProgram "$out/bin/binman" --prefix PATH : "${lib.makeBinPath btools}"
133 '';
134 };
135
136 patman = python3Packages.buildPythonApplication rec {
137 pname = "patch_manager";
138 inherit version;
139 pyproject = true;
140
141 src = fetchPypi {
142 inherit pname version;
143 hash = "sha256-zD9e87fpWKynpUcfxobbdk6wbM6Ja3f8hEVHS7DGIKQ=";
144 };
145
146 build-system = with python3Packages; [
147 setuptools
148 ];
149
150 dependencies =
151 (with python3Packages; [
152 aiohttp
153 pygit2
154 ])
155 ++ [
156 u_boot_pylib
157 ];
158 };
159
160}