2015-06-07 21:12:18 +02:00
|
|
|
{ stdenv, fetchurl, bc, dtc
|
|
|
|
, toolsOnly ? false
|
|
|
|
, defconfig ? "allnoconfig"
|
|
|
|
, targetPlatforms
|
|
|
|
, filesToInstall
|
|
|
|
}:
|
2009-11-08 01:32:12 +01:00
|
|
|
|
2010-03-02 00:22:48 +01:00
|
|
|
let
|
|
|
|
platform = stdenv.platform;
|
2015-06-07 21:12:18 +02:00
|
|
|
crossPlatform = stdenv.cross.platform;
|
|
|
|
makeTarget = if toolsOnly then "tools NO_SDL=1" else "all";
|
|
|
|
installDir = if toolsOnly then "$out/bin" else "$out";
|
|
|
|
buildFun = kernelArch:
|
2010-03-01 16:21:24 +01:00
|
|
|
''
|
|
|
|
if test -z "$crossConfig"; then
|
2015-06-07 21:12:18 +02:00
|
|
|
make ${makeTarget}
|
2010-03-01 16:21:24 +01:00
|
|
|
else
|
2015-06-07 21:12:18 +02:00
|
|
|
make ${makeTarget} ARCH=${kernelArch} CROSS_COMPILE=$crossConfig-
|
2010-03-01 16:21:24 +01:00
|
|
|
fi
|
|
|
|
'';
|
2010-03-02 00:22:48 +01:00
|
|
|
in
|
|
|
|
|
2015-06-07 21:12:18 +02:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "uboot-${defconfig}-${version}";
|
2015-07-19 02:50:32 +02:00
|
|
|
version = "2015.07";
|
2015-06-07 21:12:18 +02:00
|
|
|
|
2010-03-02 00:22:48 +01:00
|
|
|
src = fetchurl {
|
2015-06-07 21:12:18 +02:00
|
|
|
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
|
2015-07-19 02:50:32 +02:00
|
|
|
sha256 = "1nclmyii5a1igvgjc4kxvi1fk2y82hp2iy4iywp34b3zf6ywjj0b";
|
2010-03-02 00:22:48 +01:00
|
|
|
};
|
2009-11-08 01:32:12 +01:00
|
|
|
|
2015-06-19 05:13:34 +02:00
|
|
|
patches = [ ./vexpress-Use-config_distro_bootcmd.patch ];
|
|
|
|
|
2015-06-07 21:12:18 +02:00
|
|
|
nativeBuildInputs = [ bc dtc ];
|
2009-11-08 01:32:12 +01:00
|
|
|
|
2015-06-07 21:12:18 +02:00
|
|
|
configurePhase = ''
|
|
|
|
make ${defconfig}
|
2009-11-08 01:32:12 +01:00
|
|
|
'';
|
2010-03-02 00:22:48 +01:00
|
|
|
|
|
|
|
buildPhase = assert (platform ? kernelArch);
|
|
|
|
buildFun platform.kernelArch;
|
|
|
|
|
2015-06-07 21:12:18 +02:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p ${installDir}
|
|
|
|
cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = !toolsOnly;
|
|
|
|
|
|
|
|
crossAttrs = {
|
|
|
|
buildPhase = assert (crossPlatform ? kernelArch);
|
|
|
|
buildFun crossPlatform.kernelArch;
|
|
|
|
};
|
2010-03-02 00:22:48 +01:00
|
|
|
|
2015-06-07 21:12:18 +02:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "http://www.denx.de/wiki/U-Boot/";
|
|
|
|
description = "Boot loader for embedded systems";
|
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = [ maintainers.dezgeg ];
|
|
|
|
platforms = targetPlatforms;
|
|
|
|
};
|
2009-11-08 01:32:12 +01:00
|
|
|
}
|