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}";
|
|
|
|
version = "2015.04";
|
|
|
|
|
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";
|
|
|
|
sha256 = "0q2x1wh1f6rjh9rmcnkf28dxcvp9hkhi4vzspqkzamb6b3gp06ha";
|
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
|
|
|
}
|