Put a script in init now router wont fully boot

Discussion in 'Tomato Firmware' started by scrupul0us, Jan 29, 2011.

  1. scrupul0us

    scrupul0us Network Guru Member



    * Certain wireless clients cause the router to crash or reboot on while trying to associate. The "ND" drivers are an attempt to rectify this, but when used, Intel 2200B/G wireless clients cannot associate. The following script corrects the problem with the ND drivers:

    nvram set wl_reg_mode=off

    nvram commit

    So i put those two lines in the "init" tab, saved, rebooted and now my power light just flashes... I'm assuming its not liking the script

    I DID backup my config prior to doing this

    How do I get back up and running?
  2. Toastman

    Toastman Super Moderator Staff Member Member

    You did not say what version of Tomato you are using.
  3. scrupul0us

    scrupul0us Network Guru Member

    Sorry about that, I'm running a wrt54gs v4 and 1.28 version of tomato
  4. TexasFlood

    TexasFlood Network Guru Member

  5. mstombs

    mstombs Network Guru Member

    These are once off commands to be run from telnet/ssh console - and maybe only needed on old versions.

    You don't really want to be writing to flash (with the commit) at the same time as reading - this type of thing used to corrupt flash on certain ADSL routers I know of.

    Hope the reset button works - unfortunately is some CFE's the reset button GPIO is defined in nvram vars
  6. scrupul0us

    scrupul0us Network Guru Member

    No luck with the 30/30/30

    the moment I power the router on the light just starts flashing (which I think is normal anyway)

    You'd think thered be a short period of time that could be interrupted before that script runs
  7. mstombs

    mstombs Network Guru Member

    Unfortunately there are some things like memory timing and cpu speed that are configured by nvram vars, so if the nvram is corrupt the bootloader can crash before it gets anywhere. This should be fixable by JTAG - 2 hours to solder in the connector, 2 seconds to erase nvram - and then the router reset to default itself on reboot.
  8. scrupul0us

    scrupul0us Network Guru Member

  9. scrupul0us

    scrupul0us Network Guru Member

  10. mstombs

    mstombs Network Guru Member

    I bought one of those when there was an introductory offer at half price - but haven't used it - there is some deal between them and dd-wrt Tornado who develops tjtag software, see


    - its a number of steps on from its HairyDairyMaid origin http://downloads.openwrt.org/utils/HairyDairyMaid_WRT54G_Debrick_Utility_v48.zip, but no source-code yet for the latest which is supposed to support Asus RTN-16 etc.

    I have used a home-made passive cable many times with tjtag 3.01 and earlier versions

    Never used the solder-free type - my Router's have always had filled in holes which take ages to clear with solder sucker/ solder wick - one word of advice if you go down this route - use fresh solder to wet the old.

    For once off I would be tempted to just use bared copper Cat 5 cable, and then just cut-off, but you do need the resistors at parallel port end.
  11. TexasFlood

    TexasFlood Network Guru Member

    FYI, I picked up one of these Universal JTAG Adapters when it was on special for $10. Still not a bad deal at $18.99 if you want to minimize your construction work. Here is the original DD-WRT thread about that deal, might be worth reading if you end up buying one. I believe this is the same company which hosts the wiki link you posted above as you can see "For detailed configuration steps, please visit our tutorial page at: http://www.tiaowiki.com" at the bottom of the Universal JTAG Adapter product page. So that wiki is on my list of references also since I own that adapter.

    As far as other docs, there is a JTAG section in the DD-WRT "Recover from a bad flash" page and also the "JTAG-adapter" page. There is also a JTAG page on the OpenWRT wiki here.
  12. scrupul0us

    scrupul0us Network Guru Member

    So I just popped my router open, the jtag holes are open! I guess if I buy a kit I'll soldier in some pin headers =)

    I think I'll end up buying their kit... Seems complete and has some recognition here which makes me feel better about using it

    I actually think the hardest part about this is going to be finding a parallel port to use on a windows computer (all the software I've seen seems winderz based) but if theres a nix based flavor out there (for jtag, obviously there's tftp) then I have an ubuntu box that should fit the bill nicely

    I think my only other concerns would be which pins on that adapter go the according pins on the jtag header... Unfortunately the walkthrough on their wiki uses an older adapter and I didnt see any docs on the universal for the 54gs

    I supposed i can cross that bridge when I get there seeing as Texasflood has used it

    Thanks again for all the input/feedback... I'm still facepalming over having done this.. I should have asked first before putting that darn script in there =)
  13. TexasFlood

    TexasFlood Network Guru Member

    Found a DD-WRT JTAG wiki page that recommends the following:

    Jtag on a Laptop Computer
    Laptops don't normally have parallel ports anymore, and if your laptop doesn't as you would have hoped, USB Jtag is expensive, and doesn't appear to work consistently well. The best option is to get a ExpressCard Parallel port adapter (or presumably PCMCIA would also work). Further information is in this thread

    If you have a laptop that isn't running windows, I wonder if you could boot like the "Mini Windows Xp" environment form Hiren's BootCD or a similar boot CD? Probably a bad idea. Just get the source to tjtag v3.0.1 here and build it yourself, :wink:. On Linux, if you have gcc installed, I think you just extract the archive into a directory, CD to that directory, and type-> make.
  14. mstombs

    mstombs Network Guru Member

    Tornado's tjtag includes Linux 32 and 64 bit executables, and v3.01 compiles easily. Linux doesn't need the ancient quirky windows "Loaddrv" and "giveio.sys", but on Ubuntu I have to use "sudo rmmod lp" to get the printer driver to give up the parallel port.
  15. TexasFlood

    TexasFlood Network Guru Member

    You're right, looks like the executables are there. It's been a while since I used this and hadn't noticed. Thanks for the heads up on Ubuntu as that's the platform I'll most likely be using when I try to rescue my next router, an old WR850G and if so that will save me time and trouble.
  16. scrupul0us

    scrupul0us Network Guru Member

    =) Very good news on the Linux builds

    I'm going to order one of the jtag kits today and hopefully have time to putz around this weekend (read: come back here and beg for assistance)
  17. scrupul0us

    scrupul0us Network Guru Member


    I found this wireup / pinout on their wiki:


    Would that schematic/wire-up be valid for my wrt54gs (I presume it would be)

    Good news is my wifes old laptop has a LPT port on the back (hello 2002) so this should be relatively easy

    If I read this all correctly I'll just:
    1) wire up the pin-outs

    2) Follow this to step 8 http://www.tiaowiki.com/w/Debrick_Routers_Using_JTAG_Cable#Debrick_it.21 (presuming all goes well)

    3) ??? reboot router ???

    Little unclear to me what to do after I delete the nvram... Do I simply reboot the router and it will be back to factory with the linksys firmware (i dont see how thats possible) or do I tftp the latest tomato up (whats the IP

    Any clarification beyond wiping the nvram with the jtag tool would be appreciated =)
  18. mstombs

    mstombs Network Guru Member

    It is possible it will boot back into Tomato, the init script is stored in nvram so that will definitely be wiped. The posts on dd-wrt suggest it is an old dd-wrt problem with default nvram vars, maybe now fixed. Not a problem with Linksys firmware - not sure it is a problem with Tomato - my trusty old GS 1.1 hasn't had Linksys firmware on it since before HyperWRT Thibor days and I don't recall a problem needing tftp after reset - but I don't recall using the reset button either (its in use mounted high up on a wall...).
  19. scrupul0us

    scrupul0us Network Guru Member

    Perhaps I don't fully understand how the router works and where are the programming is stored, but, if I'm reading your post correctly, simply wiping the nvram just wipes the configuration, not the actual firmware...

    So (best case) if I wipe the nvram, I should presumably be left with Tomoto and no real configuration... If thats the case then I'd be VERY happy...

    As stated I backed up my config before putting the script in the init tab so I should be able to do a restore and then be up and running again

    Ugh and to think I've gone through ALL this just to try and get my old WPA54G adapters to work...

    :: sighs ::
  20. scrupul0us

    scrupul0us Network Guru Member

    jtag kit came Monday... hooray!

    Looks like I'll have to dig my heels in on Saturday
  21. TexasFlood

    TexasFlood Network Guru Member

    Good luck. I'm on the road or I'd be tempted to try recovering my old WR850G as well.
  22. scrupul0us

    scrupul0us Network Guru Member

    sighs... so I got it all wired up per:


    Per this I've used pn 6 for my ground:


    downloaded tjtag from:


    jtag adapter has power... when I run the tjtag utility I'm getting:

    'Couldn't access giveio device'

    the zip file had no dll or sys files included to drop in c:\windows\system32 so i'm not sure if thats the issue?

    I'm no newb to soldering either... My connections to the pin headers are nice and clean and complete... no bad traces on the board either from what I see via my magnifying lens

    any idears on that?
  23. scrupul0us

    scrupul0us Network Guru Member


    OK what they 'dont tell you' in the wiki is that you have to:

    1) drop giveio.sys in c:\windows\system32\drivers
    2) run loaddrv.exe (included in zip), install giveio.sys and then start giveio.sys

    The fun continues!
  24. Toastman

    Toastman Super Moderator Staff Member Member

  25. scrupul0us

    scrupul0us Network Guru Member


    -Backed up the nvram, cfe, whole flash three times
    -Wiped the nvram and rebooted

    Router came back! Default and admin/admin for the login and it was running tomato!

    So great, I set my usual admin password and save... I then uploaded my configuration from before I entered that script... click OK and let it go... router came back up after 30 seconds (power LED cycled flashing to non) so I figured, power it down and put it back together...

    Well now when I power it back up, the power is flashing, dmz and wifi are off and the wlan -> port 4 are lit

    Jeesh... now what, should I just erase the nvram again or... ?
  26. scrupul0us

    scrupul0us Network Guru Member

    Another little oddity (im still hoked up via jtag btw) i cleared the nvram and got back in...

    I disabled the wireless so it wouldnt interfere with my other router and checked a few other things and rebooted it from the interface... after it reboots the wireless is enabled again... WTH?

    is this all acting wonky for a reason, eg, im still jtag connected or is the router effed?
  27. Toastman

    Toastman Super Moderator Staff Member Member

    Probably the config file that you restored is corrupted. Use an older one or reconfigure from scratch. It's almost certainly not the hardware.
  28. scrupul0us

    scrupul0us Network Guru Member

    Well that doesnt explain why after a fresh nvram clear that settings I change, like the wireless radio, are not persistent between reboots...

    I vaguely recall reading somewhere that if you still have jtag hooked up it will cause nvram reset issues because it leaves the memory in some kind of "state"

    i guess what I can do is upgrade my edge router to 1.28, dump the config and then load it on this router and see if that works

    thanks to everyone for their feedback and assistance =)
  29. scrupul0us

    scrupul0us Network Guru Member

    wow i feel like such a liar...

    per my other thread on how to view a backed up cfg file I'm looking through my back and low and behold:

    script_init=nvram set wl_reg_mode=off
    nvram commit
    i dunno how thats there as I backed up before I entered that, but, perhaps I'm mistaken

    I'm going to try and remove those bits and then restore the cfg and see if it works
  30. mstombs

    mstombs Network Guru Member

    Congrats on the JTAG recovery

    Tomato wireless not staying disabled is a common Tomato issue I recall - so not a new problem!
  31. scrupul0us

    scrupul0us Network Guru Member

    Just wanted to say that I was able to do a full recovery with my backed up config...

    Used 7zip to open the cfg and npp to edit the offending script bits out...

    Quick config restore and I am back in business!

    Thanks to everyone for their advice and support with my noobish mistake =)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice