Replacing Adam2 booloader with PSP bootloader

All about firmwares for routers. Support for RouterTech firmwares is here too.
Post Reply
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Replacing Adam2 booloader with PSP bootloader

Post by thechief » Mon Oct 05, 2009 1:59 pm

Okay, here is my experience of changing the Adam2 bootloader on my DLink G524T to a suitable PSP Bootloader.

NOTE: attempting to change your router's bootloader is a VERY RISKY VENTURE. It can all so easily go BADLY WRONG, with your router being totally trashed. If you don't have a good alternative router, then you'd better stop here! If your bootloader becomes corrupted, you WILL require JTAG (and a backup copy of a working bootloader) in order to stand any chance at all of recovering it.

I only had the courage to try what I document below because I had other fully functional routers, and was quite happy to throw this DLink 524T into the bin if the attempt to change the bootloader trashed the router.

These were the steps that I took:
1. I connected a serial console cable so that I could see exactly what was happening.

2. I upgraded the router's firmware to the RouterTech v2.91.1 Adam2 (4mb-flash) firmware.

3. I logged in to the router via telnet (telnet 192.168.1.1)

4. I defragmented the environment again (setenv DEFRAG DEFRAG)

5. I transferred the new PSP bootloader binary (psbl_4M_16M_AMD_AR7RD.bin) to the router's /var/ directory, with WinSCP

6. I copied the new bootloader to overwrite the existing one

Code: Select all

cat psbl_4M_16M_AMD_AR7RD.bin > /dev/mtdblock/2
That is the command that I used on this occasion - but using "cat" like this can be problematic, so this might be safer

Code: Select all

dd if=psbl_4M_16M_AMD_AR7RD.bin of=/dev/mtdblock/2
Edit: on all other attempts at doing this, I have used the "cat" command (above) from a telnet session, and it has worked fine. Your mileage may vary!

Comment: copying the bootloader over was the real biggie! - At this point, we had reached "the point of no return" - the router either had a new bootloader, or it was ready for the dustbin, since I have no suitable JTAG, and don't know how to make one!

7. I fired up the pctool (v2.3) and rebooted the router (/sbin/reboot)

8. I watched as gibberish appeared on my serial console, and thought I'd killed the router!

9. I tried to connect with the pctool, but it couldn't connect (it was trying to connect to 169.254.87.1). The pctool eventually crashed!

10. I opened the tcp/ip settings for my network connection, and set the static IP to 169.254.87.3, and the default gateway to 169.254.87.1

11. I fired up the pctool again, removed the power lead from the router, and inserted it again.

12. I tried to connect again with the pctool, and was relieved when it connected. I could see my brand new bootloader (phew!)

13. I ran a pre-prepared PSPboot environment script (c:\psbl_env.txt - see contents below) with the pctool (to change the environment to PSPboot)

Code: Select all

setenv IPA 192.168.1.1
setenv mtd0 0x900a9000,0x90400000
setenv mtd1 0x90020090,0x900a9000
setenv mtd2 0x90000000,0x90010000
setenv mtd3 0x90010000,0x90020000
setenv mtd4 0x90020000,0x90400000
setenv MAC_PORT 1
setenv MODETTY0 38400,n,8,1,hw
setenv MODETTY1 38400,n,8,1,hw
setenv StaticBuffer 384
setenv modulation 0x1
setenv BOOTCFG m:f:"mtd1"
setenv PROMPT (psbl)
setenv vcc_encaps0 0.0
setenv vcc_encaps1 0.0
setenv vcc_encaps2 0.0
setenv vcc_encaps3 0.0
setenv vcc_encaps4 0.0
setenv vcc_encaps5 0.0
setenv vcc_encaps6 0.0
setenv vcc_encaps7 0.0
setenv FLASHSZ 0x00400000
setenv MEMSZ 0x01000000
These values are suitable for the RT v2.91.1 AR7RD psbl 4mb-flash firmware.
PS: HWA_0 was set to the value of "maca" in my original Adam2 environment (saved with the RUC, of course), and HWA_3 was set to the value of Adam2's "macc".

14. I set the pctool's "Media Type" to "FLASH"

15. I flashed the RouterTech firmware's config file (RTech_AR7RD-4Ports_config.img) with the pctool

16. I flashed the RouterTech firmware image (RouterTech_3.6.0D_20090922_2.91.1_AR7RD-4Ports_psbl-4mb-flash_firmware.upgrade.img) with the pctool

17. I rebooted the router, and watched it all boot up successfully!

Attached is a zip file containing the PSP bootloader image that I used. Use entirely at your own peril!

Edit: some re-formatting done, and the "dd" command syntax added.
Edit2: "setenv MAC_PORT 1" is NOT right for every router - so you would be well advised to backup your router's working environment (e.g., by running the RUC again) before trying any of this.
Edit3: look further down this page for another (later) version of the PSP boot loader. If it works, it will automatically set fully functional PSPboot environment variables (including the mtd partitions), avoiding the need for step #13 above. And you will then only need to flash a pspboot firmware (via ftp or the pctool). So this one is a better option.
Attachments
psbl_4M_16M_AMD_AR7RD.zip
This zip file contains psp bootloader image that I used. Use at your own peril. It worked for me - but if it trashes your router, then go and buy another router! Don't use this if your router doesn't have an AMD flash chip!
(28.61 KiB) Downloaded 1369 times
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
tiepolo
Experienced
Experienced
Posts: 162
Joined: Sat Mar 03, 2007 10:10 pm
Location: milan, Italy

Re: Replacing Adam2 booloader with PSP bootloader

Post by tiepolo » Thu Dec 17, 2009 7:14 pm

Hello!

Very nice job!

Do you know a reference text to understand which are the differences between the 2 bootloaders?

Do you kow where one can get the binaries of PSP?

Do you have an idea of where one can get a serial console cable for dlinks? Up to now I was lucky but this seems to me dangerous...

Paolo
Paolo
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: Replacing Adam2 booloader with PSP bootloader

Post by thechief » Thu Dec 17, 2009 7:36 pm

tiepolo wrote:Hello!

Very nice job!
:)
tiepolo wrote:Do you know a reference text to understand which are the differences between the 2 bootloaders?
Simple - adam2=rubbish; psp=good. That's all that you really need to know!
tiepolo wrote:Do you kow where one can get the binaries of PSP?
There used to be some on the Acorp site (which seems to be down). However, you need to be very careful that whatever bootloader image you use matches your hardware - else, big problem
tiepolo wrote:Do you have an idea of where one can get a serial console cable for dlinks?
viewtopic.php?f=3&t=3076
tiepolo wrote:Up to now I was lucky but this seems to me dangerous...
Paolo
I think what you really need is JTAG. If your trash your bootloader, that is the ONLY WAY to recover the router.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Re: Replacing Adam2 booloader with PSP bootloader

Post by mstombs » Thu Dec 17, 2009 7:45 pm

From what I can gather Ti stopped development of adam2 over 5 years ago, they designed pspboot to replace it and provided some backward compatability (such as ftp prompts = adam2). A big obvious change is the relocation of the env+config from the end of the flash chip to the bottom adjacent to the bootloader - this change alone may be reason to rename the bootloader because it means they are incompatible, not a version upgrade.
User avatar
Pondera
Experienced
Experienced
Posts: 254
Joined: Sun Mar 25, 2007 4:06 pm
Location: Brindisi (Italy)

Re: Replacing Adam2 booloader with PSP bootloader

Post by Pondera » Sat Dec 19, 2009 8:15 am

thechief wrote:There used to be some on the Acorp site (which seems to be down). However, you need to be very careful that whatever bootloader image you use matches your hardware - else, big problem
http://www.mcmcc.bat.ru/

http://www.ddixlab.ru/
User avatar
Pondera
Experienced
Experienced
Posts: 254
Joined: Sun Mar 25, 2007 4:06 pm
Location: Brindisi (Italy)

Re: Replacing Adam2 booloader with PSP bootloader

Post by Pondera » Mon Dec 21, 2009 1:04 am

@tiepolo
I'm using PSPBoot 1.4.0.7 (the last version; in attachment in this topic) installed on a DSL-504T.
DSL-G604T has the same hardware of a 504T plus wireless chipset so I think PSPBoot 1.4.0.7 could work on a G604T!
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Re: Replacing Adam2 booloader with PSP bootloader

Post by mstombs » Mon Dec 21, 2009 10:57 am

I think we have established that bootloaders are generally not specific to the installed switch - they presumably use it in default configuration, BUT you need different bootloaders for different flash chips AMD or Intel for example. Some D-Links have Atmel flash chips and have been troublesome in past.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: Replacing Adam2 booloader with PSP bootloader

Post by thechief » Mon Dec 21, 2009 1:06 pm

I have used an AMD bootloader image with an Atmel flash router (Dlink G604T, I believe), and it was quite fine. Your mileage may vary.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
User avatar
Pondera
Experienced
Experienced
Posts: 254
Joined: Sun Mar 25, 2007 4:06 pm
Location: Brindisi (Italy)

Re: Replacing Adam2 booloader with PSP bootloader

Post by Pondera » Mon Dec 21, 2009 5:23 pm

For models D-Link DSL-300T and DSL-302T, AMD flash memory are compatible with Atmel but NOT with Intel!
tiepolo
Experienced
Experienced
Posts: 162
Joined: Sat Mar 03, 2007 10:10 pm
Location: milan, Italy

Re: Replacing Adam2 booloader with PSP bootloader

Post by tiepolo » Mon Dec 21, 2009 5:59 pm

I thank you both very much for informations

I'll execute the replace when I'll have the routers phisically in my hands (I usually configure them by remote).

Is there any comprehensive explanation of psp, as they exist for adam2?

Paolo
Paolo
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: Replacing Adam2 booloader with PSP bootloader

Post by thechief » Mon Dec 21, 2009 6:27 pm

If you don't have JTAG connectors and a JTAG cable, this could become a one-way street to a trashed router!
tiepolo wrote:Is there any comprehensive explanation of psp, as they exist for adam2?
See this, and this.
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: Replacing Adam2 booloader with PSP bootloader

Post by thechief » Wed Dec 30, 2009 5:10 pm

I have also now replaced the Adam2 bootloader of an old Dlink (v1) G604T with a psp bootloader. The whole process was smooth and incident-free. :)

Edit: the bootloader binary that I used is attached. WARNING: USE AT YOUR OWN PERIL!. If it works, then it will automatically set fully functional PSPboot environment variables (including the mtd partitions), and you will only need to flash a pspboot firmware (with the pctool). So this one is a better option than the earlier bootloader binary posted above.
Attachments
psbl_4M_16M_AMD_AR7WRD.zip
This zip file contains psp bootloader image that I used for the DLink G604T. Use at your own peril. It worked for me - but if it trashes your router, then go and buy another router! Don't use this if your router doesn't have an AMD-compatible flash chip!
(28.8 KiB) Downloaded 1490 times
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
KevinR
Regular
Regular
Posts: 95
Joined: Sat Jul 14, 2007 8:51 pm

Re: Replacing Adam2 booloader with PSP bootloader

Post by KevinR » Wed Dec 30, 2009 10:33 pm

thechief wrote:I have also now replaced the Adam2 bootloader of an old Dlink (v1) G604T with a psp bootloader. The whole process was smooth and incident-free. :)
I just wanted to say - Wow. :D :shock: :D

If I ever get hold of a cheap spare I'll have to try it.
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Re: Replacing Adam2 booloader with PSP bootloader

Post by thechief » Thu Dec 31, 2009 1:25 am

Thanks! And good luck with any such attempts! Personally, I wouldn't try any of this on a router without JTAG connectors in place, and without a JTAG cable.

I have discovered that the V.A1 G604Ts all seem to have both serial and JTAG connectors on board (and very old firmwares). It can be quite tricky (and hairy) to upgrade their firmwares (pctool and a lot of patience usually required) but once you've managed to upgrade the firmware to RT, it becomes easier to do other things (e.g., changing the bootloader).
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
jesse9999
Newbie
Newbie
Posts: 3
Joined: Thu Dec 31, 2009 5:40 am

Re: Replacing Adam2 booloader with PSP bootloader

Post by jesse9999 » Thu Jan 21, 2010 5:39 pm

Hi

I had changed the Adam2 bootloader on my gt701wg to PSP Bootloader successfully.But I have no a suitable RT firmware to use.So I had to change it back.Could you build a RT firmware for 1-port wireless (psp bootloader) AR7WRD routers using the TNETW1130 wireless chip routers?

Thanks!
Post Reply