rloader, alternative tech to achieve fast boot time for arm linux

34
Connect your device to application

Upload: matthsu

Post on 13-May-2015

3.305 views

Category:

Technology


0 download

DESCRIPTION

There are many approaches to speed up boot time for embedded device. One of the interesting tech is based hibernation. Rloader is based on this kind of tech.

TRANSCRIPT

Page 1: Rloader, alternative tech to achieve fast boot time for ARM Linux

Connect your device to application

Page 2: Rloader, alternative tech to achieve fast boot time for ARM Linux

Rloader,Alternative technology to achieve fast boot time for ARM Linux

Matt Hsu

<[email protected]>

Page 3: Rloader, alternative tech to achieve fast boot time for ARM Linux

Agenda Motivation

Boot Time Measurement

Reduction Approach

Hibernation Based Technologies

Rloader

Demo

Summary

Q & A

Page 4: Rloader, alternative tech to achieve fast boot time for ARM Linux

Movitation

Page 5: Rloader, alternative tech to achieve fast boot time for ARM Linux

Why Boot Time?Define boot time, please

Power saving

User experiences

Android's boot time is especially painful

DevicesTablet

In-vechile system

TV

Smart Phone

Camera

Page 6: Rloader, alternative tech to achieve fast boot time for ARM Linux

We Are Not AloneQuick boot

Ubiqutous

Improving meego boot-up timeHiroshi DOYU, Nokia Sotware Architect

Boosting up embedded Linux device: experience on Linux-based smarphone

Samsung Electronics Co. Ltd.

Swap-before-hibernate: A fast-on algorithm at OS level

Shi-wu Lo, OS Lab, CCU

Page 7: Rloader, alternative tech to achieve fast boot time for ARM Linux

Embedd Linux Wiki

Page 8: Rloader, alternative tech to achieve fast boot time for ARM Linux

Boot Time Measurement

Page 9: Rloader, alternative tech to achieve fast boot time for ARM Linux

Kernel spaceKernel parameter

printk.time =1

linux-2.6/scripts/show_delta

Ftraceftrace=initcall

InitcallEnable BOOT_TRACER config

./scripts/bootgraph.pl boot_time >out.svg

initcall_debug

Page 10: Rloader, alternative tech to achieve fast boot time for ARM Linux

User SpaceBootchart

http://www.bootchart.org/

cat /proc/uptime

2012.39 512.64

grabserialhttp://elinux.org/Grabserial

Page 11: Rloader, alternative tech to achieve fast boot time for ARM Linux

Hardware ApproachExternal instrument

Scope

Logic Analyzer

Hardware timer countResolution is dependent on your clock source

ETM (Embedded Trace Microcell)Need assisted software such as TRACE32/OpenOCD

New feature in ARM Cortex seies

Page 12: Rloader, alternative tech to achieve fast boot time for ARM Linux

Reduction Approach

Page 13: Rloader, alternative tech to achieve fast boot time for ARM Linux

Divide and Conquer

Bootloader

Kernel

Userland

Page 14: Rloader, alternative tech to achieve fast boot time for ARM Linux

Bootloader

Minimal bootloaderQi bootloader

zboot, linux boot directly

Enable I-cache

Copy kernel into base + 0x2000000 offset

DMA-capable copy

Multi-block read (MMC)

Page 15: Rloader, alternative tech to achieve fast boot time for ARM Linux

KernelKernel parameter

quiet

Preset LPJLoop per jiffy

Deferred initcallinclude/linux/init.h

arch/arm/kernel/vmlinux.lds

Compressed kernelUCL

XZ

Page 16: Rloader, alternative tech to achieve fast boot time for ARM Linux

Userland

Optimize linker and loader timeSpecific linker option

Parallelize rc script

Application specific optimization

Hibernation based technologies

Page 17: Rloader, alternative tech to achieve fast boot time for ARM Linux

Hibernate-Based Technologies

Swsusp, aka software suspend

Swsusp2 (TuxOnICE)

Page 18: Rloader, alternative tech to achieve fast boot time for ARM Linux

Swsusp Natviely support in x86

Based on work byTI, Teerth Reddy

https://patchwork.kernel.org/patch/96442/

Nokia, Hiroshi DOYUhttps://lists.linux-foundation.org/pipermail/linux-pm/2010-June/027422.html

Start hibernationecho disk >/sys/power/state

Page 19: Rloader, alternative tech to achieve fast boot time for ARM Linux

Swsusp2/TuxOnICENot support in main line kernel

Provides many featuresCompression of images

Readhead

multiple thread I/O

drop pagecache

Hbernation triggereho 1 >/sys/power/tuxonice/do_hibernation

Page 20: Rloader, alternative tech to achieve fast boot time for ARM Linux

Rloader, (Resume Loader)

Page 21: Rloader, alternative tech to achieve fast boot time for ARM Linux

Rloader Is Nothing NewDo we really need follow normal booting process?

The implementation of Rloader could beBootloader

snapshot boot

www.elinux.org/images/3/37/Snapshot-boot-final.pdf

Custom kernelKernel with software resume support

Different hibernation images make difference user scenario

Page 22: Rloader, alternative tech to achieve fast boot time for ARM Linux

Booting Process

Boottloaderinit

Kernel Init init.rc, platform-specific rc

Normal booting

Bootloaderinit

Minimal deviceInit

Restoreprocess

Bootloaderinit

Restoreprocess

Kernel as Rloader

Bootloader as Rloader

Page 23: Rloader, alternative tech to achieve fast boot time for ARM Linux

Make ARM Hibernated

Merge patchesswsusp patch from TI/Nokia

TOI patches according to your kernel version

'swap out' page as much as possible

ARM does not support ACPI

Currently, there are patches for ARM Cortex A8/A9 provided

Page 24: Rloader, alternative tech to achieve fast boot time for ARM Linux

Hardware/Software Descripton

ARM OMAP3 Beagleboard

Kernel2.6.32 with corresponding TOI patch

BootloaderQi

256MB RAM

0xdroid Eclair

Page 25: Rloader, alternative tech to achieve fast boot time for ARM Linux

Something before hibernating

echo 100 > /proc/sys/vm/swappiness

echo -2 > /sys/power/tuxonice/image_size_limit

echo 3 >/proc/sys/vm/drop_caches

busybox swapon -p 1 /dev/block/mtdX

Page 26: Rloader, alternative tech to achieve fast boot time for ARM Linux

Normal Booting Time Diagram

Power On ResetGPIO signal of stepping into kernel

25 seconds

GPIO signal of Key-guard event

Page 27: Rloader, alternative tech to achieve fast boot time for ARM Linux

Hibernation Boot Time Diagram

GPIO signal of stepping into kernel

GPIO signal of Key-gurad event

6 seconds

Power On Reset

Page 28: Rloader, alternative tech to achieve fast boot time for ARM Linux

Rloader as Kernel or Bootloader?It's a trade-off between your boot time and management cost

MaintainenceOnce kernel/TOI changes, you need to re-implement

ComplexicityHow to restore pages?

Resume point? PC value?

Improved room might be limited

Page 29: Rloader, alternative tech to achieve fast boot time for ARM Linux

Further OptimizationRe-construct initcall stages

Try different algorithm out on compressing images

http://code.google.com/p/snappy/

Lazy loading

Put driver state into hibernation image

Page 30: Rloader, alternative tech to achieve fast boot time for ARM Linux

Summary

It's still far away from being a product

File system inconstencyPower failure as hibernation

Hardware solution is the sliver bullet?

The time of stepping into hibernation is also needed to concern

Page 31: Rloader, alternative tech to achieve fast boot time for ARM Linux

Demo

Page 32: Rloader, alternative tech to achieve fast boot time for ARM Linux

Resourcehttp://elinux.org/Boot_Time

http://tuxonice.net/

http://gitorious.org/improving-meego-boot-up-time/t2t/commit/d29d8576cf7969c1240e9f6420404c6329d3c524

www.kernel.org/doc/ols/2010/ols2010-pages-9-18.pdf

http://gitorious.org/+0xlab/0xlab-bootloader/qi-bootloader

http://www.oberhumer.com/opensource/ucl/

http://code.google.com/p/0xdroid/

www.kernel.org/doc/ols/2010/ols2010-pages-9-18.pdf

Page 33: Rloader, alternative tech to achieve fast boot time for ARM Linux
Page 34: Rloader, alternative tech to achieve fast boot time for ARM Linux

27 May 2011Conference

Sponsoredby

http://0xlab.org