-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
54 lines (44 loc) · 1.3 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ pkgs ? import <nixpkgs> {} }:
let
nixpkgs = import pkgs.path { system = "x86_64-linux"; };
board = "NanoPC-T4";
in
nixpkgs.stdenv.mkDerivation {
name = "armbian-rkbin-${board}";
src = nixpkgs.fetchFromGitHub {
rev = "3bd0321cae5ef881a6005fb470009ad5a5d1462d";
owner = "armbian";
repo = "rkbin";
sha256 = "09r4dzxsbs3pff4sh70qnyp30s3rc7pkc46v1m3152s7jqjasp31";
};
nativeBuildInputs = [ nixpkgs.patchelf nixpkgs.makeWrapper ];
dontBuild = true;
dontStrip = true;
installPhase = ''
TOOLS=(
tools/firmwareMerger
tools/kernelimage
tools/loaderimage
tools/mkkrnlimg
tools/rkdeveloptool
tools/trust_merger
)
for tool in "''${TOOLS[@]}"; do
echo "Patching $tool"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$tool"
done
# ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked
TOOLS+=(tools/resource_tool)
mkdir -p $out/share/rkbin
for f in *; do
cp -r $f $out/share/rkbin/
done
for tool in "''${TOOLS[@]}"; do
makeWrapper $out/share/rkbin/$tool $out/bin/''${tool/tools/}
done
'';
meta = with nixpkgs.stdenv.lib; {
description = "Proprietary bits from Rockchip used by Rockchip for ${board}";
license = licenses.unfree;
};
}