My DD-WRT adventures have come to an end. I spent a long time finding the perfect firmware, cramming Python into it, massaging libraries and… found an immovable roadblock.
Here’s the thing: in DD-WRT the serial port — which I intend to use for communication between the Arduino and Fonera — is connected to the Linux console. This makes sense: that port is there as an interface of last resort, but it’w only useful if it’s actually connected to something like the shell. Unfortunately, a side effect of this is that all incoming communication triggers system commands — regardless of whether it’s from an administrator who’s just accidentally screwed up his ethernet port or from a microcontroller trying to politely say hello. Worse, the console hogs the serial port, preventing my Python script from reading from it at all.
This linkage is established when the kernel is invoked. That’s not an easy thing to change without recompiling DD-WRT. It can be undone at runtime using a program called setconsole, but that program isn’t compiled into the DD-WRT firmware I have — I’d have to recompile to get it. And if I’m going to recompile things, why not just use OpenWRT? It’s smaller, easier to build and more customizable. And while DD-WRT and its community is undoubtedly better for most people trying to simply turn their routers into better routers, OWRT’s got more people ready to discuss the esoteric router territory where I’ve found myself. The order of magnitude difference in the projects’ respective IRC channel populations is proof enough of that. Sure, in OWRT exotic network configurations may require a bit more wading through documentation and conf files (as opposed to DD-WRT’s pleasantly powerful web interface). But that’s a small price to pay if the goddamn thing actually works.
So last night I successfully built and installed OpenWRT. I had to do it in a VirtualBox Ubuntu image — building OWRT on OS X is possible but a bit of a pain. Other than that, it went great. I haven’t yet put the install through its python-using paces — I found I’d accidentally left a few packages out on my first pass, so after establishing that SSH worked I set it to recompile and went to bed — but every software component I need (python-mini, setconsole, pyserial, stty, etc.) was right there in the menuconfig build system. Clearly somebody has gotten these things to work in the past — tonight I hope to be next one to accomplish that feat.
Most Linksys devices have 2 serial ports. Are both of them linked to the console in DD-WRT?
Sorry, I couldn’t say. I’d suggest the DD-WRT wiki — it’s likely to contain the answer, or someone who can provide it.
It is possible to deatach the serial from the linux shell but it can not be done at runtime.
Start up your fon and look with dmesg for the kernel commandline. Should looks like this:
console=ttyS0,115200 panic=10 root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd
Save it anyhow, restart your fon and enter into the bootloader (redboot).
(putty.exe can help here a little bit because it automatically interrupts the boot process after connecting!)
To disable the serial console you need to alter your foneras boot script. Currently it should be set to:
fis load -l linux
exec
Now you need the kernel command line you saved before. Take it as it is except the console-flag. This must be altered from “conosle=*whatever* to “console=none”!
After this the startscript should look like this:
fis load -l linux
exec -c “console=none panic=10 root=/dev/mtdblock2 rootfstype=squashfs,jffs2 noinitrd”
Good luck! (sorry for my bad english :) )
Markus
@Markus
thx a lot for your comment. I was looking for a way to disable the serial console on my Linksys WRT54GL for quite a while. I gave up as well and using Kamikaze now…
I would like to check your procedure. But I’m unsure how to modify the boot script.
Can you explain more in detail?
thx – felix
oh this will not work on a gl, this will only work on routers running redboot as bootloader, for example a fornera
i have an old wrt54g v1 somewhere here in my junk. i will see if i can find this loveley thing, maybe there is another way to do this on this platform too
greetings – and a happy new year
markus
@Bejo @Felix
Seems the gl indeed have 2 different serial ports. as far as i understand the wiki, only the first port is attached to the console (/dev/tts/0) the socondary port (/dev/tts/1) should work
but i did not test this yet
@markus
yes indeed, the wrt54gl got two serials devs, and tts/1 is working fine. But I would need tts/0 as well.
As the gl got no redboot bootloader but cfe, I assume the only way to get /tts/0 detached from the console is compiling dd-wrt from source and changing the kernel command line before….
@Markus:
I also need to disconnect the serial port from the console and stumbled over your approach.
After changing the startup script of my Fonera as described in your comment
… nothing changed in the behaviour!
I am using DD-WRT V24-SP2
Do you have any idea, why no go?
Thanks in andvance,
Ingo
You also can contact me by mail: in.
se@
gmx.
li
What does this command result?
dmesg |grep “Kernel command”
The op is right. DD-WRT has got several negative points, and this one is just one in a series. For starters, you can see that its not really an open source solution, even at the filesystem level, not even ipkg works as in open distros. I have spent by now several months trying to make a fon both, a wireless client bridge and being able to unbind the serial console without success. I have flashed several diferent distros but none of them allowed for both.
OpenWRT failed on the client bridge, whereas dd-wrt fails on the most basic thing, which is to allow for the console to be unbound.
Yes, I have tried the exec line on the latest dd-wrt but the kernel just ignores redboot’s line.
At this very moment the features edge is on Gargoyle. It took me 30 mins to have exactly the setup I wanted.
Big big thumbs up for Gargoyle. As it’s based on OpenWRT, its robust and extensible, opkg works a treat, and above all is predictable. No jffs hassle, simple but powerful web config, and the rest can be accomplished by changing predictable config files.
Congratulations Gargoyle and to the OP: I agree completely!
jodim