Projecte

General

Perfil

Upgrade system

The upgrade system is a qMp tool to automatic check for new versions and upgrade them. It used a remote server to find new versions and download the images if needed. To know if there is a new version it uses the information from /etc/qmp/qmp.version which is a timestamp of the compilation date.

These are the options available in /etc/config/qmp related with the upgrade system:

config qmp 'update'
    option images 'IMAGES'
    option devices 'DEVICES'
    option filter 'sysupgrade'
    option preserve '/etc/config/qmp /etc/shadow /etc/passwd /etc/rc.local /etc/firewall.user /etc/dropbear /etc/config/b6m-spread /etc/qmp/.birth /etc/config/gateways /etc/config/mini_snmpd'
    option url 'http://fw.qmp.cat/master'

  • url: Specify the url (http, https or ftp) to get the images
  • images: specify the name of the images file
  • devices: specify the name of the devices file
  • filter: specify a image name filter
  • preserve: the list of file to preserve. Use "none" to specify any file

All these options have default values so define them is not mandatory

Images file

This file is a list with the available images in the server. The syntax is:

CHECKSUM_MD5 FILENAME

There is an special syntax for the FILENAME:

 <DEVICE>-<FILTER1>-<FILTER2>-<TIMESTAMP>.[OPTIONAL_EXTENSION]
Some valid examples are:
  1. Alix-qMp-sysupgrade-20120411_1932.bin
  2. RouterStationPro-guifi-sysupgrade-20120410.img
  3. NanoStationM5-experiment-upgrade-20120211
Of course the image file must be reachable from URL/FILENAME, so an easy way to generate this file is:
  1. Place your shell in the web server directory (with all the images)
  2. Execute: md5sum *.bin > IMAGES

Devices file

This file is needed to know which DEVICE_NAME (Alix, RouterStation, etc.) should be use by the device which is upgrading the system.
The syntax is:

DEVICE_TYPE_HASH DEVICE_NAME

DEVICE_TYPE_HASH is an special hash which is calculated using the next command (from inside the same device!)

( [ -f /tmp/sysinfo/board_name ] && cat /tmp/sysinfo/board_name || cat /proc/cpuinfo | egrep "^vendor_id|^model name|^machine") | md5sum | awk '{print $1}'

Previously, cat /proc/cpuinfo | egrep "^vendor_id|^model name|^machine" | md5sum | awk '{print $1}' was used.

In theory this HASH is able to identify the kind of device! It works at least for: Alix, RouterStation, NanoStation, Tplink2543

So, when a device checks if there is any new image, it first downloads this file to know which DEVICE_NAME must use.

A valid example of this file:

d11c4c408a408f6a14c80b92d24af992 Alix
5c220ec807601507cf28c785d944dcd2 Tplink2543
02f054340bd0eb44c7a9c5a2bbdb49f3 RouterStationPro

Executing the upgrade

There is a functions file placed on /etc/qmp/qmp_update.sh This file is used by "qmpcontrol" to perform the actions.

There are three ways to use the upgrade function:
  1. qmpcontrol upgrade
  2. qmpcontrol upgrade http://fw.qmp.cat/testing/Alix-qMp_testing-sysupgrade-20120411_1932.bin
  3. qmpcontrol upgrade /tmp/Alix-qMp_testing-sysupgrade-20120411_1932.bin

First one (default one) check the server url, get the devices file, get the images file and upgrade the system if there is any new version available

Second one upgrades from a specific URL

Third one upgrades from a image placed on the filesystem