Merge pull request #53170 from lopsided98/uboot-rockpro64
uboot: add RockPro64 support, fix Rock64 build, misc related changes
This commit is contained in:
commit
615ed6d90a
@ -1,7 +1,7 @@
|
|||||||
{ stdenv, fetchgit, fetchpatch, flex, bison, pkgconfig, python2, swig, which }:
|
{ stdenv, fetchgit, fetchpatch, flex, bison, pkgconfig, python2, swig, which }:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "dtc-${version}";
|
pname = "dtc";
|
||||||
version = "1.4.7";
|
version = "1.4.7";
|
||||||
|
|
||||||
src = fetchgit {
|
src = fetchgit {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, fetchFromGitHub, buildPackages }:
|
{ stdenv, fetchFromGitHub, pkgsCross, buildPackages }:
|
||||||
|
|
||||||
let
|
let
|
||||||
buildArmTrustedFirmware = { filesToInstall
|
buildArmTrustedFirmware = { filesToInstall
|
||||||
@ -6,7 +6,7 @@ let
|
|||||||
, platform
|
, platform
|
||||||
, extraMakeFlags ? []
|
, extraMakeFlags ? []
|
||||||
, extraMeta ? {}
|
, extraMeta ? {}
|
||||||
, version ? "1.5"
|
, version ? "2.0"
|
||||||
, ... } @ args:
|
, ... } @ args:
|
||||||
stdenv.mkDerivation (rec {
|
stdenv.mkDerivation (rec {
|
||||||
|
|
||||||
@ -17,11 +17,14 @@ let
|
|||||||
owner = "ARM-software";
|
owner = "ARM-software";
|
||||||
repo = "arm-trusted-firmware";
|
repo = "arm-trusted-firmware";
|
||||||
rev = "refs/tags/v${version}";
|
rev = "refs/tags/v${version}";
|
||||||
sha256 = "1gm0bn2llzfzz9bfsz11fhwxj5lxvyrq7bc13fjj033nljzxn7k8";
|
sha256 = "087pkwa6slxff0aiz3v42gww007nww97bl1p96fvvs7rr1y14gjx";
|
||||||
};
|
};
|
||||||
|
|
||||||
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
depsBuildBuild = [ buildPackages.stdenv.cc ];
|
||||||
|
|
||||||
|
# For Cortex-M0 firmware in RK3399
|
||||||
|
nativeBuildInputs = [ pkgsCross.arm-embedded.stdenv.cc ];
|
||||||
|
|
||||||
makeFlags = [
|
makeFlags = [
|
||||||
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||||
"PLAT=${platform}"
|
"PLAT=${platform}"
|
||||||
@ -83,4 +86,11 @@ in rec {
|
|||||||
extraMeta.platforms = ["aarch64-linux"];
|
extraMeta.platforms = ["aarch64-linux"];
|
||||||
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf"];
|
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
armTrustedFirmwareRK3399 = buildArmTrustedFirmware rec {
|
||||||
|
extraMakeFlags = [ "bl31" ];
|
||||||
|
platform = "rk3399";
|
||||||
|
extraMeta.platforms = ["aarch64-linux"];
|
||||||
|
filesToInstall = [ "build/${platform}/release/bl31/bl31.elf"];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
24
pkgs/misc/rkdeveloptool/default.nix
Normal file
24
pkgs/misc/rkdeveloptool/default.nix
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libusb1 }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "rkdeveloptool";
|
||||||
|
version = "1.3";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "rockchip-linux";
|
||||||
|
repo = "rkdeveloptool";
|
||||||
|
rev = "081d237ad5bf8f03170c9d60bd94ceefa0352aaf";
|
||||||
|
sha256 = "05hh7j3xgb8l1k1v2lis3nvlc0gp87ihzg6jci7m5lkkm5qgv3ji";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ autoreconfHook pkgconfig ];
|
||||||
|
|
||||||
|
buildInputs = [ libusb1 ];
|
||||||
|
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
homepage = https://github.com/rockchip-linux/rkdeveloptool;
|
||||||
|
description = "A tool from Rockchip to communicate with Rockusb devices";
|
||||||
|
license = licenses.gpl2;
|
||||||
|
maintainers = [ maintainers.lopsided98 ];
|
||||||
|
};
|
||||||
|
}
|
@ -1,20 +1,22 @@
|
|||||||
{ stdenv, fetchurl, fetchpatch, bc, bison, dtc, flex, openssl, python2, swig
|
{ stdenv, lib, fetchurl, fetchpatch, bc, bison, dtc, flex, openssl, swig
|
||||||
, armTrustedFirmwareAllwinner
|
, armTrustedFirmwareAllwinner
|
||||||
, buildPackages
|
, buildPackages
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
buildUBoot = { filesToInstall
|
buildUBoot = { version ? "2018.09"
|
||||||
|
, filesToInstall
|
||||||
, installDir ? "$out"
|
, installDir ? "$out"
|
||||||
, defconfig
|
, defconfig
|
||||||
|
, extraConfig ? ""
|
||||||
, extraPatches ? []
|
, extraPatches ? []
|
||||||
, extraMakeFlags ? []
|
, extraMakeFlags ? []
|
||||||
, extraMeta ? {}
|
, extraMeta ? {}
|
||||||
, ... } @ args:
|
, ... } @ args:
|
||||||
stdenv.mkDerivation (rec {
|
stdenv.mkDerivation (rec {
|
||||||
|
|
||||||
name = "uboot-${defconfig}-${version}";
|
pname = "uboot-${defconfig}";
|
||||||
version = "2018.09";
|
inherit version;
|
||||||
|
|
||||||
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 +24,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 +34,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" ];
|
||||||
@ -46,11 +52,15 @@ let
|
|||||||
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||||
] ++ extraMakeFlags;
|
] ++ extraMakeFlags;
|
||||||
|
|
||||||
|
passAsFile = [ "extraConfig" ];
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
|
||||||
make ${defconfig}
|
make ${defconfig}
|
||||||
|
|
||||||
|
cat $extraConfigPath >> .config
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -58,7 +68,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 +78,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 +94,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
|
||||||
@ -238,10 +248,8 @@ in rec {
|
|||||||
extraMeta.platforms = ["armv7l-linux"];
|
extraMeta.platforms = ["armv7l-linux"];
|
||||||
filesToInstall = ["u-boot-with-nand-spl.imx"];
|
filesToInstall = ["u-boot-with-nand-spl.imx"];
|
||||||
buildFlags = "u-boot-with-nand-spl.imx";
|
buildFlags = "u-boot-with-nand-spl.imx";
|
||||||
postConfigure = ''
|
extraConfig = ''
|
||||||
cat >> .config << EOF
|
|
||||||
CONFIG_CMD_SETEXPR=y
|
CONFIG_CMD_SETEXPR=y
|
||||||
EOF
|
|
||||||
'';
|
'';
|
||||||
# sata init; load sata 0 $loadaddr u-boot-with-nand-spl.imx
|
# sata init; load sata 0 $loadaddr u-boot-with-nand-spl.imx
|
||||||
# sf probe; sf update $loadaddr 0 80000
|
# sf probe; sf update $loadaddr 0 80000
|
||||||
|
@ -2,25 +2,24 @@
|
|||||||
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}";
|
version = "2017.09";
|
||||||
version = "2018.01";
|
|
||||||
|
|
||||||
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
|
||||||
'';
|
'';
|
||||||
|
36
pkgs/misc/uboot/rockpro64.nix
Normal file
36
pkgs/misc/uboot/rockpro64.nix
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{ lib, buildUBoot, fetchFromGitHub }: let
|
||||||
|
rkbin = fetchFromGitHub {
|
||||||
|
owner = "ayufan-rock64";
|
||||||
|
repo = "rkbin";
|
||||||
|
rev = "af17d09dee19b41f4f01e1722eaf6911fb296245";
|
||||||
|
sha256 = "189f7h6wj2yrcc5ga103jnyysykf9j3j9p1vcy7791bxwxqxnggf";
|
||||||
|
};
|
||||||
|
in buildUBoot rec {
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
}
|
@ -14270,6 +14270,7 @@ in
|
|||||||
armTrustedFirmwareAllwinner
|
armTrustedFirmwareAllwinner
|
||||||
armTrustedFirmwareQemu
|
armTrustedFirmwareQemu
|
||||||
armTrustedFirmwareRK3328
|
armTrustedFirmwareRK3328
|
||||||
|
armTrustedFirmwareRK3399
|
||||||
;
|
;
|
||||||
|
|
||||||
microcodeAmd = callPackage ../os-specific/linux/microcode/amd.nix { };
|
microcodeAmd = callPackage ../os-specific/linux/microcode/amd.nix { };
|
||||||
@ -15317,7 +15318,35 @@ in
|
|||||||
# Non-upstream U-Boots:
|
# Non-upstream U-Boots:
|
||||||
ubootNanonote = callPackage ../misc/uboot/nanonote.nix { };
|
ubootNanonote = callPackage ../misc/uboot/nanonote.nix { };
|
||||||
|
|
||||||
ubootRock64 = callPackage ../misc/uboot/rock64.nix { };
|
inherit (let
|
||||||
|
dtc = buildPackages.dtc.overrideAttrs (old: rec {
|
||||||
|
version = "1.4.5";
|
||||||
|
src = fetchgit {
|
||||||
|
url = "https://git.kernel.org/pub/scm/utils/dtc/dtc.git";
|
||||||
|
rev = "refs/tags/v${version}";
|
||||||
|
sha256 = "10y5pbkcj5gkijcgnlvrh6q2prpnvsgihb9asz3zfp66mcjwzsy3";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
# Newer dtc versions are incompatible with U-Boot 2017.09
|
||||||
|
inherit (callPackage ../misc/uboot {
|
||||||
|
inherit dtc;
|
||||||
|
buildPackages = buildPackages // {
|
||||||
|
python2 = buildPackages.python2.override (old: {
|
||||||
|
packageOverrides = pySelf: pySuper: {
|
||||||
|
libfdt = pySelf.toPythonModule dtc;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}) buildUBoot;
|
||||||
|
in {
|
||||||
|
ubootRock64 = callPackage ../misc/uboot/rock64.nix {
|
||||||
|
inherit buildUBoot;
|
||||||
|
};
|
||||||
|
|
||||||
|
ubootRockPro64 = callPackage ../misc/uboot/rockpro64.nix {
|
||||||
|
inherit buildUBoot;
|
||||||
|
};
|
||||||
|
}) ubootRock64 ubootRockPro64;
|
||||||
|
|
||||||
uclibc = callPackage ../os-specific/linux/uclibc { };
|
uclibc = callPackage ../os-specific/linux/uclibc { };
|
||||||
|
|
||||||
@ -19128,6 +19157,8 @@ in
|
|||||||
|
|
||||||
rkt = callPackage ../applications/virtualization/rkt { };
|
rkt = callPackage ../applications/virtualization/rkt { };
|
||||||
|
|
||||||
|
rkdeveloptool = callPackage ../misc/rkdeveloptool { };
|
||||||
|
|
||||||
rofi-unwrapped = callPackage ../applications/misc/rofi { };
|
rofi-unwrapped = callPackage ../applications/misc/rofi { };
|
||||||
rofi = callPackage ../applications/misc/rofi/wrapper.nix { };
|
rofi = callPackage ../applications/misc/rofi/wrapper.nix { };
|
||||||
|
|
||||||
|
@ -1559,6 +1559,10 @@ in {
|
|||||||
|
|
||||||
libais = callPackage ../development/python-modules/libais { };
|
libais = callPackage ../development/python-modules/libais { };
|
||||||
|
|
||||||
|
libfdt = disabledIf isPy3k (toPythonModule (pkgs.dtc.override {
|
||||||
|
python2 = python;
|
||||||
|
}));
|
||||||
|
|
||||||
libtmux = callPackage ../development/python-modules/libtmux { };
|
libtmux = callPackage ../development/python-modules/libtmux { };
|
||||||
|
|
||||||
libusb1 = callPackage ../development/python-modules/libusb1 { inherit (pkgs) libusb1; };
|
libusb1 = callPackage ../development/python-modules/libusb1 { inherit (pkgs) libusb1; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user