groupfedora17
fedora17 时间:2021-03-26 阅读:(
)
Hands-onKernelLabBasedontheYoctoProject1.
4release(dylan)April2013TomZanussiDarrenHartIntroductionWelcometotheYoctoProjectHands-onKernelLab!
DuringthissessionyouwilllearnhowtoworkeffectivelywiththeLinuxkernelwithintheYoctoProject.
The'Hands-onKernelLab'isactuallyaseriesoflabsthatwillcoverthefollowingtopics:Creatingandusingatraditionalkernelrecipe(lab1)Using'bitbake-cmenuconfig'tomodifythekernelconfigurationandreplacethedefconfigwiththenewconfiguration(lab1)Addingakernelmoduletothekernelsourceandconfiguringitasabuilt-inmodulebyaddingoptionstothekerneldefconfig(lab1)Creatingandusingalinux-yocto-basedkernel(lab2)Addingakernelmoduletothekernelsourceandconfiguringitasabuilt-inmoduleusinglinux-yocto'configfragments'(lab2)Usingthelinux-yoctokernelasanLTSIkernel(configuringinanitemaddedbytheLTSIkernelwhichismergedintolinux-yocto)(lab2)Usinganarbitrarygit-basedkernelviathelinux-yocto-customkernelrecipe(lab3)Addingakernelmoduletothekernelsourceofanarbitrarygit-basedkernelandconfiguringitasaloadablemoduleusing'configfragments'(lab3)Actuallygettingthemoduleintotheimageandautoloadingitonboot(lab3)Usingalocalcloneofanarbitrarygit-basedkernelviathelinux-yocto-customkernelrecipetodemonstrateatypicaldevelopmentworkflow(lab4)Modifyingthelocallyclonedcustomkernelsourceandverifyingthechangesinthenewimage(lab4)Usingalocalcloneofalinux-yocto-kernelrecipetodemonstrateatypicaldevelopmentworkflow(lab4)Modifyingthelocallyclonedlinux-yoctokernelsourceandverifyingthechangesinthenewimage(lab4)Usinga'bare'localcloneofalinux-yocto-kernelrecipetodemonstrateatypicaldevelopmentworkflow(lab4)Modifyingthelocallycloned'bare'linux-yoctokernelsourceandverifyingthechangesinthenewimage(lab4)Addingandusinganexternalkernelmoduleviaamodulerecipe(lab4)Usingthe'YoctoBSPTools'yocto-bsptoolgenerateanewYoctoBSP(lab5)Usingthe'YoctoBSPTools'yocto-kerneltooltoaddkernelpatchesandconfigfragments(lab5)ThislabassumesyouhaveabasicunderstandingoftheYoctoProjectandbitbake,Hands-onKernelLabwww.
yoctoproject.
orgPage2of39andarecomfortablenavigatingaUNIXfilesystemfromtheshellandissuingshellcommands.
Ifyouneedhelpinthisarea,pleaseconsulttheintroductorymaterialwhichyoucanfindontheYoctowebsiteand/orGoogleforwhateverelseyouneedtoknowtogetstarted.
AllofthematerialcoveredinthislabisdocumentedintheYoctoProjectLinuxKernelDevelopmentManual:http://www.
yoctoproject.
org/docs/latest/kernel-dev/kernel-dev.
htmlPleaseconsultthekerneldevelopmentmanualformoredetailedinformationandbackgroundonthetopicscoveredinthislab.
Tip:Throughoutthelabyouwillneedtoeditvariousfiles.
Sometimesthepathnamestothesefilesarelong.
Itiscriticalthatyouenterthemexactly.
RememberyoucanusetheTabkeytohelpautocompletepathnamesfromtheshell.
YoumayalsocopyandpastethepathsfromthePDFversionofthislabwhichyoucanfindatthesamelocationthatthisdocumentwasfound.
Tip:Eachlabisindependentoftheothersanddoesn'tdependontheresultsofanypreviouslab,sofeelfreetojumprighttoanylabthat'sofinteresttoyou.
BuildSystemBasicSetupThishands-onlabwasdesignedtobecompletedonacomputerrunningtheUbuntu12.
04"PrecisePangolin"operatingsystem.
WhilethisspecificreleaseofUbuntuisrecommendedtoavoidunforeseenincompatibilities,youcangenerallyusearecentreleaseofUbuntu,Fedora,orOpenSUSEtocompletethishands-onlab.
Thishands-onlabwasdevelopedandthereforealsotestedonaFedora17system.
Beforestartingtheseexercises,pleaseensurethatyoursystemhasthenecessarysoftwareprerequisitesinstalledasdescribedintheYoctoProjectQuickStartGuide(seethesubsectionentitled"ThePackages"):http://www.
yoctoproject.
org/docs/1.
4/yocto-project-qs/yocto-project-qs.
htmlThishands-onlabassumesyouhaveanetworkconnectionandhaveaworkingversionof'git'installed.
You'llneedagoodnetworkconnectionfortheinitialsetupanddownloadofthesourcepackagesbuiltbytherecipes.
'git'isrequiredforcreatingandtestingkernelpatchesforthegit-basedkernelrecipesusedinlab4,butisn'trequiredbytheotherlabs.
PreparingYourBuildEnvironmentPleaselogintoyoursystemasanormaluserandonceloggedin,launchaterminalbysimultaneouslypressingthefollowingkeys:Ctrl+Alt+TAlternatively,youcanopenaterminalbyclickingthe'Dash'iconandtyping'terminal'intheentryfield.
Whenthe'Terminal'iconappears,clickonittoopenaterminal.
ThroughoutthelabyoumayfinditusefultoworkwithmorethanonetabinyourHands-onKernelLabwww.
yoctoproject.
orgPage3of39terminal.
Tocreateadditionaltabs:FileOpenTabInordertorunthelabs,you'llfirstneedtodownloadtheYocto1.
4'dylan'sourcesintoyourhomedirectory.
Fromyourterminalshell,type:$wgethttp://downloads.
yoctoproject.
org/releases/yocto/yocto-1.
4/poky-dylan-9.
0.
0.
tar.
bz2$bunzip2-cpoky-dylan-9.
0.
0.
tar.
bz2|tarxvf-Onceyou'vegottentheYocto1.
4sources,youshouldcdintothethepoky-dylan-9.
0.
0directorythatwascreated::$cdpoky-dylan-9.
0.
0/Listingthefilesinthatdirectoryshouldshowthefollowingfilesandsubdirectories:$lsbitbakeLICENSEmeta-hobmeta-yoctooe-init-build-envREADME.
hardwaredocumentationmetameta-skeletonmeta-yocto-bspREADMEscriptsYoualsoneedtogetandunpacktheinstructionallayersforthislab:$wgethttps://www.
yoctoproject.
org/sites/yoctoproject.
org/files/kernel-lab-1.
4-layers.
tar.
bz2$bunzip2-ckernel-lab-1.
4-layers.
tar.
bz2|tarxvf-Listingthefilesinthecurrentdirectory,whichshouldstillbepoky-dylan-9.
0.
0,shouldnowshowthefollowingfilesandsubdirectories:$lsbitbakemeta-hobmeta-lab5-qemuarm.
finishedREADMEdocumentationmeta-lab1-qemux86meta-skeletonREADME.
hardwarekernel-lab-1.
4-layers.
tar.
bz2meta-lab2-qemux86meta-yoctoscriptsLICENSEmeta-lab3-qemux86meta-yocto-bspmetameta-lab4-qemux86oe-init-build-envHands-onKernelLabwww.
yoctoproject.
orgPage4of39Lab1:TraditionalKernelRecipeInthislabyouwillmodifyastock3.
0.
18Linuxkernelrecipetomakeitbootonaqemux86machine.
Youwillthenapplyapatchandmodifytheconfigurationtoaddasimplekernelmodulewhichprintsamessagetotheconsole.
Thiswillfamiliarizeyouwiththebasicbitbakeworkflowforworkingwithandmodifyingsimplekernelrecipes.
SetuptheEnvironment$cd~/poky-dylan-9.
0.
0/$sourceoe-init-build-envOpenlocal.
conf:$geditconf/local.
confanduncommentthefollowinglines:BB_NUMBER_THREADS="4"PARALLEL_MAKE="-j4"Ifyouhaveadifferentnumberofprocessors,changethosevaluestomatchthenumberofprocessorsyouhaveinyourmachine.
Addthefollowinglinejustabovethelinethatsays'MACHINE="qemux86":MACHINE="lab1-qemux86"Saveyourchangesandclosegedit.
Nowopenbblayers.
conf:$geditconf/bblayers.
confandaddthe'meta-lab1-qemux86'layertotheBBLAYERSvariable.
Thefinalresultshouldlooklikethis,assumingyouraccountiscalled'myacct'(simplycopythelinecontaining'meta-yocto-bsp'andreplace'meta-yocto-bsp'with'meta-lab1-qemux86'):BBLAYERS="\/home/myacct/poky-dylan-9.
0.
0/meta\/home/myacct/poky-dylan-9.
0.
0/meta-yocto\/home/myacct/poky-dylan-9.
0.
0/meta-yocto-bsp\/home/myacct/poky-dylan-9.
0.
0/meta-lab1-qemux86\"Youshouldnotneedtomakeanyfurtherchanges.
Saveyourchangesandclosegedit.
Themeta-lab1-qemux86layerprovidesaverysimpleLinux3.
0.
18recipe.
Openitingeditforreview:$gedit~/poky-dylan-9.
0.
0/meta-lab1-qemux86/recipes-kernel/linux/linux_3.
0.
18.
bbThisisabare-bonessimpleLinuxkernelrecipe.
Itinheritsallofthelogicforconfiguringandbuildingthekernelfromthekernel.
bbclass(the'inheritkernel'line).
ItspecifiestheLinuxkernelsourcesinSRC_URIasarecenttarballreleasefromkernel.
org.
Italsospecifiesadefconfig,thisfileisusedasthe.
configtobuildthekernel.
Itisemptyfornow,sotheLinuxkernelconfigurationsystemwilluseHands-onKernelLabwww.
yoctoproject.
orgPage5of39defaults.
YouwillalsonoticeacommentedoutpatchonanotherSRC_URIline,leaveitcommentedoutfornow,wewillcomebacktothat.
Themeta-lab1-qemux86layeralsoprovidesafairlystandardmachineconfigurationwhosepurposeistodefineagroupofmachine-specificsettingsforthe'lab1-qemux86'machine.
Thesesettingsprovidemachine-specificvaluesforanumberofvariables(alldocumentedintheYoctoProjectReferenceManual)whichallowustobootthe'lab1-qemux86'machineintoagraphicalqemuenvironment.
Openitingeditforreview:$gedit~/poky-dylan-9.
0.
0/meta-lab1-qemux86/conf/machine/lab1-qemux86.
confWithoutgoingintotoomuchdetail,thereareafewthingstonoteaboutthisfile.
Thefirstisthefilenameitself;notethatthebasefilenamematchesthemachinename,inthiscase'lab1-qemux86',whichisalsothesameasthemachinenamespecifiedintheMACHINEsettinginlocal.
conf.
Secondly,notethatotherthanthe'require'statements,whichessentiallyjustimplementafileinclusionmechanism,theconfigurationconsistsalmostentirelyofvariableassignments.
Thevariousassignmentoperatorsaredocumentedelsewhereandarerelativelyobvious,butfornowwe'lljustmentionthatthe'='assignmentoperatorimplementsconditionalassignment:ifthevariablehasn'talreadybeenset,ittakesonthevaluespecifiedontheright-hand-side.
Finally,awordofexplanationaboutthePREFERRED_PROVIDERassignmentsinthemachineconfigurationfile.
Manycomponentsofthebuildsystemhavemultipleimplementationsavailable.
Thebuildsystemwillnormallychooseadefaultimplementationandversionforaparticularcomponent,butsometimesitmakessenseforamachinetoexplicitlyspecifyaspecificimplementationand/orversionifitknowsitdoesn'twanttousethedefaults.
Itmayalsowanttospecifyspecificvaluesinorderto'pindown'aparticularimplementationandversionregardlessofwhatthedefaultsare,orhowtheymaychangeinthefuture.
Inthecaseofthe'lab1-qemux86'machine,youseethatitspecifiesaPREFERRED_PROVIDERforthevirtual/kernelcomponent:PREFERRED_PROVIDER_virtual/kernel="linux"Thereasonitdoesthisisthatifitdidn't,itwouldpickupthedefaultlinux-yocto_3.
8kernel(whichistheversionspecifiedintheqemu.
incfileincludedfollowingthatline).
Also,becausethere'sonlyasinglelinux_*recipe,there'snoambiguityaboutwhichversiontochooseandthereforenospecificversionspecified.
Ifyouneededto,youcoulddothatusingaPREFERRED_VERSIONdirective–you'llseeanexampleofthatinLab2.
Note:Thereasonthelayersandthemachineshaveslightlyunwieldynamese.
g.
'lab1-qemux86'ratherthanjustthesimpler'lab1'isthatthere'saknownproblemwiththerunqemuscriptinthatitwillonlyrecognizemachinenamesthatendwithoneofthebaseqemumachinenames(seeYoctoBug#2890fordetails).
Keepthisinmindifyoudecidetocreateyourownqemu-machinebasedBSPlayers.
Hands-onKernelLabwww.
yoctoproject.
orgPage6of39BuildtheImageNowyouwillbuildthekernelandassembleitintoaqemubootableimage.
Thisfirstbuildmaytakealongtime,perhapsuptoanhour,sogohavelunch!
(thefirstbuildwilltakethelongest,sinceinadditiontobuilding,thesystemwilldownloadallthepackagesitneeds).
$bitbakecore-image-minimalNote:Forthislab,therewillbeanumberofwarningmessagesoftheform'WARNING:QAIssue:.
.
.
'.
Youcansafelyignorethose.
NowboottheimagewithQEMU:$runqemutmp/deploy/images/bzImage-lab1-qemux86.
bintmp/deploy/images/core-image-minimal-lab1-qemux86.
ext3AblackQEMUwindowshouldappearandimmediatelystartprintingtheLinuxkernelbootmessages.
.
.
followedbyakernelpanic:Thekernelfailedtoloadarootfilesystem.
Notethatunderthe"Listofallpartitions:"therearenodevices.
Thismeansthatthekerneldidnotfindadriverforanyoftheblockdevicesprovidedfortheqemumachine.
ReconfiguretheLinuxKernelQEMUprovidesanIntelPIIXIDEcontroller.
UsetheLinuxkernelmenuconfigcommandtoconfigurethisintoyourkernel:$bitbakelinux-cmenuconfigAnewwindowwillappearthatallowsyoutoenablevariousLinuxkernelconfigurationoptions.
Usethefollowingkeystonavigatethemenu:Up/Downarrows:moveupanddownHands-onKernelLabwww.
yoctoproject.
orgPage7of39Left/Rightarrows:ChooseacommandorEnter:ExecuteacommandDescendsintoamenuBacksoutofamenu,orexitsmenuconfigSpace:toggleaconfigurationoptionNotethatbeforedescendingintoamenuthatisitselfconfigurable,youwillneedtocheckthemenuitemoritscontentswillbeempty.
Enablethefollowingoptions:DeviceDrivers--->[*]ATA/ATAPI/MFM/RLLsupport(DEPRECATED)--->[*]IntelPIIX/ICHchipsetssupportGenericDriverOptions--->[*]Maintainadevtmpfsfilesystemtomountat/dev[*]Automountdevtmpfsat/dev,afterthekernelmountedtherootfsFilesystems--->[*]Ext3journalingfilesystemsupportExitandsaveyourchangesbyselectingExitandpressingEnter,repeatuntilitpromptsyoutosaveyourchanges.
Nowrebuildanddeployonlythekernel.
Thisavoidshavingtorebuildtheimageitself,whichhasnotchanged,savingyouafewminutes.
ThentrytobootitinQEMUagain:$bitbakelinux-cdeploy$runqemutmp/deploy/images/bzImage-lab1-qemux86.
bintmp/deploy/images/core-image-minimal-lab1-qemux86.
ext3Hands-onKernelLabwww.
yoctoproject.
orgPage8of39QEMUwillstartasbefore,butthistimewillbootallthewaytoaloginprompt.
Asyoucansee,thereareanumberofscary-lookingerrorsandwarningsontheconsole.
Thisisduetothefactthatyou'restartingwithabare-bonesconfigurationandsimplytryingtogettoafunctionalbootprompt,withoutbotheringtoworryaboutanythingmoreatthispoint.
Inthisrespect,youhaveasuccessfuloutcome,andyoucanshouldnowbeabletologinasrootwithnopasswordifyouwanttopokearound.
Uptothispoint,ifyouweretosharethemeta-lab1-qemux86layerwithsomeoneelse,thekerneltheybuildwouldstillfailtoboot,becausethefixesonlyexistinyoursystem'sWORKDIR.
Youneedtoupdatethedefconfiginthelayerwiththeoneyoumodifiedwithmenuconfig.
Copythe.
configoverthedefconfiginthelayer:$cptmp/work/lab1_qemux86-poky-linux/linux/3.
0.
18-r0/linux-3.
0.
18/.
config~/poky-dylan-9.
0.
0/meta-lab1-qemux86/recipes-kernel/linux/linux/defconfigHands-onKernelLabwww.
yoctoproject.
orgPage9of39PatchingtheKernelNowthatyouhavetheLinuxkernelbootingonyourmachine,youcanstartmodifyingit.
Hereyouwillapplyapatchtoaddasimpledriverwhichprintsamessagetotheconsoleduringboot.
Openandreviewthepatchsoyouknowwhattoexpectonceitisapplied:$gedit~/poky-dylan-9.
0.
0/meta-lab1-qemux86/recipes-kernel/linux/linux/yocto-testmod.
patchLookfortheprintkstatementintheyocto_testmod_init()function.
Thisisthemessageyouwilllookfortoverifythechangeshavetakeneffect.
InstructthelayertoapplythepatchbyaddingittotheSRC_URI.
EdittheLinuxkernelrecipe:$gedit~/poky-dylan-9.
0.
0/meta-lab1-qemux86/recipes-kernel/linux/linux_3.
0.
18.
bbUncommentthefollowingline:SRC_URI+="file://yocto-testmod.
patch"Saveyourchangesandclosegedit.
Nowusemenuconfigtoenablethedriver.
Bitbakewilldetecttherecipefilehaschangedandstartbyfetchingthenewsourcesandapplythepatch.
$bitbakelinux-cmenuconfigDeviceDrivers--->[*]Miscdevices--->[*]YoctoTestDriver(NEW)Exitandsaveyourchangesasbefore.
Hands-onKernelLabwww.
yoctoproject.
orgPage10of39NowrebuildthekernelandbootitinQEMU.
$bitbakelinux-cdeploy$runqemutmp/deploy/images/bzImage-lab1-qemux86.
bintmp/deploy/images/core-image-minimal-lab1-qemux86.
ext3YoucanscrollbackthroughthebootlogusingShift+PgUp.
YoushouldfindtheYoctotestdrivermessageinthere.
Finally,asbefore,ifyouwanttosavetheconfigurationforposterity,youneedtoupdatethedefconfiginthelayerwiththeoneyoumodifiedforthenewdriver.
Todoso,youcancopythe.
configoverthedefconfiginthelayer(butit'snotrequiredatthispoint,asthelabisessentiallyfinishedandtheresultsaren'trequiredforanylaterlabs):$cptmp/work/lab1_qemux86-poky-linux/linux-3.
0.
18-r0/linux-3.
0.
18/.
config~/poky-dylan-9.
0.
0/meta-lab1-qemux86/recipes-kernel/linux/linux/defconfigLab1ConclusionCongratulations!
YouhavemodifiedandconfiguredtheLinuxkernelusingatraditionalbitbakeLinuxkernelrecipe.
Youalsoupdatedthelayeritselfsothatyourchangescanbeshared.
ThisconcludesLab1.
Hands-onKernelLabwww.
yoctoproject.
orgPage11of39Lab2:Linux-YoctoKernelRecipeInthislabyouwillworktowardsthesameendgoalasinLab1.
Thistimeyouwillusethelinux-yoctorecipeandtooling.
Thissimplifiestheprocessofconfiguringthekernelandmakesreusingyourworkmucheasier.
SetuptheEnvironment$cd~/poky-dylan-9.
0.
0/$sourceoe-init-build-envOpenlocal.
conf:$geditconf/local.
confAddthefollowinglinejustabovethelinethatsays'MACHINE="qemux86":MACHINE="lab2-qemux86"Saveyourchangesandclosegedit.
Nowopenbblayers.
conf:$geditconf/bblayers.
confandaddthe'meta-lab2-qemux86'layertotheBBLAYERSvariable.
Thefinalresultshouldlooklikethis,assumingyouraccountiscalled'myacct'(simplycopythelinecontaining'meta-yocto-bsp'andreplace'meta-yocto-bsp'with'meta-lab2-qemux86'):BBLAYERS="\/home/myacct/poky-dylan-9.
0.
0/meta\/home/myacct/poky-dylan-9.
0.
0/meta-yocto\/home/myacct/poky-dylan-9.
0.
0/meta-yocto-bsp\/home/myacct/poky-dylan-9.
0.
0/meta-lab2-qemux86\"Youshouldnotneedtomakeanyfurtherchanges.
Saveyourchangesandclosegedit.
ReviewtheLab2LayerThislayerdiffersfrommeta-lab1onlyintheLinuxkernelrecipes.
Thislayercontainsthefollowingfilesforthekernel:recipes-kernel/linux/linux-yocto_3.
4.
bbappendlinux-yocto_3.
8.
bbappendfiles/pramfs.
cfglab2.
cfgyocto-testmod.
patchOpenthe3.
8kernelrecipe:$gedit~/poky-dylan-9.
0.
0/meta-lab2-qemux86/recipes-kernel/linux/linux-yocto_3.
8.
bbappendNotethatthisisnotacompleterecipe,butratheranextensionofthelinux-yoctorecipeprovidedbythepokysources.
Itaddsthelayerpathforadditionalfilesandsetsupsomemachine-specificvariables.
Noticethatinsteadofadefconfigfile,theHands-onKernelLabwww.
yoctoproject.
orgPage12of39recipeaddslab2.
cfgtotheSRC_URI.
ThisisaLinuxkernelconfigfragment.
Ratherthanacomplete.
configfile,aconfigfragmentlistsonlytheconfigoptionsyouspecificallywanttochange.
Tostartout,thisfragmentiscommentedout,andthelinux-yoctosourceswillprovideadefault.
configcompatiblewithcommonPChardware.
Thelab2.
cfgconfigfragmentisanexampleofaconfigfragmentthat'sbothdefinedandspecifiedin'recipe-space',inotherwordsdefinedasafileundertherecipe's(inthiscase)files/directoryandaddedviatheSRC_URI.
Configfragmentscanalsobedefinedinthekernelrepository's'meta'branchandaddedtotheBSPviaKERNEL_FEATURESstatementsinthekernelrecipe:KBRANCH_lab2-qemux86="standard/common-pc/base"KMACHINE_lab2-qemux86="common-pc"KERNEL_FEATURES_append_lab2-qemux86+="cfg/smp.
scc"Intherecipefragmentabove,the'cfg/smp.
scc'kernelfeature,whichessentiallymapstotheCONFIG_SMPconfigurationsetting,isaddedtothemachine'skernelconfigurationtoturnonSMPcapabilitiesfortheBSP.
KernelfeaturesaswellastheKBRANCHandKMACHINEsettingsreferencedabove,whichessentiallyspecifythesourcebranchfortheBSP,arealldescribedindetailintheYoctoLinuxKernelDevelopmentManual.
Themeta-lab2-qemux86machineconfigurationisverysimilartotothemeta-lab1-qemux86inLab1.
Openitingeditforreview:$gedit~/poky-dylan-9.
0.
0/meta-lab2-qemux86/conf/machine/lab2-qemux86.
confThemaindifferencefromtheLab1machineconfigurationisthatitspecifiesnotonlyaPREFERRED_PROVIDERforthevirtual/kernelcomponent,butaPREFERRED_VERSIONaswell:PREFERRED_PROVIDER_virtual/kernel="linux-yocto"PREFERRED_VERSION_linux-yocto="3.
8%"BecausetheLab2layerhasmultiplekernelimplementationsavailabletoit(linux-yocto_3.
4,linux-yocto_3.
8,andlinux-yocto-dev),thereisinthiscasesomeambiguityaboutwhichimplementationandversiontochoose.
Theabovelineschoosea'linux-yocto'recipeasthePREFERRED_PROVIDER,andexplicitlyselectthelinux-yocto_3.
8versionviathePREFERRED_VERSIONsetting(thetrailing'%'servesasawildcard,meaninginthiscasetoessentiallyignoreanyminorversioninthepackageversionwhendoingthematch).
Inthiscase,thebuildsystemwouldhavechosenthesameimplementationandversionviadefaults(linux-yoctobyvirtueoftheincludedqemu.
inc,and3.
8simplybecauseit'sthehighestversionnumberavailableforthelinux-yoctorecipes–thisiscontainedinthelogictreatingpackageselectioninthebuildsystem),butagain,sometimesitmakessensetoavoidsurprisesandexplicitly'pindown'specificprovidersandversions.
BuildtheImageOK,youhavedonethisbefore:$bitbakecore-image-minimalHands-onKernelLabwww.
yoctoproject.
orgPage13of39$runqemutmp/deploy/images/bzImage-lab2-qemux86.
bintmp/deploy/images/core-image-minimal-lab2-qemux86.
ext3Thelinux-yoctorepositorymeta-dataalreadyprovidesthedriversupportneededtobootinQEMU–themissingconfigurationsettingsforPIIX/ICH,ext3,anddevtmpfsthatyouexplicitlyaddedtotheconfigurationinLab1arealreadyincludedinthebasicconfigurationinheritedviathemeta-datainLab2.
Thismeta-dataisreusedacrossseveralBoardSupportPackages(BSPs),reducingthetediumofmanagingacompletekernelconfigforeveryBSP.
InthecaseofLab2,itmeansthatyoudon'thavetogothroughanuproductivebootfailureandconfigurationupdatecycleasyoudidinLab1.
Tip:Ifyouarepressedfortime,youcantakeourwordthatthiswillbootwithoutconfigurationchangesandmoveontomodifyingthekernel.
Besuretorunbitbakecore-image-minimalbeforeyouruntherunqemucommandthough,oritwillfailtofindadiskimageforthelab2-qemux86machine.
ModifytheKernelNowyoucanapplythedriverpatchandconfigurethekerneltouseit.
Editthelinux-yoctokernelrecipe:$gedit~/poky-dylan-9.
0.
0/meta-lab2-qemux86/recipes-kernel/linux/linux-yocto_3.
8.
bbappendanduncommentthelineincludingthepatchandthelineincludingthelab2configfragment:SRC_URI+="file://yocto-testmod.
patch"SRC_URI+="file://lab2.
cfg"Thisaccomplishesthesamething,addingandenablingthe'yocto-testmod'module,thatyouaccomplishedinLab1.
Thedifferencehereisthatinsteadofusingmenuconfigtoenablethenewoptioninthemonolithic.
configfileasinLab1,hereyouaddthepatchinthesamewaybutenablethetestmoduleusingthestandalonelab2.
cfgconfigfragment.
Saveyourchangesandclosegedit.
ConfiguretheKernelYoucouldusemenuconfigtoenabletheoption,butsinceyoualreadyknowwhatitis,youcansimplyaddittothelab2.
cfgfile.
Openthefile:$gedit~/poky-dylan-9.
0.
0/meta-lab2-qemux86/recipes-kernel/linux/files/lab2.
cfgandexaminethefollowinglines,whichenablesthemoduleasabuilt-inkernelmodule:#EnablethetestmodCONFIG_YOCTO_TESTMOD=yClosegedit.
Tip:Youknowwhatyouneedtoaddnow,butifyouarenotsureexactlywhichconfigoptionyouneed,youcansaveofftheoriginal.
config(afteraninitiallinux-yoctobuild),thenrunmenuconfigandtakeadiffofthetwofiles.
Youcantheneasilydeducewhatyourconfigfragmentshouldcontain.
Hands-onKernelLabwww.
yoctoproject.
orgPage14of39Nowyoucanrebuildandbootthenewkernel.
Bitbakewilldetecttherecipefilehaschangedandstartbyfetchingthenewsourcesandapplythepatch:$bitbakelinux-yocto-cdeploy$runqemutmp/deploy/images/bzImage-lab2-qemux86.
bintmp/deploy/images/core-image-minimal-lab2-qemux86.
ext3Likebefore,QEMUwillopenanewwindowandboottoaloginprompt.
YoucanuseShift+PgUptoscrollupandfindthenewdrivermessage.
ModifytheKerneltoMakeUseofanLTSIKernelOptionNote:ThisexerciseshowshowtoenabletheLTSIpramfsfeatureusingthepramfs.
cfgconfigoption.
ThisisverysimilartothepreviousexerciseinwhichyouenabledtheYocto'testmod'usingthelab2.
cfgfragment.
ThevalueinthiscaseistoshowthatLTSIkerneloptionscanbeusedinexactlythesameway.
Assuch,ifyou'renotinterestedspecificallyinLTSI,youcansafelyskipthenextfewsections.
Thelinux-yocto-3.
8kernelisthemostup-to-dateversionofthelinux-yoctokernelavailableinYocto1.
4.
Becauseithasn'tyethadacorrespondingLTSIversionreleasedforityet,itdoesn'tyetsupportanyLTSIfeatures.
However,thelinux-yocto-3.
4kernelisalsoavailable,andithashadtheLTSIkernelpatchesmergedin.
TotakeadvantageofthoseLTSIfeatures,you'llfirstneedtoswitchkernelstothelinux-yocto-3.
4kernel.
Todothat,you'llchangethepreferredkernelversionto3.
4inthelab2machineconfigurationbyeditingthelab2-qemux86.
conffile:$gedit~/poky-dylan-9.
0.
0/meta-lab2-qemux86/conf/machine/lab2-qemux86.
confChangethepreferredversionofthekernelinthatfilefrom3.
8to3.
4.
Inotherwords,change:PREFERRED_VERSION_linux-yocto="3.
8%"#PREFERRED_VERSION_linux-yocto="3.
4%"to:#PREFERRED_VERSION_linux-yocto="3.
8%"PREFERRED_VERSION_linux-yocto="3.
4%"Becausethelinux-yocto-3.
4kernelhastransparentlymergedinthe3.
4LTSIkernel,allofthecapabilitiesoftheLTSIkernelarenowavailableandaccessiblevialinux-yoctoconfigfragments.
We'lldemonstratethisbyenablingaconfigoptionnormallyavailableonlytotheLTSIkernel,forthe'pramfs'filesystem,nowalsoavailableinthelinux-yoctokernelbyvirtueofthemergeroftheLTSIkernelintolinux-yocto-3.
4.
Editthelinux-yoctokernelrecipe:$gedit~/poky-dylan-9.
0.
0/meta-lab2-qemux86/recipes-kernel/linux/linux-yocto_3.
4.
bbappendanduncommentthelineincludingthepramfsconfigfragment:SRC_URI+="file://pramfs.
cfg"Saveyourchangesandclosegedit.
Hands-onKernelLabwww.
yoctoproject.
orgPage15of39ConfiguretheKernelYoucouldusemenuconfigtoenabletheoption,butsinceyoualreadyknowwhatitis,youcansimplyaddittothepramfs.
cfgfile.
Openthefile:$gedit~/poky-dylan-9.
0.
0/meta-lab2-qemux86/recipes-kernel/linux/files/pramfs.
cfgandexaminethefollowinglines,whichenablesthepramfsfilesystemmoduleasabuilt-inkernelmodule:#EnableLTSI'spramfsCONFIG_PRAMFS=yCONFIG_PRAMFS_WRITE_PROTECT=yClosegedit.
RebuildtheKernelNowyoucanrebuildandbootthenewkernel:$bitbakelinux-yocto-cdeploy$runqemutmp/deploy/images/bzImage-lab2-qemux86.
bintmp/deploy/images/core-image-minimal-lab2-qemux86.
ext3YoucanverifythattheLTSIpramfsmodulehasbeenaddedtothekernelbylookingattheoutputof'cat/proc/filesystems',whichwillnowshowanentryforthepramfsfilesystem,whichwasn'ttherebefore(seethethirdentryfromthebottom):Hands-onKernelLabwww.
yoctoproject.
orgPage16of39Lab2ConclusionInthislabyouappliedapatchandmodifiedtheconfigurationoftheLinuxkernelusingaconfigfragment,whichisafeatureprovidedbythelinux-yoctokerneltooling.
YoualsoenabledanLTSIkerneloptionusingaconfigfragment,whichispossiblebecausethe3.
4linux-yoctokernelhasmergedthe3.
4LTSIcode.
ThisconcludesLab2.
ExtraCredit:IterativeDevelopmentShouldyouneedtomodifythekernelfurtheratthispoint,perhapsitfailedtocompileoryouwanttoexperimentwiththenewdriver,youcandothatdirectlyusingthesourcesintheWORKDIR:$cd~/poky-dylan-9.
0.
0/build/tmp/work/lab2_qemux86-poky-linux/linux-yocto/3.
8.
4+gitAUTOINC+27b63fdbd25ad1a37bacc05f49a205c150d21779_d9a45e3325030f7bd6f37947a7a0b12da7f602c3-r4.
1.
0/linuxTip:ThisisagreattimetomakeuseofthatTabcompletion!
Aftermakingchangestothesource,youcanrebuildandtestthosechanges,justbecarefulnottorunaclean,fetch,unpackorpatchtaskoryouwillloseyourchanges:$cd~/poky-dylan-9.
0.
0/build$bitbakelinux-yocto-ccompile-f$bitbakelinux-yocto-cdeploy$runqemutmp/deploy/images/bzImage-lab2-qemux86.
bintmp/deploy/images/core-image-minimal-lab2-qemux86.
ext3Youcanrepeatthiscycleasneededuntilyouarehappywiththekernelchanges.
Thelinux-yoctorecipecreatesagittreehere,soonceyouaredonemakingyourchanges,youcaneasilysavethemoffintoapatchusingstandardgitcommands:$gitaddpath/to/file/you/change$gitcommit–signoff$gitformat-patch-1Youcanthenintegratethesepatchesintothelayerbycopyingthemalongsidetheyocto-testmod.
patchandaddingthemtotheSRC_URI.
Hands-onKernelLabwww.
yoctoproject.
orgPage17of39Lab3:CustomKernelRecipeInthislabyouwilluseusethelinux-yocto-customrecipeandtoolingtomakeuseofanon-linux-yoctogit-basedkernelofyourchoosing,whilestillretainingtheabilitytoreuseyourworkviaconfigfragments.
You'llalsolearnwhatyouneedtodotobuild,install,andautomaticallyloadaloadablekernelmoduleinsteadofasabuilt-inmoduleasyoudidinlab2.
SetuptheEnvironment$cd~/poky-dylan-9.
0.
0/$sourceoe-init-build-envOpenlocal.
conf:$geditconf/local.
confAddthefollowinglinejustabovethelinethatsays'MACHINE="qemux86":MACHINE="lab3-qemux86"Saveyourchangesandclosegedit.
Nowopenbblayers.
conf:$geditconf/bblayers.
confandaddthe'meta-lab3-qemux86'layertotheBBLAYERSvariable.
Thefinalresultshouldlooklikethis,assumingyouraccountiscalled'myacct'(simplycopythelinecontaining'meta-yocto-bsp'andreplace'meta-yocto-bsp'with'meta-lab3-qemux86'):BBLAYERS="\/home/myacct/poky-dylan-9.
0.
0/meta\/home/myacct/poky-dylan-9.
0.
0/meta-yocto\/home/myacct/poky-dylan-9.
0.
0/meta-yocto-bsp\/home/myacct/poky-dylan-9.
0.
0/meta-lab3-qemux86\"Youshouldnotneedtomakeanyfurtherchanges.
Saveyourchangesandclosegedit.
ReviewtheLab3LayerThislayerdiffersfrommeta-lab3-qemux86onlyintheLinuxkernelrecipe.
Thislayercontainsthefollowingfilesforthekernel:recipes-kernel/linux/linux-yocto-custom/defconfiglab3.
cfgyocto-testmod.
patchlinux-yocto-custom.
bbOpenthekernelrecipe:$gedit~/poky-dylan-9.
0.
0/meta-lab3-qemux86/recipes-kernel/linux/linux-yocto-custom.
bbNotethatthisisacompletereciperatheranextensionasinlab2.
Infactitwasderivedfromthelinux-yocto-custom.
bbrecipefoundinpoky-dylan-9.
0.
0/meta-Hands-onKernelLabwww.
yoctoproject.
orgPage18of39skeleton/recipes-kernel/linux.
Noticethatitusesadefconfigfileandadditionallyaddslab3.
cfgtotheSRC_URI.
Thedefconfigisrequiredbecausethisisnotalinux-yoctokernelasusedinlab2,butratheranarbitrarykernelwrappedbythelinux-yocto-customrecipe.
Anarbitrarykerneldoesn'tcontainallthemetadatapresentinthelinux-yoctokernelandthereforedoesn'thaveamappingtoanyofthebaseconfigurationitemsassociatedwiththesetofBSPtypesavailableinthelinux-yoctokernel.
Inthecaseofthelinux-yoctokernel,thismappingisresponsibleforassemblingthe.
configfromacollectionoffragments,butsinceacustomkerneldoesn'thaveaccesstothese,adefconfigthatprovidesthebasicsetofoptionsneededtobootthemachineisexplicitlyrequired.
However,becausethisisalinux-yocto-customkernel,itdoeshavetheabilitytospecifyandreuseconfigfragments,whichisthemajordifferencebetweenthissetupandthesimpletarball-basedkernelusedinlab1,whichalsousedadefconfig.
Thelab3.
cfgfragmentisaLinuxkernelconfigfragment.
Ratherthanacomplete.
configfile,aconfigfragmentlistsonlytheconfigoptionsyouspecificallywanttochange.
Tostartout,thisfragmentiscommentedout,andthelinux-yocto-customsourceswilluseonlythedefconfigspecified,whichiscompatiblewithcommonPChardware.
BuildtheImageOK,youhavedonethisbefore:$bitbakecore-image-minimal$runqemutmp/deploy/images/bzImage-lab3-qemux86.
bintmp/deploy/images/core-image-minimal-lab3-qemux86.
ext3ModifytheKernelNowyoucanapplythedriverpatchandconfigurethekerneltouseit.
Editthelinux-yocto-customkernelrecipe:$gedit~/poky-dylan-9.
0.
0/meta-lab3-qemux86/recipes-kernel/linux/linux-yocto-custom.
bbanduncommentthelinesincludingthepatchandthelab3configfragment:SRC_URI+="file://yocto-testmod.
patch"SRC_URI+="file://lab3.
cfg"Saveyourchangesandclosegedit.
ConfiguretheKernelYoucouldusemenuconfigtoenabletheoption,butsinceyoualreadyknowwhatitis,youcansimplyaddittothelab3.
cfgfile.
Openthefile:$gedit~/poky-dylan-9.
0.
0/meta-lab3-qemux86/recipes-kernel/linux/linux-yocto-custom/lab3.
cfgandexaminethefollowinglines,whichenablesthemoduleasabuilt-inkernelmodule:Hands-onKernelLabwww.
yoctoproject.
orgPage19of39#EnablethetestmodCONFIG_YOCTO_TESTMOD=mThisconfigurestheyocto-testmodasamodulethistimeinsteadofasabuilt-inmoduleasinlab2.
Inordertoactuallygetthemoduleintotheimageandloaded,you'llneedtoaddacoupleadditionalitemstothekernelrecipeandmachineconfiguration,butwe'llcoverthatinthefollowingstep.
Saveyourchangesandclosegedit.
Tip:Youknowwhatyouneedtoaddnow,butifyouarenotsureexactlywhichconfigoptionyouneed,youcansaveofftheoriginal.
config(afteraninitiallinux-yoctobuild),thenrunmenuconfigandtakeadiffofthetwofiles.
Youcantheneasilydeducewhatyourconfigfragmentshouldcontain.
RebuildtheImageNowyoucanrebuildandbootthenewimage.
You'rerebuildingthenewimageratherthanjustthekernelinthiscasebecausethemoduleisnolongerincludedinthekernelimagebutratherinthe/lib/modulesdirectoryofthefilesystemimage,whichrequiresustobuildanewrootfilesystem.
Bitbakewilldetecttherecipefilehaschangedandstartbyfetchingthenewsourcesandapplythepatch:$bitbakecore-image-minimal$runqemutmp/deploy/images/bzImage-lab3-qemux86.
bintmp/deploy/images/core-image-minimal-lab3-qemux86.
ext3Thistime,youwon'tlookforamessage,butratherseewhetheryourmodulewasloaded.
Todothat,you'lluse'lsmod'togetalistofloadedmodules.
Notseeingwhatyouexpect(you'dexpecttosee'yocto_testmod'intheoutputof'lsmod',butwon't),youshouldthencheckwhetheryourmoduleswereinstalledintherootfilesystem(yeshouldseea'kernel/drivers/misc'directoryin/lib/modules/3.
8.
11-yocto-standard,containingyouryocto-testmod.
kokernelmodulebinary):Hands-onKernelLabwww.
yoctoproject.
orgPage20of39Obviously,you'renotseeingwhatyou'dexpect,solet'sverifywhetheryourmodulewasinfactbuilt.
Youcandothatbylookinginthedeploydirectoryonthebuildsystem:$ls~/poky-dylan-9.
0.
0/build/tmp/deploy/rpm/lab3_qemux86/|grepyocto-testmodYoushouldinfactseeanRPMfilethatwascreatedforthehello-testmodmodule–youshouldseesomethingsimilartothefollowingoutputfromthepreviouscommand:kernel-module-yocto-testmod-3.
8.
11+git0+c1be5a5b1b355d40e6cf79cc979eb66dafa24ad1-r0.
lab3_qemux86.
rpmSo,yourmodulewasbuilt,itjustwasn'taddedtotheimage.
Onewayofmakingthathappenistoaddittothemachineconfiguration:AddtheModuletotheImageandHaveitAutoloadonBootOpenthemachineconfigurationfile:$gedit~/poky-dylan-9.
0.
0/meta-lab3-qemux86/conf/machine/lab3-qemux86.
confanduncommentthefollowinglineattheendofthefile:MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS+="kernel-module-yocto-testmod"Thiswillcausetheyocto-testmodmoduletobeincludedintheminimalimage,butitwon'tcausethemoduletobeloadedonboot.
Todothat,you'lluncommentthefollowinglinetothelinux-yocto-customrecipe:module_autoload_yocto-testmod="yocto-testmod"Openthelinux-yocto-custom.
bbfileanduncommentthatline:Hands-onKernelLabwww.
yoctoproject.
orgPage21of39$gedit~/poky-dylan-9.
0.
0/meta-lab3-qemux86/recipes-kernel/linux/linux-yocto-custom.
bbBecauseyou'vechangedtheoutputoftherecipe,youalsoneedto'bumpthePR'totellthebuildsystemtorebuildthekernel.
Findthelinethatsays'PR="r1"'andchangeitto:PR="r2"Note:Yourmoduleisn'texactly'essential'andyou'dnormallyuseMACHINE_EXTRA_RRECOMMENDS,butthisisthevariableyouneedtousewiththeminimalimagesinceitdoesn'tincludethebasepackagethatincludesthelattervariable.
Now,let'sbuildtheminimalimageagainandbootit:$bitbakecore-image-minimal$runqemutmp/deploy/images/bzImage-lab3-qemux86.
bintmp/deploy/images/core-image-minimal-lab3-qemux86.
ext3Thistime,lsmodshowsyocto-testmodloaded,asexpected:Likebefore,QEMUwillopenanewwindowandboottoaloginprompt.
YoucanuseShift+PgUptoscrollupandfindthenewdrivermessage.
Youcanalsotype'dmesg|less'attheprompttolookforthemoduleinitmessage.
Lab3ConclusionInthislabyouappliedapatchandmodifiedtheconfigurationofanarbitrarygit-basednon-linux-yoctoLinuxkernelusingaconfigfragment.
Youalsoaddedandautoloadedamoduleasaloadablemodule.
ThisconcludesLab3.
Hands-onKernelLabwww.
yoctoproject.
orgPage22of39Lab4:CustomKernelRecipeWithLocalRepositoryInthislabyouwilluseusethelinux-yocto-customrecipeandtoolingtomakeuseofalocalnon-linux-yoctogit-basedkernelofyourchoosing,whilestillretainingtheabilitytoreuseyourworkviaconfigfragments.
Thismakesforaneasierworkflowwhenmakingchangestothekernelcode,whichthislabwillalsodemonstrate.
Thislabwillalsodemonstratehowtocreateandusearecipeusedtobuildandinstallanexternalkernelmodule.
SetuptheEnvironment$cd~/poky-dylan-9.
0.
0/$sourceoe-init-build-envOpenlocal.
conf:$geditconf/local.
confAddthefollowinglinejustabovethelinethatsays'MACHINE="qemux86":MACHINE="lab4-qemux86"Saveyourchangesandclosegedit.
Nowopenbblayers.
conf:$geditconf/bblayers.
confandaddthe'meta-lab4-qemux86'layertotheBBLAYERSvariable.
Thefinalresultshouldlooklikethis,assumingyouraccountiscalled'myacct'(simplycopythelinecontaining'meta-yocto-bsp'andreplace'meta-yocto-bsp'with'meta-lab4-qemux86'):BBLAYERS="\/home/myacct/poky-dylan-9.
0.
0/meta\/home/myacct/poky-dylan-9.
0.
0/meta-yocto\/home/myacct/poky-dylan-9.
0.
0/meta-yocto-bsp\/home/myacct/poky-dylan-9.
0.
0/meta-lab4-qemux86\"Youshouldnotneedtomakeanyfurtherchanges.
Saveyourchangesandclosegedit.
ReviewtheLab4LayerThislayerdiffersfrommeta-lab3-qemux86inthatinsteadofyocto-testmodpatchintheLinuxkernelrecipeitself,you'lladdanexternalkernelmodulecalledhello-mod.
ItalsocontainsachangetotheSRC_URIinthelinux-yocto-custom.
bbthatpointsittoalocalkernelrepo,whichyou'llneedtomodify,andaKBRANCHvariablethatwillpointtoa'workingbranch'inthelocalrepo,whichwe'lldescribeinmoredetaillater.
Thislayercontainsthefollowingfilesforthekernel:recipes-kernel/hello-mod/files/COPYINGhello.
cMakefilehello-mod_0.
1.
bbHands-onKernelLabwww.
yoctoproject.
orgPage23of39linux/linux-yocto-custom/defconfiglinux-yocto-custom.
bbOpenthekernelrecipe:$gedit~/poky-dylan-9.
0.
0/meta-lab4-qemux86/recipes-kernel/linux/linux-yocto-custom.
bbNotethatasinlab3,thisisacompletereciperatheranextensionasinlab2.
Infactitwasderivedfromthelinux-yocto-custom.
bbrecipefoundinpoky-dylan-9.
0.
0/meta-skeleton/recipes-kernel/linux.
Noticethatitusesadefconfigfilebutdoesn'taddanyadditional.
cfgfiletotheSRC_URIasinlab3.
Becauseyou'readdinganexternalmodule,youdon'thaveaconfigoptioninthekerneltodefine–themodulewillbeincludedintheimagebyvirtueoftheBSPconfigurationdirectiveswe'lldescribeinalaterstepratherthanviachangestothekernelconfigurationitself.
Thedefconfigisrequiredbecausethisisnotalinux-yoctokernelasusedinlab2,butratheranarbitrarykernelwrappedbythelinux-yocto-customrecipe.
Anarbitrarykerneldoesn'tcontainallthemetadatapresentinthelinux-yoctokernelandthereforedoesn'thaveamappingtoanyofthebaseconfigurationitemsassociatedwiththesetofBSPtypesavailableinthelinux-yoctokernel.
Inthecaseofthelinux-yoctokernel,thismappingisresponsibleforassemblingthe.
configfromacollectionoffragments,butsinceacustomkerneldoesn'thaveaccesstothese,adefconfigthatprovidesthebasicsetofoptionsneededtobootthemachineisexplicitlyrequired.
However,becausethisisalinux-yocto-customkernel,itdoeshavetheabilitytospecifyandreuseconfigfragments,whichisthemajordifferencebetweenthissetupandthesimpletarball-basedkernelusedinlab1.
Tostartout,thelinux-yocto-customsourceswillusethedefconfigspecified,whichiscompatiblewithcommonPChardware.
Movingontotheexternalmodule,openthehello-modrecipeandexamineit:$gedit~/poky-dylan-9.
0.
0/meta-lab4-qemux86/recipes-kernel/hello-mod/hello-mod_0.
1.
bbTherecipeitselfisverysimple–itnamesthefilesthatmakeupthemoduleintheSRC_URIandinheritsthemodulebbclass,whichenablesthebuildsystemtobuildthecodelistedasakernelmodule.
Thehello-mod/filesdirectorycontainsthehello.
ckernelsourcefileandamoduleMakefile,whichyoucanalsoexamine.
Becauseinthislabyou'rebuildingthekernelfromalocalrepository,youfirstneedtocreatealocalcloneofthekernelyouwanttouse.
Todothis,cdintothepoky-dylan-9.
0.
0directoryandcreatealocalcloneofthelinux-stablekernel:$cd~/poky-dylan-9.
0.
0$gitclonegit://git.
kernel.
org/pub/scm/linux/kernel/git/stable/linux-stable.
gitlinux-stable-work.
gitYoushouldseesomethinglikethefollowingasoutput:Cloninginto'linux-stable-work.
git'.
.
.
remote:Countingobjects:3017120,done.
remote:Compressingobjects:100%(469816/469816),done.
Hands-onKernelLabwww.
yoctoproject.
orgPage24of39remote:Total3017120(delta2535629),reused3000147(delta2519086)Receivingobjects:100%(3017120/3017120),625.
23MiB|610KiB/s,done.
Resolvingdeltas:100%(2535629/2535629),done.
Checkingoutfiles:100%(41520/41520),done.
Note:Cloningthekernelcantakealongtime.
Youcanspeedupthecloneifyoualreadyhavealocalclonethatyoucanbasethenewoneoffof–see'git-clone–reference'fordetails).
Nowcdintotheclonedkernelandcheckoutabranchnamed'work-branch':$cd~/poky-dylan-9.
0.
0/linux-stable-work.
git$gitcheckout-bwork-branchremotes/origin/linux-3.
8.
yYoushouldseesomethinglikethefollowingasoutput:Branchwork-branchsetuptotrackremotebranchlinux-3.
8.
yfromorigin.
Switchedtoanewbranch'work-branch'Editthelinux-yocto-customkernelrecipe:$gedit~/poky-dylan-9.
0.
0/meta-lab4-qemux86/recipes-kernel/linux/linux-yocto-custom.
bbandchangetheSRC_URItopointtothelocalcloneyoujustcreated.
Ifyou'vedoneitasinstructed,youshouldonlyneedtochangehome/myaccttoyourhomedirectory:SRC_URI="git:///home/myacct/poky-dylan-9.
0.
0/linux-stable-work.
git;protocol=file;bareclone=1"Saveyourchangesandclosegedit.
NotealsotheKBRANCHlineinthesamefile:KBRANCH="work-branch"TheKBRANCHvariablenamesthebranchthatwillbeusedtobuildthekernel.
Ifyou'vecheckedoutandwanttoworkwithadifferentbranch,youshouldchangetheKBRANCHvariabletothatbranch.
BuildtheImageOK,youhavedonethisbefore(don'tforgettocdbackintothebuilddirectory):$cd~/poky-dylan-9.
0.
0/build$bitbakecore-image-minimal$runqemutmp/deploy/images/bzImage-lab4-qemux86.
bintmp/deploy/images/core-image-minimal-lab4-qemux86.
ext3AddtheExternalKernelModuleNowthatyouhaveaworkingkernel,youcanaddthehello-modexternalmoduletotheimage.
Recallthatyoudon'tneedtochangethekernelconfigurationtoaddthemodulebecauseitwon'tbemadepartofthekernelsourceviaaSRC_URIadditionasinthepreviouslab,butwillbebuiltasan'external'module.
Todothat,firstopenthemachineconfigurationfile:$gedit~/poky-dylan-9.
0.
0/meta-lab4-qemux86/conf/machine/lab4-qemux86.
confanduncommentthefollowinglineattheendofthefile:MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS+="hello-mod"NotethatintheMACHINE_ESSENTIAL_EXTRA_RRECOMMENDSline,youusedthenameofthehello-modpackagedirectlyinsteadofprependingitwith'kernel-Hands-onKernelLabwww.
yoctoproject.
orgPage25of39module-'asyoudidinlab3.
That'sbecauseithasitsownpackagecreatedforitbyvirtueofthefactthatit'sastandalonerecipe,ratherthanthesynthesizedpackagecreatedbythekernelrecipeinthecaseoflab3.
Note:Yourmoduleisn'texactly'essential'andyou'dnormallyuseMACHINE_EXTRA_RRECOMMENDS,butthisisthevariableyouneedtousewiththeminimalimagesinceitdoesn'tincludethebasepackagethatincludesthelattervariable.
Nowyoucanrebuildandbootthenewimage.
You'rerebuildingthenewimageratherthanjustthekernelinthiscasebecausethemoduleisnotincludedinthekernelimagebutinsteadisaddedtothe/lib/modulesdirectoryofthefilesystemimage,whichrequiresustobuildanewrootfilesystem.
Bitbakewilldetectthemachineconfigurationhaschangedandwillbuildandaddthenewmodule:$bitbakecore-image-minimal$runqemutmp/deploy/images/bzImage-lab4-qemux86.
bintmp/deploy/images/core-image-minimal-lab4-qemux86.
ext3Loggingintothemachineandlookingaround,youcanseethatthenewmodulewasindeedaddedtotheimage,inthiscasethe/lib/modules/3.
8.
23-yocto-standard/extradirectory,whichyouseecontainsyourhello.
komodule.
Youcanloaditandseetheresultsusing'modprobehello':ModifythelocalkernelThemainreasontousealocalkernelistobeabletoeasilymodifyandrebuildit,andtestthechanges.
Hands-onKernelLabwww.
yoctoproject.
orgPage26of39Todemonstratethat,you'llmakeasimplemodificationtothekernelcodeandseetheresultsinthebootedsystem.
Changedirectoriesintothelocalkernelrepositoryandopenthefs/filesystems.
csourcefile:$cd~/poky-dylan-9.
0.
0/linux-stable-work.
git$geditfs/filesystems.
cScrolldowntothefilesystems_proc_show(.
.
.
)function(youcanusetheSearch|Find.
.
.
optioninGedittomorequicklylocateit):staticintfilesystems_proc_show(structseq_file*m,void*v){structfile_system_type*tmp;read_lock(&file_systems_lock);tmp=file_systems;while(tmp){seq_printf(m,"%s\t%s\n",(tmp->fs_flags&FS_REQUIRES_DEV)nodev",tmp->name);tmp=tmp->next;}read_unlock(&file_systems_lock);return0;}Addasimpleprintk()tothatfunction,sothatwhenyou'cat/proc/filesystems'inthebootedimageyou'llseeamessageinthekernellogs.
printk("Kilfoywashere!
\n");Afteraddingtheprintk(),filesystems_proc_show(.
.
.
)shouldlooklikethis:staticintfilesystems_proc_show(structseq_file*m,void*v){structfile_system_type*tmp;read_lock(&file_systems_lock);tmp=file_systems;while(tmp){seq_printf(m,"%s\t%s\n",(tmp->fs_flags&FS_REQUIRES_DEV)nodev",tmp->name);tmp=tmp->next;}read_unlock(&file_systems_lock);printk("Kilfoywashere!
\n");return0;}Verifythatthecodewaschangedusing'gitdiff':$gitdiff-pHEADYoushouldseesomethinglikethefollowingasoutput:diff--gita/fs/filesystems.
cb/fs/filesystems.
cindex96f2428.
.
9712c33100644---a/fs/filesystems.
cHands-onKernelLabwww.
yoctoproject.
orgPage27of39+++b/fs/filesystems.
c@@-231,6+231,9@@staticintfilesystems_proc_show(structseq_file*m,void*v)tmp=tmp->next;}read_unlock(&file_systems_lock);++printk("Kilfoywashere!
\n");+return0;}Inorderforthebuildtopickupthechange,youneedtocommitthechanges:$gitcommit-a-m"fs/filesystems.
c:addamessagethatwillbeloggedtothekernellogwhenyou'cat/proc/filesystems'.
"Youshouldseethefollowingoutputifyourcommitwassuccessful:[work-branchc619044]fs/filesystems.
c:addamessagethatwillbeloggedtothekernellogwhenyou'cat/proc/filesystems'.
1filechanged,2insertions(+)Youcanalsoverifythatthechangewasindeedaddedtothecurrentbranchvia'gitlog':$gitlogYoushouldseesomethinglikethisintheoutputof'gitlog':commit8823416a46ecf40ae88baa10ecacdf670c2c4f48Author:TomZanussiDate:ThuMay911:13:492013-0500fs/filesystems.
c:addamessagethatwillbeloggedtothekernellogwhenyou'cat/proc/filesystems'.
Youshouldnowbeabletorebuildthekernelandseethechanges.
Thereisonedifferenceinthiscasehowever–whenusingalocalclone,youneedtodoa'cleanall'ofthekernelrecipe.
Thereasonforthatisthatthebuildsystemcachesthekernel(asahiddenfileinthedownloads/git2incaseyou'reinterested)thatitlastdownloadedandwillusethatcachedcopyifpresentandwon'tfetchthemodifiedcopy,evenifbuiltfromacompletelycleanstate.
Forcinga'cleanall'ontherecipeclearsoutthatcachedcopyaswellandallowsthebuildsystemtoseeyourkernelchanges(don'tforgettocdbackintothebuilddirectory):$cd~/poky-dylan-9.
0.
0/build$bitbake-ccleanallvirtual/kernel$bitbake-cdeployvirtual/kernel$runqemutmp/deploy/images/bzImage-lab4-qemux86.
bintmp/deploy/images/core-image-minimal-lab4-qemux86.
ext3Note:The'cleanall'stepisn'tnecessarywhenusinga'bareclone',whichyoucanseeanexampleofinthe'Usingalocallinux-yocto-basedkernelasabareclone'sectionbelow.
Youcanusethe'bareclone'methoddescribedthereinplaceofthe'straightclone'methodhereifdesired–simplycreatelinux-stable-work.
gitasabarecloneandpushtoitfromastraightcloneofthat.
Thebootprocessoutputshowsthat/proc/filesystemsisreadbyotherprocesses,whichproducesmultiplemessagesinthebootoutput.
Youcanhowevershowthenewcodeinactionbycat'ingthatfileyourselfandseeingthatthenumberofHands-onKernelLabwww.
yoctoproject.
orgPage28of39printklinesincreasesinthekernellog:Usingalocallinux-yocto-basedkernelForthislab,youusedthelinux-yocto-customrecipewithalocalrepository,butitshouldbenotedthatyoucandothesamethingwiththestandardlinux-yoctokernel,whichisactuallythemorecommonuse-case.
Todothatyouessentiallyrepeattheprevioussetofstepsbutwiththelinux-yoctokernelinstead.
ThemaindifferenceisthatyouneedaslightlydifferentSRC_URI,whichneedstotracktwobranchesinsteadofone–the'machine'andthe'meta'branches.
Thefollowingstepscanbeusedtousealocalversionofthelinux-yoctokernel.
Becauseinthislabyou'rebuildingthekernelfromalocalrepository,youfirstneedtocreatealocalcloneofthekernelyouwanttouse.
Todothis,cdintothepoky-dylan-9.
0.
0directoryandcreatealocalcloneofthelinux-yocto-3.
8kernel:$cd~/poky-dylan-9.
0.
0$gitclonegit://git.
yoctoproject.
org/linux-yocto-3.
8linux-yocto-3.
8.
gitYoushouldseesomethinglikethefollowingasoutput:Cloninginto'linux-yocto-3.
8.
git'.
.
.
remote:Countingobjects:2851607,done.
remote:Compressingobjects:100%(456267/456267),done.
remote:Total2851607(delta2389861),reused2829536(delta2367803)Receivingobjects:100%(2851607/2851607),604.
77MiB|727KiB/s,done.
Resolvingdeltas:100%(2389861/2389861),done.
Checkingoutfiles:100%(41521/41521),done.
Note:Cloningthekernelcantakealongtime.
YoucanspeedupthecloneifyouHands-onKernelLabwww.
yoctoproject.
orgPage29of39alreadyhavealocalclonethatyoucanbasethenewoneoffof–see'git-clone–reference'fordetails).
Nowcdintotheclonedkernelandcreateaworkingbranchnamed'standard/common-pc/base':$cd~/poky-dylan-9.
0.
0/linux-yocto-3.
8.
git$gitcheckout-bstandard/common-pc/baseremotes/origin/standard/common-pc/baseYoushouldseesomethinglikethefollowingasoutput:Branchstandard/common-pc/basesetuptotrackremotebranchstandard/common-pc/basefromorigin.
Switchedtoanewbranch'standard/common-pc/base'Switchtothelab2layerForthis,you'llbereusinglab2,whichusesthelinux-yoctokernelalready:Openlocal.
conf(don'tforgettocdbackintothebuilddirectory):$cd~/poky-dylan-9.
0.
0/build$geditconf/local.
confAddthefollowinglinejustabovethelinethatsays'MACHINE="qemux86":MACHINE="lab2-qemux86"Saveyourchangesandclosegedit.
Nowopenbblayers.
conf:$geditconf/bblayers.
confandaddthe'meta-lab2-qemux86'layertotheBBLAYERSvariable.
Thefinalresultshouldlooklikethis,assumingyouraccountiscalled'myacct'(simplycopythelinecontaining'meta-yocto-bsp'andreplace'meta-yocto-bsp'with'meta-lab2-qemux86'):BBLAYERS="\/home/myacct/poky-dylan-9.
0.
0/meta\/home/myacct/poky-dylan-9.
0.
0/meta-yocto\/home/myacct/poky-dylan-9.
0.
0/meta-yocto-bsp\/home/myacct/poky-dylan-9.
0.
0/meta-lab2-qemux86\"Youshouldnotneedtomakeanyfurtherchanges.
Saveyourchangesandclosegedit.
Modifythelab2kerneltousethelocallinux-yoctorepoEditthelinux-yoctokernelrecipe:$gedit~/poky-dylan-9.
0.
0/meta-lab2-qemux86/recipes-kernel/linux/linux-yocto_3.
8.
bbappendYou'llneedtoaddanewSRC_URItopointtothelocalcloneyoujustcreated,buttodothat,youneedtostartwithaSRC_URIthatmakessenseforthelinux-yocto-3.
8kernel.
Ingedit,use'File|Open'tonavigatetoandopenthebaselinux-yocto-3.
8recipe:~/poky-dylan-9.
0.
0/meta/recipes-kernel/linux/linux-yocto_3.
8.
bb.
CopythefollowingSRC_URIlinefromthelinux-yocto_3.
8bbfiletothelinux-yocto_3.
8.
bbappendinthelab2-qemux86layer:Hands-onKernelLabwww.
yoctoproject.
orgPage30of39SRC_URI="git://git.
yoctoproject.
org/linux-yocto-3.
8.
git;protocol=git;nocheckout=1;branch=${KBRANCH},meta;name=machine,meta"Replacethe'git.
yoctoproject.
org/linux-yocto-3.
8.
git'kernelwiththepathtothelocallinux-yocto-3.
8kernelthatyoujustcloned(becarefultousethefullpathtothelocalrepointheSRC_URIi.
e.
thetripleforwardslashintheSRC_URIisnotamistake).
Also,changethe'protocol'to'file'andreplace'nocheckout=1'with'bareclone=1'.
ThefinalSRC_URIshouldlooksomethinglikethis:SRC_URI="git:///home/trz/poky-dylan-9.
0.
0/linux-yocto-3.
8.
git;protocol=file;bareclone=1;branch=${KBRANCH},meta;name=machine,meta"Also,commentoutthecurrentSRCREVlinesanduncommentthefollowingSRCREVlines:SRCREV_machine_pn-linux-yocto_lab2-qemux86="${AUTOREV}"SRCREV_meta_pn-linux-yocto_lab2-qemux86="${AUTOREV}"Saveyourchangesandclosegedit.
RebuildtheKernelOK,youhavedonethisbefore(don'tforgettocdbackintothebuilddirectory):$cd~/poky-dylan-9.
0.
0/build$bitbake-cdeployvirtual/kernel$runqemutmp/deploy/images/bzImage-lab2-qemux86.
bintmp/deploy/images/core-image-minimal-lab2-qemux86.
ext3Modifythelocallinux-yocto-basedkernelAtthispoint,youhavethesamesetupwiththelinux-yocto-basedkernelasyoudidwiththelinux-yocto-custom-basedkernel,soyoushouldbeabletofollowthesamesequenceofstepsoutlinedintheprevioussectiontitled'Modifythelocalkernel'tomodify,build,andseetheresultsofanykernelchangesyoumaketothelocallinux-yocto-3.
8repository.
Usingalocallinux-yocto-basedkernelasabarecloneInthislabsofar,you'vesimplyusedastraightcloneofagitkernelasaworkingclone.
Thereisanotherworkflowbasedona'bareclone'thatforsomedevelopersiseasiertoworkwith.
Alargebonusrealizedfromusingthismethodisthatinthecaseofbareclones,thebuildsystemisabletoautomaticallypickupsourcechangeswithouttheneedfora'cleanall'step.
Thebareclonemethoddoesaddanextrasteptothemodificationstep,butthetimesavingsofnothavingtodoa'cleanall'andsubsequentnewfetchofthe(albeitlocal)kerneladdsupovertime.
Thefollowingstepscanbeusedtouseabareclonelocalversionofthelinux-yoctokernel.
Becauseinthislabyou'rebuildingthekernelfromabarelocalrepository,youfirstneedtocreateabarelocalcloneofthekernelyouwanttouseandclonethattocreatea'working'clone.
Duringdevelopment,you'llpushyourchangesfromtheworkingclonebackintothebareclone.
Tosetthisup,cdintothepoky-dylan-9.
0.
0directoryandcreateabarelocalcloneofthelinux-yocto-3.
8kernel:$cd~/poky-dylan-9.
0.
0$gitclone--baregit://git.
yoctoproject.
org/linux-yocto-3.
8linux-yocto-3.
8-bare.
gitYoushouldseesomethinglikethefollowingasoutput:Hands-onKernelLabwww.
yoctoproject.
orgPage31of39Cloningintobarerepository'linux-yocto-3.
8-bare.
git'.
.
.
remote:Countingobjects:2851607,done.
remote:Compressingobjects:100%(456267/456267),done.
remote:Total2851607(delta2389855),reused2829542(delta2367803)Receivingobjects:100%(2851607/2851607),604.
78MiB|566KiB/s,done.
Resolvingdeltas:100%(2389855/2389855),done.
Nowcreatealocalworkingcloneofthelocalbareclone:$gitclonelinux-yocto-3.
8-bare.
gitlinux-yocto-3.
8-workYoushouldseesomethinglikethefollowingasoutput:Cloninginto'linux-yocto-3.
8-work'.
.
.
done.
Checkingoutfiles:100%(41521/41521),done.
Nowcdintotheworkingcloneandcreateaworkingbranchnamed'standard/common-pc/base':$cdlinux-yocto-3.
8-work/$gitcheckout-bstandard/common-pc/baseremotes/origin/standard/common-pc/baseYoushouldseesomethinglikethefollowingasoutput:Branchstandard/common-pc/basesetuptotrackremotebranchstandard/common-pc/basefromorigin.
Switchedtoanewbranch'standard/common-pc/base'Editthelinux-yoctokernelrecipeandchangetheSRC_URItopointtothebareclone:$gedit~/poky-dylan-9.
0.
0/meta-lab2-qemux86/recipes-kernel/linux/linux-yocto_3.
8.
bbappendThefinalSRC_URIshouldlooksomethinglikethis:SRC_URI="git:///home/trz/poky-dylan-9.
0.
0/linux-yocto-3.
8-bare.
git;protocol=file;bareclone=1;branch=${KBRANCH},meta;name=machine,meta"Nowrebuildthekernel:$cd~/poky-dylan-9.
0.
0/build$bitbake-cdeployvirtual/kernel$runqemutmp/deploy/images/bzImage-lab2-qemux86.
bintmp/deploy/images/core-image-minimal-lab2-qemux86.
ext3Atthispoint,youhavethesamesetupwiththelinux-yocto-basedkernelasyoudidwiththelinux-yocto-custom-basedkernel,soyoushouldbeabletofollowthesamesequenceofstepsoutlinedintheprevioussectiontitled'Modifythelocalkernel'tomodifythekernel.
Thedifferenceinthiscaseisthatyou'llbemodifyingthecodeinthelinux-yocto-3.
8-workcloneofthebareclone,andonceyou'vecommittedyourchangeintheworkclone:$cd~/poky-dylan-9.
0.
0/linux-yocto-3.
8-work$geditfs/filesystems.
c$gitcommit-a-m"fs/filesystems.
c:Hey,thisisthecommitIpushedfromaworkingcloneintothisbareclone!
Neat,eh"youneedtopushittothebareclone:$gitpushoriginstandard/common-pc/base:standard/common-pc/baseYoushouldseesomethinglikethefollowingasoutput:Countingobjects:7,done.
Deltacompressionusingupto8threads.
Compressingobjects:100%(4/4),done.
Hands-onKernelLabwww.
yoctoproject.
orgPage32of39Writingobjects:100%(4/4),412bytes,done.
Total4(delta3),reused0(delta0)Unpackingobjects:100%(4/4),done.
To/home/trz/poky-dylan-9.
0.
0/linux-yocto-3.
8-bare.
gitdd089cb.
.
2d3d273standard/common-pc/base->standard/common-pc/baseVerifythatthechangesyoumadeintheworkingclonemadeittothebareclone:$cd~/poky-dylan-9.
0.
0/linux-yocto-3.
8-bare.
git$gitlogstandard/common-pc/baseYoushouldseesomethinglikethefollowingasoutput:commit2d3d2734768cd8bbbff4211379a0f4eb2d6d49d3Author:TomZanussiDate:FriMay1008:31:502013-0500fs/filesystems.
c:Hey,thisisthecommitIpushedfromaworkingcloneintothisbareclone!
Neat,ehSigned-off-by:TomZanussiNowrebuildthekernel(noneedtodoa'cleanall'thistime)andyoushouldseeyourchangeappear:$cd~/poky-dylan-9.
0.
0/build$bitbake-cdeployvirtual/kernel$runqemutmp/deploy/images/bzImage-lab2-qemux86.
bintmp/deploy/images/core-image-minimal-lab2-qemux86.
ext3Lab4ConclusionInthislabyoubuiltandbootedanarbitrarygit-basednon-linux-yoctoLinuxkernelasalocalrepository,whichyouthenmodified,andyouimmediatelysawtheresultsofyourchangesafterrebuildingthekernel.
Inaddition,youwerealsoabletodothesameworkflowusingalocallinux-yocto-basedkernelaswellaswithabarecloneofthelinux-yoctokernel.
Youalsoaddedandloadedanexternalkernelmodule.
ThisconcludesLab4.
Hands-onKernelLabwww.
yoctoproject.
orgPage33of39Lab5:TheYoctoBSPToolUpuntilnow,youhavemodifiedexistinglayersbymanuallyeditingindividualfilesanddirectlymanipulatingtheconfigurationofthekernel.
ThisisaskillyouneedtohaveinordertounderstandandworkwithexistingBSPs.
However,thereisaneasierwaytocreateaninitiallayerwiththecustomizationsyouwant.
TheYoctoBSPToolconsistsofasmallsetofscriptswhichgenerateastandardizedYoctoBSPlayer,includingmachineconfiguration,supportingrecipes,andREADMEfiles.
Italsoallowstheusertoadd(andremove)patchesandkernelconfigfragmentstoalinux-yoctokernelwithouthavingtoeditorlearnthesordiddetailsofthelinux-yoctometa-data.
CreatetheLab5LayerYouwillusetheyocto-bspcommandtocreateanewlayerforamachinecalledlab5-qemuarm.
Createthelayeralongsidetheotherlablayersin~/poky-dylan-9.
0.
0:$cd~/poky-dylan-9.
0.
0/$sourceoe-init-build-env$cd~/poky-dylan-9.
0.
0/$yocto-bspcreatelab5-qemuarmqemuSelectthefollowinganswersforthequeriespresentedwhenprompted(byenteringthegivennumbersor(y/n)valuesasappropriate,followedbytheEnterkey(ifyoudon'texplicitlyselectanythingbyjustpressingEnter,thedefaultvaluelistedwillbechosenforyou.
Onlythenon-defaultvaluesarehighlightedred):Whichqemuarchitecturewouldyouliketouse[default:i386]1)i386(32-bit)2)x86_64(64-bit)3)ARM(32-bit)4)PowerPC(32-bit)5)MIPS(32-bit)3Wouldyouliketousethedefault(3.
8)kernel(y/n)[default:y]DoyouneedanewmachinebranchforthisBSP(thealternativeistore-useanexistingbranch)[y/n][default:y]Gettingbranchesfromremoterepogit://git.
yoctoproject.
org/linux-yocto-3.
8.
git.
.
.
PleasechooseamachinebranchtobaseyournewBSPbranchon:[default:standard/base]1)standard/arm-versatile-926ejs2)standard/base3)standard/beagleboard.
.
1WouldyoulikeSMPsupport(y/n)[default:y]DoesyourBSPhaveatouchscreen(y/n)[default:n]DoesyourBSPhaveakeyboard(y/n)[default:y]Onsuccess,thetoolwillreport:NewqemuBSPcreatedinmeta-lab5-qemuarmHands-onKernelLabwww.
yoctoproject.
orgPage34of39SetuptheEnvironmentChangedirectoriesbackintothebuilddirectory:$cdbuildOpenlocal.
conf:$geditconf/local.
confAddthefollowinglinejustabovethelinethatsays'MACHINE="qemux86":MACHINE="lab5-qemuarm"Saveyourchangesandclosegedit.
Nowopenbblayers.
conf:$geditconf/bblayers.
confandaddthe'meta-lab5-qemuarm'layertotheBBLAYERSvariable.
Thefinalresultshouldlooklikethis,assumingyouraccountiscalled'myacct'(simplycopythelinecontaining'meta-yocto-bsp'andreplace'meta-yocto-bsp'with'meta-lab5-qemux86'):BBLAYERS="\/home/myacct/poky-dylan-9.
0.
0/meta\/home/myacct/poky-dylan-9.
0.
0/meta-yocto\/home/myacct/poky-dylan-9.
0.
0/meta-yocto-bsp\/home/myacct/poky-dylan-9.
0.
0/meta-lab5-qemuarm\"Youshouldnotneedtomakeanyfurtherchanges.
Saveyourchangesandclosegedit.
BuildtheImageOK,youhavedonethisbefore(don'tforgettocdbackintothebuilddirectory):$cd~/poky-dylan-9.
0.
0/build$bitbakecore-image-minimal$runqemutmp/deploy/images/zImage-lab5-qemuarm.
bintmp/deploy/images/core-image-minimal-lab5-qemuarm.
ext3Hands-onKernelLabwww.
yoctoproject.
orgPage35of39ModifytheKernelRecipeRatherthanmanuallyeditingtherecipefilesasinpreviouslabs,youaregoingtousetheYoctoBSPTooltoaddthedriverpatchandupdatetheconfiguration.
Rememberthatthebaselinux-yoctorecipetakescareofthestandardhardwarerequirementsfortheqemumachine,butyouwillstillneedtotellitabouttheoptionstoenablethetestdriver.
Forthekernelpatch,you'lljustre-usetheyocto-testmod.
patchfromlab2:Addthepatchusingthe'yocto-kernelpatchadd'command:$yocto-kernelpatchaddlab5-qemuarm~/poky-dylan-9.
0.
0/meta-lab2-qemux86/recipes-kernel/linux/files/yocto-testmod.
patchYoushouldseethefollowingoutputfromthecommand:Addedpatches:yocto-testmod.
patchYoucanverifythatthepatchisincludedinthelab5-qemuarmkernelbyusingthe'yocto-kernelpatchlist'command:$yocto-kernelpatchlistlab5-qemuarmThecurrentsetofmachine-specificpatchesforlab5-qemuarmis:1)yocto-testmod.
patchSimilarly,youcanaddconfigoptionsusingthe'yocto-kernelconfigadd'command:$yocto-kernelconfigaddlab5-qemuarmCONFIG_YOCTO_TESTMOD=yYoushouldseethefollowingoutputfromthecommand:Addeditems:CONFIG_YOCTO_TESTMOD=yYoucanverifythattheconfigitemwasaddedtothelab5-qemuarmkernelconfigurationbyusingthe'yocto-kernelconfiglist'command:$yocto-kernelconfiglistlab5-qemuarmThecurrentsetofmachine-specifickernelconfigitemsforlab5-qemuarmis:1)CONFIG_YOCTO_TESTMOD=yReviewtheLayerThemeta-lab5-qemuarmlayercontainsthefollowingsetoffilesforthekernel:meta-lab5-qemuarm/recipes-kernel/linux/files/lab5-qemuarm.
cfglab5-qemuarm-preempt-rt.
scclab5-qemuarm-tiny.
scclab5-qemuarm.
scclab5-qemuarm-standard.
scclab5-qemuarm-user-config.
cfglab5-qemuarm-user-patches.
scclab5-qemuarm-user-features.
sccyocto-testmod.
patchlinux-yocto_3.
8.
bbappendlinux-yocto_3.
8.
bbappend.
prevHands-onKernelLabwww.
yoctoproject.
orgPage36of39Atthetoplevelofthelinux/directory,youcanseethe.
bbappendfile,whichisanextensionofthelinux-yocto-3.
8Linuxkernelrecipe.
Thelinux-yocto_3.
8.
bbappendissimilartolab2'sLinuxkernelrecipeextension.
Ifyouopenitupandlookatit,youwillseethatthefilesinthefilessubdirectoryarereferencedintheSRC_URIvariableappend(thelinethatstartswithSRC_URI+=).
Noticethatincludestheyocto-testmod.
patchyouaddedusingtheyocto-kernelpatchaddcommand.
Ifyouopenthelab5-qemuarm-user-config.
cfgfileinthefilessubdirectory,youwillseetheconfigurationoptionsyouaddedfortheYoctotestmoduleusingtheyocto-kernelconfigaddcommand.
Finally,notethelinux-yocto_3.
8.
bbappend.
prevfile,whichissimplyabackupcopyofthecorresponding.
bbappendfile,keptincasesomethinggoeswrongwiththeadd(ordelete)patch(orconfig)operation.
BuildtheImageNowyoucanrebuildandbootthenewkernel:$bitbakelinux-yocto-cdeploy$runqemutmp/deploy/images/zImage-lab5-qemuarm.
bintmp/deploy/images/core-image-minimal-lab5-qemuarm.
ext3Likebefore,QEMUwillopenanewwindowandboottoaloginprompt.
YoucanuseShift+PgUptoscrollupandfindthenewdrivermessage.
Lab5ConclusionInthislabyouusedtheYoctoBSPtoolstogenerateacompleteBSPlayer,includingpatchesandconfigfragments,withoutwritinganyofityourself.
ThisconcludesLab5.
Hands-onKernelLabwww.
yoctoproject.
orgPage37of39NOTESHands-onKernelLabwww.
yoctoproject.
orgPage38of39NOTESHands-onKernelLabwww.
yoctoproject.
orgPage39of39
整理一下CloudCone商家之前推送的闪购VPS云服务器产品,数量有限,活动推出可能很快机器就售罄了,有需要美国便宜VPS云服务器的朋友可以关注一下。CloudCone怎么样?CloudCone服务器好不好?CloudCone值不值得购买?CloudCone是一家成立于2017年的美国服务器提供商,国外实力大厂,自己开发的主机系统面板,CloudCone主要销售美国洛杉矶云服务器产品,优势特点是...
华为云怎么样?华为云用在线的方式将华为30多年在ICT基础设施领域的技术积累和产品解决方案开放给客户,致力于提供稳定可靠、安全可信、可持续创新的云服务,做智能世界的“黑土地”,推进实现“用得起、用得好、用得放心”的普惠AI。华为云作为底座,为华为全栈全场景AI战略提供强大的算力平台和更易用的开发平台。本次年终聚惠618活动相当给力,1核2G内存1m云耀云服务器仅88元/年起,送主机安全基础版套餐,...
LOCVPS发来了新的洛杉矶CN2线路主机上线通知,基于KVM架构,目前可与香港云地、香港邦联机房XEN架构主机一起适用7折优惠码,优惠后最低美国洛杉矶CN2线路KVM架构2GB内存套餐月付38.5元起。LOCPVS是一家成立较早的国人VPS服务商,目前提供洛杉矶MC、洛杉矶C3、和香港邦联、香港沙田电信、香港大埔、日本东京、日本大阪、新加坡、德国和荷兰等机房VPS主机,基于KVM或者XEN架构。...
fedora17为你推荐
neworiental我国最好的英语学校是在哪里?留学生认证留学生服务中心认证内容和范围?kaixin.com人人网和开心网互通,可我用的是kaixin001的开心,和kaixin*com不是一个呀!同一ip网站最近我们网站老是出现同一个IP无数次的进我们网站,而且是在同一时刻,是不是被人刷了?为什么呀?同一ip网站同一个IP不同的30个网站,是不是在一个服务器上呢?seo优化工具SEO优化要用到什么软件?125xx.com高手指教下,www.fshxbxg.com这个域名值多少钱?www.bbb551.com100bbb网站怎样上不去了广告法新广告法哪些广告词不能用,广告违禁词大全woshiheida这个左下角水印woshiheida的gif出处在哪呢?急!!!!!
google电话 idc评测 20g硬盘 360抢票助手 好玩的桌面 100x100头像 howfile 百兆独享 爱奇艺会员免费试用 免费mysql数据库 360云服务 yundun 数据库空间 国外免费云空间 websitepanel vi命令 vim命令 华为云服务器宕机 主机系统 国内免备案空间 更多