Beyond Logic

Exploring the Netcomm NB5 - ADAM2 FTP Server

    Help!, Iíve just re-flashed my NB5 via the web interface, now it doesnít work.

    First, donít panic. Itís not the end of the world.

    Second, check if the ETH/ACT LED lights and stays on. If it does, this tends to suggest both the NB5ís kernel and filesystem was successfully loaded. If you have configured your NB5 to a different IP, try opening a browser to the factory default address (This may require a change of subnets).

    If however your modem appears to be lifeless, it could be an ideal time to make use of the ADAM2 FTP server. The ADAM2 FTP server is part of the bootloader resident in mtd2. It is the first thing loaded when the NB5 starts, and opens a FTP server for 5 seconds before booting the linux kernel (provided the ďautoloadĒ environment variable be present (default)).

    Reboot your modem and immediately open a ftp connection to (The IP address, is the default address for the NB5 and is obtained from the my_ipaddress environment variable. This is independent of the IP address set in the NB5ís web configuration interface.)

      Connected to
      220 ADAM2 FTP Server ready.
      User ( adam2
      331 Password required for adam2.
      230 User adam2 successfully logged in.

    As there is a small window of time when the ADAM2 FTP server listens after a reboot, you may need to make several attempts before a successful connection is made.

    Once successfully logged in using the username and password of adam2, the following standard FTP command are available to reload new firmware and modify environment variables :


    The ADAM2 FTP server also introduces the following non-standard commands :

      REBOOT		Reboots Modem          
      UNSETENV	Deletes Environment Variable Entries 
      SETENV		Set Environment Variables
      GETENV		Gets Environment Variables 
      MEDIA		Selects FLSH or SDRAM

    Uploading kernel and fileSystem firmware

    Before new firmware can be uploaded, the FTP client must be set to binary mode and the bootloader set to store images in FLASH. Prefix non-standard FTP commands with quote, if your client doesn't understand them.

      ftp> bin
      200 Type set to I
      ftp> quote MEDIA FLSH
      200 Media set to FLSH.

    Now begin to upload the images. If you intend to load manufacturer's firmware from Netcomm, use the non "upgrade" files. These files do not have the "TI" checksum appended to the end of the file. First we upload the filesystem.

      ftp> put nsp.annexA.img "fs mtd0"
      200 Port command successful.
      150 Opening BINARY mode data connection for file transfer.
      226 Transfer complete.
      ftp: 1433600 bytes sent in 10.88Seconds 131.83Kbytes/sec.

    then the Linux Kernel,

      ftp> put ram_zimage_pad.ar7rd.nsp.squashfs.bin "kernel mtd1"
      200 Port command successful.
      150 Opening BINARY mode data connection for file transfer.
      226 Transfer complete.
      ftp: 524288 bytes sent in 4.25Seconds 123.36Kbytes/sec.

    and last, the configuration file.

      ftp> put config.xml "cfg mtd3"
      200 Port command successful.
      150 Opening BINARY mode data connection for file transfer.
      226 Transfer complete.
      ftp: 29592 bytes sent in 0.22Seconds 132.46Kbytes/sec.

    Once done, issue the REBOOT command to reset the router and load your new firmware.

      ftp> quote REBOOT
      221-Thank you for using the FTP service on ADAM2.
      221 Goodbye.
      Connection closed by remote host.

    Environment Variables

    If the 550 environment variable not set. error appears when an attempt is made to upload the firmware, it is possible the environment variables are corrupt or missing. The ADAM2 ftp server includes GETENV, SETENV, and UNSETENV commands to work with the variables. First, check for the existence of mtd0, mtd1, mtd2 & mtd3 variables. They should appear as :

      ftp> quote GETENV mtd0
      mtd0        0x90090000,0x901f0000
      ftp> quote GETENV mtd1
      mtd1        0x90010000,0x90090000 
      ftp> quote GETENV mtd2
      mtd2        0x90000000,0x90010000 
      ftp> quote GETENV mtd3
      mtd3        0x901f0000,0x90200000

    If they are missing or different, you will need to re-initialise them using the following commands :

      ftp> quote SETENV mtd0,0x90090000,0x901f0000
      200 SETENV command successful
      ftp> quote SETENV mtd1,0x90010000,0x90090000
      200 SETENV command successful
      ftp> quote SETENV mtd2,0x90000000,0x90010000
      200 SETENV command successful
      ftp> quote SETENV mtd3,0x901f0000,0x90200000
      200 SETENV command successful

    and attempt to upload the firmware again.

    ADAM2 Bootloader

    If your new filesystem/kernel doesnít work and you donít know why, or you are unable to resuscitate your patient using the ADAM2 FTP server it may be time to pop inside and do some debugging with the ADAM2 Bootloader.

Copyright 2005 Craig Peacock - 15th June 2005