U-Boot: refactor to allow easier extendability
[dezgeg: minor stylistic tweaks, export buildUBoot for out-of-tree users]
This commit is contained in:
parent
421989fb5a
commit
95ed5766d6
@ -1,62 +1,89 @@
|
|||||||
{ stdenv, fetchurl, bc, dtc
|
{ stdenv, fetchurl, bc, dtc }:
|
||||||
, toolsOnly ? false
|
|
||||||
, defconfig ? "allnoconfig"
|
|
||||||
, targetPlatforms
|
|
||||||
, filesToInstall
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
platform = stdenv.platform;
|
buildUBoot = { targetPlatforms
|
||||||
crossPlatform = stdenv.cross.platform;
|
, filesToInstall
|
||||||
makeTarget = if toolsOnly then "tools NO_SDL=1" else "all";
|
, installDir ? "$out"
|
||||||
installDir = if toolsOnly then "$out/bin" else "$out";
|
, defconfig
|
||||||
buildFun = kernelArch:
|
, extraMeta ? {}
|
||||||
''
|
, ... } @ args:
|
||||||
if test -z "$crossConfig"; then
|
stdenv.mkDerivation (rec {
|
||||||
make ${makeTarget}
|
|
||||||
else
|
name = "uboot-${defconfig}-${version}";
|
||||||
make ${makeTarget} ARCH=${kernelArch} CROSS_COMPILE=$crossConfig-
|
version = "2015.10";
|
||||||
fi
|
|
||||||
|
nativeBuildInputs = [ bc dtc ];
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
|
||||||
|
sha256 = "0m8r08izci0lzzjn5c5g5manp2rc7yc5swww0lxr7bamjigqvimx";
|
||||||
|
};
|
||||||
|
|
||||||
|
configurePhase = ''
|
||||||
|
make ${defconfig}
|
||||||
'';
|
'';
|
||||||
in
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
installPhase = ''
|
||||||
name = "uboot-${defconfig}-${version}";
|
runHook preInstall
|
||||||
version = "2015.10";
|
|
||||||
|
|
||||||
src = fetchurl {
|
mkdir -p ${installDir}
|
||||||
url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
|
cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
|
||||||
sha256 = "0m8r08izci0lzzjn5c5g5manp2rc7yc5swww0lxr7bamjigqvimx";
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
dontStrip = true;
|
||||||
|
|
||||||
|
crossAttrs = {
|
||||||
|
makeFlags = [
|
||||||
|
"ARCH=${stdenv.cross.platform.kernelArch}"
|
||||||
|
"CROSS_COMPILE=${stdenv.cross.config}-"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
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;
|
||||||
|
} // extraMeta;
|
||||||
|
} // args);
|
||||||
|
|
||||||
|
in rec {
|
||||||
|
inherit buildUBoot;
|
||||||
|
|
||||||
|
ubootTools = buildUBoot rec {
|
||||||
|
installDir = "$out/bin";
|
||||||
|
buildFlags = "tools NO_SDL=1";
|
||||||
|
dontStrip = false;
|
||||||
|
targetPlatforms = stdenv.lib.platforms.linux;
|
||||||
|
filesToInstall = ["tools/dumpimage" "tools/mkenvimage" "tools/mkimage"];
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [ ./vexpress-Use-config_distro_bootcmd.patch ];
|
ubootJetsonTK1 = buildUBoot rec {
|
||||||
|
defconfig = "jetson-tk1_defconfig";
|
||||||
nativeBuildInputs = [ bc dtc ];
|
targetPlatforms = ["armv7l-linux"];
|
||||||
|
filesToInstall = ["u-boot" "u-boot.dtb" "u-boot-dtb-tegra.bin" "u-boot-nodtb-tegra.bin"];
|
||||||
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; {
|
ubootPcduino3Nano = buildUBoot rec {
|
||||||
homepage = "http://www.denx.de/wiki/U-Boot/";
|
defconfig = "Linksprite_pcDuino3_Nano_defconfig";
|
||||||
description = "Boot loader for embedded systems";
|
targetPlatforms = ["armv7l-linux"];
|
||||||
license = licenses.gpl2;
|
filesToInstall = ["u-boot-sunxi-with-spl.bin"];
|
||||||
maintainers = [ maintainers.dezgeg ];
|
};
|
||||||
platforms = targetPlatforms;
|
|
||||||
|
ubootRaspberryPi = buildUBoot rec {
|
||||||
|
defconfig = "rpi_defconfig";
|
||||||
|
targetPlatforms = ["armv6l-linux"];
|
||||||
|
filesToInstall = ["u-boot.bin"];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Intended only for QEMU's vexpress-a9 emulation target!
|
||||||
|
ubootVersatileExpressCA9 = buildUBoot rec {
|
||||||
|
defconfig = "vexpress_ca9x4_defconfig";
|
||||||
|
targetPlatforms = ["armv7l-linux"];
|
||||||
|
filesToInstall = ["u-boot"];
|
||||||
|
patches = [ ./vexpress-Use-config_distro_bootcmd.patch ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -10574,36 +10574,13 @@ let
|
|||||||
ubootChooser = name: ubootTools;
|
ubootChooser = name: ubootTools;
|
||||||
|
|
||||||
# Upstream U-Boots:
|
# Upstream U-Boots:
|
||||||
ubootTools = callPackage ../misc/uboot {
|
inherit (callPackage ../misc/uboot {})
|
||||||
toolsOnly = true;
|
buildUBoot
|
||||||
targetPlatforms = lib.platforms.linux;
|
ubootJetsonTK1
|
||||||
filesToInstall = ["tools/dumpimage" "tools/mkenvimage" "tools/mkimage"];
|
ubootPcduino3Nano
|
||||||
};
|
ubootRaspberryPi
|
||||||
|
ubootVersatileExpressCA9
|
||||||
ubootJetsonTK1 = callPackage ../misc/uboot {
|
;
|
||||||
defconfig = "jetson-tk1_defconfig";
|
|
||||||
targetPlatforms = ["armv7l-linux"];
|
|
||||||
filesToInstall = ["u-boot" "u-boot.dtb" "u-boot-dtb-tegra.bin" "u-boot-nodtb-tegra.bin"];
|
|
||||||
};
|
|
||||||
|
|
||||||
ubootPcduino3Nano = callPackage ../misc/uboot {
|
|
||||||
defconfig = "Linksprite_pcDuino3_Nano_defconfig";
|
|
||||||
targetPlatforms = ["armv7l-linux"];
|
|
||||||
filesToInstall = ["u-boot-sunxi-with-spl.bin"];
|
|
||||||
};
|
|
||||||
|
|
||||||
ubootRaspberryPi = callPackage ../misc/uboot {
|
|
||||||
defconfig = "rpi_defconfig";
|
|
||||||
targetPlatforms = ["armv6l-linux"];
|
|
||||||
filesToInstall = ["u-boot.bin"];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Intended only for QEMU's vexpress-a9 emulation target!
|
|
||||||
ubootVersatileExpressCA9 = callPackage ../misc/uboot {
|
|
||||||
defconfig = "vexpress_ca9x4_defconfig";
|
|
||||||
targetPlatforms = ["armv7l-linux"];
|
|
||||||
filesToInstall = ["u-boot"];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Non-upstream U-Boots:
|
# Non-upstream U-Boots:
|
||||||
ubootSheevaplug = callPackage ../misc/uboot/sheevaplug.nix { };
|
ubootSheevaplug = callPackage ../misc/uboot/sheevaplug.nix { };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user