blob: 5928406eb548dc5bff1cb96695ec068b997c12ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
{stdenv, fetchurl, unzip}:
let
platform = stdenv.platform;
configureFun = ubootConfig :
''
make mrproper
make ${ubootConfig} NBOOT=1 LE=1
'';
buildFun = kernelArch :
''
unset src
if test -z "$crossConfig"; then
make clean all
else
make clean all ARCH=${kernelArch} CROSS_COMPILE=$crossConfig-
fi
'';
in
stdenv.mkDerivation {
name = "uboot-2012.07";
src = fetchurl {
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-2012.07.tar.bz2";
sha256 = "15nli6h9a127ldizsck3g4ysy5j4m910wawspgpadz4vjyk213p0";
};
nativeBuildInputs = [ unzip ];
dontStrip = true;
installPhase = ''
mkdir -p $out
cp u-boot.bin $out
cp u-boot u-boot.map $out
mkdir -p $out/bin
cp tools/{envcrc,mkimage} $out/bin
'';
# 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 ];
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;
};
}
|