Adam2

Adam2 is a bootloader for the linux-based firmwares on ADSL modem/routers based on the Texas Instruments AR7 (mips32) chipset. This bootloader has been superseded by the PSP 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 Adam2 is to start (i.e., bootup) the Linux kernel for the router's firmware. Adam2 also has a built in ftp server which can be used to access the router to do various things (e.g., upgrading the router's firmware). Adam2 also has a command line with its own set of commands. The Adam2 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 an Adam2 router, the geometry of the flash memory (for a 4mb flash chip) may look like this:
* mtd0 0x90098000,0x903f0000
* mtd1 0x90010090,0x90098000
* mtd2 0x90000000,0x90010000
* mtd3 0x903F0000,0x90400000
* mtd4 0x90010000,0x903f0000
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.
Adam2 versus PSP bootloader
As has been indicated, Adam2 has been superseded by the PSP 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.
* It seems that no new Adam2 routers are being made
* 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 Adam2 bootloader
The Adam2 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. And there are a number of third party releases out in the wild. 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 Adam2 Environment
The Adam2 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 "printenv" can 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 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 "/proc/ticfg/env" and "/proc/sys/dev/adam2/environment" in the later Adam2 firmwares (both apparently refer to the same data, but the latter often contains more information). The usual method of accessing the Adam2 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 "cat /proc/ticfg/env" will display the contents of the environment. The "echo" 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 variable if it doesn't already exist).
The Adam2 Environment Variables
This is an example of an Adam2 environment listing (sorted):
* autoload 1
* autoload_timeout 7
* bootloaderVersion 0.22.02
* bootserport tty0
* cpufrequency 150000000
* firstfreeaddress 0x9401d328
* flashsize 0x00400000
* HWRevision Unknown
* mac_ap 00:0F:3D:11:22:33
* maca 00:0F:3D:33:44:55
* memsize 0x01000000
* modetty0 38400,n,8,1,hw
* modetty1 38400,n,8,1,hw
* modulation 0xff
* mtd0 0x90098000,0x903f0000
* mtd1 0x90010090,0x90098000
* mtd2 0x90000000,0x90010000
* mtd3 0x903F0000,0x90400000
* mtd4 0x90010000,0x903f0000
* my_ipaddress 192.168.1.1
* ProductID AR7WRD
* prompt Adam2_AR7RD
* req_fullrate_freq 125000000
* SerialNumber none
* StaticBuffer 128
* sysfrequency 125000000
* usb_board_mac 00.0d.88.11.22.33
* usb_man D-Link
* usb_pid 0x0
* usb_rndis_mac 00.0d.88.22.33.44
* usb_vid 0x0
* 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 Adam2 bootloader
The list of routers with the Adam2 bootloader is vast, but apparently not increasing in number. Below is a selection:
* DLink DSL G604T/G624T/G664T/G684T series
* Linksys WAG54Gv2/WAG200G/WAG54GP2v2
* The original Solwise/Aztech 600E/600ER/600EW series and their clones
* and a list of others.
 
< Prev   Next >