Project

General

Profile

Upgrade system » History » Version 5

Roger Pueyo Centelles, 12/16/2014 10:40 AM

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