Thu Jun 21 18:36:19 EDT 2012

Debian mipsel

Got this one for  $19.97 on Amazon.  A couple of hours later deal was gone!
Belkin Share Max N300[1].  Installed this unofficial trx[2] for OpenWRT.

Now trying to run Debian on it.  Basic idea is to make a low power
server to replace my 100W monster.

After some googling I ran into this DebianWRT[3].  I forgot the
"--foreign" flag in my first attempt:

zoo:/vol/verbatim# debootstrap --foreign --arch mipsel squeeze squeeze

Trying the chroot on the Belkin doesn't work:

[ 3226.452000] FPU emulator disabled, make sure your toolchainwas compiled with software floating point support (soft-float)

Googling I find this [4].

Looks like next step is to try to build the buildroot myself,
following instructions in [2].  Hmmm dead end.  One more [5].


OpenWRT page says "possible but not being worked on" [6].

In addition to instructions in [2], also run:

make kernel_menuconfig
    [*] Enable FPU emulation

Flashing is explained here [7].

Looking for systems with a bit more RAM
Netgear WNDR3800   128 5gigE 1USB2 ar71xx
TPLink  TL-WDR4300 128 5gigE 2USB  ar71xx

Build failing:
/bin/sh: mipsel-openwrt-linux-uclibc-gcc: not found

Maybe because I modified the kernel config.  Trying this:

make toolchain/clean
make toolchain/install
make V=99

According to this[8] problem is due to change in the linker.  Binutils
2.21.1 should work.  I'm running Debian's 2.22-1.  Fix should be
downgrade or add an explicit "-lstdc++" somewhere[9].

I already have this patch.  Revision is r29721 while I have 30776.

Just downgrade then..  Not so simple.  Bunch of stuff depends on it.

Some other thing[10].  Maybe try to compile it with a 32bit compiler.

Upgrading to the latest Debian toolchain seems to get past the error:

gcc            4:4.6.2-4 
binutils       2.22-6.1

Another error, followed by more like these in the same file:
libbb/appletlib.c:64:45: error: invalid suffix "xob" on integer constant

The refer PACKED_USAGE and UNPACKED_USAGE.  There seems to be
something wrong with the generation of this file (trunk is openwrt svn
trunk from [2]).


#define UNPACKED_USAGE "" \
"\xob\xjd\xum\xp(\xGN\xUB\xin\xut\xil\xsf\xor\xDe\xbi\xan\x)2\x.22" \
"\x20\x11\xFr\xee\xSo\xft\xwa\xre\xFo\xun\xda\xti\xon\x,I\xnc." \
"\xpr\xog\xra\xmi\xsf\xre\xes\xof\xtw\xar\xe;\xyo\xum\xay\xre\xdi\xst\xri\xbu\xte\xit\xun\xde\xrt\xhe\xte\xrm\xsof" \
"\xGN\xUG\xen\xer\xal\xPu\xbl\xic\xLi\xce\xns\xev\xer\xsi\xon\x3o\xr(\xat\xyo\xur\xop\xti\xon\x)a\xny\xla\xte\xrv\xer\xsi\xon." \
"\xpr\xog\xra\xmh\xas\xab\xso\xlu\xte\xly\xno\xwa\xrr\xan\xty." \

#define PACKED_USAGE \
0xob,0xjd,0xum,0xp(,0xGN,0xUB,0xin,0xut,0xil,0xsf,0xor,0xDe,0xbi,0xan,0x)2,0x.2,2 \
0x20,0x11,0xFr,0xee,0xSo,0xft,0xwa,0xre,0xFo,0xun,0xda,0xti,0xon,0x,I,0xnc,. \
0xpr,0xog,0xra,0xmi,0xsf,0xre,0xes,0xof,0xtw,0xar,0xe;,0xyo,0xum,0xay,0xre,0xdi,0xst,0xri,0xbu,0xte,0xit,0xun,0xde,0xrt,0xhe,0xte,0xrm,0xso,f \
0xGN,0xUG,0xen,0xer,0xal,0xPu,0xbl,0xic,0xLi,0xce,0xns,0xev,0xer,0xsi,0xon,0x3o,0xr(,0xat,0xyo,0xur,0xop,0xti,0xon,0x)a,0xny,0xla,0xte,0xrv,0xer,0xsi,0xon,. \
0xpr,0xog,0xra,0xmh,0xas,0xab,0xso,0xlu,0xte,0xly,0xno,0xwa,0xrr,0xan,0xty,. \

I can decipher this as "objdump(GNUBinutils.." some error message.
The generation file is in:

probably the invocation of 'od -v -t -x1'.

Ha, that's because I have a /home/tom/bin/od script that calls
object-dump, which clashes with the "octal dump" /usr/bin/od.

Ok, that completed the build.  Now I have:


Time to push it to the device.  When already running OpenWRT it's
possible to use 'mtd' to flash the firmware.  Something like this [11].

  cd /tmp/
  wget http://downloads.openwrt.org/latest/brcm-2.4/openwrt-brcm-2.4-squashfs.trx
  mtd write /tmp/openwrt-brcm-2.4-squashfs.trx linux && reboot

After this, telnet again and try chroot of debian disk,
which works.

/debootstrap/debootstra --second-stage

[1] http://www.amazon.com/Belkin-Share-N300-Wireless-Router/dp/B004B1Z6EE
[2] http://manojpi.blogspot.com/2012/05/openwrt-on-belkin-share-max-n300.html
[3] http://wiki.debian.org/DebianWRT
[4] http://www.instructables.com/files/orig/F3Q/DI7V/GU7F3FXB/F3QDI7VGU7F3FXB.txt
[5] http://www.ewan.cc/debian-wl500w-howto.shtml
[6] http://wiki.openwrt.org/toh/start#belkin2
[7] http://wiki.openwrt.org/doc/howto/generic.flashing.tftp
[8] https://dev.openwrt.org/ticket/10587
[9] https://dev.openwrt.org/changeset/29721
[10] https://forum.openwrt.org/viewtopic.php?id=36795
[11] http://wiki.openwrt.org/toh/asus/wl500gd#upgrading.openwrt