SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
Updating Embedded Linux devices
in the field
Updating Embedded Linux devices in the field 1 Copyright © 2011-2015, 2net Ltd
License
These slides are available under a Creative Commons Attribution-ShareAlike 3.0
license. You can read the full text of the license here
http://creativecommons.org/licenses/by-sa/3.0/legalcode
You are free to
• copy, distribute, display, and perform the work
• make derivative works
• make commercial use of the work
Under the following conditions
• Attribution: you must give the original author credit
• Share Alike: if you alter, transform, or build upon this work, you may distribute
the resulting work only under a license identical to this one (i.e. include this
page exactly as it is)
• For any reuse or distribution, you must make clear to others the license terms of
this work
Updating Embedded Linux devices in the field 2 Copyright © 2011-2015, 2net Ltd
About Chris Simmonds
• Consultant and trainer
• Working with embedded Linux since 1999
• Android since 2009
• Speaker at many conferences and
workshops
"Looking after the Inner Penguin" blog at http://2net.co.uk/
https://uk.linkedin.com/in/chrisdsimmonds/
https://google.com/+chrissimmonds
Updating Embedded Linux devices in the field 3 Copyright © 2011-2015, 2net Ltd
Overview
• The need for software update of embedded devices
• Update by file or system image
• Update agent: bootloader or application
• An Linux update agent: SWupdate
• Update strategies
• Failsafe
Updating Embedded Linux devices in the field 4 Copyright © 2011-2015, 2net Ltd
The problem
• Embedded software is non-trivial (=> has bugs!)
• Devices are often connected to the Internet
• Allowing hackers to exploit the bugs
• Result: problems with the IoT
• We need an update mechanism to fix those bugs in
the field
• (Not to mention the desire to deploy new features,
better performance, etc.)
Updating Embedded Linux devices in the field 5 Copyright © 2011-2015, 2net Ltd
Components of embedded Linux
• Bootloader
• Linux Kernel (+ Device Tree and kernel modules)
• Root file system (basic operating system libraries and
utilities, usually read-only)
• System apps (often a separate partition, but may be
combined with root file system)
• User data (configuration settings, logs, user-supplied
data)
Updating Embedded Linux devices in the field 6 Copyright © 2011-2015, 2net Ltd
Frequency of update
Frequency
Ease of update
Bootloader
Kernel
Root file system
System applications
Updating Embedded Linux devices in the field 7 Copyright © 2011-2015, 2net Ltd
Requirements of an updater
• Robust: must not render the device unusable
• Atomic: must not apply half an update
• Fail-safe: have a fall-back mode if all else fails
• Remote, unattended update (as an option)
• Audit trail: so you can tell what updates have been
applied
• Preserve user data
Updating Embedded Linux devices in the field 8 Copyright © 2011-2015, 2net Ltd
A simple approach
• Majority of updates are to root filesystem and system
apps, which are "just files"
• Many projects have an updater based on tarballs and
some shell scripts
• They all fail, because:
• Lack atomicity
• Can’t update kernel in raw flash memory
• (Usually) no audit trail
• Not fail-safe
• Remember: if it can go wrong, it will go wrong
(eventually) 1
1Murphy’s law
Updating Embedded Linux devices in the field 9 Copyright © 2011-2015, 2net Ltd
Atomic file updates
• Update is either complete or not done at all
• "Easy" to achieve for individual files, e.g. using
POSIX rename (2) and careful checkpointing with
fsync (2)
• More difficult to keep relationships between files
consistent
• Example: application and dependant libraries
• (Can be done if you pay attention to library versioning)
• Mainstream Linux package managers (RPM and
dpkg) solve a lot of the problems but are still not
bulletproof
Updating Embedded Linux devices in the field 10 Copyright © 2011-2015, 2net Ltd
Atomic system image updates
• Instead of a large number of individual files, consider
a system as a smaller number of system images
• Kernel, root filesystem, system apps, etc
• Embedded devices are typically put together like this
• Need a method to update safely
• Examples:
• Dual copies of OS and ping-pong between them
• Have separate recovery OS just for updating
Updating Embedded Linux devices in the field 11 Copyright © 2011-2015, 2net Ltd
Two copies of the OS
Bootloader User
data
Boot
flag
OS Copy 1
OS Copy 2
• Update OS copy 2 from OS copy 1; set boot flag
when done
• "ping-pong" between OS copies
• But, requires double the flash storage
Updating Embedded Linux devices in the field 12 Copyright © 2011-2015, 2net Ltd
Recovery OS
Bootloader
Main OS
Recovery OS
User
data
Boot
flag
• To perform update, set boot flag and reboot into
recovery OS
• Then update main OS; clear boot flag when done
• Reboot to start updated main OS
Updating Embedded Linux devices in the field 13 Copyright © 2011-2015, 2net Ltd
Bootloader as update agent
• Seems an attractive option: simple environment with
no OS running
• But, bootloaders have limited support for peripherals,
file system formats and network protocols
• Incorporating the necessary software would make the
bootloader more buggy
• Remember that updating the bootloader itself is
difficult, often a single point of failure
• Conclusion: bootloader is not a good update agent!
Updating Embedded Linux devices in the field 14 Copyright © 2011-2015, 2net Ltd
Linux application as update agent
• Much better environment
• Access to all peripherals
• Read-write access to file systems
• All network protocols
• Maybe a display for user interaction
• Few open source examples
• One is SWupdate
Updating Embedded Linux devices in the field 15 Copyright © 2011-2015, 2net Ltd
SWupdate
• Written by Stefano Babic
• Source: https://github.com/sbabic/swupdate
• Doc: https://github.com/sbabic/swupdate/blob/
master/doc/source/swupdate.rst
• Yocto meta layer available:
https://github.com/sbabic/meta-swupdate
• Can use pre- and post- install scripts to set/reset the
boot flag in the bootloader (U-Boot, for example)
Updating Embedded Linux devices in the field 16 Copyright © 2011-2015, 2net Ltd
Local update
Main OS
image
Recovery OSSD
SWupdate
• Update supplied on local removable media, initiated
by user or maintenance staff
Updating Embedded Linux devices in the field 17 Copyright © 2011-2015, 2net Ltd
Remote update 1/2
Main OS
image
Recovery OS
SD
SWupdate
Downloader
Updater
• Download update from network to local storage:
allows update to be verified and installed at a
convenient time
• May be initiated by user or automatically
• Requires spare local storage
Updating Embedded Linux devices in the field 18 Copyright © 2011-2015, 2net Ltd
Remote update 2/2
Main OS
image
Recovery OS
SWupdate
Downloader
Updater
• Update directly from network stream: no local
storage needed
• Device is unavailable while updating, may lead to
significant down time if link slow or broken
• (Streaming not implemented in SWupadte yet)
Updating Embedded Linux devices in the field 19 Copyright © 2011-2015, 2net Ltd
Failsafe
• Robust software update is not the whole answer
• Can’t protect against installing (correctly) a buggy
update
• Last line of defence:
• Watchdog -> reboots if device is not functioning
• Bootloader counts boots triggered by watchdog
• Boot into recovery mode when exceed threshold and
attempt to re-install
Updating Embedded Linux devices in the field 20 Copyright © 2011-2015, 2net Ltd
Further reading
• "Building Murphy-compatible embedded Linux
systems" by Gilad Ben-Yossef https://www.kernel.
org/doc/ols/2005/ols2005v1-pages-21-36.pdf
• "Updating an embedded system :swupdate
documentation"
http://sbabic.github.io/swupdate/
• The rename (2) function:
http://pubs.opengroup.org/onlinepubs/
009695399/functions/rename.html
• The fsync (2) function: http://pubs.opengroup.org/
onlinepubs/009695399/functions/fsync.html
Updating Embedded Linux devices in the field 21 Copyright © 2011-2015, 2net Ltd
• Questions?
Slides on Slide Share: http://www.slideshare.net/
chrissimmonds/linux-field-update-2015
Updating Embedded Linux devices in the field 22 Copyright © 2011-2015, 2net Ltd

Más contenido relacionado

La actualidad más candente

Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingTushar B Kute
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardAnne Nicolas
 
Software update for embedded systems - elce2014
Software update for embedded systems - elce2014Software update for embedded systems - elce2014
Software update for embedded systems - elce2014Stefano Babic
 
The Yocto Project
The Yocto ProjectThe Yocto Project
The Yocto Projectrossburton
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)RuggedBoardGroup
 
Static Partitioning with Xen, LinuxRT, and Zephyr: A Concrete End-to-end Exam...
Static Partitioning with Xen, LinuxRT, and Zephyr: A Concrete End-to-end Exam...Static Partitioning with Xen, LinuxRT, and Zephyr: A Concrete End-to-end Exam...
Static Partitioning with Xen, LinuxRT, and Zephyr: A Concrete End-to-end Exam...Stefano Stabellini
 
Kernel Module Programming
Kernel Module ProgrammingKernel Module Programming
Kernel Module ProgrammingSaurabh Bangad
 
Run Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoRun Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoMarco Cavallini
 
Fosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using VirtualizationFosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using VirtualizationThe Linux Foundation
 
GPU Virtualization in Embedded Automotive Solutions
GPU Virtualization in Embedded Automotive SolutionsGPU Virtualization in Embedded Automotive Solutions
GPU Virtualization in Embedded Automotive SolutionsGlobalLogic Ukraine
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver艾鍗科技
 
Linux booting process!!
Linux booting process!!Linux booting process!!
Linux booting process!!sourav verma
 
Yocto Project introduction
Yocto Project introductionYocto Project introduction
Yocto Project introductionYi-Hsiu Hsu
 

La actualidad más candente (20)

Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Part 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module ProgrammingPart 02 Linux Kernel Module Programming
Part 02 Linux Kernel Module Programming
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
 
Software update for embedded systems - elce2014
Software update for embedded systems - elce2014Software update for embedded systems - elce2014
Software update for embedded systems - elce2014
 
The Yocto Project
The Yocto ProjectThe Yocto Project
The Yocto Project
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
Linux Device Driver’s
Linux Device Driver’sLinux Device Driver’s
Linux Device Driver’s
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
Static Partitioning with Xen, LinuxRT, and Zephyr: A Concrete End-to-end Exam...
Static Partitioning with Xen, LinuxRT, and Zephyr: A Concrete End-to-end Exam...Static Partitioning with Xen, LinuxRT, and Zephyr: A Concrete End-to-end Exam...
Static Partitioning with Xen, LinuxRT, and Zephyr: A Concrete End-to-end Exam...
 
Kernel Module Programming
Kernel Module ProgrammingKernel Module Programming
Kernel Module Programming
 
Run Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using YoctoRun Qt on Linux embedded systems using Yocto
Run Qt on Linux embedded systems using Yocto
 
Embedded Hypervisor for ARM
Embedded Hypervisor for ARMEmbedded Hypervisor for ARM
Embedded Hypervisor for ARM
 
Fosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using VirtualizationFosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using Virtualization
 
GPU Virtualization in Embedded Automotive Solutions
GPU Virtualization in Embedded Automotive SolutionsGPU Virtualization in Embedded Automotive Solutions
GPU Virtualization in Embedded Automotive Solutions
 
Linux Serial Driver
Linux Serial DriverLinux Serial Driver
Linux Serial Driver
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 
Kernel Debugging & Profiling
Kernel Debugging & ProfilingKernel Debugging & Profiling
Kernel Debugging & Profiling
 
Linux booting process!!
Linux booting process!!Linux booting process!!
Linux booting process!!
 
Yocto Project introduction
Yocto Project introductionYocto Project introduction
Yocto Project introduction
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 

Destacado

Read-only rootfs: theory and practice
Read-only rootfs: theory and practiceRead-only rootfs: theory and practice
Read-only rootfs: theory and practiceChris Simmonds
 
Software update for IoT Embedded World 2017
Software update for IoT Embedded World 2017Software update for IoT Embedded World 2017
Software update for IoT Embedded World 2017Chris Simmonds
 
Quick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIOQuick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIOChris Simmonds
 
The end of embedded Linux (as we know it)
The end of embedded Linux (as we know it)The end of embedded Linux (as we know it)
The end of embedded Linux (as we know it)Chris Simmonds
 
Userspace drivers-2016
Userspace drivers-2016Userspace drivers-2016
Userspace drivers-2016Chris Simmonds
 
A timeline for embedded Linux
A timeline for embedded LinuxA timeline for embedded Linux
A timeline for embedded LinuxChris Simmonds
 
Kernel Recipes 2013 - Easy rootfs using Buildroot
Kernel Recipes 2013 - Easy rootfs using BuildrootKernel Recipes 2013 - Easy rootfs using Buildroot
Kernel Recipes 2013 - Easy rootfs using BuildrootAnne Nicolas
 
Embedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoSherif Mousa
 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerSherif Mousa
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMSherif Mousa
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughThomas Graf
 

Destacado (12)

Read-only rootfs: theory and practice
Read-only rootfs: theory and practiceRead-only rootfs: theory and practice
Read-only rootfs: theory and practice
 
Software update for IoT Embedded World 2017
Software update for IoT Embedded World 2017Software update for IoT Embedded World 2017
Software update for IoT Embedded World 2017
 
Quick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIOQuick and Easy Device Drivers for Embedded Linux Using UIO
Quick and Easy Device Drivers for Embedded Linux Using UIO
 
The end of embedded Linux (as we know it)
The end of embedded Linux (as we know it)The end of embedded Linux (as we know it)
The end of embedded Linux (as we know it)
 
Userspace drivers-2016
Userspace drivers-2016Userspace drivers-2016
Userspace drivers-2016
 
A timeline for embedded Linux
A timeline for embedded LinuxA timeline for embedded Linux
A timeline for embedded Linux
 
Kernel Recipes 2013 - Easy rootfs using Buildroot
Kernel Recipes 2013 - Easy rootfs using BuildrootKernel Recipes 2013 - Easy rootfs using Buildroot
Kernel Recipes 2013 - Easy rootfs using Buildroot
 
Embedded Linux from Scratch to Yocto
Embedded Linux from Scratch to YoctoEmbedded Linux from Scratch to Yocto
Embedded Linux from Scratch to Yocto
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Yocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution MakerYocto - Embedded Linux Distribution Maker
Yocto - Embedded Linux Distribution Maker
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking WalkthroughLinuxCon 2015 Linux Kernel Networking Walkthrough
LinuxCon 2015 Linux Kernel Networking Walkthrough
 

Similar a Linux field-update-2015

Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...ICS
 
Chapter 1 - Introduction to Operating System.pptx
Chapter 1 - Introduction to Operating System.pptxChapter 1 - Introduction to Operating System.pptx
Chapter 1 - Introduction to Operating System.pptxgowthamiv26
 
Debian or Yocto Project? Which is the best for your Embedded Linux project?
Debian or Yocto Project? Which is the best for your Embedded Linux project?Debian or Yocto Project? Which is the best for your Embedded Linux project?
Debian or Yocto Project? Which is the best for your Embedded Linux project?Chris Simmonds
 
Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018Mender.io
 
Bn 1027 demo linux adminstration
Bn 1027 demo  linux adminstrationBn 1027 demo  linux adminstration
Bn 1027 demo linux adminstrationconline training
 
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and AdministerOracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and AdministerAndrejs Karpovs
 
eZ UnConference#2 - eZ Publish 5 basics Philippe Vincent-Royol & Florent Huck
eZ UnConference#2 - eZ Publish 5 basics Philippe Vincent-Royol & Florent HuckeZ UnConference#2 - eZ Publish 5 basics Philippe Vincent-Royol & Florent Huck
eZ UnConference#2 - eZ Publish 5 basics Philippe Vincent-Royol & Florent HuckeZ Publish Community
 
Tips for Installing Cognos Analytics 11.2.1x
Tips for Installing Cognos Analytics 11.2.1xTips for Installing Cognos Analytics 11.2.1x
Tips for Installing Cognos Analytics 11.2.1xSenturus
 
IoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSesIoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSesMender.io
 
eFolder Expert Series Webinar - BDR Do's and Dont's: Featuring Andrew Bensing...
eFolder Expert Series Webinar - BDR Do's and Dont's: Featuring Andrew Bensing...eFolder Expert Series Webinar - BDR Do's and Dont's: Featuring Andrew Bensing...
eFolder Expert Series Webinar - BDR Do's and Dont's: Featuring Andrew Bensing...eFolder
 
The Art of Sitecore Upgrades
The Art of Sitecore UpgradesThe Art of Sitecore Upgrades
The Art of Sitecore UpgradesRuud van Falier
 
What’s New in UniVerse 11.2
What’s New in UniVerse 11.2What’s New in UniVerse 11.2
What’s New in UniVerse 11.2Rocket Software
 
docslide-3df5a529-2ffd-ef23.ppt
docslide-3df5a529-2ffd-ef23.pptdocslide-3df5a529-2ffd-ef23.ppt
docslide-3df5a529-2ffd-ef23.pptPrasannaDeSilva7
 
Building Embedded Linux Systems Introduction
Building Embedded Linux Systems IntroductionBuilding Embedded Linux Systems Introduction
Building Embedded Linux Systems IntroductionSherif Mousa
 
10 ways hardware engineers can make software integration easier
10 ways hardware engineers can make software integration easier10 ways hardware engineers can make software integration easier
10 ways hardware engineers can make software integration easierChris Simmonds
 
Opening last bits of the infrastructure
Opening last bits of the infrastructureOpening last bits of the infrastructure
Opening last bits of the infrastructureErwan Velu
 
Uklug2011.lotus.on.linux.report.technical.edition.v1.0
Uklug2011.lotus.on.linux.report.technical.edition.v1.0Uklug2011.lotus.on.linux.report.technical.edition.v1.0
Uklug2011.lotus.on.linux.report.technical.edition.v1.0dominion
 
Lecture Lesson 1 Windows 7 Configuration
Lecture Lesson 1 Windows 7 ConfigurationLecture Lesson 1 Windows 7 Configuration
Lecture Lesson 1 Windows 7 ConfigurationKen Hutchins
 

Similar a Linux field-update-2015 (20)

Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
Software Update Mechanisms: Selecting the Best Solutin for Your Embedded Linu...
 
Chapter 1 - Introduction to Operating System.pptx
Chapter 1 - Introduction to Operating System.pptxChapter 1 - Introduction to Operating System.pptx
Chapter 1 - Introduction to Operating System.pptx
 
Debian or Yocto Project? Which is the best for your Embedded Linux project?
Debian or Yocto Project? Which is the best for your Embedded Linux project?Debian or Yocto Project? Which is the best for your Embedded Linux project?
Debian or Yocto Project? Which is the best for your Embedded Linux project?
 
Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018Embedded Linux Build Systems - Texas Linux Fest 2018
Embedded Linux Build Systems - Texas Linux Fest 2018
 
Dedicated embedded linux af Esben Haabendal, Prevas A/S
Dedicated embedded linux af Esben Haabendal, Prevas A/SDedicated embedded linux af Esben Haabendal, Prevas A/S
Dedicated embedded linux af Esben Haabendal, Prevas A/S
 
Bn 1027 demo linux adminstration
Bn 1027 demo  linux adminstrationBn 1027 demo  linux adminstration
Bn 1027 demo linux adminstration
 
Linux
LinuxLinux
Linux
 
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and AdministerOracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
Oracle E-Business Suite R12.2.6 on Database 12c: Install, Patch and Administer
 
eZ UnConference#2 - eZ Publish 5 basics Philippe Vincent-Royol & Florent Huck
eZ UnConference#2 - eZ Publish 5 basics Philippe Vincent-Royol & Florent HuckeZ UnConference#2 - eZ Publish 5 basics Philippe Vincent-Royol & Florent Huck
eZ UnConference#2 - eZ Publish 5 basics Philippe Vincent-Royol & Florent Huck
 
Tips for Installing Cognos Analytics 11.2.1x
Tips for Installing Cognos Analytics 11.2.1xTips for Installing Cognos Analytics 11.2.1x
Tips for Installing Cognos Analytics 11.2.1x
 
IoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSesIoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSes
 
eFolder Expert Series Webinar - BDR Do's and Dont's: Featuring Andrew Bensing...
eFolder Expert Series Webinar - BDR Do's and Dont's: Featuring Andrew Bensing...eFolder Expert Series Webinar - BDR Do's and Dont's: Featuring Andrew Bensing...
eFolder Expert Series Webinar - BDR Do's and Dont's: Featuring Andrew Bensing...
 
The Art of Sitecore Upgrades
The Art of Sitecore UpgradesThe Art of Sitecore Upgrades
The Art of Sitecore Upgrades
 
What’s New in UniVerse 11.2
What’s New in UniVerse 11.2What’s New in UniVerse 11.2
What’s New in UniVerse 11.2
 
docslide-3df5a529-2ffd-ef23.ppt
docslide-3df5a529-2ffd-ef23.pptdocslide-3df5a529-2ffd-ef23.ppt
docslide-3df5a529-2ffd-ef23.ppt
 
Building Embedded Linux Systems Introduction
Building Embedded Linux Systems IntroductionBuilding Embedded Linux Systems Introduction
Building Embedded Linux Systems Introduction
 
10 ways hardware engineers can make software integration easier
10 ways hardware engineers can make software integration easier10 ways hardware engineers can make software integration easier
10 ways hardware engineers can make software integration easier
 
Opening last bits of the infrastructure
Opening last bits of the infrastructureOpening last bits of the infrastructure
Opening last bits of the infrastructure
 
Uklug2011.lotus.on.linux.report.technical.edition.v1.0
Uklug2011.lotus.on.linux.report.technical.edition.v1.0Uklug2011.lotus.on.linux.report.technical.edition.v1.0
Uklug2011.lotus.on.linux.report.technical.edition.v1.0
 
Lecture Lesson 1 Windows 7 Configuration
Lecture Lesson 1 Windows 7 ConfigurationLecture Lesson 1 Windows 7 Configuration
Lecture Lesson 1 Windows 7 Configuration
 

Más de Chris Simmonds

Debugging embedded devices using GDB
Debugging embedded devices using GDBDebugging embedded devices using GDB
Debugging embedded devices using GDBChris Simmonds
 
Running Android on the Raspberry Pi: Android Pie meets Raspberry Pi
Running Android on the Raspberry Pi: Android Pie meets Raspberry PiRunning Android on the Raspberry Pi: Android Pie meets Raspberry Pi
Running Android on the Raspberry Pi: Android Pie meets Raspberry PiChris Simmonds
 
Reducing the boot time of Linux devices
Reducing the boot time of Linux devicesReducing the boot time of Linux devices
Reducing the boot time of Linux devicesChris Simmonds
 
Android rpi-csimmonds-fosdem-2019
Android rpi-csimmonds-fosdem-2019Android rpi-csimmonds-fosdem-2019
Android rpi-csimmonds-fosdem-2019Chris Simmonds
 
Reducing boot time in embedded Linux
Reducing boot time in embedded LinuxReducing boot time in embedded Linux
Reducing boot time in embedded LinuxChris Simmonds
 
Linux power management: are you doing it right?
Linux power management: are you doing it right?Linux power management: are you doing it right?
Linux power management: are you doing it right?Chris Simmonds
 
Embedded Android: Android beyond the smartphone
Embedded Android: Android beyond the smartphoneEmbedded Android: Android beyond the smartphone
Embedded Android: Android beyond the smartphoneChris Simmonds
 
Android beyond the smartphone
Android beyond the smartphoneAndroid beyond the smartphone
Android beyond the smartphoneChris Simmonds
 
Tuning Android for low RAM
Tuning Android for low RAMTuning Android for low RAM
Tuning Android for low RAMChris Simmonds
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depthChris Simmonds
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
 

Más de Chris Simmonds (11)

Debugging embedded devices using GDB
Debugging embedded devices using GDBDebugging embedded devices using GDB
Debugging embedded devices using GDB
 
Running Android on the Raspberry Pi: Android Pie meets Raspberry Pi
Running Android on the Raspberry Pi: Android Pie meets Raspberry PiRunning Android on the Raspberry Pi: Android Pie meets Raspberry Pi
Running Android on the Raspberry Pi: Android Pie meets Raspberry Pi
 
Reducing the boot time of Linux devices
Reducing the boot time of Linux devicesReducing the boot time of Linux devices
Reducing the boot time of Linux devices
 
Android rpi-csimmonds-fosdem-2019
Android rpi-csimmonds-fosdem-2019Android rpi-csimmonds-fosdem-2019
Android rpi-csimmonds-fosdem-2019
 
Reducing boot time in embedded Linux
Reducing boot time in embedded LinuxReducing boot time in embedded Linux
Reducing boot time in embedded Linux
 
Linux power management: are you doing it right?
Linux power management: are you doing it right?Linux power management: are you doing it right?
Linux power management: are you doing it right?
 
Embedded Android: Android beyond the smartphone
Embedded Android: Android beyond the smartphoneEmbedded Android: Android beyond the smartphone
Embedded Android: Android beyond the smartphone
 
Android beyond the smartphone
Android beyond the smartphoneAndroid beyond the smartphone
Android beyond the smartphone
 
Tuning Android for low RAM
Tuning Android for low RAMTuning Android for low RAM
Tuning Android for low RAM
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depth
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 

Linux field-update-2015

  • 1. Updating Embedded Linux devices in the field Updating Embedded Linux devices in the field 1 Copyright © 2011-2015, 2net Ltd
  • 2. License These slides are available under a Creative Commons Attribution-ShareAlike 3.0 license. You can read the full text of the license here http://creativecommons.org/licenses/by-sa/3.0/legalcode You are free to • copy, distribute, display, and perform the work • make derivative works • make commercial use of the work Under the following conditions • Attribution: you must give the original author credit • Share Alike: if you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one (i.e. include this page exactly as it is) • For any reuse or distribution, you must make clear to others the license terms of this work Updating Embedded Linux devices in the field 2 Copyright © 2011-2015, 2net Ltd
  • 3. About Chris Simmonds • Consultant and trainer • Working with embedded Linux since 1999 • Android since 2009 • Speaker at many conferences and workshops "Looking after the Inner Penguin" blog at http://2net.co.uk/ https://uk.linkedin.com/in/chrisdsimmonds/ https://google.com/+chrissimmonds Updating Embedded Linux devices in the field 3 Copyright © 2011-2015, 2net Ltd
  • 4. Overview • The need for software update of embedded devices • Update by file or system image • Update agent: bootloader or application • An Linux update agent: SWupdate • Update strategies • Failsafe Updating Embedded Linux devices in the field 4 Copyright © 2011-2015, 2net Ltd
  • 5. The problem • Embedded software is non-trivial (=> has bugs!) • Devices are often connected to the Internet • Allowing hackers to exploit the bugs • Result: problems with the IoT • We need an update mechanism to fix those bugs in the field • (Not to mention the desire to deploy new features, better performance, etc.) Updating Embedded Linux devices in the field 5 Copyright © 2011-2015, 2net Ltd
  • 6. Components of embedded Linux • Bootloader • Linux Kernel (+ Device Tree and kernel modules) • Root file system (basic operating system libraries and utilities, usually read-only) • System apps (often a separate partition, but may be combined with root file system) • User data (configuration settings, logs, user-supplied data) Updating Embedded Linux devices in the field 6 Copyright © 2011-2015, 2net Ltd
  • 7. Frequency of update Frequency Ease of update Bootloader Kernel Root file system System applications Updating Embedded Linux devices in the field 7 Copyright © 2011-2015, 2net Ltd
  • 8. Requirements of an updater • Robust: must not render the device unusable • Atomic: must not apply half an update • Fail-safe: have a fall-back mode if all else fails • Remote, unattended update (as an option) • Audit trail: so you can tell what updates have been applied • Preserve user data Updating Embedded Linux devices in the field 8 Copyright © 2011-2015, 2net Ltd
  • 9. A simple approach • Majority of updates are to root filesystem and system apps, which are "just files" • Many projects have an updater based on tarballs and some shell scripts • They all fail, because: • Lack atomicity • Can’t update kernel in raw flash memory • (Usually) no audit trail • Not fail-safe • Remember: if it can go wrong, it will go wrong (eventually) 1 1Murphy’s law Updating Embedded Linux devices in the field 9 Copyright © 2011-2015, 2net Ltd
  • 10. Atomic file updates • Update is either complete or not done at all • "Easy" to achieve for individual files, e.g. using POSIX rename (2) and careful checkpointing with fsync (2) • More difficult to keep relationships between files consistent • Example: application and dependant libraries • (Can be done if you pay attention to library versioning) • Mainstream Linux package managers (RPM and dpkg) solve a lot of the problems but are still not bulletproof Updating Embedded Linux devices in the field 10 Copyright © 2011-2015, 2net Ltd
  • 11. Atomic system image updates • Instead of a large number of individual files, consider a system as a smaller number of system images • Kernel, root filesystem, system apps, etc • Embedded devices are typically put together like this • Need a method to update safely • Examples: • Dual copies of OS and ping-pong between them • Have separate recovery OS just for updating Updating Embedded Linux devices in the field 11 Copyright © 2011-2015, 2net Ltd
  • 12. Two copies of the OS Bootloader User data Boot flag OS Copy 1 OS Copy 2 • Update OS copy 2 from OS copy 1; set boot flag when done • "ping-pong" between OS copies • But, requires double the flash storage Updating Embedded Linux devices in the field 12 Copyright © 2011-2015, 2net Ltd
  • 13. Recovery OS Bootloader Main OS Recovery OS User data Boot flag • To perform update, set boot flag and reboot into recovery OS • Then update main OS; clear boot flag when done • Reboot to start updated main OS Updating Embedded Linux devices in the field 13 Copyright © 2011-2015, 2net Ltd
  • 14. Bootloader as update agent • Seems an attractive option: simple environment with no OS running • But, bootloaders have limited support for peripherals, file system formats and network protocols • Incorporating the necessary software would make the bootloader more buggy • Remember that updating the bootloader itself is difficult, often a single point of failure • Conclusion: bootloader is not a good update agent! Updating Embedded Linux devices in the field 14 Copyright © 2011-2015, 2net Ltd
  • 15. Linux application as update agent • Much better environment • Access to all peripherals • Read-write access to file systems • All network protocols • Maybe a display for user interaction • Few open source examples • One is SWupdate Updating Embedded Linux devices in the field 15 Copyright © 2011-2015, 2net Ltd
  • 16. SWupdate • Written by Stefano Babic • Source: https://github.com/sbabic/swupdate • Doc: https://github.com/sbabic/swupdate/blob/ master/doc/source/swupdate.rst • Yocto meta layer available: https://github.com/sbabic/meta-swupdate • Can use pre- and post- install scripts to set/reset the boot flag in the bootloader (U-Boot, for example) Updating Embedded Linux devices in the field 16 Copyright © 2011-2015, 2net Ltd
  • 17. Local update Main OS image Recovery OSSD SWupdate • Update supplied on local removable media, initiated by user or maintenance staff Updating Embedded Linux devices in the field 17 Copyright © 2011-2015, 2net Ltd
  • 18. Remote update 1/2 Main OS image Recovery OS SD SWupdate Downloader Updater • Download update from network to local storage: allows update to be verified and installed at a convenient time • May be initiated by user or automatically • Requires spare local storage Updating Embedded Linux devices in the field 18 Copyright © 2011-2015, 2net Ltd
  • 19. Remote update 2/2 Main OS image Recovery OS SWupdate Downloader Updater • Update directly from network stream: no local storage needed • Device is unavailable while updating, may lead to significant down time if link slow or broken • (Streaming not implemented in SWupadte yet) Updating Embedded Linux devices in the field 19 Copyright © 2011-2015, 2net Ltd
  • 20. Failsafe • Robust software update is not the whole answer • Can’t protect against installing (correctly) a buggy update • Last line of defence: • Watchdog -> reboots if device is not functioning • Bootloader counts boots triggered by watchdog • Boot into recovery mode when exceed threshold and attempt to re-install Updating Embedded Linux devices in the field 20 Copyright © 2011-2015, 2net Ltd
  • 21. Further reading • "Building Murphy-compatible embedded Linux systems" by Gilad Ben-Yossef https://www.kernel. org/doc/ols/2005/ols2005v1-pages-21-36.pdf • "Updating an embedded system :swupdate documentation" http://sbabic.github.io/swupdate/ • The rename (2) function: http://pubs.opengroup.org/onlinepubs/ 009695399/functions/rename.html • The fsync (2) function: http://pubs.opengroup.org/ onlinepubs/009695399/functions/fsync.html Updating Embedded Linux devices in the field 21 Copyright © 2011-2015, 2net Ltd
  • 22. • Questions? Slides on Slide Share: http://www.slideshare.net/ chrissimmonds/linux-field-update-2015 Updating Embedded Linux devices in the field 22 Copyright © 2011-2015, 2net Ltd