LINUXBOOT
LINUXBOOT
LINUXBOOT
Agenda
Hardware Discussion
Software Components
Introduction
Consumer'
Splas. screen/ 0st user process started/ Device full% up and runnin)' connected/ Hardware Desi)n Bootloader Implementation Kernel Confi)uration pplication &rofile
Optimization Opportunities
Bootloader
$a% +e multiple sta)es 1emove support for unused features $odif%!remove .ardware pro+in) features Keep it Simple' Small -2 $an% opportunities for optimization Low .an)in) fruit can +e eas% to 3pluc43 $ost are up to %ou5
Kernel
pplications
Root FS Mount
Userland Apps
Bootloader Considerations
Bootloader Considerations
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% +e unnecessar% Disa+lin) t.ese features can .ave a si)nificant impact on +oot time
#or fast +oot' )et t.e +ootloader out of t.e wa% quic4l%
Decompression can ta4e several seconds5 Tradeoff- more #las. stora)e required Ima)e and zIma)e 6 1$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' #L SH speed(((
9Details var% for eac. arc.itecture' 1$ discussed .ere
2008 MontaVista Software - Confidential 7
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 lots of 3stuff3 6i(e( features2 %ou ma% not need
$D!1aid support' I&vB' Cumerous #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
COC#IDE$D
1 ID!LA$ support
Saves init time if not used on HF w! ID7 ctrlr Can also use .dx8nopro+e
COC#IDEIKCOC#ID
COC#IDEID7
COC#IDE&CC 1D COC#IDEHOT&L"D
Lots of functionalit% G do %ou need it all/ ie( 4ernel autoconf' multicast' advanced router' etc( Default confi)s often .ave muc. of t.is ena+led
COC#IDEDCOTI#@ COC#IDEICOTI#@ COC#IDE:#S COC#IDE "TO#SHE#S 6 utomounter2 etc
10
Calibration Routines
*Calculatin) Bo)o$ips(((, llows precise Idela%62 routines Can ta4e si)nificant time lpK8xxxxx
7as% to use- most platforms will displa% correct value in 4ernel lo) 6and to console2 on startup
2008 MontaVista Software - Confidential 11
Driver Configuration
F.at functionalit% must +e availa+le immediatel%/ F.at functionalit% can +e deferred/ F.at drivers are not needed/
12
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 COC#IDE$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) in t.e 4ernel
*Assumes minimal system, few drivers.
2008 MontaVista Software - Confidential
13
"se tmpfs for !tmp' possi+l% !var' ot.ers $ount writa+le #S later' suc. as L##SM on CO1 #las. Consider %our tolerance to sudden power off
Lournalin) file s%stems can protect +ut at a cost of increased startup times
14
7xecutes directl% from 6CO12 #las. 1educes D1 $ requirements 6and t.us power2 7liminates timeJconsumin) cop% from #las. Dependin) on .!w arc.itecture' could +e muc. slower
dvanta)es
Disadvanta)es
Completel% eliminates calls to print462 Saves si)nificant 4ernel size' and t.erefore load time 7liminates man% +oot messa)es J decreasin) +oot time Co 4ernel status messa)e are availa+le5 $a4es 4ernel de+u))in) ver% difficult
dvanta)es
Disadvanta)e
t.orou).l% tested 4ernel s.ould wor4 well .ere lternativel%' use *quiet, command line parameter
suppresses print4 output durin) +oot' preservin) t.e print4 infrastructure to +e used postJ+oot
2008 MontaVista Software - Confidential 16
Tools
1equires K LLS@$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
17
Tools
18
Tools
ppends time info to print462 output 7na+les measurement of lon) operations' esp( at +oot time
[ [ [ [ [ [ [ [ [ [ [ [ [ [
1.321054] 1.326629] 1.331964] 1.342289] 1.345936] 1.350403] 1.355816] 1.360571] 1.366034] 2.880506] 2.883575] 2.892227] 2.897798] 2.906152]
md: linear personality registered for level -1 md: raid0 personality registered for level 0 md: raid1 personality registered for level 1 TCP cubic registered NET: Registered protocol family 1 NET: Registered protocol family 17 RPC: Registered udp transport module. RPC: Registered tcp transport module. drivers/rtc/hctosys.c: unable to open rtc device (rtc0) IP-Config: Complete: device=eth0, addr=192.168.1.201, mask=255.255.255.0, gw=255... host=8349itx, domain=, nis-domain=(none), bootserver=192.168.1.9, rootserver=192.168.1.9, rootpath= md: Autodetecting RAID arrays.
19
Tools
initcallEde+u)
20
?-;B power on to command prompt 1ed+oot +ootloader ta4es 0? seconds Cetwor4in)' static I& Bus%+ox userland $an% 4ernel optimizations M(= Seconds J Kernel start to s.ell prompt $inimal en)ineerin) investment
21
#inal Confi)uration
Applications/Userland
Startup scripts
void &erl!&%t.on dependencies 6will reduce #S size as well2 One custom startup script instead of usin) S%sA Init and !etc!init(d
*+oot, ever%t.in) at once drivers and tas4s can do t.eir several seconds of waitin) at t.e same time Splas. screens' etc )ive impression t.at unit is +ooted w.ile initialization continues Dets +ac4 to definin) w.at *+ooted, means(((
23
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
e()( man% *Smart &.ones, onl% cold +oot if %ou remove N replace +atter%
24
On one proKect' t.is .elped ID #las. as a +ottlenec4 #ocused on acceleratin) #las. I!O reduced +oot time <M>O
rKan van de Aen' Linux &lum+ers Conference Bootin) Linux in > Seconds 6xQB!Des4top focused2 6Sept 0Q' M??Q2
.ttp-!!lwn(net! rticles!MPPHQ;!
25
26
Thank you!