Project

General

Profile

Upgrade system » History » Version 3

Pau Escrich, 09/12/2012 05:59 PM

1 1 Pau Escrich
h1. Upgrade system
2 1 Pau Escrich
3 2 Pau Escrich
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.
4 1 Pau Escrich
5 1 Pau Escrich
These are the options available in /etc/config/qmp related with the upgrade system:
6 1 Pau Escrich
<pre>
7 1 Pau Escrich
config 'qmp' 'update'
8 1 Pau Escrich
        option 'url' 'http://upc2.qmp.cat/qmp'
9 1 Pau Escrich
        option 'images' 'IMAGES'
10 1 Pau Escrich
        option 'devices' 'DEVICES'
11 1 Pau Escrich
        option 'filter' 'sysupgrade'
12 1 Pau Escrich
        option 'preserve' '/etc/config/qmp /etc/shadow /etc/passwd'
13 1 Pau Escrich
14 1 Pau Escrich
</pre>
15 1 Pau Escrich
16 1 Pau Escrich
* url: Specify the url (http, https or ftp) to get the images
17 1 Pau Escrich
* images: specify the name of the images file
18 1 Pau Escrich
* devices: specify the name of the devices file
19 1 Pau Escrich
* filter: specify a image name filter
20 1 Pau Escrich
* preserve: the list of file to preserve. Use "none" to specify any file
21 1 Pau Escrich
22 1 Pau Escrich
All these options have default values so define them is not mandatory
23 1 Pau Escrich
24 1 Pau Escrich
h3. Images file
25 1 Pau Escrich
26 1 Pau Escrich
This file is a list with the available images in the server. The syntax is:
27 1 Pau Escrich
<pre>
28 1 Pau Escrich
CHECKSUM_MD5 FILENAME
29 1 Pau Escrich
</pre>
30 1 Pau Escrich
31 1 Pau Escrich
There is an special syntax for the FILENAME:
32 1 Pau Escrich
33 1 Pau Escrich
<pre>
34 3 Pau Escrich
 <DEVICE>-<EXTRA_INFO>-<FILTER>-<TIMESTAMP>.[OPTIONAL_EXTENSION]
35 1 Pau Escrich
</pre>
36 1 Pau Escrich
37 1 Pau Escrich
Some valid examples are:
38 3 Pau Escrich
# Alix-qMp-sysupgrade-20120411_1932.bin
39 3 Pau Escrich
# RouterStationPro-guifi-sysupgrade-20120410.img
40 3 Pau Escrich
# NanoStationM5-experiment-upgrade-20120211
41 1 Pau Escrich
42 1 Pau Escrich
Of course the image file must be reachable from URL/FILENAME, so an easy way to generate this file is:
43 1 Pau Escrich
# Place your shell in the web server directory (with all the images)
44 1 Pau Escrich
# Execute: md5sum *.bin > IMAGES
45 1 Pau Escrich
46 1 Pau Escrich
47 1 Pau Escrich
h3. Devices file
48 1 Pau Escrich
49 1 Pau Escrich
This file is needed to know which DEVICE_NAME (Alix, RouterStation, etc.) should be use by the device which is upgrading the system.
50 1 Pau Escrich
The syntax is:
51 1 Pau Escrich
<pre>
52 1 Pau Escrich
DEVICE_TYPE_HASH DEVICE_NAME
53 1 Pau Escrich
</pre>
54 1 Pau Escrich
55 1 Pau Escrich
DEVICE_TYPE_HASH is an special hash which is calculated using the next command (from inside the same device!)
56 1 Pau Escrich
57 1 Pau Escrich
<pre>
58 1 Pau Escrich
cat /proc/cpuinfo | egrep  "^vendor_id|^model name|^machine" | md5sum | awk '{print $1}'
59 1 Pau Escrich
</pre>
60 1 Pau Escrich
61 1 Pau Escrich
In theory this HASH is able to identify the kind of device! It works at least for: Alix, RouterStation, NanoStation, Tplink2543
62 1 Pau Escrich
63 1 Pau Escrich
So, when a device checks if there is any new image, it first downloads this file to know which DEVICE_NAME must use.
64 1 Pau Escrich
65 1 Pau Escrich
A valid example of this file:
66 1 Pau Escrich
<pre>
67 1 Pau Escrich
d11c4c408a408f6a14c80b92d24af992 Alix
68 1 Pau Escrich
5c220ec807601507cf28c785d944dcd2 Tplink2543
69 1 Pau Escrich
02f054340bd0eb44c7a9c5a2bbdb49f3 RouterStationPro
70 1 Pau Escrich
</pre>
71 1 Pau Escrich
72 1 Pau Escrich
h3. Executing the upgrade
73 1 Pau Escrich
74 1 Pau Escrich
There is a functions file placed on /etc/qmp/qmp_update.sh This file is used by "qmpcontrol" to perform the actions.
75 1 Pau Escrich
76 1 Pau Escrich
There are three ways to use the upgrade function:
77 1 Pau Escrich
# qmpcontrol upgrade 
78 3 Pau Escrich
# qmpcontrol upgrade http://fw.qmp.cat/testing/Alix-qMp_testing-sysupgrade-20120411_1932.bin
79 3 Pau Escrich
# qmpcontrol upgrade /tmp/Alix-qMp_testing-sysupgrade-20120411_1932.bin
80 1 Pau Escrich
81 1 Pau Escrich
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
82 1 Pau Escrich
83 1 Pau Escrich
Second one upgrades from a specific URL
84 1 Pau Escrich
85 1 Pau Escrich
Third one upgrades from a image placed on the filesystem