summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Wolsieffer <benwolsieffer@gmail.com>2019-11-28 23:44:30 -0500
committerBen Wolsieffer <benwolsieffer@gmail.com>2019-12-05 13:02:48 -0500
commit4d6921a5d80780982ae6f12dbcba7d17acddaefa (patch)
treee19deab2ae8709bee44af61ddcbfeff5c6e82bd3
parentd8d5ffaac78fc4e61fd5af1aa72df55067f6859f (diff)
downloadnixpkgs-4d6921a5d80780982ae6f12dbcba7d17acddaefa.tar
nixpkgs-4d6921a5d80780982ae6f12dbcba7d17acddaefa.tar.gz
nixpkgs-4d6921a5d80780982ae6f12dbcba7d17acddaefa.tar.bz2
nixpkgs-4d6921a5d80780982ae6f12dbcba7d17acddaefa.tar.lz
nixpkgs-4d6921a5d80780982ae6f12dbcba7d17acddaefa.tar.xz
nixpkgs-4d6921a5d80780982ae6f12dbcba7d17acddaefa.tar.zst
nixpkgs-4d6921a5d80780982ae6f12dbcba7d17acddaefa.zip
ubootRock64, ubootRockPro64: use upstream U-Boot
The Rock64 still needs a binary TPL to avoid memory initialization issues.
-rw-r--r--pkgs/misc/uboot/default.nix50
-rw-r--r--pkgs/misc/uboot/rock64-fdt-dtc-compatibility.patch105
-rw-r--r--pkgs/misc/uboot/rock64.nix38
-rw-r--r--pkgs/misc/uboot/rockpro64.nix38
-rw-r--r--pkgs/top-level/all-packages.nix6
5 files changed, 50 insertions, 187 deletions
diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix
index 0c30e76b3fa..8a07461bb2f 100644
--- a/pkgs/misc/uboot/default.nix
+++ b/pkgs/misc/uboot/default.nix
@@ -1,5 +1,6 @@
-{ stdenv, lib, fetchurl, fetchpatch, bc, bison, dtc, flex, openssl, swig
-, armTrustedFirmwareAllwinner
+{ stdenv, lib, fetchurl, fetchpatch, fetchFromGitHub, bc, bison, dtc, flex
+, openssl, swig, armTrustedFirmwareAllwinner, armTrustedFirmwareRK3328
+, armTrustedFirmwareRK3399
 , buildPackages
 }:
 
@@ -27,14 +28,22 @@ let
     src = if src == null then defaultSrc else src;
 
     patches = [
+      # Submitted upstream: https://patchwork.ozlabs.org/patch/1203693/
       (fetchpatch {
         url = https://github.com/dezgeg/u-boot/commit/extlinux-path-length-2018-03.patch;
         sha256 = "07jafdnxvqv8lz256qy29agjc2k1zj5ad4k28r1w5qkhwj4ixmf8";
       })
+      # Submitted upstream: https://patchwork.ozlabs.org/patch/1203678/
+      (fetchpatch {
+        name = "rockchip-allow-loading-larger-kernels.patch";
+        url = "https://marc.info/?l=u-boot&m=157537843004298&q=raw";
+        sha256 = "0l3l88cc9xkxkraql82pfgpx6nqn4dj7cvfaagh5pzfwkxyw0n3p";
+      })
     ] ++ extraPatches;
 
     postPatch = ''
       patchShebangs tools
+      patchShebangs arch/arm/mach-rockchip
     '';
 
     nativeBuildInputs = [
@@ -251,6 +260,43 @@ in {
     filesToInstall = ["u-boot.bin"];
   };
 
+  ubootRock64 = let
+    rkbin = fetchFromGitHub {
+      owner = "ayufan-rock64";
+      repo = "rkbin";
+      rev = "f79a708978232a2b6b06c2e4173c5314559e0d3a";
+      sha256 = "0h7xm4ck3p3380c6bqm5ixrkxwcx6z5vysqdwvfa7gcqx5d6x5zz";
+    };
+  in buildUBoot {
+    extraMakeFlags = [ "all" "u-boot.itb" ];
+    defconfig = "rock64-rk3328_defconfig";
+    extraMeta = {
+      platforms = [ "aarch64-linux" ];
+      license = lib.licenses.unfreeRedistributableFirmware;
+    };
+    BL31="${armTrustedFirmwareRK3328}/bl31.elf";
+    filesToInstall = [ "u-boot.itb" "idbloader.img"];
+    # Derive MAC address from cpuid
+    # Submitted upstream: https://patchwork.ozlabs.org/patch/1203686/
+    extraConfig = ''
+      CONFIG_MISC_INIT_R=y
+    '';
+    # Close to being blob free, but the U-Boot TPL causes random memory
+    # corruption
+    postBuild = ''
+      ./tools/mkimage -n rk3328 -T rksd -d ${rkbin}/rk33/rk3328_ddr_786MHz_v1.13.bin idbloader.img
+      cat spl/u-boot-spl.bin >> idbloader.img
+    '';
+  };
+
+  ubootRockPro64 = buildUBoot {
+    extraMakeFlags = [ "all" "u-boot.itb" ];
+    defconfig = "rockpro64-rk3399_defconfig";
+    extraMeta.platforms = ["aarch64-linux"];
+    BL31="${armTrustedFirmwareRK3399}/bl31.elf";
+    filesToInstall = [ "u-boot.itb" "idbloader.img"];
+  };
+
   ubootSheevaplug = buildUBoot {
     defconfig = "sheevaplug_defconfig";
     extraMeta.platforms = ["armv5tel-linux"];
diff --git a/pkgs/misc/uboot/rock64-fdt-dtc-compatibility.patch b/pkgs/misc/uboot/rock64-fdt-dtc-compatibility.patch
deleted file mode 100644
index 92725cac5b4..00000000000
--- a/pkgs/misc/uboot/rock64-fdt-dtc-compatibility.patch
+++ /dev/null
@@ -1,105 +0,0 @@
-From fbee2adffd39b03e10262b09779faef94c4d5a9d Mon Sep 17 00:00:00 2001
-From: Ben Wolsieffer <benwolsieffer@gmail.com>
-Date: Thu, 18 Apr 2019 15:50:24 -0400
-Subject: [PATCH] fdt: make compatible with dtc >=1.4.6
-
-Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
----
- include/libfdt_env.h         | 6 +++---
- lib/libfdt/fdt.h             | 6 +++---
- lib/libfdt/libfdt.h          | 6 +++---
- lib/libfdt/libfdt_internal.h | 6 +++---
- tools/dtoc/fdt.py            | 2 +-
- 5 files changed, 13 insertions(+), 13 deletions(-)
-
-diff --git a/include/libfdt_env.h b/include/libfdt_env.h
-index 6c6845f76c..1fbcd0ef83 100644
---- a/include/libfdt_env.h
-+++ b/include/libfdt_env.h
-@@ -6,8 +6,8 @@
-  * SPDX-License-Identifier:	LGPL-2.1+
-  */
- 
--#ifndef _LIBFDT_ENV_H
--#define _LIBFDT_ENV_H
-+#ifndef LIBFDT_ENV_H
-+#define LIBFDT_ENV_H
- 
- #include "compiler.h"
- #include "linux/types.h"
-@@ -32,4 +32,4 @@ typedef __be64 fdt64_t;
- /* adding a ramdisk needs 0x44 bytes in version 2008.10 */
- #define FDT_RAMDISK_OVERHEAD	0x80
- 
--#endif /* _LIBFDT_ENV_H */
-+#endif /* LIBFDT_ENV_H */
-diff --git a/lib/libfdt/fdt.h b/lib/libfdt/fdt.h
-index 3134d78332..38cc182739 100644
---- a/lib/libfdt/fdt.h
-+++ b/lib/libfdt/fdt.h
-@@ -1,5 +1,5 @@
--#ifndef _FDT_H
--#define _FDT_H
-+#ifndef FDT_H
-+#define FDT_H
- /*
-  * libfdt - Flat Device Tree manipulation
-  * Copyright (C) 2006 David Gibson, IBM Corporation.
-@@ -64,4 +64,4 @@ struct fdt_property {
- #define FDT_V16_SIZE	FDT_V3_SIZE
- #define FDT_V17_SIZE	(FDT_V16_SIZE + sizeof(fdt32_t))
- 
--#endif /* _FDT_H */
-+#endif /* FDT_H */
-diff --git a/lib/libfdt/libfdt.h b/lib/libfdt/libfdt.h
-index cb533f4275..9345a59f05 100644
---- a/lib/libfdt/libfdt.h
-+++ b/lib/libfdt/libfdt.h
-@@ -1,5 +1,5 @@
--#ifndef _LIBFDT_H
--#define _LIBFDT_H
-+#ifndef LIBFDT_H
-+#define LIBFDT_H
- /*
-  * libfdt - Flat Device Tree manipulation
-  * Copyright (C) 2006 David Gibson, IBM Corporation.
-@@ -2189,4 +2189,4 @@ int fdt_device_is_available(const void *blob, int node);
- int fdt_node_offset_by_phandle_node(const void *fdt, int node, uint32_t phandle);
- #endif /* SWIG */
- 
--#endif /* _LIBFDT_H */
-+#endif /* LIBFDT_H */
-diff --git a/lib/libfdt/libfdt_internal.h b/lib/libfdt/libfdt_internal.h
-index 9a79fe85dd..8fdda7ee79 100644
---- a/lib/libfdt/libfdt_internal.h
-+++ b/lib/libfdt/libfdt_internal.h
-@@ -1,5 +1,5 @@
--#ifndef _LIBFDT_INTERNAL_H
--#define _LIBFDT_INTERNAL_H
-+#ifndef LIBFDT_INTERNAL_H
-+#define LIBFDT_INTERNAL_H
- /*
-  * libfdt - Flat Device Tree manipulation
-  * Copyright (C) 2006 David Gibson, IBM Corporation.
-@@ -47,4 +47,4 @@ static inline struct fdt_reserve_entry *_fdt_mem_rsv_w(void *fdt, int n)
- 
- #define FDT_SW_MAGIC		(~FDT_MAGIC)
- 
--#endif /* _LIBFDT_INTERNAL_H */
-+#endif /* LIBFDT_INTERNAL_H */
-diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
-index dbc338653b..ac2191fb37 100644
---- a/tools/dtoc/fdt.py
-+++ b/tools/dtoc/fdt.py
-@@ -360,7 +360,7 @@ class Fdt:
-         poffset = libfdt.fdt_first_property_offset(self._fdt, node._offset)
-         while poffset >= 0:
-             p = self._fdt_obj.get_property_by_offset(poffset)
--            prop = Prop(node, poffset, p.name, p.value)
-+            prop = Prop(node, poffset, p.name, p)
-             props_dict[prop.name] = prop
- 
-             poffset = libfdt.fdt_next_property_offset(self._fdt, poffset)
--- 
-2.21.0
-
diff --git a/pkgs/misc/uboot/rock64.nix b/pkgs/misc/uboot/rock64.nix
deleted file mode 100644
index 9dd43f5fe7e..00000000000
--- a/pkgs/misc/uboot/rock64.nix
+++ /dev/null
@@ -1,38 +0,0 @@
-{ lib, buildUBoot, fetchFromGitHub, armTrustedFirmwareRK3328 }: let
-  rkbin = fetchFromGitHub {
-    owner = "ayufan-rock64";
-    repo = "rkbin";
-    rev = "f79a708978232a2b6b06c2e4173c5314559e0d3a";
-    sha256 = "0h7xm4ck3p3380c6bqm5ixrkxwcx6z5vysqdwvfa7gcqx5d6x5zz";
-  };
-in buildUBoot {
-  version = "2017.09";
-
-  src = fetchFromGitHub {
-    owner = "ayufan-rock64";
-    repo = "linux-u-boot";
-    rev = "56bd9582537a70c30387de3ce9038a56d2c77bfe";
-    sha256 = "1m0k8ivzhmg9y4x0k7fz7y71pgblzxy81m6x32iivz5kjnxdnv4i";
-  };
-
-  extraPatches = [ ./rock64-fdt-dtc-compatibility.patch ];
-
-  extraMakeFlags = [ "BL31=${armTrustedFirmwareRK3328}/bl31.elf" "u-boot.itb" "all" ];
-
-  # Close to being blob free, but the U-Boot TPL causes the kernel to hang after a few minutes
-  postBuild = ''
-    ./tools/mkimage -n rk3328 -T rksd -d ${rkbin}/rk33/rk3328_ddr_786MHz_v1.13.bin idbloader.img
-    cat spl/u-boot-spl.bin >> idbloader.img
-    dd if=u-boot.itb of=idbloader.img seek=448 conv=notrunc
-  '';
-
-  defconfig = "rock64-rk3328_defconfig";
-  filesToInstall = [ "spl/u-boot-spl.bin" "tpl/u-boot-tpl.bin" "u-boot.itb" "idbloader.img"];
-
-  extraMeta = with lib; {
-    maintainers = [ maintainers.lopsided98 ];
-    platforms = ["aarch64-linux"];
-    # Because of the TPL blob
-    license = licenses.unfreeRedistributableFirmware;
-  };
-}
diff --git a/pkgs/misc/uboot/rockpro64.nix b/pkgs/misc/uboot/rockpro64.nix
deleted file mode 100644
index 436e1bcdf87..00000000000
--- a/pkgs/misc/uboot/rockpro64.nix
+++ /dev/null
@@ -1,38 +0,0 @@
-{ lib, buildUBoot, fetchFromGitHub }: let
-  rkbin = fetchFromGitHub {
-    owner = "ayufan-rock64";
-    repo = "rkbin";
-    rev = "f79a708978232a2b6b06c2e4173c5314559e0d3a";
-    sha256 = "0h7xm4ck3p3380c6bqm5ixrkxwcx6z5vysqdwvfa7gcqx5d6x5zz";
-  };
-in buildUBoot {
-  version = "2017.09";
-
-  src = fetchFromGitHub {
-    owner = "ayufan-rock64";
-    repo = "linux-u-boot";
-    rev = "56bd9582537a70c30387de3ce9038a56d2c77bfe";
-    sha256 = "1m0k8ivzhmg9y4x0k7fz7y71pgblzxy81m6x32iivz5kjnxdnv4i";
-  };
-
-  extraPatches = [ ./rock64-fdt-dtc-compatibility.patch ];
-
-  # Upstream ATF hangs in SPL
-  extraMakeFlags = [ "BL31=${rkbin}/rk33/rk3399_bl31_v1.25.elf" "u-boot.itb" "all" ];
-
-  postBuild = ''
-    ./tools/mkimage -n rk3399 -T rksd -d ${rkbin}/rk33/rk3399_ddr_933MHz_v1.19.bin idbloader.img
-    cat spl/u-boot-spl.bin >> idbloader.img
-    dd if=u-boot.itb of=idbloader.img seek=448 conv=notrunc
-  '';
-
-  defconfig = "rockpro64-rk3399_defconfig";
-  filesToInstall = [ "spl/u-boot-spl.bin" "u-boot.itb" "idbloader.img"];
-
-  extraMeta = with lib; {
-    maintainers = [ maintainers.lopsided98 ];
-    platforms = ["aarch64-linux"];
-    # Because of the TPL and ATF (BL31) blobs
-    license = licenses.unfreeRedistributableFirmware;
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index ce42f22d8e1..11292dd8c08 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -16974,6 +16974,8 @@ in
     ubootRaspberryPi3_32bit
     ubootRaspberryPi3_64bit
     ubootRaspberryPiZero
+    ubootRock64
+    ubootRockPro64
     ubootSheevaplug
     ubootSopine
     ubootUtilite
@@ -16983,10 +16985,6 @@ in
   # Non-upstream U-Boots:
   ubootNanonote = callPackage ../misc/uboot/nanonote.nix { };
 
-  ubootRock64 = callPackage ../misc/uboot/rock64.nix { };
-
-  ubootRockPro64 = callPackage ../misc/uboot/rockpro64.nix { };
-
   uclibc = callPackage ../os-specific/linux/uclibc { };
 
   uclibcCross = callPackage ../os-specific/linux/uclibc {