2010-03-02 02:22:48 +03:00
|
|
|
{stdenv, fetchurl, unzip}:
|
2009-11-08 03:32:12 +03:00
|
|
|
|
2010-03-02 02:22:48 +03:00
|
|
|
let
|
|
|
|
platform = stdenv.platform;
|
|
|
|
configureFun = ubootConfig :
|
2010-03-01 18:21:24 +03:00
|
|
|
''
|
|
|
|
make mrproper
|
2010-03-02 02:22:48 +03:00
|
|
|
make ${ubootConfig} NBOOT=1 LE=1
|
2010-03-01 18:21:24 +03:00
|
|
|
'';
|
|
|
|
|
2010-03-02 02:22:48 +03:00
|
|
|
buildFun = kernelArch :
|
2010-03-01 18:21:24 +03:00
|
|
|
''
|
|
|
|
unset src
|
|
|
|
if test -z "$crossConfig"; then
|
|
|
|
make clean all
|
|
|
|
else
|
2010-03-02 02:22:48 +03:00
|
|
|
make clean all ARCH=${kernelArch} CROSS_COMPILE=$crossConfig-
|
2010-03-01 18:21:24 +03:00
|
|
|
fi
|
|
|
|
'';
|
2010-03-02 02:22:48 +03:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2013-01-27 18:27:54 +04:00
|
|
|
name = "uboot-2012.07";
|
2010-03-02 02:22:48 +03:00
|
|
|
|
|
|
|
src = fetchurl {
|
2013-01-27 18:27:54 +04:00
|
|
|
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-2012.07.tar.bz2";
|
|
|
|
sha256 = "15nli6h9a127ldizsck3g4ysy5j4m910wawspgpadz4vjyk213p0";
|
2010-03-02 02:22:48 +03:00
|
|
|
};
|
2009-11-08 03:32:12 +03:00
|
|
|
|
2012-12-28 22:20:09 +04:00
|
|
|
nativeBuildInputs = [ unzip ];
|
2009-11-08 03:32:12 +03:00
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
2012-01-19 00:16:00 +04:00
|
|
|
mkdir -p $out
|
2010-02-17 23:53:01 +03:00
|
|
|
cp u-boot.bin $out
|
2009-11-08 03:32:12 +03:00
|
|
|
cp u-boot u-boot.map $out
|
|
|
|
|
2012-01-19 00:16:00 +04:00
|
|
|
mkdir -p $out/bin
|
2009-11-08 03:32:12 +03:00
|
|
|
cp tools/{envcrc,mkimage} $out/bin
|
|
|
|
'';
|
2010-03-02 02:22:48 +03:00
|
|
|
|
2013-01-27 18:27:54 +04:00
|
|
|
# They have 'errno.h' included by a "-idirafter". As the gcc
|
|
|
|
# wrappers add the glibc include as "-idirafter", the only way
|
|
|
|
# we can make the glibc take priority is to -include errno.h.
|
|
|
|
postPatch = if stdenv ? glibc && stdenv.glibc != null then ''
|
|
|
|
sed -i 's,$(HOSTCPPFLAGS),-include ${stdenv.glibc}/include/errno.h $(HOSTCPPFLAGS),' config.mk
|
|
|
|
'' else "";
|
|
|
|
|
|
|
|
patches = [ ./sheevaplug-sdio.patch ./sheevaplug-config.patch ];
|
|
|
|
|
2010-03-02 02:22:48 +03:00
|
|
|
configurePhase =
|
|
|
|
assert platform ? uboot && platform.uboot != null;
|
|
|
|
assert (platform ? ubootConfig);
|
|
|
|
configureFun platform.ubootConfig;
|
|
|
|
|
|
|
|
buildPhase = assert (platform ? kernelArch);
|
|
|
|
buildFun platform.kernelArch;
|
|
|
|
|
|
|
|
crossAttrs = let
|
|
|
|
cp = stdenv.cross.platform;
|
|
|
|
in
|
|
|
|
assert cp ? uboot && cp.uboot != null;
|
|
|
|
{
|
|
|
|
configurePhase = assert (cp ? ubootConfig);
|
|
|
|
configureFun cp.ubootConfig;
|
|
|
|
|
|
|
|
buildPhase = assert (cp ? kernelArch);
|
|
|
|
buildFun cp.kernelArch;
|
|
|
|
};
|
2009-11-08 03:32:12 +03:00
|
|
|
}
|