Wednesday, May 31, 2017

Make Something That Isn't A Computer A Computer - Episode 2

This is a cop out because moving to where I'll be living over the summer took more time than I thought it would. So in this episode of "Make Something That Isn't A Computer A Computer", we'll be making a old router into a computer. I know, I know, it's basically already a computer... but we're going to try and benchmark its performance and see what it's really capable of and we're going to try to do more with this than we did with the drone board because this has far more documentation than that drone board did. I guess you could say it was... undocumented code. B)



The router in question is the WRT54GS V7. This line of routers is probably one of the most popular ever made. For a stretch I saw these things everywhere. The blue housing is unmistakable. Something I found odd about the progression of many of the routers in this line - including this one - is that the amount of flash memory they have goes down as the version number goes up. Something I just found interesting.

The only firmware that seemed to be definitive to work was DD-WRT. I would have preferred Tomato, but the website wasn't clear if it would work so I didn't want to risk bricking the device. So I followed the instructions at the device's wiki page and got the router running DD-WRT no problem. I did some things to the router to make it less like a router and more like a computer. For example, I turned off the wireless and I made the WAN port a LAN port. Just 'cause. I also enabled telnet so we can get access to a Linux terminal.

The first thing you'll notice is that this terminal sucks. You can't even run ls. I think this is because they needed to strip the firmware down so much to fit the Linux Kernel and Busybox into 2MB of flash that they had to get rid of everything. So we'll need to make an alias: alias ls="echo *" which will echo an asterisk if the directory is empty, or the contents of the directory if its not. You can't see the permissions using this, it's just to see what you're doing. Change to the root directory and run your new list command. You should see a familiar Linux file structure.

Let's dive into the proc folder. Here's the cpu info for the processor that's in my box:

system type             : Broadcom BCM5354 chip rev 2
processor               : 0
cpu model               : BCM3302 V2.9
BogoMIPS                : 239.20
wait instruction        : no
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : no
hardware watchpoint     : no
VCED exceptions         : not available

VCEI exceptions         : not available

Not exactly the long list of features we're used to seeing, but we can see that it is in fact running a 32-bit MIPS processor. We can grab the toolchain for that off of the DD-WRT website and start writing stuff for it! Namely, a hello world program and a benchmark of some kind.

But here's the problem: you can't compile for something without a compiler. That's right, I couldn't find the toolchain needed to compile for this router. Everything either turned up dead or it just straight up didn't work. I tried like 10 different toolchains before giving up temporarily. I'm not going to lie... I thought this was going to be easy. Maybe if Open-WRT was supported on this router. I think this was just a poor router to do this on. I'll get my hands on a better router for the next episode and see if I can compile for that one. Something with more flash and that can run Open-WRT because that community seems active enough to have current and existing toolchains. But, such is life.

I did not expect this to be harder than the drone. I figured this would be super easy. But I was very wrong. That just goes to show you that you shouldn't put off posting on your blog where you like to keep a rigorous schedule, otherwise you'll end up with many failure posts. This month has been crazy for me, so I'm sure we'll get back on track next month. I'm sure all five or so of my readers will be delighted with whatever's going to be next. (I have no idea what I'm going to do next

No comments:

Post a Comment