uboot: add RockPro64, fix Rock64 build

Switch the Rock64 build from a newer, less maintained U-Boot tree, to an older
but more maintained and featureful version.
This commit is contained in:
Ben Wolsieffer 2018-12-30 18:44:03 -05:00
parent bb72c0668d
commit e245086709
4 changed files with 60 additions and 17 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, fetchpatch, bc, bison, dtc, flex, openssl, python2, swig { stdenv, lib, fetchurl, fetchpatch, bc, bison, dtc, flex, openssl, python2, swig
, armTrustedFirmwareAllwinner , armTrustedFirmwareAllwinner
, buildPackages , buildPackages
}: }:
@ -14,7 +14,7 @@ let
stdenv.mkDerivation (rec { stdenv.mkDerivation (rec {
name = "uboot-${defconfig}-${version}"; name = "uboot-${defconfig}-${version}";
version = "2018.09"; version = args.version or "2018.09";
src = fetchurl { src = fetchurl {
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2"; url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
@ -22,10 +22,6 @@ let
}; };
patches = [ patches = [
(fetchpatch {
url = https://github.com/dezgeg/u-boot/commit/pythonpath-2018-07.patch;
sha256 = "096zqrlr8m9lxjma0iv7y6x78qswfs3q1w2irjkbmcvniz1azbs8";
})
(fetchpatch { (fetchpatch {
url = https://github.com/dezgeg/u-boot/commit/extlinux-path-length-2018-03.patch; url = https://github.com/dezgeg/u-boot/commit/extlinux-path-length-2018-03.patch;
sha256 = "07jafdnxvqv8lz256qy29agjc2k1zj5ad4k28r1w5qkhwj4ixmf8"; sha256 = "07jafdnxvqv8lz256qy29agjc2k1zj5ad4k28r1w5qkhwj4ixmf8";
@ -36,7 +32,15 @@ let
patchShebangs tools patchShebangs tools
''; '';
nativeBuildInputs = [ bc bison dtc flex openssl python2 swig ]; nativeBuildInputs = [
bc
bison
dtc
flex
openssl
(buildPackages.python2.withPackages (p: [ p.libfdt ]))
swig
];
depsBuildBuild = [ buildPackages.stdenv.cc ]; depsBuildBuild = [ buildPackages.stdenv.cc ];
hardeningDisable = [ "all" ]; hardeningDisable = [ "all" ];
@ -58,7 +62,7 @@ let
runHook preInstall runHook preInstall
mkdir -p ${installDir} mkdir -p ${installDir}
cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir} cp ${lib.concatStringsSep " " filesToInstall} ${installDir}
runHook postInstall runHook postInstall
''; '';
@ -68,7 +72,7 @@ let
dontStrip = true; dontStrip = true;
meta = with stdenv.lib; { meta = with lib; {
homepage = http://www.denx.de/wiki/U-Boot/; homepage = http://www.denx.de/wiki/U-Boot/;
description = "Boot loader for embedded systems"; description = "Boot loader for embedded systems";
license = licenses.gpl2; license = licenses.gpl2;
@ -84,7 +88,7 @@ in rec {
installDir = "$out/bin"; installDir = "$out/bin";
hardeningDisable = []; hardeningDisable = [];
dontStrip = false; dontStrip = false;
extraMeta.platforms = stdenv.lib.platforms.linux; extraMeta.platforms = lib.platforms.linux;
extraMakeFlags = [ "HOST_TOOLS_ALL=y" "CROSS_BUILD_TOOLS=1" "NO_SDL=1" "tools" ]; extraMakeFlags = [ "HOST_TOOLS_ALL=y" "CROSS_BUILD_TOOLS=1" "NO_SDL=1" "tools" ];
postConfigure = '' postConfigure = ''
sed -i '/CONFIG_SYS_TEXT_BASE/c\CONFIG_SYS_TEXT_BASE=0x00000000' .config sed -i '/CONFIG_SYS_TEXT_BASE/c\CONFIG_SYS_TEXT_BASE=0x00000000' .config

View File

@ -2,25 +2,25 @@
rkbin = fetchFromGitHub { rkbin = fetchFromGitHub {
owner = "ayufan-rock64"; owner = "ayufan-rock64";
repo = "rkbin"; repo = "rkbin";
rev = "d8b90685b3d93c358936babdd854f1018bc6d35e"; rev = "af17d09dee19b41f4f01e1722eaf6911fb296245";
sha256 = "0wrh3xa968sdp0j9n692jnv3071ymab719zc56vllba0aaabiaxr"; sha256 = "189f7h6wj2yrcc5ga103jnyysykf9j3j9p1vcy7791bxwxqxnggf";
}; };
in buildUBoot rec { in buildUBoot rec {
name = "uboot-${defconfig}-${version}"; name = "uboot-${defconfig}-${version}";
version = "2018.01"; version = "2017.09";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "ayufan-rock64"; owner = "ayufan-rock64";
repo = "linux-u-boot"; repo = "linux-u-boot";
rev = "19e31fac0dee3c4f6b2ea4371e4321f79db0f495"; rev = "d646df03ace3bd191e24361944ce1c7ef3c8744c";
sha256 = "1vmv7q9yafsc0zivd0qdfmf930dvhzkf4a3j6apxxgx9g10wgwrg"; sha256 = "0gclcd034qfhfbabrdqmky08i0hlwmn63n0zg6mndplms5qpcx75";
}; };
extraMakeFlags = [ "BL31=${armTrustedFirmwareRK3328}/bl31.elf" "u-boot.itb" "all" ]; extraMakeFlags = [ "BL31=${armTrustedFirmwareRK3328}/bl31.elf" "u-boot.itb" "all" ];
# So close to being blob free... But U-Boot TPL causes the kernel to hang # Close to being blob free, but the U-Boot TPL causes the kernel to hang after a few minutes
postBuild = '' postBuild = ''
./tools/mkimage -n rk3328 -T rksd -d ${rkbin}/rk33/rk3328_ddr_786MHz_v1.06.bin idbloader.img ./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 cat spl/u-boot-spl.bin >> idbloader.img
dd if=u-boot.itb of=idbloader.img seek=448 conv=notrunc dd if=u-boot.itb of=idbloader.img seek=448 conv=notrunc
''; '';

View File

@ -0,0 +1,37 @@
{ lib, buildUBoot, fetchFromGitHub }: let
rkbin = fetchFromGitHub {
owner = "ayufan-rock64";
repo = "rkbin";
rev = "af17d09dee19b41f4f01e1722eaf6911fb296245";
sha256 = "189f7h6wj2yrcc5ga103jnyysykf9j3j9p1vcy7791bxwxqxnggf";
};
in buildUBoot rec {
name = "uboot-${defconfig}-${version}";
version = "2017.09";
src = fetchFromGitHub {
owner = "ayufan-rock64";
repo = "linux-u-boot";
rev = "d646df03ace3bd191e24361944ce1c7ef3c8744c";
sha256 = "0gclcd034qfhfbabrdqmky08i0hlwmn63n0zg6mndplms5qpcx75";
};
# Upstream ATF hangs in SPL
extraMakeFlags = [ "BL31=${rkbin}/rk33/rk3399_bl31_v1.17.elf" "u-boot.itb" "all" ];
postBuild = ''
./tools/mkimage -n rk3399 -T rksd -d ${rkbin}/rk33/rk3399_ddr_933MHz_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 = "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;
};
}

View File

@ -15304,6 +15304,8 @@ in
ubootRock64 = callPackage ../misc/uboot/rock64.nix { }; ubootRock64 = callPackage ../misc/uboot/rock64.nix { };
ubootRockPro64 = callPackage ../misc/uboot/rockpro64.nix { };
uclibc = callPackage ../os-specific/linux/uclibc { }; uclibc = callPackage ../os-specific/linux/uclibc { };
uclibcCross = callPackage ../os-specific/linux/uclibc { uclibcCross = callPackage ../os-specific/linux/uclibc {