aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/misc/uboot
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2020-01-12 01:00:12 +0000
committerKatharina Fey <kookie@spacekookie.de>2020-01-12 01:00:12 +0000
commiteeaf5d25d5f6ae7ae1f5bf8a3dee4559693f8147 (patch)
treeafc41ca8dde96b41089ca324533084aef570322f /nixpkgs/pkgs/misc/uboot
parent63c4c4dda49dc69e5812faa7ef8406180998f3ae (diff)
parente4134747f5666bcab8680aff67fa3b63384f9a0f (diff)
Merge commit 'e4134747f5666bcab8680aff67fa3b63384f9a0f'
Diffstat (limited to 'nixpkgs/pkgs/misc/uboot')
-rw-r--r--nixpkgs/pkgs/misc/uboot/default.nix109
-rw-r--r--nixpkgs/pkgs/misc/uboot/rock64-fdt-dtc-compatibility.patch105
-rw-r--r--nixpkgs/pkgs/misc/uboot/rock64.nix38
-rw-r--r--nixpkgs/pkgs/misc/uboot/rockpro64.nix38
4 files changed, 104 insertions, 186 deletions
diff --git a/nixpkgs/pkgs/misc/uboot/default.nix b/nixpkgs/pkgs/misc/uboot/default.nix
index 0c30e76b3fa..5bd20c0765b 100644
--- a/nixpkgs/pkgs/misc/uboot/default.nix
+++ b/nixpkgs/pkgs/misc/uboot/default.nix
@@ -1,5 +1,7 @@
-{ stdenv, lib, fetchurl, fetchpatch, bc, bison, dtc, flex, openssl, swig
-, armTrustedFirmwareAllwinner
+{ stdenv, lib, fetchurl, fetchpatch, fetchFromGitHub, bc, bison, dtc, flex
+, openssl, swig, meson-tools, armTrustedFirmwareAllwinner
+, armTrustedFirmwareRK3328, armTrustedFirmwareRK3399
+, armTrustedFirmwareS905
, buildPackages
}:
@@ -27,14 +29,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 = [
@@ -85,7 +95,7 @@ let
homepage = http://www.denx.de/wiki/U-Boot/;
description = "Boot loader for embedded systems";
license = licenses.gpl2;
- maintainers = with maintainers; [ dezgeg samueldr ];
+ maintainers = with maintainers; [ dezgeg samueldr lopsided98 ];
} // extraMeta;
} // removeAttrs args [ "extraMeta" ]);
@@ -120,6 +130,12 @@ in {
filesToInstall = ["u-boot-sunxi-with-spl.bin"];
};
+ ubootBananaPim3 = buildUBoot {
+ defconfig = "Sinovoip_BPI_M3_defconfig";
+ extraMeta.platforms = ["armv7l-linux"];
+ filesToInstall = ["u-boot-sunxi-with-spl.bin"];
+ };
+
ubootBananaPim64 = buildUBoot {
defconfig = "bananapi_m64_defconfig";
extraMeta.platforms = ["aarch64-linux"];
@@ -163,6 +179,52 @@ in {
filesToInstall = ["u-boot.bin" "SPL"];
};
+ # Flashing instructions:
+ # dd if=bl1.bin.hardkernel of=<device> conv=fsync bs=1 count=442
+ # dd if=bl1.bin.hardkernel of=<device> conv=fsync bs=512 skip=1 seek=1
+ # dd if=u-boot.gxbb of=<device> conv=fsync bs=512 seek=97
+ ubootOdroidC2 = let
+ firmwareBlobs = fetchFromGitHub {
+ owner = "armbian";
+ repo = "odroidc2-blobs";
+ rev = "47c5aac4bcac6f067cebe76e41fb9924d45b429c";
+ sha256 = "1ns0a130yxnxysia8c3q2fgyjp9k0nkr689dxk88qh2vnibgchnp";
+ meta.license = lib.licenses.unfreeRedistributableFirmware;
+ };
+ in buildUBoot {
+ defconfig = "odroid-c2_defconfig";
+ extraMeta.platforms = ["aarch64-linux"];
+ filesToInstall = ["u-boot.bin" "u-boot.gxbb" "${firmwareBlobs}/bl1.bin.hardkernel"];
+ postBuild = ''
+ # BL301 image needs at least 64 bytes of padding after it to place
+ # signing headers (with amlbootsig)
+ truncate -s 64 bl301.padding.bin
+ cat '${firmwareBlobs}/gxb/bl301.bin' bl301.padding.bin > bl301.padded.bin
+ # The downstream fip_create tool adds a custom TOC entry with UUID
+ # AABBCCDD-ABCD-EFEF-ABCD-12345678ABCD for the BL301 image. It turns out
+ # that the firmware blob does not actually care about UUIDs, only the
+ # order the images appear in the file. Because fiptool does not know
+ # about the BL301 UUID, we would have to use the --blob option, which adds
+ # the image to the end of the file, causing the boot to fail. Instead, we
+ # take advantage of the fact that UUIDs are ignored and just put the
+ # images in the right order with the wrong UUIDs. In the command below,
+ # --tb-fw is really --scp-fw and --scp-fw is the BL301 image.
+ #
+ # See https://github.com/afaerber/meson-tools/issues/3 for more
+ # information.
+ '${buildPackages.armTrustedFirmwareTools}/bin/fiptool' create \
+ --align 0x4000 \
+ --tb-fw '${firmwareBlobs}/gxb/bl30.bin' \
+ --scp-fw bl301.padded.bin \
+ --soc-fw '${armTrustedFirmwareS905}/bl31.bin' \
+ --nt-fw u-boot.bin \
+ fip.bin
+ cat '${firmwareBlobs}/gxb/bl2.package' fip.bin > boot_new.bin
+ '${buildPackages.meson-tools}/bin/amlbootsig' boot_new.bin u-boot.img
+ dd if=u-boot.img of=u-boot.gxbb bs=512 skip=96
+ '';
+ };
+
ubootOdroidXU3 = buildUBoot {
defconfig = "odroid-xu3_defconfig";
extraMeta.platforms = ["armv7l-linux"];
@@ -251,10 +313,47 @@ 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"];
- filesToInstall = ["u-boot.bin"];
+ filesToInstall = ["u-boot.kwb"];
};
ubootSopine = buildUBoot {
@@ -268,7 +367,7 @@ in {
defconfig = "cm_fx6_defconfig";
extraMeta.platforms = ["armv7l-linux"];
filesToInstall = ["u-boot-with-nand-spl.imx"];
- buildFlags = "u-boot-with-nand-spl.imx";
+ buildFlags = [ "u-boot-with-nand-spl.imx" ];
extraConfig = ''
CONFIG_CMD_SETEXPR=y
'';
diff --git a/nixpkgs/pkgs/misc/uboot/rock64-fdt-dtc-compatibility.patch b/nixpkgs/pkgs/misc/uboot/rock64-fdt-dtc-compatibility.patch
deleted file mode 100644
index 92725cac5b4..00000000000
--- a/nixpkgs/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/nixpkgs/pkgs/misc/uboot/rock64.nix b/nixpkgs/pkgs/misc/uboot/rock64.nix
deleted file mode 100644
index 9dd43f5fe7e..00000000000
--- a/nixpkgs/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/nixpkgs/pkgs/misc/uboot/rockpro64.nix b/nixpkgs/pkgs/misc/uboot/rockpro64.nix
deleted file mode 100644
index 436e1bcdf87..00000000000
--- a/nixpkgs/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;
- };
-}