MIPS Builds

cetinsert edited this page Feb 17, 2013 · 29 revisions

OpenWrt An attempt is underway to port PortFusion to the MIPS CPU architecture. It is hoped to enable running PortFusion on OpenWrt routers and other embedded devices.

First target device is TL-WR1043ND, which is a big-endian MIPS architecture as shown on https://dev.openwrt.org/wiki/platforms.

Both big and little endian binaries are being built.

To check endiannes of your Linux:

$ echo -n I | hexdump -o | awk '{ print substr($2,6,1); exit}'
# 0 = big-endian
# 1 = little-endian

Build 1.2.1


root@debian:~# cat /proc/cpuinfo 
system type     : MIPS Malta
processor       : 0
cpu model       : MIPS 24Kc V0.0
BogoMIPS        : 706.56
wait instruction    : yes
microsecond timers  : yes
tlb_entries     : 16
extra interrupt vector  : yes
hardware watchpoint : yes, count: 1, address/irw mask: [0x0ff8]
ASEs implemented    : mips16
shadow register sets    : 1
kscratch registers  : 0
core            : 0
VCED exceptions     : not available
VCEI exceptions     : not available

root@debian:~# uname -a
Linux debian 3.2.0-4-4kc-malta #1 Debian 3.2.32-1 mips GNU/Linux

root@debian:~# ghc -V
The Glorious Glasgow Haskell Compilation System, version 7.4.1


cabal update
cabal install splice     -f "-portable"
cabal install PortFusion -f " threaded"
root@debian:~# file ~/.cabal/bin/PortFusion
/root/.cabal/bin/PortFusion: ELF 32-bit MSB executable, MIPS, MIPS-II version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0x9a53af63be9047466acadde61e9be012fd5a57c5, with unknown capability 0x41000000 = 0xf676e75, with unknown capability 0x10000 = 0x70401, stripped
root@debian:~# ~/.cabal/bin/PortFusion

CORSIS PortFusion    ( ]-[ayabusa 1.2.1 )
(c) 2012 Cetin Sert. All rights reserved.

Linux - MIPS [Thu Jan 10 02:03:55 2013]

  See usage: http://fusion.corsis.eu

Notes with QEMU

  • cabal update seems to hang but eventually finishes
  • no Haskell librararies are needed except what ships with haskell-platform
  • compilation takes around 30.0 (minutes.seconds)
  • linking takes around 2.0 (minutes.seconds)
  • resulting binary is stripped, its size is 8 MB
  • static linking does not work; so libgmp.so.10 is needed on target devices:
  • static linking does not work; binares require (e)glibc and not work with uclibc