Pspboot

PSPBoot (or "the PSP bootloader") is a bootloader for the linux-based firmwares on ADSL modem/routers based on the Texas Instruments AR7 (mips32) chipset. This bootloader supersedes the Adam2 bootloader and can be found on both wireless routers (AR7WRD and variants) using the TNETW1130 (ACX100) and TNETW1350A wifi chips, and non-wireless (AR7RD and variants) routers. The primary function of PSPBoot is to start (i.e., bootup) the Linux kernel for the router's firmware. Pspboot also has a built in ftp server that is remarkably similar to the Adam2 ftp server. The Pspboot ftp server can similarly be used to access the router to do various things (e.g., upgrading the router's firmware). Pspboot also has a command line with its own set of commands. The command line can be accessed from a serial console.
Details
The AR7 router family typically have flash chips from AMD, Intel, or ATMEL, and some are manufactured by other companies but are compatible with the AMD chips. These chips are normally partitioned in mtd blocks - typically, "mtd0", "mtd1", "mtd2", "mtd3" and "mtd4"). In these routers, the bootloader is located in the mtd2 partition, which is normally 64kb in size. The mtd2 partition normally starts at offset 0x90000000 and ends at offset 0x90010000 on the flash chip. On a PSPboot router, the geometry of the flash memory (for a 4mb flash chip) may look like this:
* mtd0 0x900a4000,0x90400000
* mtd1 0x90020090,0x900a4000
* mtd2 0x90000000,0x90010000
* mtd3 0x90010000,0x90020000
* mtd4 0x90020000,0x90400000
The linux file system resides in the mtd0 partition. The linux kernel resides in mtd1. The configuration information and the bootloader's environment variables reside in mtd3, while mtd4 (if present) holds the entire firmware.
The sizes and locations of the mtd2 and mtd3 partitions are normally fixed, and can almost invariably be found at the offsets listed above. Any departure from these is unusual in AR7 routers, and would most likely be problematic for the operation of the router, or for upgrades of its firmware.
Some manufacturers of AR7 routers (e.g., Acorp, Safecom) seem to support only one of Adam2 or PSPBoot in their firmwares, while some (e.g., DLink, Solwise, Aztech) support both. Some third party AR7 firmwares such as RouterTech and perhaps OpenWRT support both.
PSPBoot versus Adam2
As has been indicated, PSPBoot supersedes the older Adam2 bootloader. It is unlikely that any new AR7 routers using Adam2 are being made. PSPBoot is only slightly backwards compatible with Adam2. Each expects a linux kernel in a different format from the other, so that a kernel compiled for one will fail to load with the other. Furthermore, even though they both expect to reside in mtd2, load their kernel from mtd1, and load their environment variables from mtd3, the offsets for their mtd1 and mtd3 partitions are very different. This is not made easier by the fact that some (but not all) Adam2 mtd2 partitions are 128kb in size. Finally, many of the environment variables have different names between the two bootloaders.
A router with a modern firmware will not perform very differently whether it has Adam2 or PSPBoot. However, PSPBoot has the clear edge over Adam2 in some respects:
* Most manufacturers no longer update firmwares for Adam2-based routers, whereas updates are constantly released for PSPboot routers.
* Adam2 environment variables are limited to 80 byte blocks (including the variable's name), whereas PSPBoot variables can be much longer.
* The Adam2 environment suffers badly from fragmentation, and is not very good at self-repair in such cases (often the internal attempts at self-repair end up trashing the mtd3 partition, badly bricking the router). Even when the router is not bricked, the fragmentation often leads to a number of intractable problems with Adam2-based routers, the most obvious symptoms being an inability to save configuration information, or to upgrade the firmware without resorting to some third-party tools. PSPBoot, on the other hand, is very good at fixing its environment when it gets full or badly fragmented.
* Upgrading an Adam2 router's firmware often requires knowing (and setting) the correct mtd partition sizes for the new firmware in advance. This is hardly ever needed with PSPBoot.
Upgrading the PSP bootloader
The PSP bootloader comes in a number of different versions (sometimes, varying according to the manufacturer of the router), each with different features enabled, and each supporting a specific flash chip. While the bootloader can be upgraded to a different version, it is not advisable - for the simple reason that, if something goes wrong with the upgrade (and there is a lot that can go wrong), the only way in which the router could be recovered would be through a JTAG interface. This is not a process for the faint-hearted, and normally requires extensive technical (and electrical) skills. Therefore only the very brave would venture to upgrade their bootloader.
The PSPBoot Environment
The PSPBoot environment is located in the first 10kb of the mtd3 partition. This can be accessed in a number of ways. First, at the bootloader's own command prompt, the command <code style="font-size: 120%">printenv</code> can be executed to list the environment variables or any of them, and <code style="font-size: 120%">setenv</code> can be executed to set/change the value of a specific environment variable. It is not possible under normal circumstances to access the bootloader's command prompt. The only way in which this can be done is to build a serial console cable, and then interrupt the router's boot process at the serial console. Given the technicalities involved in such an enterprise, it is, unsurprisingly, not an option for most people.
With this in mind, the firmwares normally provide an interface to the relevant section of the mtd3 partition through a file called <tt>/proc/ticfg/env</tt>. The usual method of accessing the PSPBoot environment variables is to login to the router's firmware's linux command line interface, and read from or write to this "file". So for example, the command
:<code>cat /proc/ticfg/env</code>
will display the contents of the environment. The <code style="font-size: 125%">echo</code> command can be used to set/change the values of specific variables, so for example, the command
:<code>echo Version 3.5.5 > /proc/ticfg/env</code>
will set the value of the environment variable "Version" to "3.5.5" (creating a new entry for the variable if it doesn't already exist).
The PSPBoot Environment Variables
This is an example of a (sorted) PSPBoot environment listing:
* BOOTCFG m:f:"mtd1"
* bootloaderVersion 1.2.0.4
* CPUFREQ 150000000
* FLASHSZ 0x00400000
* HWA_0 00:12:17:11:22:33
* HWA_HRNDIS 00:E0:A6:61:62:64
* HWA_RNDIS 00:E0:A6:61:62:63
* HWRevision Unknown
* IPA 192.168.1.1
* MAC_PORT 0
* MEMSZ 0x01000000
* MODETTY0 38400,n,8,1,hw
* MODETTY1 38400,n,8,1,hw
* modulation 0x1
* mtd0 0x900a4000,0x90400000
* mtd1 0x90020090,0x900a4000
* mtd2 0x90000000,0x90010000
* mtd3 0x90010000,0x90020000
* mtd4 0x90020000,0x90400000
* ProductID AR7RD
* PROMPT (psbl)
* SerialNumber none
* SYSFREQ 125000000
* USB_VID 0x0451
* USB_PID 0x6060
* vcc_encaps0 0.0
* vcc_encaps1 0.0
* vcc_encaps2 0.0
* vcc_encaps3 0.0
* vcc_encaps4 0.0
* vcc_encaps5 0.0
* vcc_encaps6 0.0
* vcc_encaps7 0.0
Routers with the PSP bootloader
The list of routers with the PSP bootloader is too vast to reproduce in full. Below is a selection:
* DLink DSL 2640T, DSL 504T GenII
* Solwise/Aztech 605E/605ER/605EW series and their clones
* Safecom SART2-4112, SART2-4115, SWAMR/SWART2 54108/54125 series and their clones
* Acorp LAN120M/LAN122, LAN420M/LAN422, W400G/W422G
* Linksys ADSL2MUE
* Castlenet ASW800
* Paradigm Technology PTI-8505G
* Pluscom AWR-7200
* and a very long list of others.
 
< Prev   Next >