I wanted to add a 1-wire bus to one of my Foneras. I already flashed it to DD-WRT some time ago, but realized that I can't disable the serial system console or the shell so there's no way to use the serial port for anything else. I searched around and it seemed like
Gargoyle might be a better solution. It's a firmware based on
OpenWRT. I flashed it, only to realize that the same restriction applies to the system console part. It seems all Fonera firmwares ignore the kernel command string set in RedBoot and just work with a hardcoded one. Which usually contains console=/dev/ttyS0 making the serial port useless.
A post on the Gargoyle forums refers me to setconsole, which isn't included in either version (stable/testing) anymore. I tried with several setconsole compiles of my own only to get an assortment of error messages. Because compiling a whole new firmware is entirely too much of a pain for something as simple as freeing up a serial port i ended up unpacking the kernel image and modifying the hardcoded string with a hex editor. Then repacking, padding, and flashing the modified image to the Fonera. (modify the string to console=/dev/null)
The
LZMA SDK from 7zip can be used for the compression.
Make note of the kernel image size before unpacking, and pad with null bytes to that exact size after repack. This is not optional. Flashing will fail otherwise.
This worked, so I proceeded to disable the shell in /etc/inittab making the serial port usable again.
Thanks to the OpenWRT roots the rest was pretty easy on the software side.
the commands
opkg update
opkg install owfs
opkg install owhttpd
gave me all the tools I needed to work with 1-wire.
And ..
opkg install php4-cli
opkg install php4-mod-gd
gave me what I needed to code up web interfaces.
The CLI compile is required because the CGI one is Apache specific. Gargoyle has a small httpd lacking most of Apache's features. The CGI compile will error out however the CLI release can be made to work. There are certain annoyances like a missing $_GET/$_POST and the requirement to send a \n before page content and after headers, but they are not that serious.
( to fix get: parse_str($SERVER["QUERY_STRING"],$_GET) )
On the hardware side I opted to use a
DS2480B 1-Wire Line Driver chip. This chip is used in the DS9097U adapters so it's basically the standard in UART to 1-Wire interfacing. I wanted to include fancy things on the board like a software controlled power switch and an activity LED, but in the end I abandoned both. The power switch didn't work out, and the LED was pretty useless due to the low activity on the bus. Because of this the original board is ugly and overkill. It is however extremely simple to hook this chip up. There are no external component requirements. POL VPP and VDD needs to be connected to together. Rest is obvious. (TXD,RXD, 1-w DQ and GNDs to appropriate holes/solderpads on the interface board, then TXD,RXD,GND to Fonera, and DQ and GND to some sort of connector for the 1-Wire bus. You can also get the 5V for the interface board by soldering to the Fonera's PSU connector)
Here's a simplified interface board:

eagle brd
here
I opted to use an RJ9 connector simply because I had one on hand, and because it fit right next to the Ethernet's RJ45.

You might want to consider including the Fonera's 5V on your connector. It could become handy if you want to attach non-parasitic devices in the future. I opted not to do so. I will be building a "powered hub" out of a 5way phone-line splitter later.
For testing I used iButtons hooked up as seen below.
RJ11 Blue dot receptor -> Ghetto RJ9<->RJ11 cable -> Fonera

Simple OWFS testing: (connecting and removing iButton)

Success!
Now I have a LAN/WLAN/MicroLAN router :)