000webhost

Web hosting

Saturday, August 18, 2012

Funky Firmware

I've been examining my home network. Part of this process has obviously involved examining firmware upgrade options for embedded routers such as OpenWRT, DD-WRT, and Tomato. I have a Linksys WRT-54GL lying around but due to the flash constraints (it runs with 4MB flash and 8MB RAM) I've also been investigating other options (including hardware mods) and alternative hardware for a reasonable (sub-100). The hardware mods (such as USB, SD, Serial, etc...) aren't all that difficult. The main thing to take into consideration though is that this is the Internet. Information will vary in quality, people have slightly different hardware, and of course the way people communicate isn't always clear. Nonetheless, an SD card mod is very much a viable (and easy if you are a semi-decent solderer) option if you need more space for software installation (though indications of a short aren't exactly easy to decipher in the logs though).

Log entry with bad soldering job for SD mod.

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43663 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43275 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[FATAL] mmc_card_init: invalid response from card: ff found, waiting for 01
[ERROR] mmc_init: got an error calling mmc_card_init: 01
[ERROR] mmc_check_media: change detected but was not able to initialize new card: ffffffff

Log entry with good soldering job for SD mod.

[INFO] mmc_hardware_init: initializing GPIOs
[INFO] mmc_card_init: the period of a 380KHz frequency lasts 524 CPU cycles
[INFO] mmc_card_init: powering card on. sending 80 CLK
[INFO] mmc_card_init: 80 CLK sent in 43646 CPU cycles
[INFO] mmc_card_init: resetting card (CMD0)
[INFO] mmc_card_init: doing initialization loop
[INFO] mmc_card_init: card inited successfully in 354 tries (10920782 CPU cycles).
[INFO] mmc_init: MMC/SD Card ID:
01 50 41 53 30 31 36 42 45 8a 16 3f b4 00 59 1f [INFO] Manufacturer ID   : 01
[INFO] OEM/Application ID: PA
[INFO] Product name      : S016B
[INFO] Product revision  : 4.5
[INFO] Product SN        : 3a529fb1
[INFO] Product Date      : 2005-9
[INFO] mmc_card_config: size = 14560, hardsectsize = 512, sectors = 29120
[WARN] mmc_init: hd_sizes=14560, hd[0].nr_sects=29120
[INFO] mmc_card_init: set_blocklen (CMD16) succeeded !
Partition check:
 mmca: p1

http://beta.ivc.no/wiki/index.php/Adding_SD_card_to_WRT54GL
http://www.isnull.com.ar/2009/12/wrt54gl-v11-sd-card-mod-with-openwrt.html
http://wiki.openwrt.org/doc/howto/mmc_over_gpio
http://www.jbprojects.net/articles/wrt54gl_mods/#sw2
http://www.dd-wrt.com/wiki/index.php/Linksys_WRT54G-TM_SD/MMC_mod
http://programmingstuff.free.fr/files/openwrt/whiterussian/mmc/src/

Along the way, I obviously found some interesting information about the hardware as well. One thing which surprised me though was how little exploration (it seemed that way to me) was done of the onboard voltages though. Some of the extraneous circuits out just didn't seem to be required. On my board alone there seemed to be stable sources for 2 (LEDs), ~3 (JTAG/Serial), 1.8, 5, 15 (DC Jack) volts around various areas of the board (with some clever programming and/or wiring you may also be able to extract decent/stable voltages from the Ethernet ports as well).

Please note that there is a difference in signalling/voltage between the onboard JTAG and standard RS-232 serial ports though. Note also, that while the difficulty of the solder job to create onboard serial/JTAG ports is trivial the USB job is can be extremely difficult if not well thought out or if you don't have adequate equipment on hand.

http://www.dslreports.com/forum/r22654574-Undersized-Power-supplies-from-Linksys.
http://www.dd-wrt.com/phpBB2/viewtopic.php?t=54242&postdays=0&postorder=asc&start=75
http://www.techrepublic.com/photos/cracking-open-the-linksys-wrt54g-wireless-router/62182
http://woodhousellc.com/?p=30
http://en.wikipedia.org/wiki/Ethernet_over_twisted_pair
http://www.mingtek.tw/pdf/B-17.pdf
http://www.powco.net/wrt/
http://www.jbprojects.net/articles/wrt54gl_mods/
https://forum.openwrt.org/viewtopic.php?id=9653
http://www.devttys0.com/2011/07/reverse-engineering-vxworks-firmware-wrt54gv8/
http://wikidevi.com/wiki/Atheros
http://www.wrtrouters.com/router/wrt54g/
http://en.wikipedia.org/wiki/Linksys_WRT54G_series
http://infodepot.wikia.com/wiki/Linksys_WRT54GL_v1.0
http://infodepot.wikia.com/wiki/Linksys_WRT54GL_v1.1
http://www.apcmedia.com/salestools/VAVR-5WKLPK_R1_EN.pdf
http://en.wikipedia.org/wiki/Serial_port
http://www.aggsoft.com/rs232-pinout-cable/pinout-and-signal.htm
http://forums.whirlpool.net.au/archive/1784403
http://www.instantfundas.com/2010/07/7-alternative-firmware-for-wireless.html
http://www.jbprojects.net/articles/wrt54gl_mods/
https://forum.openwrt.org/viewtopic.php?pid=5329
http://wiki.openwrt.org/doc/howto/mmc_over_gpio
https://forum.openwrt.org/viewtopic.php?id=9653&p=1
https://forum.openwrt.org/viewtopic.php?pid=47366
https://forum.openwrt.org/viewtopic.php?id=23308
http://en.wikipedia.org/wiki/Capacitor_plague
http://www.apogeekits.com/power_adapter_selection.htm
http://answers.yahoo.com/question/index?qid=20080823014024AADQZnk
http://en.wikipedia.org/wiki/Failure_modes_of_electronics
http://www.elexp.com/t_solder.htm
http://helpdeskgeek.com/windows-7/windows-7-hyperterminal/
http://www.evga.com/forums/tm.aspx?m=185066&mpage=1
http://electronics.stackexchange.com/questions/1409/best-methods-to-fix-broken-tracks
http://en.wikipedia.org/wiki/Voltage_spike
http://parashell.sourceforge.net/docs/parallel.txt
http://www.unixmen.com/unp-universel-file-extractor/

Note that if you end up using the Ritmo HL-340 USB to serial adapter you'll need the ch341 kernel module under Linux and the following driver for Windows 64 Bit (not included on the support CD that I received).


Bus 002 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

[130081.190436] usb 3-1: new full speed USB device number 2 using uhci_hcd
[130081.349157] usb 3-1: New USB device found, idVendor=1a86, idProduct=7523
[130081.349171] usb 3-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[130081.349182] usb 3-1: Product: USB2.0-Ser!
[130081.467336] usbcore: registered new interface driver usbserial
[130081.467386] USB Serial support registered for generic
[130081.467474] usbcore: registered new interface driver usbserial_generic
[130081.467482] usbserial: USB Serial Driver core
[130081.480724] USB Serial support registered for ch341-uart
[130081.480788] ch341 3-1:1.0: ch341-uart converter detected
[130081.492731] usb 3-1: ch341-uart converter now attached to ttyUSB0
[130081.492825] usbcore: registered new interface driver ch341

I explored a number of options for a full router upgrade (but D-Link/Netcomm/NetGear were prime options simply because I had credit at my local Officeworks store). Here are some of the options. Note, that most on-line reviews of D-Link hardware seem to indicate that these are terrible devices in their normal guise/firmware configuration (they also seem to have a history of releasing bad first versions but solid subsequent revisions (read Amazon reviews)) but with better firmware they can make extremely good, inexpensive pieces of hardware.

https://www.flashrouters.com/blog/2012/02/07/d-link-dir-632-dd-wrt-router-with-8-ethernet-ports-integrated-vpn-usb-port-featured-dd-wrt-flashrouter-of-the-day/
http://forum.pfsense.org/index.php?topic=47207.0
http://doc.pfsense.org/index.php/HOWTO_Install_pfSense
http://www.dd-wrt.com/wiki/index.php/Known_incompatible_devices
http://www.dd-wrt.com/wiki/index.php/Supported_Devices
http://www.dd-wrt.com/wiki/index.php/JFFS_File_System
http://www.dd-wrt.com/wiki/index.php/D-Link_DIR-632
http://www.dd-wrt.com/wiki/index.php/D-Link_DIR-825

Moreover, depending on your router choice you may be able to gain 3G backup capability (via USB modem).

http://www.dd-wrt.com/wiki/index.php/Cellular_Phone/USB_Modem_as_WAN_connection
http://doc.pfsense.org/index.php/Configuring_3G_modems

Another choice of course is to simply turn a spare PC/laptop/netbook into a router and use a crossover cable to keep things going (laptop is obviously a decent choice since it basically has its own backup power system).

https://support.net.com/display/UXDOC1/Ethernet+Crossover+Cable
http://en.wikipedia.org/wiki/Ethernet_crossover_cable
http://www.jaycar.com.au/productView.asp?ID=YT6081
http://ubuntuguide.net/ubuntu-connect-to-internet-via-android-phone-as-usb-modem

3G setup is actually fairly easy (depending on the modem) under Linux (I've seen and heard of bad things when it comes to many OEM software driver setups).
usb_modeswitch -v [Vendor ID] -p [Product ID] -R
nm-connection-editor (or some other network configuration utility).

Watch for some wierdness though. I had one system not being able to automatically pickup DNS setting from the ISP. I had to manually insert a rule.

https://bugzilla.redhat.com/show_bug.cgi?id=467004
http://forums.whirlpool.net.au/archive/1544486

While we're on the topic of firmware there does seem to be Open Source firmware projects for well known SSD's out there.

http://www.openssd-project.org/wiki/The_OpenSSD_Project

As you can see though, SSD reliability is still very much up in the air (across ALL manufacturers) though (keep backups, do your research, and so on.).

http://www.xtremesystems.org/forums/showthread.php?271063-SSD-Write-Endurance-25nm-Vs-34nm

- as usual thanks to all of the individuals and groups who purchase and use my goods and services
http://sites.google.com/site/dtbnguyen/
http://dtbnguyen.blogspot.com.au/

Dodgy Job Contract Clauses, Random Stuff, and More

- in this post we'll be going through dodgy job contract clauses. Ironically, many of which are actually unlawful and unenforceable on c...