2015-06-07 20:12:18 +01:00
|
|
|
{ stdenv, fetchurl, bc, dtc
|
|
|
|
, toolsOnly ? false
|
|
|
|
, defconfig ? "allnoconfig"
|
|
|
|
, targetPlatforms
|
|
|
|
, filesToInstall
|
|
|
|
}:
|
2009-11-08 00:32:12 +00:00
|
|
|
|
2010-03-01 23:22:48 +00:00
|
|
|
let
|
|
|
|
platform = stdenv.platform;
|
2015-06-07 20:12:18 +01: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 15:21:24 +00:00
|
|
|
''
|
|
|
|
if test -z "$crossConfig"; then
|
2015-06-07 20:12:18 +01:00
|
|
|
make ${makeTarget}
|
2010-03-01 15:21:24 +00:00
|
|
|
else
|
2015-06-07 20:12:18 +01:00
|
|
|
make ${makeTarget} ARCH=${kernelArch} CROSS_COMPILE=$crossConfig-
|
2010-03-01 15:21:24 +00:00
|
|
|
fi
|
|
|
|
'';
|
2010-03-01 23:22:48 +00:00
|
|
|
in
|
|
|
|
|
2015-06-07 20:12:18 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "uboot-${defconfig}-${version}";
|
2015-10-25 01:09:24 +01:00
|
|
|
version = "2015.10";
|
2015-06-07 20:12:18 +01:00
|
|
|
|
2010-03-01 23:22:48 +00:00
|
|
|
src = fetchurl {
|
2015-06-07 20:12:18 +01:00
|
|
|
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
|
2015-10-25 01:09:24 +01:00
|
|
|
sha256 = "0m8r08izci0lzzjn5c5g5manp2rc7yc5swww0lxr7bamjigqvimx";
|
2010-03-01 23:22:48 +00:00
|
|
|
};
|
2009-11-08 00:32:12 +00:00
|
|
|
|
2015-06-19 04:13:34 +01:00
|
|
|
patches = [ ./vexpress-Use-config_distro_bootcmd.patch ];
|
|
|
|
|
2015-06-07 20:12:18 +01:00
|
|
|
nativeBuildInputs = [ bc dtc ];
|
2009-11-08 00:32:12 +00:00
|
|
|
|
2015-06-07 20:12:18 +01:00
|
|
|
configurePhase = ''
|
|
|
|
make ${defconfig}
|
2009-11-08 00:32:12 +00:00
|
|
|
'';
|
2010-03-01 23:22:48 +00:00
|
|
|
|
|
|
|
buildPhase = assert (platform ? kernelArch);
|
|
|
|
buildFun platform.kernelArch;
|
|
|
|
|
2015-06-07 20:12:18 +01:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p ${installDir}
|
|
|
|
cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = !toolsOnly;
|
|
|
|
|
|
|
|
crossAttrs = {
|
|
|
|
buildPhase = assert (crossPlatform ? kernelArch);
|
|
|
|
buildFun crossPlatform.kernelArch;
|
|
|
|
};
|
2010-03-01 23:22:48 +00:00
|
|
|
|
2015-06-07 20:12:18 +01: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 00:32:12 +00:00
|
|
|
}
|