您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 管理学资料 > linux快速启动方案,启动时间优化
OptimizingLinuxBootTimeThissessiongivesanoverviewofmethodsforoptimizingtheboottimeofaLinuxsystemJuly2012LAB:InstalledandconfiguredVMWarePlayerv4orlaterInstalledUbuntu10.04InstalledthelatestSitaraLinuxSDKandCCSv5WithintheSitaraLinuxSDK,ranthesetup.sh(toinstallrequiredhostpackages)UsingaSitaraEVM,followedtheQSGtoconnectethernet,serialcables,SDcardand5VpowerBootedtheEVMandnoticedtheMatrixGUIapplicationlauncherontheLCDPulledtheipaddrofyourEVMandranremoteMatrixusingawebbrowserBroughttheUSBtoSerialcableyouconfirmedonyoursetup(preferable)4Agenda•WhatisFastBoot?•BootProcessOverview•MeasuringBootTime•IdentifyingtheBootSteps•Profiling–U-boot–LinuxKernel•OptimizationTechniques–U-boot–LinuxKernel–FileSystem5WhatisFastBoot?•Fastbootreferstominimizingtheboottimeofasystem.Theboottimeofthesystemisthetimeittakesfromtheapplicationofpowertothesystembecoming“available”•“Available”hasalotofdifferentmeaningsdependingontheuserexpectations.–Appearanceofthehomescreenfordeviceslikecellphones–AnaudibletoneorLEDindicator–ALinuxprompt–Becomingdiscoverableonthenetwork–Havingakeyperipheralbecomeavailable•TheabovevariancesshowwhytheSitaraLinuxSDKisgenerallynotfullyoptimizedforboottime.EachusercanhaveadifferenttargetandagenericSDKcannotsatisfyallusertargets–Therearealsomanyfeaturesthatmakeforagooddevelopmentenvironment,butwhichdonotmakeforafastbootingenvironment6BootProcessOverview7MeasuringBootTime•Thereareacoupleofdifferentoptionsformeasuringboottime.YoucanuseaCprogramthattimestampseachlineontheserialport.––Compilewith“gcctstamp.c-otstamp”–Thiscanalsobeinvokedas“cat/dev/TTYDEVICE|tstamp•RealTermforWindowssupportstimestampingtheincomingserialdata––SupportlogginginUnixdateformat–Abilitytologdirectlytoafile–Abilitytostoploggingafterapredefinedtime–Noneedtoswitchterminalforinteractivesession•TeraTermforWindowscannowlogtimeaswellbutdoesnotgiveelapsedtimemeasurements.8MeasuringBootTime-Cont•UsingtheCprogramapproachyouwillseeoutputlike:18.0660.093:ThuJun2811:56:00UTC2012INIT:Enteringrunlevel:518.2620.175:Startingsystemmessagebus:dbus.18.2800.018:StartingHardwareabstractionlayerhald19.4741.194:StartingDropbearSSHserver:dropbear.19.4990.025:Startingtelnetdaemon.19.5380.039:Startingnetworkbenchmarkserver:netserver.19.5690.031:Startingsyslogd/klogd:done19.6290.060:Startingthttpd.19.7310.102:StartingPVR20.1580.427:StartingLighttpdWebServer:lighttpd.20.1760.018:2012-06-2811:56:02:(log.c.166)serverstarted•IntheaboveoutputyoucanseethatstartingtheDropbearSSHservertakes1.194seconds.–IfyoudonotneedSSHyoucansave1.194secondsbydisablingDropbear–DisablingDropbearisassimpleasremovingtheS10dropbearinitscriptfromthe/etc/rc5.ddirectory9IdentifyingtheBootSteps•Oneofthefirstthingstohelpinoptimizingboottimeistobeabletorecognizethemarkersindicatingwhereanewpartofthebootprocessstarts•SPL–ThefirstnewlinecharacterreceivedontheserialconsolemarksthestartofSPL•U-boot–ThebannercontainingtheU-bootversionindicatesthestartofu-bootU-Boot2011.09(Jun282012-11:20:36)•LinuxKernel–FirstlineafterthebelowlineindicatesthestartoftheLinuxkernelUncompressingLinux…done,bootingthekernel•FileSystem–ThebelowlineindicatesthetransitiontothefilesystemInitprocessINIT:version2.86booting10ProfilingtheBootLoaders•Thereisnodirectprofilingsupportinthebootloaders,buttheserialprinttimescanstillbeveryuseful•Forexample,whenbootingthekernelimageyouwillseeoutputlike:5.3350.010:##BootingkernelfromLegacyImageat80007fc0...5.3390.004:ImageName:Arago/3.2.0-psp04.06.00.08.sdk/a5.3440.005:ImageType:ARMLinuxKernelImage(uncompressed)5.3480.004:DataSize:3164688Bytes=3MiB5.3500.002:LoadAddress:800080005.3520.002:EntryPoint:800080006.2730.921:VerifyingChecksum...OK6.2760.003:XIPKernelImage...OK6.3100.034:OK•Noticethatalmostasecondisspentverifyingthekernelimagechecksum.•Ifyoursystemdoesn’tdoanythingaboutabadimage,whyspendtimeverifyingit?–Thisverificationcanbedisabledbysettingthe“verify”u-bootparametertonattheu-bootcommandpromptu-boot#setenvverifyn11ProfilingtheLinuxKernel•OneofthesimplestwaystoprofiletheLinuxkernelistoconfigure“CONFIG_PRINTK_TIME”fortheLinuxkernel.Onmostrecentkernelsthisisenabledbydefault.–Thisaddsthetimesincethekernelwasbootedin[]’sbeforeeachline[2.029785]mmc1:cardclaimstosupportvoltagesbelowthedefinedrange.T.[2.048583]mmc1:queuingunknownCIStuple0x91(3bytes)[2.055053]mmc1:newSDIOcardataddress0001[3.986724]PHY:0:00-LinkisUp-100/Full[4.015808]SendingDHCPrequests.,OK[4.036254]IP-Config:GotDHCPanswerfrom0.0.0.0,myaddressis128.247.10[4.044586]IP-Config:Complete:[4.047973]device=eth0,addr=128.247.105.20,mask=255.255.254.0,gw=12,[4.056182]host=128.247.105.20,domain=am.dhcp.ti.com,nis-domain=(non,[4.063781]bootserver=0.0.0.0,rootserver=0.0.0.0,rootpath=–InTheaboveoutputwecanseethatittakesalmost2secondstogetthenetworkPhyLinkupandobtainaDHCPIPaddress.•Dependingonnetworkspeedthiscouldbelonger.InthecasewherethereisnoDHCPserverthiscantak
本文标题:linux快速启动方案,启动时间优化
链接地址:https://www.777doc.com/doc-3352900 .html