Chinaunix首页 | 论坛 | 博客
  • 博客访问: 824547
  • 博文数量: 116
  • 博客积分: 1472
  • 博客等级: 上尉
  • 技术积分: 1725
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-06 11:45
文章分类

全部博文(116)

文章存档

2015年(1)

2014年(42)

2013年(5)

2012年(19)

2011年(49)

我的朋友

分类:

2011-07-22 10:33:34

PSPBoot (or "the PSP bootloader") is a for the -based on / based on the () chipset. This bootloader supersedes the bootloader and can be found on both (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., ) the for the router's firmware. Pspboot also has a built in 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 with its own set of commands. The command line can be accessed from a .

Contents

Details

The AR7 router family typically have chips from , , or , and some are manufactured by other companies but are compatible with the AMD chips. These chips are normally in - 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 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 resides in the mtd0 partition. The resides in mtd1. The and the bootloader's 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., , Solwise, Aztech) support both. Some third party AR7 firmwares such as and perhaps support both.

PSPBoot versus

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 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 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 , the command printenvcan be executed to list the environment variables or any of them, and setenv 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 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 to the relevant section of the mtd3 partition through a called /proc/ticfg/env. The usual method of accessing the PSPBoot environment variables is to to the router's firmware's linux , and read from or write to this "file". So for example, the command

/proc/ticfg/env

will display the contents of the environment. The command can be used to set/change the values of specific variables, so for example, the command

echo Version 3.5.5 > /proc/ticfg/env

will set the value of the environment variable "Version" to "3.5.5" (creating a new entry for the if it doesn't already exist).

The PSPBoot Environment Variables

This is an example of a 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:

  • 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
  • ADSL2MUE
  • Castlenet ASW800
  • PTI-8505G
  • Pluscom AWR-7200
  • and a very long list of others.

References
  1. The AR7W ADSL/Wireless Residential Gateway reference platform
  2. TNETW1130 "Converged Single-Chip MAC and Baseband"
  3. TNETW1350A "Application-Specific Single-Chip MAC and Baseband"
  4. The AR7 ADSL Residential Gateway reference platform
  5. "Exploring the Netcomm NB5 - ADAM2 FTP Server"
  6. "Openwrt oldwiki"

External links
阅读(1803) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~