summary refs log tree commit diff
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-07-29 23:26:07 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-07-29 23:26:07 +0000
commitb044e649891bbb1f2cb19dfd598da0bd50438a2b (patch)
tree4c4788e831b8311b092553479ded8e0677feedd8
parent537ad15e86fcf437432bb98c99bd942f0406aebc (diff)
downloadnixpkgs-b044e649891bbb1f2cb19dfd598da0bd50438a2b.tar
nixpkgs-b044e649891bbb1f2cb19dfd598da0bd50438a2b.tar.gz
nixpkgs-b044e649891bbb1f2cb19dfd598da0bd50438a2b.tar.bz2
nixpkgs-b044e649891bbb1f2cb19dfd598da0bd50438a2b.tar.lz
nixpkgs-b044e649891bbb1f2cb19dfd598da0bd50438a2b.tar.xz
nixpkgs-b044e649891bbb1f2cb19dfd598da0bd50438a2b.tar.zst
nixpkgs-b044e649891bbb1f2cb19dfd598da0bd50438a2b.zip
Making the xburst-tools for the Ben Nanonote build the firmware they need to
communicate with it. This involves making a cross-compiler for mipsel.

svn path=/nixpkgs/trunk/; revision=22818
-rw-r--r--pkgs/tools/misc/xburst-tools/default.nix20
-rw-r--r--pkgs/top-level/all-packages.nix28
2 files changed, 44 insertions, 4 deletions
diff --git a/pkgs/tools/misc/xburst-tools/default.nix b/pkgs/tools/misc/xburst-tools/default.nix
index 4f4de602c6c..2408a1cd35c 100644
--- a/pkgs/tools/misc/xburst-tools/default.nix
+++ b/pkgs/tools/misc/xburst-tools/default.nix
@@ -1,4 +1,5 @@
-{stdenv, fetchgit, libusb, autoconf, automake, confuse}:
+{stdenv, fetchgit, libusb, autoconf, automake, confuse
+, gccCross ? null}:
 
 let
   version = "2010-07-29";
@@ -6,19 +7,30 @@ in
 stdenv.mkDerivation {
   name = "xburst-tools-${version}";
 
-  patches = [ ./gcc-4.4.patch ];
-
   src = fetchgit {
     url = git://projects.qi-hardware.com/xburst-tools.git;
     rev = "00be212db22643ad602eaf60b30eb943f119e78d";
     sha256 = "66ea1a81b71bad599d76691f07a986f9bb2ccecf397e8486b661d8baace3460e";
   };
 
+  prePatch = ''
+    find . -name Makefile* -exec sed -i \
+      -e s/mipsel-openwrt-linux-/mipsel-unknown-linux-/ {} \;
+  '';
+
+  patches = [ ./gcc-4.4.patch ];
+
   preConfigure = ''
     sh autogen.sh
   '';
 
-  buildInputs = [ libusb autoconf automake confuse ];
+  configureFlags = if gccCross != null then "--enable-firmware" else "";
+
+  # Not to strip cross build binaries (this is for the gcc-cross-wrapper)
+  dontCrossStrip = true;
+
+  buildInputs = [ libusb autoconf automake confuse ] ++
+    stdenv.lib.optional (gccCross != null) gccCross;
 
   meta = {
     description = "Qi tools to access the Ben Nanonote USB_BOOT mode";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 790724085a0..339278300e8 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1948,6 +1948,34 @@ let
 
   xbursttools = import ../tools/misc/xburst-tools {
     inherit stdenv fetchgit autoconf automake libusb confuse;
+    # It needs a cross compiler for mipsel to build the firmware it will
+    # load into the Ben Nanonote
+    gccCross = let
+        pkgsCross = (import ./all-packages.nix) {
+          inherit system;
+          inherit bootStdenv noSysDirs gccWithCC gccWithProfiling config;
+          # Ben Nanonote system
+          crossSystem = {
+            config = "mipsel-unknown-linux";  
+            bigEndian = true;
+            arch = "mips";
+            float = "soft";
+            withTLS = true;
+            libc = "uclibc";
+            platform = {
+              name = "ben_nanonote";
+              kernelMajor = "2.6";
+              # It's not a bcm47xx processor, but for the headers this should work
+              kernelHeadersBaseConfig = "bcm47xx_defconfig";
+              kernelArch = "mips";
+            };
+            gcc = {
+              arch = "mips32";
+            };
+          };
+        };
+      in 
+        pkgsCross.gccCrossStageStatic;
   };
 
   xclip = import ../tools/misc/xclip {