NWR04B: Flash, telnetd, serial port...plus Ted Leo
04 Sep 2005Things are coming along on this router, and I've managed to make some progress on a couple of fronts.
First off, I've managed to get access to the flash memory on this thing. It's a little embarrassing, because I went through a lot of code in the mtd section of the kernel before realizing that I had simply not included the driver in the configuration file. Managed to learn a bit about how it fits together, though, so it wasn't wasted effort.
I've been able to get the contents of the flash out -- at least, the bit that's covered by the memory map that Codeman put together in his driver, which is about 1MB of the 2MB on board. Still, that appears to include the bootloader menu on this thing, which is good; with luck I'll be able to figure out the checksum for that, and maybe upload armboot or something. Of course, I could always just overwrite the flash directly...but I'm a little scared of that. We'll see.
The other thing that this'll lead to, of course, is including a filesystem in the flash memory itself. Right now I'm mounting everything by NFS, which is very flexible but not terribly self-contained. With something like JFFS2 and a separate partition for the kernel, I should be able to have something pretty skookum.
I ran into some weirdness with Minicom and the serial port: at random times, for reasons I couldn't figure out, the display from the router would get all scrambled. Letters and newlines would be dropped, or transposed, or just garbled out of recognition entirely. I tried everything I could think of: power-cycling the router, letting it cool (it doesn't take long for it to heat up, and things tend to go south pretty quickly when it does...must do something about that), swapping cables, swapping serial ports, exiting minicom, trying other serial port terminal programs (and let me tell you, there aren't many for Linux). Eventually I gave up and ran:
cat /dev/ttyS0 & cat > /dev/ttyS0
which worked perfectly: I could watch it boot, run commands, all
that stuff. I could even see that the shell was using colours for
ls
, which made me wonder if maybe that was a problem.
Finally, though, it came time to try uploading another kernel image. I
tried fooling around with sb
, but while I could get it to upload to
the router w/o problems, it was difficult to get the timing right when
it ended, and the image didn't seem to load properly. All right, I
thought, I'll use Minicom just for uploading. But check it out: when I
ran Minicom again, it was perfect -- no display problems at all. Still
don't know what changed, but I'm glad it's working again.
This led me to try getting the telnet daemon from BusyBox working...if
I can't use a serial port, why not just use the network? But getting
it going is going to take some work. With uClibc, there is neither a
fork()
nor a daemon()
routine, both of which are used by
telnetd. Instead, you get vfork
, which lets a child run but blocks
the parent until the child calls either exit()
or exec
. So, as
uCdot points out, the trick is to do exec()
the same program,
but with a command-line option that tells the application that it's a
child, and should be treated accordingly. Good trick.
By the time I realized that, though, it was midnight, and I figured I'd be too tired to do it coherently. And then I got the flash memory working, so I was distracted. Coming soon, though...
On another note: on Friday my wife and I went with the famous Victor Scott to see Ted Leo and the Pharmacists. Holy fuck can that man play. And his drummer! His drummer has the beard I want plus all the drumming chops in the entire world. The last drummer I saw who was anywhere close to him played for Wilco; before that, Lotion. Absolutely fucking amazing, and a must-see if you ever get the chance.
Hon. mention to opening band The Parallels, for whom I can't find a website. Great 60s-mod outfits and music, and a fun show.
4 Comments
From: Sébastien CRAMATTE
24-April-2006-16:28:16
I've got the same problem with my minicom under debian sarge. My display is scrambled ! Could you explain me a little bite more your hack ? I've tried without success. Thanks
From: Saint Aardvark
24-April-2006-19:51:00
Not sure what to tell you...it's two separate commands: "cat /dev/ttyS0 &" and "cat > /dev/ttyS0". It sets up a very simple terminal over the first serial port. You may need to set the speed and other things beforehand; I don't remember, as it's been so long since I did this.
From: Joe
29-September-2005-09:23:21
What about an SD hack to the NWR04B like this..
http://kiel.kool.dk:27/
From: Saint Aardvark
29-September-2005-18:35:42
Tha'd be damned cool. I'd come across that before but managed to forget about it entirely. Thanks for the tip!
Right now I'm trying to get writing to the MTD device working. Slow work, as I've been slacking lately and I don't know what I'm doing. What a great combination. :-)
Add a comment:
Name and email required; email is not displayed.
Related Posts
QRP weekend 08 Oct 2018
Open Source Cubesat Workshop 2018 03 Oct 2018
mpd crash? try removing files in /var/lib/mpd/ 11 Aug 2018