Projecte

General

Perfil

Actions

Upgrade system » Historial » Revisió 1

Revisió 1/6 | Següent »
Pau Escrich, 11-04-2012 22:45


Upgrade system

There is a function to easy upgrade the system.

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

config 'qmp' 'update'
        option 'url' 'http://upc2.qmp.cat/qmp'
        option 'images' 'IMAGES'
        option 'devices' 'DEVICES'
        option 'filter' 'sysupgrade'
        option 'preserve' '/etc/config/qmp /etc/shadow /etc/passwd'

  • 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_NAME>-<FILTER>-<TIMESTAMP>_[OPTIONAL_INFORMATION].[OPTIONAL_EXTENSION]
Some valid examples are:
  1. Alix-sysupgrade-20120411_1932.bin
  2. RouterStationPro-guifi-20120410.img
  3. NanoStationM5-sysupgrade-20120211_p4u
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!)

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

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-sysupgrade-20120411_1932.bin
  3. qmpcontrol upgrade /tmp/Alix-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

Actualitzat per Pau Escrich fa casi 12 anys · 1 revisions