3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/misc/uboot/default.nix
Tuomas Tynkkynen d013de6d32 U-Boot: Update to 2015.04 and major refactor
Instead of selecting the defconfig based on stdenv.platform.uboot,
provide different ubootFoo packages. Otherwise we couldn't easily build
U-Boots for different platforms than what we are currently running on.

All users of the ubootChooser function appear to be using only CLI tools
like mkimage, whose behaviour is not affected by the defconfig (their
build outputs are bitwise-identical). So add a separate package for the
CLI tools.

Of the removed patches, some version of sheevaplug-sdio.patch has
apparently been applied upstream (with at least mv_sdio.c renamed to
mvebu_mmc.c). sheevaplug-config.patch needs rebasing & re-testing on
real hardware.

Tested boards and input/output methods that upstream supports:
 - Raspberry Pi:
    - HDMI works, USB keyboard not yet supported
    - Serial via the 26-pin connector (3.3V)
 - pcDuino3 Nano:
    - HDMI + USB keyboard (only if attached to a hub)
    - Serial via the 3-pin connector (3.3V)
 - Jetson TK1: RS-232 serial port only
 - Versatile Express CA9 (for QEMU only): Serial via '-serial stdio'
2015-06-30 10:49:56 +03:00

61 lines
1.4 KiB
Nix

{ stdenv, fetchurl, bc, dtc
, toolsOnly ? false
, defconfig ? "allnoconfig"
, targetPlatforms
, filesToInstall
}:
let
platform = stdenv.platform;
crossPlatform = stdenv.cross.platform;
makeTarget = if toolsOnly then "tools NO_SDL=1" else "all";
installDir = if toolsOnly then "$out/bin" else "$out";
buildFun = kernelArch:
''
if test -z "$crossConfig"; then
make ${makeTarget}
else
make ${makeTarget} ARCH=${kernelArch} CROSS_COMPILE=$crossConfig-
fi
'';
in
stdenv.mkDerivation rec {
name = "uboot-${defconfig}-${version}";
version = "2015.04";
src = fetchurl {
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
sha256 = "0q2x1wh1f6rjh9rmcnkf28dxcvp9hkhi4vzspqkzamb6b3gp06ha";
};
nativeBuildInputs = [ bc dtc ];
configurePhase = ''
make ${defconfig}
'';
buildPhase = assert (platform ? kernelArch);
buildFun platform.kernelArch;
installPhase = ''
mkdir -p ${installDir}
cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
'';
dontStrip = !toolsOnly;
crossAttrs = {
buildPhase = assert (crossPlatform ? kernelArch);
buildFun crossPlatform.kernelArch;
};
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;
};
}