SlideShare una empresa de Scribd logo
1 de 45
Descargar para leer sin conexión
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Diego Rondini
Orchestrated Android-Style System
Upgrades for Embedded Linux
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
What this session is about
Manage and rollout software updates
on Embedded Linux devices and apply them
like Android does.
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Agenda
❯ Motivations for our work with OTA updates on Embedded Linux
❯ The Android way for managing updates
❯ Embedded Linux updates agent: SWUpdate
❯ Remote management and rollout campaigns: Eclipse hawkBit
❯ Our implementation to manage and deploy software updates
Android-like: Update Factory
❯ Demo.
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Motivations
❯ Support medium scale general purpose CPU-SOC modules
❯ Install atomically a new OS on a device
》 Atomicity of the update
❯ Track updates and divide them per device types and use cases
❯ Support custom device metadata sent to the Remote Update
Management Platform
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Preamble
❯ Boundary Devices Nitrogen6x
as reference
》 NXP i.MX6 platform (meta-freescale)
》 U-Boot on NOR flash
》 boot and root partition
❯ we refer to traditional Android single copy OTA
》 recent Pixel devices with big storage use Chrome OS based double copy OTA
❯ designed for biggest freedom of storage access while still
running in a Linux OS
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Android update: approach to OTA updates
❯ Android approach splits the upgrade process in two phases:
》 preparation for the upgrade → performed in the full fledged Regular OS
》 execution of the upgrade → performed in a purpose built Recovery OS
❯ Execution performed by the recovery binary
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Recovery Partition
Android update Workflow
Recovery OS
Regular OS
Recovery bin
Bootloader
Update bin
Update script
Reboot
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Android update: preparation
❯ Preparation on the Device flow:
》 registers to the cloud
》 polls for available updates
》 notifies update is available (Download? Y/n)
》 notifies update is ready to install (Proceed? Y/n)
》 reboot to Recovery OS
❯ Verification of package signatures
https://developer.android.com/reference/android/os/RecoverySystem.html#verifyPac
kage(java.io.File,%20android.os.RecoverySystem.ProgressListener,%20java.io.File)
❯ Installation setup and reboot in recovery mode
https://developer.android.com/reference/android/os/RecoverySystem.html#installPa
ckage(android.content.Context,%20java.io.File)
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Android update: execution
❯ Bootloader/bootscript gets “reset cause” (i.MX6 Family) and
boots in ramdisk-based Recovery Mode
❯ recovery starts
❯ recovery unpacks the update file provided (signed zip)
❯ update-binary executes actions in the updater-script (edify)
❯ log and result files are written in the partition
❯ reboot to Regular OS
❯ https://source.android.com/devices/tech/ota/device_code
❯ https://github.com/boundarydevices/android_device_boundary/commit/f069efd28d7d55
e1cc298662881b9ceabb4650e3#diff-a55e09ca16b027ed99c01ca6765d9cca
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Snippet: bootscript (i.MX6)
+setenv bootpart 1
+
+setexpr rval *0x020CC068 & 0x180 # get reset cause
+if itest.s "x$rval" -eq "x100"; then
+ echo "----------- run fastboot here";
+else
+ if itest.s "x$rval" -eq "x80"; then
+ setenv bootpart 2;
+ fi
+fi
+
+mw.l 0x020cc068 0 1
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Android Update: advantages
❯ Single copy update featuring a recovery OS
❯ OTA agent runs in regular OS
》 No need to interrupt normal operation (yet)
》 Network access (e.g. Wifi setup by the user)
》 Interaction with the user (notifications / acknowledgment)
》 Full API access (Wifi or 3G/4G? Low battery?)
❯ Recovery has no need of network access, all artifacts are
pre-fetched
❯ Update script support binary writing (no mount is required)
❯ Recovery environment is RO, minimal, isolated
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Part One: Device Update Approaches
❯ Double copy:
》 The devices features two copies
of the Application/OS/RootFS
》 Each copy must contain the
kernel, the root file system,
and each further component that
can be updated
》 Cooperation with the boot
loader is necessary to decide
which copy should be booted
❯ Single copy:
》 A separate upgrade OS is required
》 You may update Kernel and Device
Tree if the update environment is
segregated
》 Cooperation with the bootloader is
necessary to boot in update mode
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Double copy
Dual Boot Partition
Bootable system 1
ramdisk
rootfs
kernel
device tree
bootscript
Boot partition 1
rootfs partition 1
Bootable system 2
ramdisk
rootfs
kernel
device tree
bootscript
Boot partition 2
rootfs partition 2
bootloader
bootenv boot selection
Unpartitioned Space
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Double copy
Single Boot
Partition
bootloader
bootenv boot selection
Unpartitioned Space
ramdisk
kernel
device tree
bootscript
Boot partition 1
rootfs
rootfs partition 1
rootfs
rootfs partition 2
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Single copy
Simple
bootloader
bootenv boot selection
Unpartitioned Space
ramdisk
kernel
device tree
bootscript
Boot partition 1
system
recovery
rootfs
rootfs partition 1
Bootable system 1
system recovery BLOB
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Double Copy: Pros and Cons
❯ Pros:
》 Fallback in case of failure
》 Pretty easy to implement
❯ Cons:
》 Expensive in terms of storage resources, double the space
》 Requires a mechanism to switch between running and other copy if multiple
partitions are doubled (e.g. boot, root)
》 Identify which copy is running
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Single Copy: Pros and Cons
❯ Pros:
》 Requires smaller amount of space
》 “Update mode” lives in RAM
》 Can freely access whole storage (rewrite from scratch, including partition
table)
》 Can be used for factory reset (tftpboot / USB boot)
❯ Cons:
》 No fallback if write fails (e.g. power interruption). Restart recovery mode
to try again
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Embedded Linux like Android ?
❯ A good option for building a recovery system “Android Like”
Linux is SWUpdate:
》 Written in C by Stefano Babic (Denx) and contributors
》 Runs as Daemon or direct invocation
》 Update files (.swu) based on CPIO format
》 Several handlers (e.g. write raw data, write single file)
》 Update files scripting features (LUA)
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
SWUpdate: Architecture
Notifier
Installer
Default
Parser
LUA Parser
Handler Manager
UBI MTD RAW ENV LUA
Local
Storage
Remote file
server
Web Server
Custom
protocol
MCU
hawkBit
START,RUN, SUCCESS, FAILURE, DOWLOAD, DONE
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
SWUpdate: features
❯ Local interfaces:
》 Local storage (USB, SD) as artifacts source
》 Support local peripheral devices, through USB/UART for streaming update (i.e
MCU)
》 Embedded Web Server as local UI
❯ Remote interfaces:
》 HTTP, FTP
》 hawkBit (Suricatta embedded client)
❯ Signature and encryption of update files
❯ Handlers
》 U-boot for reading environment variables
》 Shell pre/post install scripts (also LUA)
》 Default config parser using libconfig (to parse update description file)
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
SWUpdate: single image format
CPIO Header
sw-descriptor
Image 1
Image 2
Image (n)
software =
{
version = "0.1.0";
target = {
hardware-compatibility: [ "1.0"];
Images: (
{
filename = “rootfs.ext4.”;
device = /dev/mmcblk0p2”;
type = “raw”;
compressed = true;
}
);
scripts:(
{
filename = “installscript.sh”;
type = “schellscript”;
sha256 = “faaaa30c….”;
}
);
}
}
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Security notes
❯ SWUpdate combines signed sw-description with the verification
of hashes for each single image.
》 RSA PKCS#1 (public/private)
》 CMS PKCS#7 (certificates)
❯ This means that only signed sw-description, generated by a
verified source, can be trusted by the installer.
》 sw-description.sig
》 Public.pem can be passed to SWUpdate daemon (on the device)
❯ sw-description contains hashes for each sub-image to verify
that each delivered subimage really belongs to the release.
》 Each image inside sw-description must have the attribute “sha256”
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Security notes: sign and configuration
#!/bin/bash
MODE="RSA"
PRODUCT_NAME="myproduct"
CONTAINER_VER="1.0"
IMAGES="rootfs kernel"
FILES="sw-description sw-description.sig $IMAGES"
#if you use RSA
if [ x"$MODE" == "xRSA" ]; then
openssl dgst -sha256 -sign priv.pem sw-description >
sw-description.sig
else
openssl cms -sign -in sw-description -out sw-description.sig
-signer mycert.cert.pem 
-inkey mycert.key.pem -outform DER -nosmimecap -binary
fi
for i in $FILES;do
echo $i;done | cpio -ov -H crc >
${PRODUCT_NAME}_${CONTAINER_VER}.swu
software =
{
version = "0.1.0";
hardware-compatibility: [ "revC"];
images: (
{
filename =
"core-image-full-cmdline-beaglebone.ext3";
device = "/dev/mmcblk0p2";
type = "raw";
sha256 =
"43cdedde429d1ee379a7d91e3e7c4b0b9ff952543a91a55bb2221e5c72cb
342b";
}
);
scripts: (
{
filename = "install.sh";
type = "shellscript";
sha256 =
"f53e0b271af4c2896f56a6adffa79a1ffa3e373c9ac96e00c4cfc577b9be
a5f1";
}
);
}
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Security notes: encryption
❯ SWUpdate supports encrypted images
》 SWUpdate allows to symmetrically encrypt update images using the 256 bit
AES block cipher in CBC mode
》 encrypted = true parameter in sw-description
software =
{
version = "0.0.1";
images: ( {
filename = "core-image-full-cmdline-beaglebone.ext3.enc";
device = "/dev/mmcblk0p3";
encrypted = true;
}
);
}
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Case Study: Warp board
❯ Small wearable reference platform
❯ Community: www.warpx.io
❯ Support for SWUpdate for OS updates
❯ Single image
》 From bootloader, flash stand alone
SWUpdate OS Image on the eMMC
■ (UMS): dd img file
■ mmc read ${initrd_addr} 0x2000 0xAA80
》 Boot the SWUpdate OS image
》 Load module for USB over ethernet
》 From a host use browser and upload the
SWU image
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Part 2: Eclipse hawkBit
The Eclipse Foundation has been very active in promoting significative
projects for the IoT, in particular under the umbrella of the Eclipse IoT
community.
Eclipse IoT is an ecosystem of companies and individuals that are working
together to establish an Internet of Things based on open technologies.
https://iot.eclipse.org, https://eclipse.org/hawkbit/
One of the (many) projects is hawkBit “to create a domain independent back
end solution for rolling out software updates to constrained edge devices
connected to IP based networking infrastructure”
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
hawkBit overview
❯ User/Applications
》 UI
》 MGMT (API)
❯ Devices
》 DDI
(HTTP/REST/JSON)
》 DMF (AMQP)
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
hawkBit Architecture
Kafka?
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
<<VM>>
RabbitMQ
<<Exchange>>
X
<<VM>> <<VM>> <<VM>>
Clustering
hawkBit
Node 3
hawkBit
Node 2
hawkBit
Node 1
Caches Caches
Caches
request
User action
Storage
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
hawkBit: workflow of a rollout campaign
❯ Prepare the update file and upload it
❯ Create a Software Module and add an artifact to it
❯ Create a Distribution
❯ Rollout a distribution to Targets
❯ Targets features:
》 Attributes (i.e HW revision, custom)
》 Tags (for grouping purposes)
》 Others like device description, what installed, logs, etc..
❯ Rollouts can be managed by groups
》 TAG filter
》 Group threshold
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Platform to manage and deliver software update artifacts which are deployed on
single copy Linux and Android devices, featuring recovery mode
Or simply….
“Manage and Deploy Android-like software updates on Embedded Linux!”
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Update Factory Architecture
❯ Service on the embedded device
》 Gnu/Linux featuring SWUpdate
》 Android Service featuring Update Server API
❯ Update Server featuring hawkBit™
❯ IAM Server
❯ Artifact Repository
❯ Metadata Repository
❯ MsgBroker
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Android “like” behaviour on Embedded Linux
Update Factory implements all the missing bits to have an
Android-like OTA mechanism on an Embedded Linux OS
❯ Device to cloud communication
❯ Bootloader coordination (boot OS selection)
❯ Recovery partition
❯ Recovery bootscript
❯ Recovery ramdisk
❯ Update installation feedback to the cloud
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Update Factory: Linux Update Anatomy
Bootloader
bootenv boot_mode
Space non partitioned
ramdisk
kernel
device tree
bootscript
Boot partition
rootfs partition
ramdisk
kernel
device tree
bootscript

Recovery Partition
.swu
cache partition
suricatta =
{
Tenant = “foo”;
Id = “bar”;
Url = "
https://updatefactory.io";
};
Regular OS Recovery OS
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Update Factory: device to cloud
SWUpdate implements the suricatta daemon mode which polls remote
update server hawkBit.
Configuration file:
suricatta :
{
tenant = "system";
id = "device";
url = "https://updatefactory.io";
artifactsstorage = "/recovery/updates";
};
isolated set of data
and configuration
unique device identifier
baseurl for request
URL generation
new option to download
update files (no install)
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Update Factory: bootloader coordination
❯ Switch between Regular OS and Recovery OS by changing
bootloader environment variables
❯ distro_bootcmd current U-Boot standard solution for distro
booting across different boards
❯ if boot_mode variable is set to update force the number of the
partition to boot from:
bootcmd=run update_bootcmd; run distro_bootcmd
update_bootcmd=if test "${boot_mode}" = "update"; then echo "Update mode selected";
setenv distro_bootpart 3; setenv scan_dev_for_boot_part run scan_dev_for_boot; fi
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Update Factory: recovery partition
Yocto now has wic support for easier and streamlined partition
creation and management.
Addition of recovery partition:
❯ new filescopy wic plugin to populate the partition
❯ .wks descriptor file
》 part --source filescopy --size 1000 --fstype=ext4 --label recovery --align 4
❯ “by-label” fstab entry
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Update Factory: bootscript & ramdisk
Recovery bootscript loads the recovery ramdisk
load ${devtype} ${devnum}:${distro_bootpart} ${a_ramdisk} ${prefix}swupdate.img
bootz ${a_zImage} ${a_ramdisk} ${a_fdt}
Recovery OS ramdisk:
❯ minimal Linux OS
❯ SWUpdate to install update files from local storage
❯ filesystem utils
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Update Factory: installation feedback
hawkBit server needs to know if update applied successfully.
SWUpdate suricatta daemon:
❯ reads ustate bootloader variable (update is installed or
failed)
❯ provides feedback to hawkBit from Regular OS
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Update Factory: future developments
❯ expand support to other boards and SOCs
❯ manual recovery mode to update from local storage (e.g. USB)
if connection is broken
❯ store update files in separate partition / storage
❯ support to update Recovery OS from the Regular OS as a second
step of the update process
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Update Factory goals
❯ Support medium scale general purpose CPU-SOC deployments
❯ Android like OTA update strategy for Embedded Linux based on
single image approach
❯ Update core components of the system
❯ Provide a solid integration with Yocto Linux to facilitate the
adoption
❯ Remote Update Management Platform as a service
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Links
❯ https://www.kynetics.com/update-factory
❯ https://docs.updatefactory.io/
❯ https://github.com/Kynetics/meta-updatefactory
❯ http://warpx.io/blog/tutorial/easy-os-upgrades-swupdate
❯ https://eclipse.org/hawkbit/
❯ https://sbabic.github.io/swupdate
❯ https://android.googlesource.com/platform/bootable/recovery/+/
android-8.0.0_r4/recovery.cpp#167
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Thanks:
Nicola La Gloria, Andrea Zoleo, Will Martindale,
Daniele Sergio, Roberto Sartori, Eric Nelson,
Gary Bisson (Boundary Devices), Gabriel Huau
(witekio) and Amit Pundir (Linaro).
and...
Thanks to my daughter Marianna for the drawing!
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Contacts:
USA
Kynetics LLC
2040 Martin Ave, Santa Clara CA 95050
Ph: +1 (408) 475 7760
Italy
Kynetics Srl
Via G. Longhin, Padova (PD) 35129
Ph: +39 (049) 781 1091
info@kynetics.com | www.kynetics.com
Diego Rondini, www.kynetics.com
Embedded Linux Conference Europe 2017, Prague
Android
Space non partitioned
uramdisk
kernel
device tree
bootscript
Boot partition
Android UF Service
Android UF Client App
kernel
device tree

Recovery Partition
Tenant = foo
Id = bar
Url = https:/updatefactory.io"
uramdisk
cache partition
.zip



Other default partitions
SoC
bootloader

Más contenido relacionado

Similar a Orchestrated Android-Style System Upgrades for Embedded Linux

Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Arun prasath
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made EasyAlon Fliess
 
Docker module 1
Docker module 1Docker module 1
Docker module 1Liang Bo
 
OpenShift 4 installation
OpenShift 4 installationOpenShift 4 installation
OpenShift 4 installationRobert Bohne
 
OpenStack Tokyo Talk Application Data Protection Service
OpenStack Tokyo Talk Application Data Protection ServiceOpenStack Tokyo Talk Application Data Protection Service
OpenStack Tokyo Talk Application Data Protection ServiceEran Gampel
 
Introduction to NodeJS JSX is an extended Javascript based language used by R...
Introduction to NodeJS JSX is an extended Javascript based language used by R...Introduction to NodeJS JSX is an extended Javascript based language used by R...
Introduction to NodeJS JSX is an extended Javascript based language used by R...JEEVANANTHAMG6
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Androidnatdefreitas
 
Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015Microsoft
 
R12 d49656 gc10-apps dba 01
R12 d49656 gc10-apps dba 01R12 d49656 gc10-apps dba 01
R12 d49656 gc10-apps dba 01zeesniper
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 augVincent De Smet
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developerPaul Czarkowski
 
OpenShift_Installation_Deep_Dive_Robert_Bohne.pdf
OpenShift_Installation_Deep_Dive_Robert_Bohne.pdfOpenShift_Installation_Deep_Dive_Robert_Bohne.pdf
OpenShift_Installation_Deep_Dive_Robert_Bohne.pdfssuser9e06a61
 
Introducing resinOS: An Operating System Tailored for Containers and Built fo...
Introducing resinOS: An Operating System Tailored for Containers and Built fo...Introducing resinOS: An Operating System Tailored for Containers and Built fo...
Introducing resinOS: An Operating System Tailored for Containers and Built fo...Balena
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011pundiramit
 
How to deploy a Java application on Google App engine Flexible environment
How to deploy a Java application on Google App engine Flexible environmentHow to deploy a Java application on Google App engine Flexible environment
How to deploy a Java application on Google App engine Flexible environmentMichelantonio Trizio
 
Managing Your Runtime With P2
Managing Your Runtime With P2Managing Your Runtime With P2
Managing Your Runtime With P2Pascal Rapicault
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned RightScale
 
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024Cloud Native NoVA
 

Similar a Orchestrated Android-Style System Upgrades for Embedded Linux (20)

Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment Docker - Demo on PHP Application deployment
Docker - Demo on PHP Application deployment
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
OpenShift 4 installation
OpenShift 4 installationOpenShift 4 installation
OpenShift 4 installation
 
OpenStack Tokyo Talk Application Data Protection Service
OpenStack Tokyo Talk Application Data Protection ServiceOpenStack Tokyo Talk Application Data Protection Service
OpenStack Tokyo Talk Application Data Protection Service
 
Introduction to NodeJS JSX is an extended Javascript based language used by R...
Introduction to NodeJS JSX is an extended Javascript based language used by R...Introduction to NodeJS JSX is an extended Javascript based language used by R...
Introduction to NodeJS JSX is an extended Javascript based language used by R...
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015Red Hat Forum Benelux 2015
Red Hat Forum Benelux 2015
 
R12 d49656 gc10-apps dba 01
R12 d49656 gc10-apps dba 01R12 d49656 gc10-apps dba 01
R12 d49656 gc10-apps dba 01
 
Develop with docker 2014 aug
Develop with docker 2014 augDevelop with docker 2014 aug
Develop with docker 2014 aug
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developer
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 
OpenShift_Installation_Deep_Dive_Robert_Bohne.pdf
OpenShift_Installation_Deep_Dive_Robert_Bohne.pdfOpenShift_Installation_Deep_Dive_Robert_Bohne.pdf
OpenShift_Installation_Deep_Dive_Robert_Bohne.pdf
 
Introducing resinOS: An Operating System Tailored for Containers and Built fo...
Introducing resinOS: An Operating System Tailored for Containers and Built fo...Introducing resinOS: An Operating System Tailored for Containers and Built fo...
Introducing resinOS: An Operating System Tailored for Containers and Built fo...
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
How to deploy a Java application on Google App engine Flexible environment
How to deploy a Java application on Google App engine Flexible environmentHow to deploy a Java application on Google App engine Flexible environment
How to deploy a Java application on Google App engine Flexible environment
 
Managing Your Runtime With P2
Managing Your Runtime With P2Managing Your Runtime With P2
Managing Your Runtime With P2
 
App container rkt
App container rktApp container rkt
App container rkt
 
Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
 
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
A Love Story with Kubevirt and Backstage from Cloud Native NoVA meetup Feb 2024
 

Último

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 

Último (20)

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 

Orchestrated Android-Style System Upgrades for Embedded Linux

  • 1. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Diego Rondini Orchestrated Android-Style System Upgrades for Embedded Linux
  • 2. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague What this session is about Manage and rollout software updates on Embedded Linux devices and apply them like Android does.
  • 3. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Agenda ❯ Motivations for our work with OTA updates on Embedded Linux ❯ The Android way for managing updates ❯ Embedded Linux updates agent: SWUpdate ❯ Remote management and rollout campaigns: Eclipse hawkBit ❯ Our implementation to manage and deploy software updates Android-like: Update Factory ❯ Demo.
  • 4. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Motivations ❯ Support medium scale general purpose CPU-SOC modules ❯ Install atomically a new OS on a device 》 Atomicity of the update ❯ Track updates and divide them per device types and use cases ❯ Support custom device metadata sent to the Remote Update Management Platform
  • 5. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Preamble ❯ Boundary Devices Nitrogen6x as reference 》 NXP i.MX6 platform (meta-freescale) 》 U-Boot on NOR flash 》 boot and root partition ❯ we refer to traditional Android single copy OTA 》 recent Pixel devices with big storage use Chrome OS based double copy OTA ❯ designed for biggest freedom of storage access while still running in a Linux OS
  • 6. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Android update: approach to OTA updates ❯ Android approach splits the upgrade process in two phases: 》 preparation for the upgrade → performed in the full fledged Regular OS 》 execution of the upgrade → performed in a purpose built Recovery OS ❯ Execution performed by the recovery binary
  • 7. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Recovery Partition Android update Workflow Recovery OS Regular OS Recovery bin Bootloader Update bin Update script Reboot
  • 8. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Android update: preparation ❯ Preparation on the Device flow: 》 registers to the cloud 》 polls for available updates 》 notifies update is available (Download? Y/n) 》 notifies update is ready to install (Proceed? Y/n) 》 reboot to Recovery OS ❯ Verification of package signatures https://developer.android.com/reference/android/os/RecoverySystem.html#verifyPac kage(java.io.File,%20android.os.RecoverySystem.ProgressListener,%20java.io.File) ❯ Installation setup and reboot in recovery mode https://developer.android.com/reference/android/os/RecoverySystem.html#installPa ckage(android.content.Context,%20java.io.File)
  • 9. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Android update: execution ❯ Bootloader/bootscript gets “reset cause” (i.MX6 Family) and boots in ramdisk-based Recovery Mode ❯ recovery starts ❯ recovery unpacks the update file provided (signed zip) ❯ update-binary executes actions in the updater-script (edify) ❯ log and result files are written in the partition ❯ reboot to Regular OS ❯ https://source.android.com/devices/tech/ota/device_code ❯ https://github.com/boundarydevices/android_device_boundary/commit/f069efd28d7d55 e1cc298662881b9ceabb4650e3#diff-a55e09ca16b027ed99c01ca6765d9cca
  • 10. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Snippet: bootscript (i.MX6) +setenv bootpart 1 + +setexpr rval *0x020CC068 & 0x180 # get reset cause +if itest.s "x$rval" -eq "x100"; then + echo "----------- run fastboot here"; +else + if itest.s "x$rval" -eq "x80"; then + setenv bootpart 2; + fi +fi + +mw.l 0x020cc068 0 1
  • 11. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Android Update: advantages ❯ Single copy update featuring a recovery OS ❯ OTA agent runs in regular OS 》 No need to interrupt normal operation (yet) 》 Network access (e.g. Wifi setup by the user) 》 Interaction with the user (notifications / acknowledgment) 》 Full API access (Wifi or 3G/4G? Low battery?) ❯ Recovery has no need of network access, all artifacts are pre-fetched ❯ Update script support binary writing (no mount is required) ❯ Recovery environment is RO, minimal, isolated
  • 12. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Part One: Device Update Approaches ❯ Double copy: 》 The devices features two copies of the Application/OS/RootFS 》 Each copy must contain the kernel, the root file system, and each further component that can be updated 》 Cooperation with the boot loader is necessary to decide which copy should be booted ❯ Single copy: 》 A separate upgrade OS is required 》 You may update Kernel and Device Tree if the update environment is segregated 》 Cooperation with the bootloader is necessary to boot in update mode
  • 13. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Double copy Dual Boot Partition Bootable system 1 ramdisk rootfs kernel device tree bootscript Boot partition 1 rootfs partition 1 Bootable system 2 ramdisk rootfs kernel device tree bootscript Boot partition 2 rootfs partition 2 bootloader bootenv boot selection Unpartitioned Space
  • 14. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Double copy Single Boot Partition bootloader bootenv boot selection Unpartitioned Space ramdisk kernel device tree bootscript Boot partition 1 rootfs rootfs partition 1 rootfs rootfs partition 2
  • 15. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Single copy Simple bootloader bootenv boot selection Unpartitioned Space ramdisk kernel device tree bootscript Boot partition 1 system recovery rootfs rootfs partition 1 Bootable system 1 system recovery BLOB
  • 16. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Double Copy: Pros and Cons ❯ Pros: 》 Fallback in case of failure 》 Pretty easy to implement ❯ Cons: 》 Expensive in terms of storage resources, double the space 》 Requires a mechanism to switch between running and other copy if multiple partitions are doubled (e.g. boot, root) 》 Identify which copy is running
  • 17. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Single Copy: Pros and Cons ❯ Pros: 》 Requires smaller amount of space 》 “Update mode” lives in RAM 》 Can freely access whole storage (rewrite from scratch, including partition table) 》 Can be used for factory reset (tftpboot / USB boot) ❯ Cons: 》 No fallback if write fails (e.g. power interruption). Restart recovery mode to try again
  • 18. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Embedded Linux like Android ? ❯ A good option for building a recovery system “Android Like” Linux is SWUpdate: 》 Written in C by Stefano Babic (Denx) and contributors 》 Runs as Daemon or direct invocation 》 Update files (.swu) based on CPIO format 》 Several handlers (e.g. write raw data, write single file) 》 Update files scripting features (LUA)
  • 19. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague SWUpdate: Architecture Notifier Installer Default Parser LUA Parser Handler Manager UBI MTD RAW ENV LUA Local Storage Remote file server Web Server Custom protocol MCU hawkBit START,RUN, SUCCESS, FAILURE, DOWLOAD, DONE
  • 20. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague SWUpdate: features ❯ Local interfaces: 》 Local storage (USB, SD) as artifacts source 》 Support local peripheral devices, through USB/UART for streaming update (i.e MCU) 》 Embedded Web Server as local UI ❯ Remote interfaces: 》 HTTP, FTP 》 hawkBit (Suricatta embedded client) ❯ Signature and encryption of update files ❯ Handlers 》 U-boot for reading environment variables 》 Shell pre/post install scripts (also LUA) 》 Default config parser using libconfig (to parse update description file)
  • 21. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague SWUpdate: single image format CPIO Header sw-descriptor Image 1 Image 2 Image (n) software = { version = "0.1.0"; target = { hardware-compatibility: [ "1.0"]; Images: ( { filename = “rootfs.ext4.”; device = /dev/mmcblk0p2”; type = “raw”; compressed = true; } ); scripts:( { filename = “installscript.sh”; type = “schellscript”; sha256 = “faaaa30c….”; } ); } }
  • 22. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Security notes ❯ SWUpdate combines signed sw-description with the verification of hashes for each single image. 》 RSA PKCS#1 (public/private) 》 CMS PKCS#7 (certificates) ❯ This means that only signed sw-description, generated by a verified source, can be trusted by the installer. 》 sw-description.sig 》 Public.pem can be passed to SWUpdate daemon (on the device) ❯ sw-description contains hashes for each sub-image to verify that each delivered subimage really belongs to the release. 》 Each image inside sw-description must have the attribute “sha256”
  • 23. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Security notes: sign and configuration #!/bin/bash MODE="RSA" PRODUCT_NAME="myproduct" CONTAINER_VER="1.0" IMAGES="rootfs kernel" FILES="sw-description sw-description.sig $IMAGES" #if you use RSA if [ x"$MODE" == "xRSA" ]; then openssl dgst -sha256 -sign priv.pem sw-description > sw-description.sig else openssl cms -sign -in sw-description -out sw-description.sig -signer mycert.cert.pem -inkey mycert.key.pem -outform DER -nosmimecap -binary fi for i in $FILES;do echo $i;done | cpio -ov -H crc > ${PRODUCT_NAME}_${CONTAINER_VER}.swu software = { version = "0.1.0"; hardware-compatibility: [ "revC"]; images: ( { filename = "core-image-full-cmdline-beaglebone.ext3"; device = "/dev/mmcblk0p2"; type = "raw"; sha256 = "43cdedde429d1ee379a7d91e3e7c4b0b9ff952543a91a55bb2221e5c72cb 342b"; } ); scripts: ( { filename = "install.sh"; type = "shellscript"; sha256 = "f53e0b271af4c2896f56a6adffa79a1ffa3e373c9ac96e00c4cfc577b9be a5f1"; } ); }
  • 24. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Security notes: encryption ❯ SWUpdate supports encrypted images 》 SWUpdate allows to symmetrically encrypt update images using the 256 bit AES block cipher in CBC mode 》 encrypted = true parameter in sw-description software = { version = "0.0.1"; images: ( { filename = "core-image-full-cmdline-beaglebone.ext3.enc"; device = "/dev/mmcblk0p3"; encrypted = true; } ); }
  • 25. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Case Study: Warp board ❯ Small wearable reference platform ❯ Community: www.warpx.io ❯ Support for SWUpdate for OS updates ❯ Single image 》 From bootloader, flash stand alone SWUpdate OS Image on the eMMC ■ (UMS): dd img file ■ mmc read ${initrd_addr} 0x2000 0xAA80 》 Boot the SWUpdate OS image 》 Load module for USB over ethernet 》 From a host use browser and upload the SWU image
  • 26. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Part 2: Eclipse hawkBit The Eclipse Foundation has been very active in promoting significative projects for the IoT, in particular under the umbrella of the Eclipse IoT community. Eclipse IoT is an ecosystem of companies and individuals that are working together to establish an Internet of Things based on open technologies. https://iot.eclipse.org, https://eclipse.org/hawkbit/ One of the (many) projects is hawkBit “to create a domain independent back end solution for rolling out software updates to constrained edge devices connected to IP based networking infrastructure”
  • 27. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague hawkBit overview ❯ User/Applications 》 UI 》 MGMT (API) ❯ Devices 》 DDI (HTTP/REST/JSON) 》 DMF (AMQP)
  • 28. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague hawkBit Architecture Kafka?
  • 29. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague <<VM>> RabbitMQ <<Exchange>> X <<VM>> <<VM>> <<VM>> Clustering hawkBit Node 3 hawkBit Node 2 hawkBit Node 1 Caches Caches Caches request User action Storage
  • 30. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague hawkBit: workflow of a rollout campaign ❯ Prepare the update file and upload it ❯ Create a Software Module and add an artifact to it ❯ Create a Distribution ❯ Rollout a distribution to Targets ❯ Targets features: 》 Attributes (i.e HW revision, custom) 》 Tags (for grouping purposes) 》 Others like device description, what installed, logs, etc.. ❯ Rollouts can be managed by groups 》 TAG filter 》 Group threshold
  • 31. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Platform to manage and deliver software update artifacts which are deployed on single copy Linux and Android devices, featuring recovery mode Or simply…. “Manage and Deploy Android-like software updates on Embedded Linux!”
  • 32. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Update Factory Architecture ❯ Service on the embedded device 》 Gnu/Linux featuring SWUpdate 》 Android Service featuring Update Server API ❯ Update Server featuring hawkBit™ ❯ IAM Server ❯ Artifact Repository ❯ Metadata Repository ❯ MsgBroker
  • 33. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Android “like” behaviour on Embedded Linux Update Factory implements all the missing bits to have an Android-like OTA mechanism on an Embedded Linux OS ❯ Device to cloud communication ❯ Bootloader coordination (boot OS selection) ❯ Recovery partition ❯ Recovery bootscript ❯ Recovery ramdisk ❯ Update installation feedback to the cloud
  • 34. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Update Factory: Linux Update Anatomy Bootloader bootenv boot_mode Space non partitioned ramdisk kernel device tree bootscript Boot partition rootfs partition ramdisk kernel device tree bootscript Recovery Partition .swu cache partition suricatta = { Tenant = “foo”; Id = “bar”; Url = " https://updatefactory.io"; }; Regular OS Recovery OS
  • 35. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Update Factory: device to cloud SWUpdate implements the suricatta daemon mode which polls remote update server hawkBit. Configuration file: suricatta : { tenant = "system"; id = "device"; url = "https://updatefactory.io"; artifactsstorage = "/recovery/updates"; }; isolated set of data and configuration unique device identifier baseurl for request URL generation new option to download update files (no install)
  • 36. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Update Factory: bootloader coordination ❯ Switch between Regular OS and Recovery OS by changing bootloader environment variables ❯ distro_bootcmd current U-Boot standard solution for distro booting across different boards ❯ if boot_mode variable is set to update force the number of the partition to boot from: bootcmd=run update_bootcmd; run distro_bootcmd update_bootcmd=if test "${boot_mode}" = "update"; then echo "Update mode selected"; setenv distro_bootpart 3; setenv scan_dev_for_boot_part run scan_dev_for_boot; fi
  • 37. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Update Factory: recovery partition Yocto now has wic support for easier and streamlined partition creation and management. Addition of recovery partition: ❯ new filescopy wic plugin to populate the partition ❯ .wks descriptor file 》 part --source filescopy --size 1000 --fstype=ext4 --label recovery --align 4 ❯ “by-label” fstab entry
  • 38. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Update Factory: bootscript & ramdisk Recovery bootscript loads the recovery ramdisk load ${devtype} ${devnum}:${distro_bootpart} ${a_ramdisk} ${prefix}swupdate.img bootz ${a_zImage} ${a_ramdisk} ${a_fdt} Recovery OS ramdisk: ❯ minimal Linux OS ❯ SWUpdate to install update files from local storage ❯ filesystem utils
  • 39. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Update Factory: installation feedback hawkBit server needs to know if update applied successfully. SWUpdate suricatta daemon: ❯ reads ustate bootloader variable (update is installed or failed) ❯ provides feedback to hawkBit from Regular OS
  • 40. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Update Factory: future developments ❯ expand support to other boards and SOCs ❯ manual recovery mode to update from local storage (e.g. USB) if connection is broken ❯ store update files in separate partition / storage ❯ support to update Recovery OS from the Regular OS as a second step of the update process
  • 41. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Update Factory goals ❯ Support medium scale general purpose CPU-SOC deployments ❯ Android like OTA update strategy for Embedded Linux based on single image approach ❯ Update core components of the system ❯ Provide a solid integration with Yocto Linux to facilitate the adoption ❯ Remote Update Management Platform as a service
  • 42. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Links ❯ https://www.kynetics.com/update-factory ❯ https://docs.updatefactory.io/ ❯ https://github.com/Kynetics/meta-updatefactory ❯ http://warpx.io/blog/tutorial/easy-os-upgrades-swupdate ❯ https://eclipse.org/hawkbit/ ❯ https://sbabic.github.io/swupdate ❯ https://android.googlesource.com/platform/bootable/recovery/+/ android-8.0.0_r4/recovery.cpp#167
  • 43. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Thanks: Nicola La Gloria, Andrea Zoleo, Will Martindale, Daniele Sergio, Roberto Sartori, Eric Nelson, Gary Bisson (Boundary Devices), Gabriel Huau (witekio) and Amit Pundir (Linaro). and... Thanks to my daughter Marianna for the drawing!
  • 44. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Contacts: USA Kynetics LLC 2040 Martin Ave, Santa Clara CA 95050 Ph: +1 (408) 475 7760 Italy Kynetics Srl Via G. Longhin, Padova (PD) 35129 Ph: +39 (049) 781 1091 info@kynetics.com | www.kynetics.com
  • 45. Diego Rondini, www.kynetics.com Embedded Linux Conference Europe 2017, Prague Android Space non partitioned uramdisk kernel device tree bootscript Boot partition Android UF Service Android UF Client App kernel device tree Recovery Partition Tenant = foo Id = bar Url = https:/updatefactory.io" uramdisk cache partition .zip Other default partitions SoC bootloader