about summary refs log tree commit diff
path: root/pkgs/misc/uboot
diff options
context:
space:
mode:
authorTravis Whitton <travis@sharpspring.com>2021-01-28 13:41:08 -0500
committerTravis Whitton <travis@sharpspring.com>2021-02-12 14:35:54 -0500
commitc21fee9d2f29a847b8a2d13ef5f228d2bd63f5d4 (patch)
tree912d0c1ceb9441db5b5db6f7b24447cc6f0e8858 /pkgs/misc/uboot
parentba680416b9f820bf3cb4bdcd375e162e26a8221c (diff)
uboot: add ubootNanoPCT4 for NanoPC-T4
Diffstat (limited to 'pkgs/misc/uboot')
-rw-r--r--pkgs/misc/uboot/default.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix
index 20d928d944d85..8b4f451c2f48d 100644
--- a/pkgs/misc/uboot/default.nix
+++ b/pkgs/misc/uboot/default.nix
@@ -1,5 +1,6 @@
 { stdenv
 , lib
+, callPackage
 , fetchurl
 , fetchpatch
 , fetchFromGitHub
@@ -178,6 +179,35 @@ in {
     '';
   };
 
+  ubootNanoPCT4 = buildUBoot rec {
+    # vanilla u-boot does not work with the nanopc-t4
+    # so we use this repo with the required patches applied
+    src = fetchFromGitHub {
+      owner = "tmountain";
+      repo = "u-boot-nanopct4";
+      rev = "23f6f74ec3ba53263ed97ec3cac9979b0ad998bc";
+      sha256 = "07b3gcizkswld796l502bj6ln0hwz7wcm2rp3knpjmmha5llb5dz";
+    };
+
+    version = "2020.10";
+    # this provides wrapped rkbin binaries that are patched to work with NixOS
+    rkbin = callPackage "${src}/rkbin" {};
+
+    defconfig = "nanopc-t4-rk3399_defconfig";
+
+    extraMeta = {
+      platforms = [ "aarch64-linux" ];
+      license = lib.licenses.unfreeRedistributableFirmware;
+    };
+    filesToInstall = [ "idbloader.bin" "uboot.img" "trust.bin" ];
+    postBuild = ''
+      ./tools/mkimage -n rk3399 -T rksd -d ${rkbin}/share/rkbin/rk33/rk3399_ddr_800MHz_v1.24.bin idbloader.bin
+      cat ${rkbin}/share/rkbin/rk33/rk3399_miniloader_v1.19.bin >> idbloader.bin
+      ${rkbin}/bin/trust_merger --replace bl31.elf ${rkbin}/share/rkbin/rk33/rk3399_bl31_v1.30.elf trust.ini
+      ${rkbin}/bin/loaderimage --pack --uboot ./u-boot-dtb.bin uboot.img
+    '';
+  };
+
   ubootNovena = buildUBoot {
     defconfig = "novena_defconfig";
     extraMeta.platforms = ["armv7l-linux"];