SlideShare a Scribd company logo
1 of 42
Download to read offline
Quickboot on i.MX6
FTF2014
04/10/2014
Gary Bisson
Embedded Software Engineer
SESSION OVERVIEW
1. Introduction
2. Boot Process
3. Optimizations
4. Solutions
5. Demonstrations
6. Conclusion
ABOUT THE PRESENTER
• Embedded Software Engineer at Adeneo Embedded
(Bellevue, WA)
Linux / Android
♦ BSP Adaptation
♦ Driver Development
♦ System Integration
Partners with Freescale
Introduction
Quickboot on i.MX6 Introduction
ARE WE TALKING ABOUT FASTBOOT?
This presentation is about quick boot
• Fastboot is the protocol used by Android to communicate
with the bootloader in order to reflash a system on the
device
• Type fastboot into google: 90% hits within first 10 pages
are about android
Warning
Fastboot is not the subject here!
5
Quickboot on i.MX6 Introduction
SPEED DOES MATTER
• Critical systems
Automotive: need to handle CAN message within a
specific time frame after boot (typically x100ms)
Monitoring: need to reboot ASAP in case of failure
6
Quickboot on i.MX6 Introduction
SPEED DOES MATTER
Consumer are used to previous generation of non-smart
devices that starts immediately
• Consumer products
TV: turn on quickly whenever pressing on the power
button
Phones: deep sleep mode allowing to have a
aggressive power management policy while keeping
responsiveness
7
Quickboot on i.MX6 Introduction
SPEED DOES MATTER
It is still possible to cheat
• Display splash screen early in the bootloader (x100ms)
• Animate the splash screen while booting
Those tricks give the end user the illusion of a quick boot, but
this could not apply to critical systems.
8
Quickboot on i.MX6 Introduction
SET YOUR GOALS
• Need to have clear goals:
Prioritize features
Set constraints
• Boot-Time optimization = trade-offs
9
Quickboot on i.MX6 Introduction
GOAL OF THE PRESENTATION
This presentation aims at:
• Showing different existing technics to optimize boot time
• Explaining how to integrate those technics
• Showing real customer solutions
10
Boot Process
Quickboot on i.MX6 Boot Process
BOOT PROCESS
12
Quickboot on i.MX6 Boot Process
BOOT PROCESS
Typical i.MX6 boot process:
• Boot ROM
• U-Boot
• Linux Kernel
• Rootfs:
Linux
Android
13
Quickboot on i.MX6 Boot Process
BOOT ROM
• Boot devices:
NOR Flash
NAND Flash
OneNAND Flash
SD/MMC
SATA HDD (only i.MX 6Dual/6Quad)
Serial (I2C/SPI) NOR Flash and EEPROM
14
Quickboot on i.MX6 Boot Process
BOOT ROM
• IVT Header
Entry point (fixed offset)
Points to DCD table
• DCD Table
List of init commands
• Boot data
A table indicating the program image offset and size
15
Quickboot on i.MX6 Boot Process
MEASUREMENT TOOLS
• Grabserial
Serial output time-stamps
• Bootgraph
Kernel driver graph
• Bootchart
Init scripts graph
16
Optimizations
Quickboot on i.MX6 Optimizations
METHODOLOGY
18
Quickboot on i.MX6 Optimizations
INTUITION
The first things that comes in mind are usually:
• Smaller size
Loads faster (bandwidth of the storage mdevice)
Loads from faster storage (NOR, MMC class 10)
• Remove uneeded features
Smaller system (see above)
Not wasting time
19
Quickboot on i.MX6 Optimizations
GENERIC OPTIMIZATIONS
• lpj
If your products are similar, you can set lpj
Gain about 250 ms by skipping the calibration loop
• Stripping init
Start your critical application as soon as possible: rcS
or inittab
An idea may be to try to use your critical application as
init
20
Quickboot on i.MX6 Optimizations
GENERIC OPTIMIZATIONS
• flash storage:
NAND, NOR, SD
We usually get really good performance booting from
SD cards, class 4 or class 6, but you will still have to
benchmark
• toolchains
Not all toolchains are created equal. Changing
toolchains, will usually make you gain the last hundred
of ms
21
Quickboot on i.MX6 Optimizations
BOOTLOADER
• U-Boot is slow? Get rid of it!
• arm-kernel-shim solutions
• Freescale platforms: configure just a few register then
passing atags
Thanks to BootROM / DCD table
22
Quickboot on i.MX6 Optimizations
BOOTLOADER
• Kernel may not initialize every device
relies on the bootloader
• Should we migrate everything to the kernel?
23
Quickboot on i.MX6 Optimizations
GENERIC SOLUTIONS
U-Boot Secondary Program Loader (SPL)
• Small binary that fits in SRAM and loads the main U-Boot
into RAM
• Within U-Boot source tree, sharing same code base
• Two scenarios:
Fast path: SPL loads and then starts Linux kernel
Development or maintenance mode: SPL loads
U-Boot
24
Quickboot on i.MX6 Optimizations
KERNEL OPTIMIZATIONS
• Remove as many features as possible
The smaller, the faster to copy from storage to RAM
Less features means less initializations
• Not always what you want
What about a full-featured kernel?
• Easy optimizations:
printk and DEBUGFS
try CONFIG_CC_OPTIMIZE_FOR_SIZE=y
SLOB memory allocator
KALLSYMS
25
Quickboot on i.MX6 Optimizations
KERNEL OPTIMIZATIONS
• Stripping a lot of features from is not always possible
• Use modules!
Load them when your critical application is ready
Not always possible to compile as module (example:
networking)
• Kernel compression
None
Gzip
LZO
26
Quickboot on i.MX6 Optimizations
KERNEL OPTIMIZATIONS
Use of deferred_initcalls
• Kernel stills grows
• Need to patch kernel
see http://elinux.org/Deferred_Initcall
• Need to modify drivers
deferred_module_init
• Will execute some init only when asked for (user-space)
cat /proc/deferred_initcalls
27
Quickboot on i.MX6 Optimizations
SMP
• SMP is quite slow to initialize
• UP systems may be faster to boot
• Hotplug the other cores afterwards
/sys/devices/system/cpu/cpuX/online
28
Quickboot on i.MX6 Optimizations
ROOTFS
• Multiple challenges when building your rootfs
May not be able to optimize the customer’s application
Even worse, you may not have the sources (blobs)
Sometimes not possible to reduce the size of your
rootfs
29
Quickboot on i.MX6 Optimizations
ROOTFS
• Use an initramfs, but use it right!
• For critical tasks only
• Use of uClibc reduces the size
• Use of mklibs to further strip the libs
• Then switch_root or pivot_root to the final rootfs
30
Solutions
Quickboot on i.MX6 Solutions
SOLUTIONS
• Boot from SDcard
• Custom bootloader
• Stripped down kernel
• Start a custom init:
launches critical application (CAN daemon)
calls deferred_initcalls
switch_root to the final rootfs and exec the final init
32
Quickboot on i.MX6 Solutions
SOLUTIONS
• Boot from SDcard
• Custom bootloader
• Stripped down kernel
• Start a custom init that launches the OpenGL application
• Rootfs has been stripped using mklibs
• Final image (bootloader + kernel + rootfs): 5.2MB
3MB for HW blobs libraries
No compression
33
Quickboot on i.MX6 Solutions
RESULTS
• CAN messages ready for transfer in about 360ms
• OpenGL application is started in 720ms from power on
590ms from reset
34
Quickboot on i.MX6 Solutions
NEXT STEPS
• Use of DMA to load the image
• Parallel inits
• Provide a more generic solution
35
Demonstrations
Quickboot on i.MX6 Demonstrations
HARDWARE SELECTION
• i.MX6Q Sabre Smart Device
• Kernel 3.0.35 release v4.1.0
• 10" LVDS display
37
Quickboot on i.MX6 Demonstrations
SOURCE CODE
• Code for the custom bootloader:
https://github.com/alexandrebelloni/whoosh
• Code for U-Boot SPL: coming soon...
• Main inspiration was http://www.elinux.org/Boot_Time but it
needs some updates
38
Conclusion
Quickboot on i.MX6 Conclusion
CONCLUSION
• No one-size-fits-all solution
• Highly depends on constraints
• Generic solution progress
40
Quickboot on i.MX6 Conclusion
QUESTIONS?
41
Quickboot on i.MX6 Conclusion
REFERENCES
• elinux.org: http://www.elinux.org/
• Free Electrons' training: http://www.free-electrons.com/
42

More Related Content

What's hot

U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
Macpaul Lin
 

What's hot (20)

U Boot or Universal Bootloader
U Boot or Universal BootloaderU Boot or Universal Bootloader
U Boot or Universal Bootloader
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
Android Booting Sequence
Android Booting SequenceAndroid Booting Sequence
Android Booting Sequence
 
Linux Systems: Getting started with setting up an Embedded platform
Linux Systems: Getting started with setting up an Embedded platformLinux Systems: Getting started with setting up an Embedded platform
Linux Systems: Getting started with setting up an Embedded platform
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
HKG15-311: OP-TEE for Beginners and Porting Review
HKG15-311: OP-TEE for Beginners and Porting ReviewHKG15-311: OP-TEE for Beginners and Porting Review
HKG15-311: OP-TEE for Beginners and Porting Review
 
Lcu14 107- op-tee on ar mv8
Lcu14 107- op-tee on ar mv8Lcu14 107- op-tee on ar mv8
Lcu14 107- op-tee on ar mv8
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 
Linux Audio Drivers. ALSA
Linux Audio Drivers. ALSALinux Audio Drivers. ALSA
Linux Audio Drivers. ALSA
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
Linux Internals - Part I
Linux Internals - Part ILinux Internals - Part I
Linux Internals - Part I
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Audio Drivers
Audio DriversAudio Drivers
Audio Drivers
 
SFO15-503: Secure storage in OP-TEE
SFO15-503: Secure storage in OP-TEESFO15-503: Secure storage in OP-TEE
SFO15-503: Secure storage in OP-TEE
 
Introduction to Modern U-Boot
Introduction to Modern U-BootIntroduction to Modern U-Boot
Introduction to Modern U-Boot
 

Viewers also liked

Mainline U-BOOT for iMX6 (AR6MX)
Mainline U-BOOT for iMX6 (AR6MX)Mainline U-BOOT for iMX6 (AR6MX)
Mainline U-BOOT for iMX6 (AR6MX)
Frodo Lai
 
U Boot Presentation Final
U Boot Presentation FinalU Boot Presentation Final
U Boot Presentation Final
ktrefz
 

Viewers also liked (18)

Mainline U-BOOT for iMX6 (AR6MX)
Mainline U-BOOT for iMX6 (AR6MX)Mainline U-BOOT for iMX6 (AR6MX)
Mainline U-BOOT for iMX6 (AR6MX)
 
ELC-E 2010: The Right Approach to Minimal Boot Times
ELC-E 2010: The Right Approach to Minimal Boot TimesELC-E 2010: The Right Approach to Minimal Boot Times
ELC-E 2010: The Right Approach to Minimal Boot Times
 
Renesas DevCon 2010: Starting a QT Application with Minimal Boot
Renesas DevCon 2010: Starting a QT Application with Minimal BootRenesas DevCon 2010: Starting a QT Application with Minimal Boot
Renesas DevCon 2010: Starting a QT Application with Minimal Boot
 
Android OTA updates
Android OTA updatesAndroid OTA updates
Android OTA updates
 
Accessing Hardware on Android
Accessing Hardware on AndroidAccessing Hardware on Android
Accessing Hardware on Android
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
Headless Android Strikes Back!
Headless Android Strikes Back!Headless Android Strikes Back!
Headless Android Strikes Back!
 
Useful USB Gadgets on Linux
Useful USB Gadgets on LinuxUseful USB Gadgets on Linux
Useful USB Gadgets on Linux
 
Yocto Project ハンズオン / 参加者用資料
Yocto Project ハンズオン / 参加者用資料Yocto Project ハンズオン / 参加者用資料
Yocto Project ハンズオン / 参加者用資料
 
FirefoxOS and its use of Linux (a deep dive into Gonk architecture)
FirefoxOS and its use of Linux (a deep dive into Gonk architecture)FirefoxOS and its use of Linux (a deep dive into Gonk architecture)
FirefoxOS and its use of Linux (a deep dive into Gonk architecture)
 
Leveraging the Android Open Accessory Protocol
Leveraging the Android Open Accessory ProtocolLeveraging the Android Open Accessory Protocol
Leveraging the Android Open Accessory Protocol
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
Yocto bspを作ってみた
Yocto bspを作ってみたYocto bspを作ってみた
Yocto bspを作ってみた
 
U Boot Presentation Final
U Boot Presentation FinalU Boot Presentation Final
U Boot Presentation Final
 
Yocto Project ハンズオン プレゼン用資料
Yocto Project ハンズオン プレゼン用資料Yocto Project ハンズオン プレゼン用資料
Yocto Project ハンズオン プレゼン用資料
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
 
レシピの作り方入門
レシピの作り方入門レシピの作り方入門
レシピの作り方入門
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 

Similar to Quickboot on i.MX6

BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr
Linaro
 

Similar to Quickboot on i.MX6 (20)

12 Lessons Learnt in Boot Time Reduction
12 Lessons Learnt in Boot Time Reduction12 Lessons Learnt in Boot Time Reduction
12 Lessons Learnt in Boot Time Reduction
 
Linux Kernel Platform Development: Challenges and Insights
 Linux Kernel Platform Development: Challenges and Insights Linux Kernel Platform Development: Challenges and Insights
Linux Kernel Platform Development: Challenges and Insights
 
Improving User Experience with Ubiquitous QuickBoot
 Improving User Experience with Ubiquitous QuickBoot Improving User Experience with Ubiquitous QuickBoot
Improving User Experience with Ubiquitous QuickBoot
 
Когда предрелизный не только софт
Когда предрелизный не только софтКогда предрелизный не только софт
Когда предрелизный не только софт
 
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese..."Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
"Making Computer Vision Software Run Fast on Your Embedded Platform," a Prese...
 
Rapid SPi Device Driver Development over USB
Rapid SPi Device Driver Development over USBRapid SPi Device Driver Development over USB
Rapid SPi Device Driver Development over USB
 
Fast boot
Fast bootFast boot
Fast boot
 
Embedded platform choices
Embedded platform choicesEmbedded platform choices
Embedded platform choices
 
XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...
XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...
XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...
 
The Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast StorageThe Linux Block Layer - Built for Fast Storage
The Linux Block Layer - Built for Fast Storage
 
UWE Linux Boot Camp 2007: Hacking embedded Linux on the cheap
UWE Linux Boot Camp 2007: Hacking embedded Linux on the cheapUWE Linux Boot Camp 2007: Hacking embedded Linux on the cheap
UWE Linux Boot Camp 2007: Hacking embedded Linux on the cheap
 
”Bare-Metal Container" presented at HPCC2016
”Bare-Metal Container" presented at HPCC2016”Bare-Metal Container" presented at HPCC2016
”Bare-Metal Container" presented at HPCC2016
 
BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr BUD17-405: Building a reference IoT product with Zephyr
BUD17-405: Building a reference IoT product with Zephyr
 
LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205LMG Lightning Talks - SFO17-205
LMG Lightning Talks - SFO17-205
 
Clr jvm implementation differences
Clr jvm implementation differencesClr jvm implementation differences
Clr jvm implementation differences
 
Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1Iot Bootcamp - abridged - part 1
Iot Bootcamp - abridged - part 1
 
The Andc Cluster
The Andc ClusterThe Andc Cluster
The Andc Cluster
 
TI TechDays 2010: swiftBoot
TI TechDays 2010: swiftBootTI TechDays 2010: swiftBoot
TI TechDays 2010: swiftBoot
 
OpenStack Integration with OpenContrail and OpenDaylight
OpenStack Integration with OpenContrail and OpenDaylightOpenStack Integration with OpenContrail and OpenDaylight
OpenStack Integration with OpenContrail and OpenDaylight
 
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)
 

Recently uploaded

notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 

Quickboot on i.MX6

  • 1. Quickboot on i.MX6 FTF2014 04/10/2014 Gary Bisson Embedded Software Engineer
  • 2. SESSION OVERVIEW 1. Introduction 2. Boot Process 3. Optimizations 4. Solutions 5. Demonstrations 6. Conclusion
  • 3. ABOUT THE PRESENTER • Embedded Software Engineer at Adeneo Embedded (Bellevue, WA) Linux / Android ♦ BSP Adaptation ♦ Driver Development ♦ System Integration Partners with Freescale
  • 5. Quickboot on i.MX6 Introduction ARE WE TALKING ABOUT FASTBOOT? This presentation is about quick boot • Fastboot is the protocol used by Android to communicate with the bootloader in order to reflash a system on the device • Type fastboot into google: 90% hits within first 10 pages are about android Warning Fastboot is not the subject here! 5
  • 6. Quickboot on i.MX6 Introduction SPEED DOES MATTER • Critical systems Automotive: need to handle CAN message within a specific time frame after boot (typically x100ms) Monitoring: need to reboot ASAP in case of failure 6
  • 7. Quickboot on i.MX6 Introduction SPEED DOES MATTER Consumer are used to previous generation of non-smart devices that starts immediately • Consumer products TV: turn on quickly whenever pressing on the power button Phones: deep sleep mode allowing to have a aggressive power management policy while keeping responsiveness 7
  • 8. Quickboot on i.MX6 Introduction SPEED DOES MATTER It is still possible to cheat • Display splash screen early in the bootloader (x100ms) • Animate the splash screen while booting Those tricks give the end user the illusion of a quick boot, but this could not apply to critical systems. 8
  • 9. Quickboot on i.MX6 Introduction SET YOUR GOALS • Need to have clear goals: Prioritize features Set constraints • Boot-Time optimization = trade-offs 9
  • 10. Quickboot on i.MX6 Introduction GOAL OF THE PRESENTATION This presentation aims at: • Showing different existing technics to optimize boot time • Explaining how to integrate those technics • Showing real customer solutions 10
  • 12. Quickboot on i.MX6 Boot Process BOOT PROCESS 12
  • 13. Quickboot on i.MX6 Boot Process BOOT PROCESS Typical i.MX6 boot process: • Boot ROM • U-Boot • Linux Kernel • Rootfs: Linux Android 13
  • 14. Quickboot on i.MX6 Boot Process BOOT ROM • Boot devices: NOR Flash NAND Flash OneNAND Flash SD/MMC SATA HDD (only i.MX 6Dual/6Quad) Serial (I2C/SPI) NOR Flash and EEPROM 14
  • 15. Quickboot on i.MX6 Boot Process BOOT ROM • IVT Header Entry point (fixed offset) Points to DCD table • DCD Table List of init commands • Boot data A table indicating the program image offset and size 15
  • 16. Quickboot on i.MX6 Boot Process MEASUREMENT TOOLS • Grabserial Serial output time-stamps • Bootgraph Kernel driver graph • Bootchart Init scripts graph 16
  • 18. Quickboot on i.MX6 Optimizations METHODOLOGY 18
  • 19. Quickboot on i.MX6 Optimizations INTUITION The first things that comes in mind are usually: • Smaller size Loads faster (bandwidth of the storage mdevice) Loads from faster storage (NOR, MMC class 10) • Remove uneeded features Smaller system (see above) Not wasting time 19
  • 20. Quickboot on i.MX6 Optimizations GENERIC OPTIMIZATIONS • lpj If your products are similar, you can set lpj Gain about 250 ms by skipping the calibration loop • Stripping init Start your critical application as soon as possible: rcS or inittab An idea may be to try to use your critical application as init 20
  • 21. Quickboot on i.MX6 Optimizations GENERIC OPTIMIZATIONS • flash storage: NAND, NOR, SD We usually get really good performance booting from SD cards, class 4 or class 6, but you will still have to benchmark • toolchains Not all toolchains are created equal. Changing toolchains, will usually make you gain the last hundred of ms 21
  • 22. Quickboot on i.MX6 Optimizations BOOTLOADER • U-Boot is slow? Get rid of it! • arm-kernel-shim solutions • Freescale platforms: configure just a few register then passing atags Thanks to BootROM / DCD table 22
  • 23. Quickboot on i.MX6 Optimizations BOOTLOADER • Kernel may not initialize every device relies on the bootloader • Should we migrate everything to the kernel? 23
  • 24. Quickboot on i.MX6 Optimizations GENERIC SOLUTIONS U-Boot Secondary Program Loader (SPL) • Small binary that fits in SRAM and loads the main U-Boot into RAM • Within U-Boot source tree, sharing same code base • Two scenarios: Fast path: SPL loads and then starts Linux kernel Development or maintenance mode: SPL loads U-Boot 24
  • 25. Quickboot on i.MX6 Optimizations KERNEL OPTIMIZATIONS • Remove as many features as possible The smaller, the faster to copy from storage to RAM Less features means less initializations • Not always what you want What about a full-featured kernel? • Easy optimizations: printk and DEBUGFS try CONFIG_CC_OPTIMIZE_FOR_SIZE=y SLOB memory allocator KALLSYMS 25
  • 26. Quickboot on i.MX6 Optimizations KERNEL OPTIMIZATIONS • Stripping a lot of features from is not always possible • Use modules! Load them when your critical application is ready Not always possible to compile as module (example: networking) • Kernel compression None Gzip LZO 26
  • 27. Quickboot on i.MX6 Optimizations KERNEL OPTIMIZATIONS Use of deferred_initcalls • Kernel stills grows • Need to patch kernel see http://elinux.org/Deferred_Initcall • Need to modify drivers deferred_module_init • Will execute some init only when asked for (user-space) cat /proc/deferred_initcalls 27
  • 28. Quickboot on i.MX6 Optimizations SMP • SMP is quite slow to initialize • UP systems may be faster to boot • Hotplug the other cores afterwards /sys/devices/system/cpu/cpuX/online 28
  • 29. Quickboot on i.MX6 Optimizations ROOTFS • Multiple challenges when building your rootfs May not be able to optimize the customer’s application Even worse, you may not have the sources (blobs) Sometimes not possible to reduce the size of your rootfs 29
  • 30. Quickboot on i.MX6 Optimizations ROOTFS • Use an initramfs, but use it right! • For critical tasks only • Use of uClibc reduces the size • Use of mklibs to further strip the libs • Then switch_root or pivot_root to the final rootfs 30
  • 32. Quickboot on i.MX6 Solutions SOLUTIONS • Boot from SDcard • Custom bootloader • Stripped down kernel • Start a custom init: launches critical application (CAN daemon) calls deferred_initcalls switch_root to the final rootfs and exec the final init 32
  • 33. Quickboot on i.MX6 Solutions SOLUTIONS • Boot from SDcard • Custom bootloader • Stripped down kernel • Start a custom init that launches the OpenGL application • Rootfs has been stripped using mklibs • Final image (bootloader + kernel + rootfs): 5.2MB 3MB for HW blobs libraries No compression 33
  • 34. Quickboot on i.MX6 Solutions RESULTS • CAN messages ready for transfer in about 360ms • OpenGL application is started in 720ms from power on 590ms from reset 34
  • 35. Quickboot on i.MX6 Solutions NEXT STEPS • Use of DMA to load the image • Parallel inits • Provide a more generic solution 35
  • 37. Quickboot on i.MX6 Demonstrations HARDWARE SELECTION • i.MX6Q Sabre Smart Device • Kernel 3.0.35 release v4.1.0 • 10" LVDS display 37
  • 38. Quickboot on i.MX6 Demonstrations SOURCE CODE • Code for the custom bootloader: https://github.com/alexandrebelloni/whoosh • Code for U-Boot SPL: coming soon... • Main inspiration was http://www.elinux.org/Boot_Time but it needs some updates 38
  • 40. Quickboot on i.MX6 Conclusion CONCLUSION • No one-size-fits-all solution • Highly depends on constraints • Generic solution progress 40
  • 41. Quickboot on i.MX6 Conclusion QUESTIONS? 41
  • 42. Quickboot on i.MX6 Conclusion REFERENCES • elinux.org: http://www.elinux.org/ • Free Electrons' training: http://www.free-electrons.com/ 42