User Tools

Site Tools


wiki:sw_updates

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
wiki:sw_updates [2019/09/25 11:15]
ghi
— (current)
Line 1: Line 1:
-====== Software updates ====== 
- 
-The KerOS Distribution supports OPKG packages (embedded version compatible with dpkg packages). 
-  
-OPKG packages are used to install customer applications and firmware upgrades (the firmware is installed with an OPKG package). OPKG packages use the ''​.ipk''​ extension. It is strongly recommended to use OPKG packages to deploy binaries/​applications since the backup mechanism relies on it. 
- 
-A package can either be installed using the network or using a USB key. \\ 
- 
-After each update, the file ''/​user/​.update''​ is appended with the status of the update. Update status can be: 
-  * OK 
-  * PARTIAL 
-  * FAILURE 
- 
-Error code can be the following: 
- 
-  * ERROR (10) - Downgrade not allowed 
-  * ERROR (11) - unknown error 
-  * ERROR (12) - dependency issue 
-  * ERROR (13) - incompatible architecture 
- 
-Partial code corresponds to a successful installation that has conflict in configuration files. \\ 
-This can cause a problem during an upgrade if the configuration files contain new field or value required by the updated software. The partial code warns the user that a manual modification of the configuration could be required, the list of the modified (and the location of the new ) configuration file being listed above the update status (''​shadow''​ and ''​hostapd''​ in this example). ​ 
- 
-__Example:​__ 
- 
-<​code> ​ 
- cat /​user/​.update 
-2017.12.01-14:​55:​18 -- Update from bscc_v1.13_klk_wifc.ipk:​ OK 
-2017.12.01-14:​55:​19 -- Update from lorasnmp_v1.13_klk_wifc.ipk:​ OK 
-2017.12.01-14:​55:​19 -- Update Status : updated 2, failed 0 , partial 0 result : OK 
-2017.12.01-15:​00:​44 -- Update from lorasnmp_v1.12_klk_wifc.ipk:​ ERROR (10) 
-2017.12.01-15:​00:​44 -- Update from toto_1.0.0_klk_lpbs.ipk:​ OK 
-2017.12.01-15:​00:​44 -- Update Status : updated 1, failed 1 , partial 0 result : FAILURE 
-2017.12.01-15:​07:​44 Existing conffile /​user/​rootfs_rw/​etc/​shadow is different from the conffile in the new package. 
- The new conffile will be placed at /​user/​rootfs_rw/​etc/​shadow-opkg. 
-Existing conffile /​user/​rootfs_rw/​etc/​hostapd.conf is different from the conffile in the new package. 
- The new conffile will be placed at /​user/​rootfs_rw/​etc/​hostapd.conf-opkg. 
-2017.12.01-15:​07:​45 -- Update from keros_3.3-beta2-38-g12943bcb_klk-wifc.ipk:​ OK 
-2017.12.01-15:​07:​45 -- Update Status : updated 0, failed 0 , partial 1 result : PARTIAL 
-2017.12.01-15:​12:​18 -- Update from lorasnmp.ipk:​ OK 
-2017.12.01-15:​12:​28 -- Update from keros.ipk: OK 
-2017.12.01-15:​12:​28 -- Update from bscc.ipk: OK 
-2017.12.01-15:​12:​28 -- Update Status : updated 3, failed 0 , partial 0 result : OK 
-2017.12.01-15:​12:​28 -- Firmware restored from backup 
-</​code>​ 
- 
-<note warning> 
-Powering off a gateway during a major upgrade will brick it. 
-</​note>​ 
- 
-===== Software update over Network ===== 
- 
-The following example describes how to trigger an update over network. This example uses a package meant to upgrade the firmware, however, the steps are the same for any other package. ​ 
- 
-  - Transfer the KerOS package corresponding to the new firmware in this directory: <code bash> 
-# From a computer: 
-scp keros_2.0.4.ipk root@<​ip_address>:/​user/​.updates/​ 
-</​code>​ 
-  - Ensure file is correctly written: <code bash># On the gateway: 
-sync </​code>​ 
-  - Trigger Update for next reboot: <code bash>​kerosd -u </​code>​ 
-  - Restart: <code bash>​reboot</​code>​ 
-  - **This step is specific to firmware updates.** Check the firmware version in the file ''/​tmp/​sys_startup_status.json''​ under the field ''​sw_version''​. 
- 
- 
-===== Software update over USB ===== 
- 
-The following example describes how to trigger an update over USB key. This example uses a package meant to upgrade the firmware, however, the steps are the same for any other package. 
- 
-<note warning>​For the Wirnet™ iStation, it is necessary to use an accessory to connect the USB stick to the product. It is possible to use either: 
-  * A USB Type C to USB-A adapter 
-  * [[wiki:​connect_istation#​connect_using_the_debug_probe|A Debug probe]] 
-</​note>​ 
- 
-==== Overview ==== 
-  - Prepare a USB key with the following files: 
-    * ''​usb.autorun'':​ Auto executable script 
-    * ''​usbkey.txt'':​ USB password file 
-    * ''​keros_x.y.z.ipk'':​ the update package 
-  - Plug the USB key on the CPU board. 
-  - Wait for status LED fast blinking. Refer to this [[wiki:​peripherals|page]] to know where is status LED on your gateway. 
-  - Unplug the USB key. 
-  - Wait for status LED to be on. 
-  - **This step is specific to firmware updates.** Chek the firmware version in the file ''/​tmp/​sys_startup_status.json''​ under the field ''​sw_version''​. 
-==== Specific files ==== 
- 
-=== usbkey.txt === 
- 
-''​usbkey.txt''​ is a security file. It includes the password of "​usbuser"​ user. \\ 
-Find information about the usbuser password in the [[wiki:​connection_credentials#​default_password|credential chapter]]. 
- 
-In case of consecutive updates on few boards, ''​usbkey.txt''​ can include multiple passwords (limited to 100). One password per line. 
- 
-Here is an example of this file for 3 different boards: 
- 
-++++ 
-File to download - usbkey.txt | 
-<file text usbkey.txt>​ 
-USBklkPassword 
-CustomPassword 
-2ndCustomPassword 
-</​file>​ 
-++++ 
- 
-=== usb.autorun === 
- 
-''​usb.autorun''​ is a script automatically executed by the board if the ''​usbkey.txt''​ file includes a correct password. \\ 
-Anything can be done in this script but here is an example used to deploy a new firmware or/and new packages: ​ 
- 
-++++ 
-File to download - usb.autorun | 
-<file bash usb.autorun>​ 
-#!/bin/sh 
- 
-USBDIR="​`dirname $0`" 
- 
-SYSLEDPATH_4_0_IBTS="/​sys/​class/​leds/​yellow:​debug"​ 
-SYSLEDPATH_4_0_IFEMTO="/​sys/​class/​leds/​led1:​red:​power"​ 
-SYSLEDPATH="/​sys/​class/​leds/​status"​ 
- 
-led_path="/​do/​not/​exist"​ 
-if [ -e "​${SYSLEDPATH}"​ ]; then 
- led_path="​${SYSLEDPATH}"​ 
-elif [ -e "​${SYSLEDPATH_4_0_IBTS}"​ ]; then 
- led_path="​${SYSLEDPATH_4_0_IBTS}"​ 
-elif [ -e "​${SYSLEDPATH_4_0_IFEMTO}"​ ]; then 
- led_path="​${SYSLEDPATH_4_0_IFEMTO}"​ 
-fi 
- 
-# 
-# Set default led behavior 
-# $1: trigger 
-# 
-#    if trigger = timer : $2 = delay_on, $3 = delay_off 
-# 
-set_led() { 
- trigger="​${1}"​ 
- on="​$2"​ 
- off="​$3"​ 
- 
- if [ -e "​${led_path}"​ ]; then 
- echo $trigger > "​${led_path}/​trigger"​ 
- case "​$trigger"​ in 
- "​timer"​) 
- echo ${on:=500} > "​${led_path}/​delay_on"​ 
- echo ${off:=500} > "​${led_path}/​delay_off"​ 
- ;; 
- "​none"​) 
- echo ${on:=0} > "​${led_path}/​brightness"​ 
- ;; 
- *) 
- # Nothing to do 
- ;; 
- esac 
- fi 
-} 
- 
- 
-deploy_packages() 
-{ 
- mkdir -p /​user/​.updates 
- for pkg in ${USBDIR}/​*.ipk 
- do 
- cp ${pkg} /​user/​.updates/​ 
- done 
- sync 
-} 
- 
-# 
-# Force the system to put the packages immediatly in backup 
-# 
-force_backup() 
-{ 
- touch /​user/​.updates/​force_backup 
- sync 
-} 
- 
- 
-# 
-# Trigger update and reboot in $1 minutes (or '​now'​) 
-# 
-trigger_update() 
-{ 
- REBOOT_TIMEOUT=$1 
- 
- kerosd -u 
- [ ${REBOOT_TIMEOUT:​=0} -ne 0 ] && shutdown -r ${REBOOT_TIMEOUT} 
-} 
- 
- 
-#####################​ 
-#     MAIN 
-#####################​ 
- 
-# Set led On 
-set_led none 1 
- 
-# Deploy packages 
-deploy_packages 
- 
-# Trigger Update 
-trigger_update 
- 
-# Optional: Force the system to put the packages immediatly in backup 
-#​force_backup 
- 
-# Prepare reboot after USB unplug 
-cat > /​tmp/​usbkey_remove << EOF 
-# Switch off Led 
-echo "​none"​ > ${led_path}/​trigger 
- 
-# Reboot Now to get Update 
-reboot 
-EOF 
- 
-# All is right, make Led blinking fast to notify User 
-set_led "​timer"​ 100 100 
-</​file>​ 
-++++ 
- 
  
wiki/sw_updates.1569402904.txt.gz · Last modified: 2019/09/25 11:15 by ghi