1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 06:01:15 +00:00
nixpkgs/pkgs/misc/uboot/default.nix
Tuomas Tynkkynen 0ec0790348 U-Boot: Patch Versatile Express to use config_distro_bootcmd.h
With this patch in place, ARMv7 NixOS can be booted in QEMU:

qemu-system-arm -kernel u-boot -M vexpress-a9 -serial stdio -sd nixos-sd-image-armv7l-linux.img -m 1024

...with all the features that boot.loader.generic-extlinux-compatible
supports, like the boot generation menu and seamless kernel upgrades
in the VM.
2015-06-30 11:10:18 +03:00

63 lines
1.5 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";
};
patches = [ ./vexpress-Use-config_distro_bootcmd.patch ];
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;
};
}