OpenWrt Forum Archive

Topic: openwrt + WRT54G ---> general purpose MIPS debian woody

The content of this topic has been archived on 30 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

While openwrt and the buildroot environment is the greatest in all the firmware distro I have seen for WRT54G, I still find it a bit too hard sometimes to make a package. So I think, why not use debian which has a complete mipsel distro ?

So I first installed a NFS server on my Xbox(also debian woody), then install the NFS kernel modules on WRT54G, after a few tweaking, I can already mount and access my Xbox through NFS.

Then back on my Xbox(i386), I do a "debootstrap" but for the mipsel arch, this downloads every a base debian needed but failed in the process because it needs to chroot into the new rootfs to do the installation and mipsel of course cannot run on i386.

Briefly going through the debootstrap package of debian, I found that it is basically all shell script with one C. I then compiled the C program using the buildroot toolchain and copy over the whole package to my WL500G then try a debootstrap right on it, using Xbox as the storage server. It didn't work for the first few tries because I don't have "id", then "ar", then "printf". So I just rebuild the openwrt firmware to include these into busybox and start all over again.

This time it worked, but broke in the middle for unknown reason which seems to be related to the stability of NFS. Then I reinstalled the NFS server again using the kernel module instead of user space stuff and start again.

2 hours later, I have a fully populated and configured debian woody mipsel available. I can chroot into it and apt-get additional apps from the net. I intend to use this to build adhoc apps for WRT54G as well as testing out stuff. What next would be to build the uClibc library under this so I can run the resulting apps on openwrt.

This is not a very ideal development environment because of the limited memory available on WL500G and the CPU is slow (82 Bogomips), it takes quite some time to install large packages like gcc but one thing I am very impressed is how solid linux is. Throughout the whole process while I am building this thing(with a cpu load > 1), I can just continue to use it as a NAT router and browse the internet(like what I am doing now) without noticing that the background is heavily cranking things across the network on the NFS server. The contrast strongly with the machine I am running(typing here) which is a Celeron 700Mhz running XP with a background java that has a load of 30% CPU. If feels noticeably sluggish.

Still I need to find a way to add swap to it as I do see process being killed because of memory issue. I believe GS should be a feasible device for development use because of the extra memory and faster CPU.

Debian does not provide a little endian mips distribution. Debian is compiled against glibc and the resulting distribution would not fit in flash.

Which is why I said, I need to build the uClibc library(thus the development stuff) so apps building against it can be run with openwrt based distro. There is a uwoody distro which is uClibc based but that is i386 only, just trying to see if I can find to make a similar one for mipsel.

However, debian does have a mipsel distro, I am running it from my WL500G through chroot. It is slow though. The libc6 is much larger than uClibc(1.6M vs .5M, uncompressed) but since my WL500G has USB, I can use a USB disk or a usb memory stick.

I am not intending to put debian on WRT54G, just want to rip some apps from there or testing things out.

Debian does not provide a little endian mips distribution. Debian is compiled against glibc and the resulting distribution would not fit in flash.

OOO, there's debian/mipsel afaik smile but on the glibc side, you're right (but it should just work with the wrt on a nfs chroot)

just a little update, for those who is interested.

I now have a uclibc building environment on this and can compile small debian packages(large like the whole uclibc library stuff is also possible but needs tweaking because of NFS and limited memory and it is slow) and rip the binaries to run on under openwrt(not chrooted).

BTW, I found a complete mipsel rootfs development system on uclibc.org so for those who has problem packaging things for ipkg, it can be a quick and dirty way to setup NFS and use that so packages can be built natively under MIPS.

The discussion might have continued from here.