about summary refs log tree commit diff
path: root/pkgs/misc
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2016-02-15 16:10:37 +0200
committerTuomas Tynkkynen <tuomas.tynkkynen@iki.fi>2016-02-15 16:10:37 +0200
commiteb9a85a38909361c5444b72f6fd4e990cca51057 (patch)
treeebebf51f1e9c513f0c89c4745fcd64d85658d03c /pkgs/misc
parentb9db5a95743b03e10d9e5ad8ddf04db1acd695f2 (diff)
parent4cf9bf9eb00e85ab1b2d117b767aff81cb1c39b2 (diff)
downloadnixlib-eb9a85a38909361c5444b72f6fd4e990cca51057.tar
nixlib-eb9a85a38909361c5444b72f6fd4e990cca51057.tar.gz
nixlib-eb9a85a38909361c5444b72f6fd4e990cca51057.tar.bz2
nixlib-eb9a85a38909361c5444b72f6fd4e990cca51057.tar.lz
nixlib-eb9a85a38909361c5444b72f6fd4e990cca51057.tar.xz
nixlib-eb9a85a38909361c5444b72f6fd4e990cca51057.tar.zst
nixlib-eb9a85a38909361c5444b72f6fd4e990cca51057.zip
Merge pull request #12742 from dezgeg/pr-uboot-changes
U-Boot: 2015.10 -> 2016.01, refactor & support some new boards
Diffstat (limited to 'pkgs/misc')
-rw-r--r--pkgs/misc/uboot/default.nix131
1 files changed, 85 insertions, 46 deletions
diff --git a/pkgs/misc/uboot/default.nix b/pkgs/misc/uboot/default.nix
index 443841363bf3..4d1d3d73990e 100644
--- a/pkgs/misc/uboot/default.nix
+++ b/pkgs/misc/uboot/default.nix
@@ -1,62 +1,101 @@
-{ stdenv, fetchurl, bc, dtc
-, toolsOnly ? false
-, defconfig ? "allnoconfig"
-, targetPlatforms
-, filesToInstall
-}:
+{ stdenv, fetchurl, bc, dtc }:
 
 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
+  buildUBoot = { targetPlatforms
+            , filesToInstall
+            , installDir ? "$out"
+            , defconfig
+            , extraMeta ? {}
+            , ... } @ args:
+           stdenv.mkDerivation (rec {
+
+    name = "uboot-${defconfig}-${version}";
+    version = "2016.01";
+
+    nativeBuildInputs = [ bc dtc ];
+
+    src = fetchurl {
+      url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
+      sha256 = "1md5jpq5n9jh08s7sdkjrvg2q7kpzwa7yrpgl9581ncrjfx2yyg5";
+    };
+
+    configurePhase = ''
+      make ${defconfig}
     '';
-in
 
-stdenv.mkDerivation rec {
-  name = "uboot-${defconfig}-${version}";
-  version = "2015.10";
+    installPhase = ''
+      runHook preInstall
 
-  src = fetchurl {
-    url = "ftp://ftp.denx.de/pub/u-boot/u-boot-${version}.tar.bz2";
-    sha256 = "0m8r08izci0lzzjn5c5g5manp2rc7yc5swww0lxr7bamjigqvimx";
-  };
+      mkdir -p ${installDir}
+      cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
+
+      runHook postInstall
+    '';
 
-  patches = [ ./vexpress-Use-config_distro_bootcmd.patch ];
+    dontStrip = true;
 
-  nativeBuildInputs = [ bc dtc ];
+    crossAttrs = {
+      makeFlags = [
+        "ARCH=${stdenv.cross.platform.kernelArch}"
+        "CROSS_COMPILE=${stdenv.cross.config}-"
+      ];
+    };
 
-  configurePhase = ''
-    make ${defconfig}
-  '';
+    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);
 
-  buildPhase = assert (platform ? kernelArch);
-    buildFun platform.kernelArch;
+in rec {
+  inherit buildUBoot;
 
-  installPhase = ''
-    mkdir -p ${installDir}
-    cp ${stdenv.lib.concatStringsSep " " filesToInstall} ${installDir}
-  '';
+  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"];
+  };
 
-  dontStrip = !toolsOnly;
+  ubootBananaPi = buildUBoot rec {
+    defconfig = "Bananapi_defconfig";
+    targetPlatforms = ["armv7l-linux"];
+    filesToInstall = ["u-boot-sunxi-with-spl.bin"];
+  };
+
+  ubootJetsonTK1 = buildUBoot rec {
+    defconfig = "jetson-tk1_defconfig";
+    targetPlatforms = ["armv7l-linux"];
+    filesToInstall = ["u-boot" "u-boot.dtb" "u-boot-dtb-tegra.bin" "u-boot-nodtb-tegra.bin"];
+  };
+
+  ubootPcduino3Nano = buildUBoot rec {
+    defconfig = "Linksprite_pcDuino3_Nano_defconfig";
+    targetPlatforms = ["armv7l-linux"];
+    filesToInstall = ["u-boot-sunxi-with-spl.bin"];
+  };
+
+  ubootRaspberryPi = buildUBoot rec {
+    defconfig = "rpi_defconfig";
+    targetPlatforms = ["armv6l-linux"];
+    filesToInstall = ["u-boot.bin"];
+  };
 
-  crossAttrs = {
-    buildPhase = assert (crossPlatform ? kernelArch);
-      buildFun crossPlatform.kernelArch;
+  # 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 ];
   };
 
-  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;
+  ubootWandboard = buildUBoot rec {
+    defconfig = "wandboard_defconfig";
+    targetPlatforms = ["armv7l-linux"];
+    filesToInstall = ["u-boot.img" "SPL"];
   };
 }