diff options
author | matthewcroughan <matt@croughan.sh> | 2024-04-11 15:56:54 +0100 |
---|---|---|
committer | matthewcroughan <matt@croughan.sh> | 2024-04-20 20:55:35 +0100 |
commit | 8463dad6c820f8378807c7a60a6940ed87c4412b (patch) | |
tree | 10a5eb99bf5140db07ede5832b5ba6b511f61a49 | |
parent | 3866e05660eb5f468ae5d9d2954df22b222a467e (diff) |
rkboot: init
-rw-r--r-- | pkgs/by-name/rk/rkboot/package.nix | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/by-name/rk/rkboot/package.nix b/pkgs/by-name/rk/rkboot/package.nix new file mode 100644 index 0000000000000..5e71406967a62 --- /dev/null +++ b/pkgs/by-name/rk/rkboot/package.nix @@ -0,0 +1,43 @@ +{ stdenv +, lib +, rkbin +, box64 +}: + +stdenv.mkDerivation { + name = "rkboot"; + + src = rkbin.src; + + postPatch = '' + substituteInPlace RKBOOT/*.ini --replace 'PATH=' 'PATH=rkboot/' + ''; + + buildPhase = '' + mkdir rkboot + for i in $(ls ./RKBOOT/*.ini) + do + # The proprietary, statically linked binaries to perform boot_merge are + # x86_64 only. Though we use box64 to emulate if building on aarch64-linux + ${lib.optionalString stdenv.isAarch64 "${lib.getExe box64}"} ./tools/boot_merger "$i" || true + done + ''; + + installPhase = '' + mkdir -p $out + if [ -z "$(ls -A rkboot)" ]; then + echo "Error: The 'rkboot' directory is empty." + exit 1 + else + mv rkboot $out/bin + fi + ''; + + meta = with lib; { + description = "Rockchip proprietary SPL bootloader blobs"; + homepage = "https://github.com/rockchip-linux/rkbin"; + license = licenses.unfreeRedistributable; + maintainers = with maintainers; [ matthewcroughan ]; + platforms = [ "x86_64-linux" "aarch64-linux" ]; + }; +} |