_LINUXBOOT ppt
-
Upload
sri-jahnavi-vytla -
Category
Documents
-
view
213 -
download
0
Transcript of _LINUXBOOT ppt
-
8/13/2019 _LINUXBOOT ppt
1/27
Reducing Boot Time:Reducing Boot Time:
Techniques for Fast BootingTechniques for Fast Booting
Chris Hallinan
Field Applications Engineer
Author: Embedded Linux Primer
-
8/13/2019 _LINUXBOOT ppt
2/27
Agenda
Introduction and Overview Hardware Discussion
Software Components
Overview of Boot Sequence Bootloader Issues
Linux Kernel Optimizations
Tools
pplications!"serland
-
8/13/2019 _LINUXBOOT ppt
3/27
Introduction
#ast Boot is Important to $an% &roducts Consumer' utomotive' $edical Devices' etc(
Si)nificant )ains w( minimal investment
#irst' define *+oot,( Does it mean-
Splas. screen/ 0st user process started/ Device full% up and runnin)' connected/
Boot time is affected +% man% factors- Hardware Desi)n Bootloader Implementation Kernel Confi)uration pplication &rofile
-
8/13/2019 _LINUXBOOT ppt
4/27
2008 MontaVista Software - Confidential 4
Typical Boot Sequence Optimization Opportunities
Bootloader $a% +e multiple sta)es
1emove support for unused features
$odif%!remove .ardware pro+in) features
Keep it Simple' Small -2
Kernel $an% opportunities for optimization
Low .an)in) fruit can +e eas% to 3pluc43
pplications $ost are up to %ou5
$ost initialization is serial
Ta4e measurements to decide w.ereto focus5
Power Applied
Pwr/Clk/Reset
Bootloader
Kernel Init
Root FS Mount
Userland Apps
-
8/13/2019 _LINUXBOOT ppt
5/27
Bootloader Considerations
Bootloader .as two primar%responsi+ilities-
Initialize C&"!Hardware 6minimall%2 Locate' load and execute a 4ernel ima)e
$a% involve several steps' includin) device I!O'decompression' etc(
-
8/13/2019 _LINUXBOOT ppt
6/27
Bootloader Considerations
$ost +ootloaders .ave man% more features
7sp( loo4 for an% t%pe of +us enumeration Lots of useful *development, functionalit% d.cp' tftp' pci scan' mem utils
device initialization' #las. utilities' etc
In a production s%stem' man% of t.ese features ma% +eunnecessar%
Disa+lin) t.ese features can .ave a si)nificant impact on+oot time
#or fast +oot' )et t.e +ootloader out of t.ewa% quic4l%
1emem+er' small 88 fast
-
8/13/2019 _LINUXBOOT ppt
7/27
2008 MontaVista Software - Confidential 7
Kernel Image Optimization
"se "ncompressed Kernel Decompression can ta4e several seconds5 Tradeoff- more #las. stora)e required
Kernel +uild produces two ima)es9 Ima)e and zIma)e 61$2 O+viousl%' zIma)e is t.e compressed
version
On i($:;0' t.is saved on avera)e ? mS
@$$A' dependin) on C&" speed' #LSHspeed(((
9Details var% for eac. arc.itecture' 1$ discussed .ere
-
8/13/2019 _LINUXBOOT ppt
8/27
2008 MontaVista Software - Confidential 8
Linux Kernel Configuration
7liminate "nnecessar% Kernel Options
1educes 4ernel size Speeds up 4ernel loadin) In some cases' will reduce 4ernel init time
once 4ernel is loaded
T%pical default 4ernel confi) contains lotsof 3stuff3 6i(e( features2 %ou ma% not need- $D!1aid support' I&v' umerous #ile
S%stems' 7xtended &artition support' etc( De+u) features suc. as 4ernel s%m+ols'
i4confi)' etc( $an% are compiled in features and increase
4ernel size
-
8/13/2019 _LINUXBOOT ppt
9/272008 MontaVista Software - Confidential 9
Kernel Config Options to Consider Disabling
CO#IE$D
1ID!LA$ support CO#IEID7
Saves init time ifnot used on HF w!
ID7 ctrlr Can also use
.dx8nopro+e
CO#IE&CC1D
CO#IEHOT&L" 1emove support for
.otplu) if notrequired
CO#IEIKCO#I 1emoves support for
confi) info' ma4es 4ernelsmaller
CO#IED7B"EK717L
CO#IEKLLS@$S
CO#IEB" "sed for de+u) G can +e
removed if desired
-
8/13/2019 _LINUXBOOT ppt
10/272008 MontaVista Software - Confidential 10
More Interesting Kernel Config Options
C.ec4 etwor4in) options
Lots of functionalit% G do %ou need it all/ ie( 4ernel autoconf' multicast' advanced router' etc(
1emove support for unnecessar% #S features Default confi)s often .ave muc. of t.is ena+led
CO#IEDOTI#@
CO#IEIOTI#@
CO#IE:#S
CO#IE"TO#SE#S 6utomounter2
etc
1emem+er- Smaller 4ernel 8 #aster load
If in doubt, make small changes. Test early andIf in doubt, make small changes. Test early and
often so you can rollback breakages easily!often so you can rollback breakages easily!
-
8/13/2019 _LINUXBOOT ppt
11/272008 MontaVista Software - Confidential 11
Calibration Routines
$an% .ardware platforms spendconsidera+le time in cali+ration routines *Calculatin) Bo)o$ips(((, llows precise dela%62 routines
Can ta4e si)nificant time "se 4ernel command line- loopsJperJiff%-
lp8xxxxx
7as% to use- most platforms will displa%correct value in 4ernel lo) 6and to console2on startup
-
8/13/2019 _LINUXBOOT ppt
12/272008 MontaVista Software - Confidential 12
Driver Configuration
Consider %our s%stem requirements- F.at functionalit% must +e availa+le
immediatel%/ F.at functionalit% can +e deferred/ F.at drivers are not needed/
$odules 6CO#IE98$2' if unused' areirrelevant Fon3t affect 4ernel startup time
-
8/13/2019 _LINUXBOOT ppt
13/272008 MontaVista Software - Confidential 13
Driver Configuration
Drivers can +e preJcompiled into 4ernel or
+uilt as modules for loadin) later "se staticall%Jlin4ed drivers for functions
t.at must +e immediatel% availa+le
"se Loada+le $odules for deferred
functionalit% Caveat- if %ou can avoid CO#IE$OD"L7S'
4ernel will +e smaller9' t.us faster to load(T.ere is pro+a+l% also a minor .it to readin)
t.e driver from t.e #S instead of it +ein) int.e 4ernel
*Assumes minimal system, few drivers.
-
8/13/2019 _LINUXBOOT ppt
14/272008 MontaVista Software - Confidential 14
File System Selection
Consider C1$#S for initial readJonl% #S Compact and fast o ournalin) entries to scan on initial mount
"se tmpfs for !tmp' possi+l% !var' ot.ers
$ount writa+le #S later' suc. as ##SM onO1 #las.
Consider %our tolerance to sudden power off ournalin) file s%stems can protect +ut at a
cost of increased startup times
-
8/13/2019 _LINUXBOOT ppt
15/272008 MontaVista Software - Confidential 15
XIP Execute in Place
&rocessor does not cop% Kernel ima)e to D1$ 7xecutes directl% from 6O12 #las.
dvanta)es 1educes D1$ requirements 6and t.us power2 7liminates timeJconsumin) cop% from #las.
Disadvanta)es Dependin) on .!w arc.itecture' could +e muc.
slower i(e( +urst!cac.e performance' etc(
Cost of #las. G 4ernel must +e storeduncompressed
@our $ilea)e $a% Aar%
-
8/13/2019 _LINUXBOOT ppt
16/272008 MontaVista Software - Confidential 16
Remove Support for printk()
T.e *Brute #orce, approac. J CO#IE&1ITK
Completel% eliminates calls to print462 dvanta)es
Saves si)nificant 4ernel size' and t.erefore load time 7liminates man% +oot messa)es J decreasin) +oot
time
Disadvanta)e o 4ernel status messa)e are availa+le5 $a4es 4ernel de+u))in) ver% difficult
t.orou).l% tested 4ernel s.ould wor4 well .ere lternativel%' use *quiet, command line parameter
suppresses print4 output durin) +oot' preservin) t.eprint4 infrastructure to +e used postJ+oot
-
8/13/2019 _LINUXBOOT ppt
17/272008 MontaVista Software - Confidential 17
Tools K#T- Kernel #unction Timin)
1equires KLLS@$S' mentioned a+ove &rovides function call tracin) and timin)
Entry Duration Local Pid Trace---------- ---------- ---------- ------- ----------------------------- 162 11523 0 0 paging_init 162 11523 0 0 | free_area_init_nodes 162 11523 12 0 | | free_area_init_node
162 11511 11511 0 | | | _etext+0x2f0 162 11511 0 0 __alloc_bootmem_node 162 11511 11511 0 ! __alloc_bootmem_core 11787 2307 2307 0 vfs_caches_init_early 11787 1531 69 0 vfs_caches_init_early 11787 686 0 0 [ alloc_large_system_hash 11787 686 0 0 [ [ __alloc_bootmem 11787 686 0 0 [ [ [ __alloc_bootmem_nopanic 11787 686 686 0 [ [ [ [ __alloc_bootmem_core
13318 776 776 0 [ inode_init_early 14094 1208 641 0 mem_init 14094 567 4 0 # free_all_bootmem 14094 563 563 0 # # free_all_bootmem_core 15607 3851 3851 0 schedule 15607 3848 3848 0 schedule 15630 1573099 1573099 1 kernel_init 15666 81152 81152 4 schedule 15666 81139 81139 4 schedule
-
8/13/2019 _LINUXBOOT ppt
18/272008 MontaVista Software - Confidential 18
Tools Linux Trace Tool4it
-
8/13/2019 _LINUXBOOT ppt
19/272008 MontaVista Software - Confidential 19
Tools
print4 timestamps 6CO#IE&1ITKETI$72 ppends time info to print462 output 7na+les measurement of lon) operations'
esp( at +oot time
[ 1.321054] md: linear personality registered for level -1
[ 1.326629] md: raid0 personality registered for level 0[ 1.331964] md: raid1 personality registered for level 1[ 1.342289] TCP cubic registered[ 1.345936] NET: Registered protocol family 1[ 1.350403] NET: Registered protocol family 17[ 1.355816] RPC: Registered udp transport module.[ 1.360571] RPC: Registered tcp transport module.[ 1.366034] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)[ 2.880506] IP-Config: Complete:[ 2.883575] device=eth0, addr=192.168.1.201, mask=255.255.255.0, gw=255...[ 2.892227] host=8349itx, domain=, nis-domain=(none),[ 2.897798] bootserver=192.168.1.9, rootserver=192.168.1.9, rootpath=[ 2.906152] md: Autodetecting RAID arrays.
-
8/13/2019 _LINUXBOOT ppt
20/272008 MontaVista Software - Confidential 20
Tools
initcallEde+u) reat wa% to )et a coarse view of s%stem
init timin)
4 msecs: initcall c02c7da0 t linear_init5 msecs: initcall c02c6bbc t init_sd6 msecs: initcall c02c7d78 t mpc83xx_wdt_init7 msecs: initcall c02cc450 t init_sunrpc10 msecs: initcall c02c01a8 t slab_sysfs_init15 msecs: initcall c02c8d50 t genl_init24 msecs: initcall c02c55c4 t serial8250_init
30 msecs: initcall c02c6364 t gfar_init34 msecs: initcall c02c743c t physmap_init72 msecs: initcall c02c9c60 t inet_init127 msecs: initcall c02c4e4c t pty_init4597 msecs: initcall c02cabe0 t ip_auto_config
-
8/13/2019 _LINUXBOOT ppt
21/272008 MontaVista Software - Confidential 21
An example of boot time reduction
i($:;0 1eference +oard Initial confi)uration-
?-; power on to command prompt 1ed+oot +ootloader ta4es 0? seconds
#inal Confi)uration etwor4in)' static I& Bus%+ox userland $an% 4ernel optimizations M(= Seconds J Kernel start to s.ell prompt $inimal en)ineerin) investment
-
8/13/2019 _LINUXBOOT ppt
22/272008 MontaVista Software - Confidential 22
Applications/Userland
Startup scripts-
void &erl!&%t.on dependencies 6will reduce #Ssize as well2 One custom startup script instead of usin) S%sA
Init and !etc!init(d
Cac.es 6+i) impact if %ou .ave a +i)userland2- Li+rar% Cac.e setup ICO #ont
&relin4 li+raries
"se tools to profile execution strace and ltrace can +e useful .ere
-
8/13/2019 _LINUXBOOT ppt
23/272008 MontaVista Software - Confidential 23
Additional Ideas and Resources
&arallelize t.e init tas4s *+oot, ever%t.in) at once drivers and tas4s can do t.eir several
seconds of waitin) at t.e same time
&rovide user feed+ac4 earl% Splas. screens' etc )ive impression t.at unit is +ooted w.ile
initialization continues ets +ac4 to definin) w.at *+ooted,
means(((
-
8/13/2019 _LINUXBOOT ppt
24/272008 MontaVista Software - Confidential 24
Additional Ideas and Resources
Save a canned memor% and s%stem stateto nonJvolatile stora)e so t.at +ootin) can occur as fast as t.e
memor% ima)e can +e read from dis4
6.i+ernation2( 1equires si)nificant stora)e
Suspend!1esume G man% consumerdevices almost never cold +oot( e()( man% *Smart &.ones, onl% cold +oot if
%ou remove N replace +atter%
-
8/13/2019 _LINUXBOOT ppt
25/272008 MontaVista Software - Confidential 25
Additional Ideas and Resources
Oprofile G S%stemwide Stat( &rofilin) for Linux On one proect' t.is .elped ID #las. as a +ottlenec4 #ocused on acceleratin) #las. I!O reduced +oot time
.ttp-!!elinux(or)!BootETime
Tim Bird3s OLS M?? presentation $et.ods to Improve Bootup Time in Linux .ttp-!!4ernel(or)!doc!ols!M??!olsM??v0Jpa)esJ=PJQQ(pdf
ran van de Aen' Linux &lum+ers ConferenceBootin) Linux in > Seconds 6xQ!Des4top focused26Sept 0Q' M??Q2 .ttp-!!lwn(net!rticles!MPPQ;!
$eld 6next slide2
-
8/13/2019 _LINUXBOOT ppt
26/272008 MontaVista Software - Confidential 26
A Meld
discussion
on Linux
startup...
-
8/13/2019 _LINUXBOOT ppt
27/27