kernel-lab-1.4

  • Upload
    swag

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

  • 8/9/2019 kernel-lab-1.4

    1/39

    Hands-on Kernel LabBased on the Yocto Project 1.4 release (dylan)

    April 2013

    Tom Zanussi

    Darren Hart

    mailto:[email protected]:[email protected]:[email protected]:[email protected]
  • 8/9/2019 kernel-lab-1.4

    2/39

    Introduction

    Welcome to the Yocto Project Hands-on ernel !a"# Durin$ this session %ou &illlearn ho& to &or' e((ectivel% &ith the !inux 'ernel &ithin the Yocto Project.

    The )Hands-on ernel !a") is actuall% a series o( la"s that &ill cover the (ollo&in$to*ics+

    ,reatin$ and usin$ a traditional 'ernel reci*e lab1 /sin$ )"it"a'e -c menucon(i$) to modi(% the 'ernel con(i$uration and

    re*lace the defconfig&ith the ne& con(i$uration lab1

    0ddin$ a 'ernel module to the 'ernel source and con(i$urin$ it as a "uilt-inmodule "% addin$ o*tions to the 'ernel defconfiglab1

    ,reatin$ and usin$ a linux-%octo-"ased 'ernel lab2

    0ddin$ a 'ernel module to the 'ernel source and con(i$urin$ it as a "uilt-inmodule usin$ linux-%octo )con(i$ (ra$ments) lab2

    /sin$ the linux-%octo 'ernel as an !T12 'ernel con(i$urin$ in an item added

    "% the !T12 'ernel &hich is mer$ed into linux-%octo lab2

    /sin$ an ar"itrar% $it-"ased 'ernel via the linux-%octo-custom 'ernel reci*elab3

    0ddin$ a 'ernel module to the 'ernel source o( an ar"itrar% $it-"ased 'erneland con(i$urin$ it as a loada"le module usin$ )con(i$ (ra$ments) lab3

    0ctuall% $ettin$ the module into the ima$e and autoloadin$ it on "oot lab3

    /sin$ a local clone o( an ar"itrar% $it-"ased 'ernel via the linux-%octo-custom 'ernel reci*e to demonstrate a t%*ical develo*ment &or'(lo& lab4

    3odi(%in$ the locall% cloned custom 'ernel source and veri(%in$ thechan$es in the ne& ima$e lab4

    /sin$ a local clone o( a linux-%octo- 'ernel reci*e to demonstrate a t%*icaldevelo*ment &or'(lo& lab4

    3odi(%in$ the locall% cloned linux-%octo 'ernel source and veri(%in$ thechan$es in the ne& ima$e lab4

    /sin$ a )"are) local clone o( a linux-%octo- 'ernel reci*e to demonstrate at%*ical develo*ment &or'(lo& lab4

    3odi(%in$ the locall% cloned )"are) linux-%octo 'ernel source and veri(%in$

    the chan$es in the ne& ima$e lab4 0ddin$ and usin$ an external 'ernel module via a module reci*e lab4

    /sin$ the )Yocto 41P Tools) %octo-"s* tool $enerate a ne& Yocto 41P lab5

    /sin$ the )Yocto 41P Tools) %octo-'ernel tool to add 'ernel *atches andcon(i$ (ra$ments lab5

    This la" assumes %ou have a "asic understandin$ o( the Yocto Project and "it"a'e5

    Hands-on Kernel a! www.yoctoproject.orgPa"e 2 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    3/39

    and are com(orta"le navi$atin$ a /627 (iles%stem (rom the shell and issuin$ shellcommands. 2( %ou need hel* in this area5 *lease consult the introductor% material&hich %ou can (ind on the Yocto &e"site and8or 9oo$le (or &hatever else %ou needto 'no& to $et started.

    0ll o( the material covered in this la" is documented in the Yocto Project !inuxernel Develo*ment 3anual+

    htt*+88&&&.%octo*roject.or$8docs8latest8'ernel-dev8'ernel-dev.html

    Please consult the 'ernel develo*ment manual (or more detailed in(ormation and"ac'$round on the to*ics covered in this la".

    Tip: Throu$hout the la" %ou &ill need to edit various (iles. 1ometimes the*athnames to these (iles are lon$. 2t is critical that %ou enter them exactl%.:emem"er %ou can use the Tab'e% to hel* autocom*lete *ath names (romthe shell. You ma% also co*% and *aste the *aths (rom the PD; version o( thisla" &hich %ou can (ind at the same location that this document &as (ound.

    Tip: ach la" is inde*endent o( the others and doesn)t de*end on the results o(an% *revious la"5 so (eel (ree to jum* ri$ht to an% la" that)s o( interest to %ou.

    Build System Basic Setup

    This hands-on la" &as desi$ned to "e com*leted on a com*uter runnin$ the/"untu =.? APrecise Pan$olinB o*eratin$ s%stem. While this s*eci(ic release o(/"untu is recommended to avoid un(oreseen incom*ati"ilities5 %ou can $enerall%use a recent release o( /"untu5 ;edora5 or C*en1/1 to com*lete this hands-onla". This hands-on la" &as develo*ed and there(ore also tested on a ;edora =s%stem.

    4e(ore startin$ these exercises5 *lease ensure that %our s%stem has the necessar%so(t&are *rereEuisites installed as descri"ed in the Yocto Project Fuic' 1tart9uide see the su"section entitled AThe Pac'a$esB+

    htt*+88&&&.%octo*roject.or$8docs8=.8%octo-*roject-Es8%octo-*roject-Es.html

    This hands-on la" assumes %ou have a net&or' connection and have a &or'in$version o( )$it) installed. You)ll need a $ood net&or' connection (or the initialsetu* and do&nload o( the source *ac'a$es "uilt "% the reci*es. )$it) is reEuired(or creatin$ and testin$ 'ernel *atches (or the $it-"ased 'ernel reci*es used inla"5 "ut isn)t reEuired "% the other la"s.

    Preparing Your Build Enironment

    Please lo$ in to %our s%stem as a normal user and once lo$$ed in5 launch a

    terminal "% simultaneousl% *ressin$ the (ollo&in$ 'e%s+Ctrl + Alt + T

    0lternativel%5 %ou can o*en a terminal "% clic'in$ the )Dash) icon and t%*in$)terminal) in the entr% (ield. When the )Terminal) icon a**ears5 clic' on it to o*ena terminal.

    Throu$hout the la" %ou ma% (ind it use(ul to &or' &ith more than one ta" in %our

    Hands-on Kernel a! www.yoctoproject.orgPa"e 3 o# 3$

    http://www.yoctoproject.org/docs/latest/kernel-dev/kernel-dev.htmlhttp://www.yoctoproject.org/docs/1.3/yocto-project-qs/yocto-project-qs.htmlhttp://www.yoctoproject.org/http://www.yoctoproject.org/docs/latest/kernel-dev/kernel-dev.htmlhttp://www.yoctoproject.org/docs/1.3/yocto-project-qs/yocto-project-qs.htmlhttp://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    4/39

    terminal. To create additional ta"s+

    File Open Tab

    2n order to run the la"s5 %ou)ll (irst need to do&nload the Yocto =. )d%lan) sourcesinto %our home director%. ;rom %our terminal shell5 t%*e+

    $ wget http://downloads.yoctoproject.org/releases/yocto/yocto-1./po!y-dylan-".#.#.tar.b%$ b&nip% -c po!y-dylan-".#.#.tar.b% ' tar ()* -

    Cnce %ou)ve $otten the Yocto =. sources5 %ou should cd into the the *o'%-d%lan-G.?.? director% that &as created++

    $ cd po!y-dylan-".#.#/

    !istin$ the (iles in that director% should sho& the (ollo&in$ (iles andsu"directories+

    $ lsbitba!e ,C 0eta-hob 0eta-yocto oe-init-b&ild-en) A23.hardwaredoc&0entation 0eta 0eta-s!eleton 0eta-yocto-bsp A23 scripts

    You also need to $et and un*ac' the instructional la%ers (or this la"+

    $ wget https://www.yoctoproject.org/sites/yoctoproject.org/files/kernel-lab-

    1.4-layers.tar.bz2$ b&nip% -c !ernel-lab-1.-layers.tar.b% ' tar ()* -

    !istin$ the (iles in the current director%5 &hich should still "e *o'%-d%lan-G.?.?5should no& sho& the (ollo&in$ (iles and su"directories+

    $ lsbitba!e 0eta-hob 0eta-lab4-5e0&ar0.*inishedA23doc&0entation 0eta-lab1-5e0&(67 0eta-s!eletonA23.hardware!ernel-lab-1.-layers.tar.b% 0eta-lab%-5e0&(67 0eta-yoctoscripts,C 0eta-lab8-5e0&(67 0eta-yocto-bsp

    0eta 0eta-lab-5e0&(67 oe-init-b&ild-en)

    Hands-on Kernel a! www.yoctoproject.orgPa"e 4 o# 3$

    https://www.yoctoproject.org/sites/yoctoproject.org/files/kernel-lab-1.4-layers.tar.bz2https://www.yoctoproject.org/sites/yoctoproject.org/files/kernel-lab-1.4-layers.tar.bz2http://www.yoctoproject.org/https://www.yoctoproject.org/sites/yoctoproject.org/files/kernel-lab-1.4-layers.tar.bz2https://www.yoctoproject.org/sites/yoctoproject.org/files/kernel-lab-1.4-layers.tar.bz2http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    5/39

    Lab !" #raditional Kernel $ecipe

    2n this la" %ou &ill modi(% a stoc' .?.=I !inux 'ernel reci*e to ma'e it "oot on aEemuxIJ machine. You &ill then a**l% a *atch and modi(% the con(i$uration toadd a sim*le 'ernel module &hich *rints a messa$e to the console. This &ill(amiliarize %ou &ith the "asic "it"a'e &or'(lo& (or &or'in$ &ith and modi(%in$sim*le 'ernel reci*es.

    Set up t%e Enironment

    $ cd 9/po!y-dylan-".#.#/$ so&rce oe-init-b&ild-en)

    C*en local.con(+

    $ gedit con*/local.con*

    and uncomment the (ollo&in$ lines+

    ; ??@AA;3A > ?-j ?

    2( %ou have a di((erent num"er o( *rocessors5 chan$e those values to match the

    num"er o( *rocessors %ou have in %our machine.0dd the (ollo&in$ line just a"ove the line that sa%s )30,H26 KKL AEemuxIJB+

    3AC=, B> ?lab1-5e0&(67?

    1ave %our chan$es and close $edit.

    6o& o*en ""la%ers.con(+

    $ gedit con*/bblayers.con*

    and add the )meta-la"=-EemuxIJ) la%er to the 44!0Y:1 varia"le. The (inalresult should loo' li'e this5 assumin$ %our account is called )m%acct) sim*l% co*%the line containin$ )meta-%octo-"s*) and re*lace )meta-%octo-"s*) &ith )meta-la"=-

    EemuxIJ)+A B> ? D/ho0e/0yacct/po!y-dylan-".#.#/0eta D/ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto D/ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto-bsp D/ho0e/0yacct/po!y-dylan-".#.#/0eta-lab1-5e0&(67 D?

    You should not need to ma'e an% (urther chan$es. 1ave %our chan$es and close$edit.

    The meta-la"=-EemuxIJ la%er *rovides a ver% sim*le !inux .?.=I reci*e. C*en itin $edit (or revie&+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab1-5e0&(67/recipes-!ernel/lin&(/lin&(;8.#.16.bb

    This is a "are-"ones sim*le !inux 'ernel reci*e. 2t inherits all o( the lo$ic (orcon(i$urin$ and "uildin$ the 'ernel (rom the !ernel.bbclass the )inherit 'ernel) line.2t s*eci(ies the !inux 'ernel sources in 1:,M/:2 as a recent tar"all release (rom'ernel.or$. 2t also s*eci(ies a de*con*ig5 this (ile is used as the .con*igto "uild the'ernel. 2t is em*t% (or no&5 so the !inux 'ernel con(i$uration s%stem &ill use

    Hands-on Kernel a! www.yoctoproject.orgPa"e % o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    6/39

    de(aults. You &ill also notice a commented out *atch on another 1:,M/:2 line5leave it commented out (or no&5 &e &ill come "ac' to that.

    The meta-la"=-EemuxIJ la%er also *rovides a (airl% standard machinecon(i$uration &hose *ur*ose is to de(ine a $rou* o( machine-s*eci(ic settin$s (orthe )la"=-EemuxIJ) machine. These settin$s *rovide machine-s*eci(ic values (or anum"er o( varia"les all documented in the Yocto Project :e(erence 3anual&hich allo& us to "oot the )la"=-EemuxIJ) machine into a $ra*hical Eemu

    environment. C*en it in $edit (or revie&+$ gedit 9/po!y-dylan-".#.#/0eta-lab1-5e0&(67/con*/0achine/lab1-5e0&(67.con*

    Without $oin$ in to too much detail5 there are a (e& thin$s to note a"out this (ile.The (irst is the (ile name itsel(N note that the "ase (ilename matches the machinename5 in this case )la"=-EemuxIJ)5 &hich is also the same as the machine names*eci(ied in the 30,H26 settin$ in local.con(.

    1econdl%5 note that other than the )reEuire) statements5 &hich essentiall% justim*lement a (ile inclusion mechanism5 the con(i$uration consists almost entirel%o( varia"le assi$nments. The various assi$nment o*erators are documentedelse&here and are relativel% o"vious5 "ut (or no& &e)ll just mention that the )KL)

    assi$nment o*erator im*lements conditional assi$nment+ i( the varia"le hasn)talread% "een set5 it ta'es on the value s*eci(ied on the ri$ht-hand-side.

    ;inall%5 a &ord o( ex*lanation a"out the P:;::DMP:CO2D: assi$nments inthe machine con(i$uration (ile. 3an% com*onents o( the "uild s%stem havemulti*le im*lementations availa"le. The "uild s%stem &ill normall% choose ade(ault im*lementation and version (or a *articular com*onent5 "ut sometimes itma'es sense (or a machine to ex*licitl% s*eci(% a s*eci(ic im*lementation and8orversion i( it 'no&s it doesn)t &ant to use the de(aults. 2t ma% also &ant to s*eci(%s*eci(ic values in order to )*in do&n) a *articular im*lementation and versionre$ardless o( &hat the de(aults are5 or ho& the% ma% chan$e in the (uture.

    2n the case o( the )la"=-EemuxIJ) machine5 %ou see that it s*eci(ies aP:;::DMP:CO2D: (or the virtual8'ernel com*onent+

    @F2;@OE,2;)irt&al/!ernel B> ?lin&(?

    The reason it does this is that i( it didn)t5 it &ould *ic' u* the de(ault linux-%octoM.I 'ernel &hich is the version s*eci(ied in the Eemu.inc (ile included(ollo&in$ that line. 0lso5 "ecause there)s onl% a sin$le linuxM reci*e5 there)s noam"i$uit% a"out &hich version to choose and there(ore no s*eci(ic versions*eci(ied. 2( %ou needed to5 %ou could do that usin$ a P:;::DMO:12C6directive Q %ou)ll see an exam*le o( that in !a" .

    Note+ The reason the la%ers and the machines have sli$htl% un&ield% names e.$.)la"=-EemuxIJ) rather than just the sim*ler )la"=) is that there)s a 'no&n *ro"lem&ith the runEemu scri*t in that it &ill onl% reco$nize machine names that end&ith one o( the "ase Eemu machine names see Yocto 4u$ RIG? (or details.ee* this in mind i( %ou decide to create %our o&n Eemu-machine "ased 41Pla%ers.

    Hands-on Kernel a! www.yoctoproject.orgPa"e & o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    7/39

    Build t%e Image

    6o& %ou &ill "uild the 'ernel and assem"le it into a Eemu "oota"le ima$e. This(irst "uild ma% ta'e a lon$ time5 *erha*s u* to an hour5 so $o have lunch# the(irst "uild &ill ta'e the lon$est5 since in addition to "uildin$5 the s%stem &illdo&nload all the *ac'a$es it needs.

    $ bitba!e core-i0age-0ini0al

    Note+ ;or this la"5 there &ill "e a num"er o( &arnin$ messa$es o( the (orm

    )W0:6269+ F0 2ssue+ ...). You can sa(el% i$nore those.6o& "oot the ima$e &ith F3/+

    $ r&n5e0& t0p/deploy/i0ages/b,0age-lab1-5e0&(67.bin t0p/deploy/i0ages/core-i0age-0ini0al-lab1-5e0&(67.e(t8

    0 "lac' F3/ &indo& should a**ear and immediatel% start *rintin$ the !inux'ernel "oot messa$es... (ollo&ed "% a 'ernel *anic+

    The 'ernel (ailed to load a root (iles%stem. 6ote that under the Aist o* allpartitions:B there are no devices. This means that the 'ernel did not (ind a driver(or an% o( the "loc' devices *rovided (or the Eemu machine.

    $econ&igure t%e Linu' Kernel

    F3/ *rovides an 2ntel P227 2D controller. /se the !inux 'ernel 0en&con*igcommand to con(i$ure this into %our 'ernel+

    $ bitba!e lin&( -c 0en&con*ig

    0 ne& &indo& &ill a**ear that allo&s %ou to ena"le various !inux 'ernelcon(i$uration o*tions. /se the (ollo&in$ 'e%s to navi$ate the menu+

  • 8/9/2019 kernel-lab-1.4

    8/39

    e*t/ight arrows: Choose a co00and electG (itG or =elpG

    nter: (ec&te a co00and

    electG 2escends into a 0en&

    (itG ac!s o&t o* a 0en&H or e(its 0en&con*ig

    pace: toggle a con*ig&ration option

    6ote that "e(ore descendin$ into a menu that is itsel( con(i$ura"le5 %ou &ill needto chec' the menu item or its contents &ill "e em*t%.

    na"le the (ollo&in$ o*tions+

    2e)ice 2ri)ers ---G IJK ATA/ATA@,/3F3/ s&pport L2@CAT2M ---G IJK ,ntel @,,N/,C= chipsets s&pport eneric 2ri)er Options ---G IJK 3aintain a de)t0p*s *ilesyste0 to 0o&nt at /de) IJK A&to0o&nt de)t0p*s at /de)H a*ter the !ernel 0o&nted the root*sFile syste0s ---G IJK (t8 jo&rnaling *ile syste0 s&pport

    xit and save %our chan$es "% selectin$ (itand *ressin$ nter5 re*eat until it*rom*ts %ou to save %our chan$es.

    6o& re"uild and de*lo% onl% the 'ernel. This avoids havin$ to re"uild the ima$eitsel(5 &hich has not chan$ed5 savin$ %ou a (e& minutes. Then tr% to "oot it inF3/ a$ain+

    $ bitba!e lin&( -c deploy$ r&n5e0& t0p/deploy/i0ages/b,0age-lab1-5e0&(67.bin t0p/deploy/i0ages/core-i0age-0ini0al-lab1-5e0&(67.e(t8

    Hands-on Kernel a! www.yoctoproject.orgPa"e o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    9/39

    F3/ &ill start as "e(ore5 "ut this time &ill "oot all the &a% to a lo$in *rom*t.0s %ou can see5 there are a num"er o( scar%-loo'in$ errors and &arnin$s on theconsole. This is due to the (act that %ou)re startin$ &ith a "are-"onescon(i$uration and sim*l% tr%in$ to $et to a (unctional "oot *rom*t5 &ithout"otherin$ to &orr% a"out an%thin$ more at this *oint. 2n this res*ect5 %ou have asuccess(ul outcome5 and %ou can should no& "e a"le to lo$ in as root&ith no*ass&ord i( %ou &ant to *o'e around.

    /* to this *oint5 i( %ou &ere to share the meta-la"=-EemuxIJ la%er &ith someoneelse5 the 'ernel the% "uild &ould still (ail to "oot5 "ecause the (ixes onl% exist in%our s%stem)s PO2,. You need to u*date the de*con*igin the la%er &ith the one%ou modi(ied &ith 0en&con*ig. ,o*% the .con*igover the de*con*igin the la%er+

    $ cp t0p/wor!/lab1;5e0&(67-po!y-lin&(/lin&(/8.#.16-r#/lin&(-8.#.16/.con*ig9/po!y-dylan-".#.#/0eta-lab1-5e0&(67/recipes-!ernel/lin&(/lin&(/de*con*ig

    Hands-on Kernel a! www.yoctoproject.orgPa"e $ o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    10/39

  • 8/9/2019 kernel-lab-1.4

    11/39

    6o& re"uild the 'ernel and "oot it in F3/.

    $ bitba!e lin&( -c deploy$ r&n5e0& t0p/deploy/i0ages/b,0age-lab1-5e0&(67.bin t0p/deploy/i0ages/core-i0age-0ini0al-lab1-5e0&(67.e(t8

    You can scroll "ac' throu$h the "oot lo$ usin$ hi*t+@g

  • 8/9/2019 kernel-lab-1.4

    12/39

    Lab )" Linu'-Yocto Kernel $ecipe

    2n this la" %ou &ill &or' to&ards the same end $oal as in !a" =. This time %ou&ill use the lin&(-yoctoreci*e and toolin$. This sim*li(ies the *rocess o(con(i$urin$ the 'ernel and ma'es reusin$ %our &or' much easier.

    Setup t%e Enironment

    $ cd 9/po!y-dylan-".#.#/$ so&rce oe-init-b&ild-en)

    C*en local.con(+

    $ gedit con*/local.con*

    0dd the (ollo&in$ line just a"ove the line that sa%s )30,H26 KKL AEemuxIJB+

    3AC=, B> ?lab%-5e0&(67?

    1ave %our chan$es and close $edit.

    6o& o*en ""la%ers.con(+

    $ gedit con*/bblayers.con*

    and add the )meta-la"-EemuxIJ) la%er to the 44!0Y:1 varia"le. The (inalresult should loo' li'e this5 assumin$ %our account is called )m%acct) sim*l% co*%the line containin$ )meta-%octo-"s*) and re*lace )meta-%octo-"s*) &ith )meta-la"-EemuxIJ)+

    A B> ? D/ho0e/0yacct/po!y-dylan-".#.#/0eta D/ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto D/ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto-bsp D/ho0e/0yacct/po!y-dylan-".#.#/0eta-lab%-5e0&(67 D?

    You should not need to ma'e an% (urther chan$es. 1ave %our chan$es and close$edit.

    $eiew t%e Lab ) Layer

    This la%er di((ers (rom meta-la"= onl% in the !inux 'ernel reci*es. This la%ercontains the (ollo&in$ (iles (or the 'ernel+

    recipes-!ernel/lin&( /lin&(-yocto;8..bbappend

    lin&(-yocto;8.6.bbappend *iles /

    pra0*s.c*glab%.c*g

    yocto-test0od.patch

    C*en the .I 'ernel reci*e+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab%-5e0&(67/recipes-!ernel/lin&(/lin&(-yocto;8.6.bbappend

    6ote that this is not a com*lete reci*e5 "ut rather an extension o( the lin&(-yoctoreci*e *rovided "% the *o'% sources. 2t adds the la%er *ath (or additional (iles andsets u* some machine-s*eci(ic varia"les. 6otice that instead o( a de*con*ig(ile5 the

    Hands-on Kernel a! www.yoctoproject.orgPa"e 12 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    13/39

    reci*e adds lab%.c*gto the 1:,M/:2. This is a !inux 'ernel con(i$ (ra$ment.:ather than a com*lete .con*ig(ile5 a con(i$ (ra$ment lists onl% the con(i$ o*tions%ou s*eci(icall% &ant to chan$e. To start out5 this (ra$ment is commented out5 andthe linux-%octo sources &ill *rovide a de(ault .con*igcom*ati"le &ith common P,hard&are.

    The lab%.c*gcon(i$ (ra$ment is an exam*le o( a con(i$ (ra$ment that)s "othde(ined and s*eci(ied in )reci*e-s*ace)5 in other &ords de(ined as a (ile under the

    reci*e)s in this case (iles8 director% and added via the 1:,M/:2. ,on(i$(ra$ments can also "e de(ined in the 'ernel re*ositor%)s )meta) "ranch and addedto the 41P via :6!M;0T/:1 statements in the 'ernel reci*e+

    AC=;lab%-5e0&(67 > ?standard/co00on-pc/base?3AC=,;lab%-5e0&(67 > ?co00on-pc?

    ;FAT ? c*g/s0p.scc?

    2n the reci*e (ra$ment a"ove5 the )c($8sm*.scc) 'ernel (eature5 &hich essentiall%ma*s to the ,C6;29M13P con(i$uration settin$5 is added to the machine)s 'ernelcon(i$uration to turn on 13P ca*a"ilities (or the 41P. ernel (eatures as &ell asthe 4:06,H and 30,H26 settin$s re(erenced a"ove5 &hich essentiall%

    s*eci(% the source "ranch (or the 41P5 are all descri"ed in detail in the Yocto!inux ernel Develo*ment 3anual.

    The meta-la"-EemuxIJ machine con(i$uration is ver% similar to to the meta-la"=-EemuxIJ in !a" =. C*en it in $edit (or revie&+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab%-5e0&(67/con*/0achine/lab%-5e0&(67.con*

    The main di((erence (rom the !a" = machine con(i$uration is that it s*eci(ies notonl% a P:;::DMP:CO2D: (or the virtual8'ernel com*onent5 "ut aP:;::DMO:12C6 as &ell+

    @F2;@OE,2;)irt&al/!ernel B> ?lin&(-yocto?@F2;E,O;lin&(-yocto B> ?8.6Q?

    4ecause the !a" la%er has multi*le 'ernel im*lementations availa"le to it linux-%octoM.5 linux-%octoM.I5 and linux-%octo-dev5 there is in this case someam"i$uit% a"out &hich im*lementation and version to choose. The a"ove lineschoose a )linux-%octo) reci*e as the P:;::DMP:CO2D:5 and ex*licitl% selectthe linux-%octoM.I version via the P:;::DMO:12C6 settin$ the trailin$ )S)serves as a &ildcard5 meanin$ in this case to essentiall% i$nore an% minor versionin the *ac'a$e version &hen doin$ the match.

    2n this case5 the "uild s%stem &ould have chosen the same im*lementation andversion via de(aults linux-%octo "% virtue o( the included Eemu.inc5 and .I sim*l%"ecause it)s the hi$hest version num"er availa"le (or the linux-%octo reci*es Q thisis contained in the lo$ic treatin$ *ac'a$e selection in the "uild s%stem5 "uta$ain5 sometimes it ma'es sense to avoid sur*rises and ex*licitl% )*in do&n)s*eci(ic *roviders and versions.

    Build the Image

    C5 %ou have done this "e(ore+

    $ bitba!e core-i0age-0ini0al

    Hands-on Kernel a! www.yoctoproject.orgPa"e 13 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    14/39

    $ r&n5e0& t0p/deploy/i0ages/b,0age-lab%-5e0&(67.bin t0p/deploy/i0ages/core-i0age-0ini0al-lab%-5e0&(67.e(t8

    The lin&(-yoctore*ositor% meta-data alread% *rovides the driver su**ort neededto "oot in F3/ Q the missin$ con(i$uration settin$s (or P22782,H5 ext5 anddevtm*(s that %ou ex*licitl% added to the con(i$uration in !a" = are alread%included in the "asic con(i$uration inherited via the meta-data in !a" . Thismeta-data is reused across several 4oard 1u**ort Pac'a$es 41Ps5 reducin$ thetedium o( mana$in$ a com*lete 'ernel con(i$ (or ever% 41P. 2n the case o( !a" 5

    it means that %ou don)t have to $o throu$h an u*roductive "oot (ailure andcon(i$uration u*date c%cle as %ou did in !a" =.

    Tip: 2( %ou are *ressed (or time5 %ou can ta'e our &ord that this &ill "oot &ithoutcon(i$uration chan$es and move on to modi(%in$ the 'ernel. 4e sure to runbitba!e core-i0age-0ini0al"e(ore %ou run the r&n5e0&command thou$h5or it &ill (ail to (ind a dis' ima$e (or the la"-EemuxIJ machine.

    *odi&y t%e Kernel

    6o& %ou can a**l% the driver *atch and con(i$ure the 'ernel to use it.

    dit the linux-%octo 'ernel reci*e+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab%-5e0&(67/recipes-!ernel/lin&(/lin&(-yocto;8.6.bbappend

    and uncomment the line includin$ the *atch and the line includin$ the la" con(i$(ra$ment+

    C; ?*ile://yocto-test0od.patch?C; ?*ile://lab%.c*g?

    This accom*lishes the same thin$5 addin$ and ena"lin$ the )%octo-testmod)module5 that %ou accom*lished in !a" =. The di((erence here is that instead o(usin$ 0en&con*igto ena"le the ne& o*tion in the monolithic .con(i$ (ile as in !a" =5here %ou add the *atch in the same &a% "ut ena"le the test module usin$ thestandalone lab%.c*gcon(i$ (ra$ment.

    1ave %our chan$es and close $edit.

    (on&igure t%e Kernel

    You could use 0en&con*igto ena"le the o*tion5 "ut since %ou alread% 'no& &hat itis5 %ou can sim*l% add it to the lab%.c*g(ile.

    C*en the (ile+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab%-5e0&(67/recipes-!ernel/lin&(/*iles/lab%.c*g

    and examine the (ollo&in$ lines5 &hich ena"les the module as a "uilt-in 'ernel

    module+R nable the test0odCOF,;OCTO;TT3O2>y

    ,lose $edit.Tip: You 'no& &hat %ou need to add no&5 "ut i( %ou are not sure exactl% &hich

    con(i$ o*tion %ou need5 %ou can save o(( the ori$inal .con*iga(ter an initiallin&(-yocto"uild5 then run 0en&con*igand ta'e a di**o( the t&o (iles.You can then easil% deduce &hat %our con(i$ (ra$ment should contain.

    Hands-on Kernel a! www.yoctoproject.orgPa"e 14 o# 3$

    http://smb//yocto-testmod.patch/http://www.yoctoproject.org/http://smb//yocto-testmod.patch/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    15/39

    6o& %ou can re"uild and "oot the ne& 'ernel. 4it"a'e &ill detect the reci*e (ilehas chan$ed and start "% (etchin$ the ne& sources and a**l% the *atch+

    $ bitba!e lin&(-yocto -c deploy$ r&n5e0& t0p/deploy/i0ages/b,0age-lab%-5e0&(67.bin t0p/deploy/i0ages/core-i0age-0ini0al-lab%-5e0&(67.e(t8

    !i'e "e(ore5 F3/ &ill o*en a ne& &indo& and "oot to a lo$in *rom*t. You canuse hi*t+@g ?8.6Q?R@F2;E,O;lin&(-yocto B> ?8.Q?

    to+

    R@F2;E,O;lin&(-yocto B> ?8.6Q?@F2;E,O;lin&(-yocto B> ?8.Q?

    4ecause the linux-%octo-. 'ernel has trans*arentl% mer$ed in the . !T12'ernel5 all o( the ca*a"ilities o( the !T12 'ernel are no& availa"le and accessi"levia linux-%octo con(i$ (ra$ments.

    We)ll demonstrate this "% ena"lin$ a con(i$ o*tion normall% availa"le onl% to the!T12 'ernel5 (or the )*ram(s) (ile s%stem5 no& also availa"le in the linux-%octo'ernel "% virtue o( the mer$er o( the !T12 'ernel into linux-%octo-..

    dit the linux-%octo 'ernel reci*e+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab%-5e0&(67/recipes-!ernel/lin&(/lin&(-yocto;8..bbappend

    and uncomment the line includin$ the *ram(s con(i$ (ra$ment+

    C; ?*ile://pra0*s.c*g?

    1ave %our chan$es and close $edit.

    Hands-on Kernel a! www.yoctoproject.orgPa"e 1% o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    16/39

    (on&igure t%e Kernel

    You could use 0en&con*igto ena"le the o*tion5 "ut since %ou alread% 'no& &hat itis5 %ou can sim*l% add it to the pramfs.c*g(ile.

    C*en the (ile+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab%-5e0&(67/recipes-!ernel/lin&(/*iles/pra0*s.c*g

    and examine the (ollo&in$ lines5 &hich ena"les the *ram(s (iles%stem module as a

    "uilt-in 'ernel module+R nable T,Ss pra0*sCOF,;@A3F>yCOF,;@A3F;P,T;@OTCT>y

    ,lose $edit.

    Rebuild the Kernel

    6o& %ou can re"uild and "oot the ne& 'ernel+

    $ bitba!e lin&(-yocto -c deploy$ r&n5e0& t0p/deploy/i0ages/b,0age-lab%-5e0&(67.bin t0p/deploy/i0ages/core-i0age-0ini0al-lab%-5e0&(67.e(t8

    You can veri(% that the !T12 *ram(s module has "een added to the 'ernel "%loo'in$ at the out*ut o( )cat 8*roc8(iles%stems)5 &hich &ill no& sho& an entr% (orthe *ram(s (iles%stem5 &hich &asn)t there "e(ore see the third entr% (rom the"ottom+

    Hands-on Kernel a! www.yoctoproject.orgPa"e 1& o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    17/39

    Lab ) (onclusion

    2n this la" %ou a**lied a *atch and modi(ied the con(i$uration o( the !inux 'ernelusin$ a con(i$ (ra$ment5 &hich is a (eature *rovided "% the lin&(-yocto'erneltoolin$. You also ena"led an !T12 'ernel o*tion usin$ a con(i$ (ra$ment5 &hich is*ossi"le "ecause the . linux-%octo 'ernel has mer$ed the . !T12 code. Thisconcludes !a" .

    E'tra (redit" Iteratie eelopment

    1hould %ou need to modi(% the 'ernel (urther at this *oint5 *erha*s it (ailed tocom*ile or %ou &ant to ex*eriment &ith the ne& driver5 %ou can do that directl%usin$ the sources in the PO2,:

    $ cd 9/po!y-dylan-".#.#/b&ild/t0p/wor!/lab%;5e0&(67-po!y-lin&(/lin&(-yocto/8.6.+gitA

  • 8/9/2019 kernel-lab-1.4

    18/39

    Lab /" (ustom Kernel $ecipe

    2n this la" %ou &ill use use the lin&(-yocto-c&sto0reci*e and toolin$ to ma'e useo( a non-linux-%octo $it-"ased 'ernel o( %our choosin$5 &hile still retainin$ thea"ilit% to reuse %our &or' via con(i$ (ra$ments. You)ll also learn &hat %ou need todo to "uild5 install5 and automaticall% load a loada"le 'ernel module instead o( asa "uilt-in module as %ou did in la".

    Set up t%e Enironment

    $ cd 9/po!y-dylan-".#.#/$ so&rce oe-init-b&ild-en)

    C*en local.con(+

    $ gedit con*/local.con*

    0dd the (ollo&in$ line just a"ove the line that sa%s )30,H26 KKL AEemuxIJB+

    3AC=, B> ?lab8-5e0&(67?

    1ave %our chan$es and close $edit.

    6o& o*en ""la%ers.con(+

    $ gedit con*/bblayers.con*

    and add the )meta-la"-EemuxIJ) la%er to the 44!0Y:1 varia"le. The (inalresult should loo' li'e this5 assumin$ %our account is called )m%acct) sim*l% co*%the line containin$ )meta-%octo-"s*) and re*lace )meta-%octo-"s*) &ith )meta-la"-EemuxIJ)+

    A B> ? D/ho0e/0yacct/po!y-dylan-".#.#/0eta D/ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto D/ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto-bsp D/ho0e/0yacct/po!y-dylan-".#.#/0eta-lab8-5e0&(67 D?

    You should not need to ma'e an% (urther chan$es. 1ave %our chan$es and close$edit.

    $eiew t%e Lab / Layer

    This la%er di((ers (rom meta-la"-EemuxIJ onl% in the !inux 'ernel reci*e. Thisla%er contains the (ollo&in$ (iles (or the 'ernel+

    recipes-!ernel / lin&( / lin&(-yocto-c&sto0 / de*con*ig lab8.c*g yocto-test0od.patch

    lin&(-yocto-c&sto0.bb

    C*en the 'ernel reci*e+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab8-5e0&(67/recipes-!ernel/lin&(/lin&(-yocto-c&sto0.bb

    6ote that this is a com*lete reci*e rather an extension as in la". 2n (act it &asderived (rom the linux-%octo-custom."" reci*e (ound in *o'%-d%lan-G.?.?8meta-

    Hands-on Kernel a! www.yoctoproject.orgPa"e 1 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    19/39

    s'eleton8reci*es-'ernel8linux. 6otice that it uses a de*con*ig(ile and additionall%adds lab8.c*gto the 1:,M/:2. The defconfigis reEuired "ecause this is not alinux-%octo 'ernel as used in la"5 "ut rather an ar"itrar% 'ernel &ra**ed "% thelinux-%octo-custom reci*e.

    0n ar"itrar% 'ernel doesn)t contain all the metadata *resent in the linux-%octo'ernel and there(ore doesn)t have a ma**in$ to an% o( the "ase con(i$urationitems associated &ith the set o( 41P t%*es availa"le in the linux-%octo 'ernel. 2n

    the case o( the linux-%octo 'ernel5 this ma**in$ is res*onsi"le (or assem"lin$the .con(i$ (rom a collection o( (ra$ments5 "ut since a custom 'ernel doesn)t haveaccess to these5 a defconfigthat *rovides the "asic set o( o*tions needed to "ootthe machine is ex*licitl% reEuired.

    Ho&ever5 "ecause this is a linux-%octo-custom 'ernel5 it does have the a"ilit% tos*eci(% and reuse con(i$ (ra$ments5 &hich is the major di((erence "et&een thissetu* and the sim*le tar"all-"ased 'ernel used in la"=5 &hich also used adefconfig.

    The la".c($ (ra$ment is a !inux 'ernel con(i$ (ra$ment. :ather than a com*lete.con*ig(ile5 a con(i$ (ra$ment lists onl% the con(i$ o*tions %ou s*eci(icall% &ant to

    chan$e. To start out5 this (ra$ment is commented out5 and the linux-%octo-customsources &ill use onl% the de*con*igs*eci(ied5 &hich is com*ati"le &ith common P,hard&are.

    Build the Image

    C5 %ou have done this "e(ore+

    $ bitba!e core-i0age-0ini0al$ r&n5e0& t0p/deploy/i0ages/b,0age-lab8-5e0&(67.bin t0p/deploy/i0ages/core-i0age-0ini0al-lab8-5e0&(67.e(t8

    *odi&y t%e Kernel

    6o& %ou can a**l% the driver *atch and con(i$ure the 'ernel to use it.dit the linux-%octo-custom 'ernel reci*e+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab8-5e0&(67/recipes-!ernel/lin&(/lin&(-yocto-c&sto0.bb

    and uncomment the lines includin$ the *atch and the la" con(i$ (ra$ment+

    C; ?*ile://yocto-test0od.patch?C; ?*ile://lab8.c*g?

    1ave %our chan$es and close $edit.

    (on&igure t%e Kernel

    You could use 0en&con*igto ena"le the o*tion5 "ut since %ou alread% 'no& &hat itis5 %ou can sim*l% add it to the lab8.c*g(ile.

    C*en the (ile+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab8-5e0&(67/recipes-!ernel/lin&(/lin&(-yocto-c&sto0/lab8.c*g

    and examine the (ollo&in$ lines5 &hich ena"les the module as a "uilt-in 'ernelmodule+

    Hands-on Kernel a! www.yoctoproject.orgPa"e 1$ o# 3$

    http://smb//yocto-testmod.patch/http://www.yoctoproject.org/http://smb//yocto-testmod.patch/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    20/39

    R nable the test0odCOF,;OCTO;TT3O2>0

    This con(i$ures the %octo-testmod as a module this time instead o( as a "uilt-inmodule as in la". 2n order to actuall% $et the module into the ima$e and loaded5%ou)ll need to add a cou*le additional items to the 'ernel reci*e and machinecon(i$uration5 "ut &e)ll cover that in the (ollo&in$ ste*.

    1ave %our chan$es and close $edit.

    Tip: You 'no& &hat %ou need to add no&5 "ut i( %ou are not sure exactl% &hichcon(i$ o*tion %ou need5 %ou can save o(( the ori$inal .con*iga(ter an initiallin&(-yocto"uild5 then run 0en&con*igand ta'e a di**o( the t&o (iles.You can then easil% deduce &hat %our con(i$ (ra$ment should contain.

    Rebuild the Image

    6o& %ou can re"uild and "oot the ne& ima$e. You)re re"uildin$ the ne& ima$erather than just the 'ernel in this case "ecause the module is no lon$er includedin the 'ernel ima$e "ut rather in the 8li"8modules director% o( the (iles%stemima$e5 &hich reEuires us to "uild a ne& root (iles%stem. 4it"a'e &ill detect thereci*e (ile has chan$ed and start "% (etchin$ the ne& sources and a**l% the*atch+

    $ bitba!e core-i0age-0ini0al$ r&n5e0& t0p/deploy/i0ages/b,0age-lab8-5e0&(67.bin t0p/deploy/i0ages/core-i0age-0ini0al-lab8-5e0&(67.e(t8

    This time5 %ou &on)t loo' (or a messa$e5 "ut rather see &hether %our module &asloaded. To do that5 %ou)ll use )lsmod) to $et a list o( loaded modules. 6ot seein$&hat %ou ex*ect %ou)d ex*ect to see )%octoMtestmod) in the out*ut o( )lsmod)5 "ut&on)t5 %ou should then chec' &hether %our modules &ere installed in the root(iles%stem %e should see a )'ernel8drivers8misc) director% in 8li"8modules8.I.==-%octo-standard5 containin$ %our %octo-testmod.'o 'ernel module "inar%+

    Hands-on Kernel a! www.yoctoproject.orgPa"e 20 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    21/39

    C"viousl%5 %ou)re not seein$ &hat %ou)d ex*ect5 so let)s veri(% &hether %ourmodule &as in (act "uilt. You can do that "% loo'in$ in the de*lo% director% on the"uild s%stem+

    $ ls 9/po!y-dylan-".#.#/b&ild/t0p/deploy/rp0/lab8;5e0&(67/ ' grep yocto-test0od

    You should in (act see an :P3 (ile that &as created (or the hello-testmod module Q

    %ou should see somethin$ similar to the (ollo&in$ out*ut (rom the *reviouscommand+

    !ernel-0od&le-yocto-test0od-8.6.11+git#+c1be4a4b1b844d#e7c*"cc""eb77da*a%ad1-r#.lab8;5e0&(67.rp0

    1o5 %our module &as "uilt5 it just &asn)t added to the ima$e. Cne &a% o( ma'in$that ha**en is to add it to the machine con(i$uration+

    dd the !odule to the Image and "a#e it utoload on Boot

    C*en the machine con(i$uration (ile+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab8-5e0&(67/con*/0achine/lab8-5e0&(67.con*

    and uncomment the (ollo&in$ line at the end o( the (ile+

    3AC=,;T,A;NTA;CO332 +> ?!ernel-0od&le-yocto-test0od?

    This &ill cause the %octo-testmod module to "e included in the minimal ima$e5 "utit &on)t cause the module to "e loaded on "oot. To do that5 %ou)ll uncomment the(ollo&in$ line to the linux-%octo-custom reci*e+

    0oda&toload;yocto-test0od > ?yocto-test0od?

    C*en the linux-%octo-custom."" (ile and uncomment that line+

    Hands-on Kernel a! www.yoctoproject.orgPa"e 21 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    22/39

  • 8/9/2019 kernel-lab-1.4

    23/39

    Lab 0" (ustom Kernel $ecipe 1it% Local $epository

    2n this la" %ou &ill use use the lin&(-yocto-c&sto0reci*e and toolin$ to ma'e useo( a local non-linux-%octo $it-"ased 'ernel o( %our choosin$5 &hile still retainin$the a"ilit% to reuse %our &or' via con(i$ (ra$ments. This ma'es (or an easier&or'(lo& &hen ma'in$ chan$es to the 'ernel code5 &hich this la" &ill alsodemonstrate. This la" &ill also demonstrate ho& to create and use a reci*e used

    to "uild and install an external 'ernel module.

    Set up t%e Enironment

    $ cd 9/po!y-dylan-".#.#/$ so&rce oe-init-b&ild-en)

    C*en local.con(+

    $ gedit con*/local.con*

    0dd the (ollo&in$ line just a"ove the line that sa%s )30,H26 KKL AEemuxIJB+

    3AC=, B> ?lab-5e0&(67?

    1ave %our chan$es and close $edit.

    6o& o*en ""la%ers.con(+

    $ gedit con*/bblayers.con*

    and add the )meta-la"-EemuxIJ) la%er to the 44!0Y:1 varia"le. The (inalresult should loo' li'e this5 assumin$ %our account is called )m%acct) sim*l% co*%the line containin$ )meta-%octo-"s*) and re*lace )meta-%octo-"s*) &ith )meta-la"-EemuxIJ)+

    A B> ? D/ho0e/0yacct/po!y-dylan-".#.#/0eta D/ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto D/ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto-bsp D/ho0e/0yacct/po!y-dylan-".#.#/0eta-lab-5e0&(67 D?

    You should not need to ma'e an% (urther chan$es. 1ave %our chan$es and close$edit.

    $eiew t%e Lab 0 Layer

    This la%er di((ers (rom meta-la"-EemuxIJ in that instead o( %octo-testmod *atchin the !inux 'ernel reci*e itsel(5 %ou)ll add an external 'ernel module called hello-mod. 2t also contains a chan$e to the 1:,M/:2 in the linux-%octo-custom."" that*oints it to a local 'ernel re*o5 &hich %ou)ll need to modi(%5 and a 4:06,Hvaria"le that &ill *oint to a )&or'in$ "ranch) in the local re*o5 &hich &e)ll

    descri"e in more detail later. This la%er contains the (ollo&in$ (iles (or the 'ernel+recipes-!ernel / hello-0od / *iles / CO@, hello.c 3a!e*ile hello-0od;#.1.bb

    Hands-on Kernel a! www.yoctoproject.orgPa"e 23 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    24/39

    lin&( / lin&(-yocto-c&sto0 / de*con*ig

    lin&(-yocto-c&sto0.bb

    C*en the 'ernel reci*e+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab-5e0&(67/recipes-!ernel/lin&(/lin&(-yocto-c&sto0.bb

    6ote that as in la"5 this is a com*lete reci*e rather an extension as in la". 2n

    (act it &as derived (rom the linux-%octo-custom."" reci*e (ound in *o'%-d%lan-G.?.?8meta-s'eleton8reci*es-'ernel8linux. 6otice that it uses a de*con*ig(ile "utdoesn)t add an% additional .c*g(ile to the 1:,M/:2 as in la".

    4ecause %ou)re addin$ an external module5 %ou don)t have a con(i$ o*tion in the'ernel to de(ine Q the module &ill "e included in the ima$e "% virtue o( the 41Pcon(i$uration directives &e)ll descri"e in a later ste* rather than via chan$es tothe 'ernel con(i$uration itsel(.

    The defconfigis reEuired "ecause this is not a linux-%octo 'ernel as used in la"5"ut rather an ar"itrar% 'ernel &ra**ed "% the linux-%octo-custom reci*e. 0nar"itrar% 'ernel doesn)t contain all the metadata *resent in the linux-%octo 'ernel

    and there(ore doesn)t have a ma**in$ to an% o( the "ase con(i$uration itemsassociated &ith the set o( 41P t%*es availa"le in the linux-%octo 'ernel. 2n thecase o( the linux-%octo 'ernel5 this ma**in$ is res*onsi"le (or assem"lin$ the.con(i$ (rom a collection o( (ra$ments5 "ut since a custom 'ernel doesn)t haveaccess to these5 a defconfigthat *rovides the "asic set o( o*tions needed to "ootthe machine is ex*licitl% reEuired.

    Ho&ever5 "ecause this is a linux-%octo-custom 'ernel5 it does have the a"ilit% tos*eci(% and reuse con(i$ (ra$ments5 &hich is the major di((erence "et&een thissetu* and the sim*le tar"all-"ased 'ernel used in la"=. To start out5 the linux-%octo-custom sources &ill use the de*con*igs*eci(ied5 &hich is com*ati"le &ith

    common P, hard&are.3ovin$ on to the external module5 o*en the hello-mod reci*e and examine it+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab-5e0&(67/recipes-!ernel/hello-0od/hello-0od;#.1.bb

    The reci*e itsel( is ver% sim*le Q it names the (iles that ma'e u* the module in the1:,M/:2 and inherits the module ""class5 &hich ena"les the "uild s%stem to"uild the code listed as a 'ernel module. The hello-mod8(iles director% containsthe hello.c 'ernel source (ile and a module 3a'e(ile5 &hich %ou can also examine.

    4ecause in this la" %ou)re "uildin$ the 'ernel (rom a local re*ositor%5 %ou (irstneed to create a local clone o( the 'ernel %ou &ant to use. To do this5 cd into the

    *o'%-d%lan-G.?.? director% and create a local clone o( the linux-sta"le 'ernel+$ cd 9/po!y-dylan-".#.#$ git clone git://git.!ernel.org/p&b/sc0/lin&(/!ernel/git/stable/lin&(-stable.git lin&(-stable-wor!.git

    You should see somethin$ li'e the (ollo&in$ as out*ut+Cloning into Slin&(-stable-wor!.gitS...re0ote: Co&nting objects: 8#11%#H done.re0ote: Co0pressing objects: 1##Q L7"617/7"617MH done.

    Hands-on Kernel a! www.yoctoproject.orgPa"e 24 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    25/39

    re0ote: Total 8#11%# Ldelta %4847%"MH re&sed 8###1 Ldelta %41"#67Mecei)ing objects: 1##Q L8#11%#/8#11%#MH 7%4.%8 3i ' 71# i/sH done.esol)ing deltas: 1##Q L%4847%"/%4847%"MH done.Chec!ing o&t *iles: 1##Q L14%#/14%#MH done.

    6ote+ ,lonin$ the 'ernel can ta'e a lon$ time. You can s*eed u* the clone i( %oualread% have a local clone that %ou can "ase the ne& one o(( o( Q see )$it-clone Qre(erence) (or details.

    6o& cd into the cloned 'ernel and chec' out a "ranch named )&or'-"ranch)+

    $ cd 9/po!y-dylan-".#.#/lin&(-stable-wor!.git$ git chec!o&t -b wor!-branch re0otes/origin/lin&(-8.6.y

    You should see somethin$ li'e the (ollo&in$ as out*ut+ranch wor!-branch set &p to trac! re0ote branch lin&(-8.6.y *ro0 origin.witched to a new branch Swor!-branchS

    dit the linux-%octo-custom 'ernel reci*e+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab-5e0&(67/recipes-!ernel/lin&(/lin&(-yocto-c&sto0.bb

    and chan$e the 1:,M/:2 to *oint to the local clone %ou just created. 2( %ou)vedone it as instructed5 %ou should onl% need to chan$e home8m%acct to %our home

    director%+C; ?git:///ho0e/0yacct/po!y-dylan-".#.#/lin&(-stable-wor!.gitVprotocol>*ileVbareclone>1?

    1ave %our chan$es and close $edit.

    6ote also the 4:06,H line in the same (ile+AC= > ?wor!-branch?

    The 4:06,H varia"le names the "ranch that &ill "e used to "uild the 'ernel. 2(%ou)ve chec'ed out and &ant to &or' &ith a di((erent "ranch5 %ou should chan$ethe 4:06,H varia"le to that "ranch.

    Build the Image

    C5 %ou have done this "e(ore don)t (or$et to cd "ac' into the "uild director%+$ cd 9/po!y-dylan-".#.#/b&ild$ bitba!e core-i0age-0ini0al$ r&n5e0& t0p/deploy/i0ages/b,0age-lab-5e0&(67.bin t0p/deploy/i0ages/core-i0age-0ini0al-lab-5e0&(67.e(t8

    2dd t%e E'ternal Kernel *odule

    6o& that %ou have a &or'in$ 'ernel5 %ou can add the hello-mod external moduleto the ima$e. :ecall that %ou don)t need to chan$e the 'ernel con(i$uration toadd the module "ecause it &on)t "e made *art o( the 'ernel source via a 1:,M/:2addition as in the *revious la"5 "ut &ill "e "uilt as an )external) module.

    To do that5 (irst o*en the machine con(i$uration (ile+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab-5e0&(67/con*/0achine/lab-5e0&(67.con*

    and uncomment the (ollo&in$ line at the end o( the (ile+

    3AC=,;T,A;NTA;CO332 +> ?hello-0od?

    6ote that in the 30,H26M116T20!M7T:0M::,C336D1 line5 %ou usedthe name o( the hello-mod *ac'a$e directl% instead o( *re*endin$ it &ith )'ernel-

    Hands-on Kernel a! www.yoctoproject.orgPa"e 2% o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    26/39

  • 8/9/2019 kernel-lab-1.4

    27/39

    To demonstrate that5 %ou)ll ma'e a sim*le modi(ication to the 'ernel code and seethe results in the "ooted s%stem.

    ,han$e directories into the local 'ernel re*ositor% and o*en the (s8(iles%stems.csource (ile+

    $ cd 9/po!y-dylan-".#.#/lin&(-stable-wor!.git$ gedit *s/*ilesyste0s.c

    1croll do&n to the (iles%stemsM*rocMsho&... (unction %ou can use the 1earch

    ;ind... o*tion in 9edit to more Euic'l% locate it+static int *ilesyste0s;proc;showLstr&ct se5;*ile J0H )oid J)MW

    str&ct *ile;syste0;type J t0pV

    read;loc!LX*ile;syste0s;loc!MVt0p > *ile;syste0sVwhile Lt0pM W

    se5;print*L0H ?QsDtQsDn?HLt0p-G*s;*lags X F;Y t0p-Gne(tVZ

    read;&nloc!LX*ile;syste0s;loc!MVret&rn #V

    Z

    0dd a sim*le *rint' to that (unction5 so that &hen %ou )cat 8*roc8(iles%stems) inthe "ooted ima$e %ou)ll see a messa$e in the 'ernel lo$s.

    print!L?il*oy was here[Dn?MV

    0(ter addin$ the *rint'5 (iles%stemsM*rocMsho&... should loo' li'e this+

    static int *ilesyste0s;proc;showLstr&ct se5;*ile J0H )oid J)MW

    str&ct *ile;syste0;type J t0pV

    read;loc!LX*ile;syste0s;loc!MVt0p > *ile;syste0sVwhile Lt0pM W

    se5;print*L0H ?QsDtQsDn?HLt0p-G*s;*lags X F;Y t0p-Gne(tVZread;&nloc!LX*ile;syste0s;loc!MV

    print!L?il*oy was here[Dn?MV

    ret&rn #V

    Z

    Oeri(% that the code &as chan$ed usin$ )$it di(()+

    $ git di** -p =A2

    You should see somethin$ li'e the (ollo&in$ as out*ut+di** --git a/*s/*ilesyste0s.c b/*s/*ilesyste0s.cinde( "7*%%6.."1%c88 1##7--- a/*s/*ilesyste0s.c

    Hands-on Kernel a! www.yoctoproject.orgPa"e 2' o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    28/39

  • 8/9/2019 kernel-lab-1.4

    29/39

    *rint' lines increases in the 'ernel lo$+

    ,sing a local linu'-yocto-based +ernel

    ;or this la"5 %ou used the linux-%octo-custom reci*e &ith a local re*ositor%5 "ut itshould "e noted that %ou can do the same thin$ &ith the standard linux-%octo'ernel5 &hich is actuall% the more common use-case.

    To do that %ou essentiall% re*eat the *revious set o( ste*s "ut &ith the linux-%octo'ernel instead. The main di((erence is that %ou need a sli$htl% di((erent 1:,M/:25&hich needs to trac' t&o "ranches instead o( one Q the )machine) and the )meta)"ranches. The (ollo&in$ ste*s can "e used to use a local version o( the linux-%octo 'ernel.

    4ecause in this la" %ou)re "uildin$ the 'ernel (rom a local re*ositor%5 %ou (irstneed to create a local clone o( the 'ernel %ou &ant to use. To do this5 cd into the*o'%-d%lan-G.?.? director% and create a local clone o( the linux-%octo-.I 'ernel+

    $ cd 9/po!y-dylan-".#.#$ git clone git://git.yoctoproject.org/lin&(-yocto-8.6 lin&(-yocto-8.6.git

    You should see somethin$ li'e the (ollo&in$ as out*ut+Cloning into Slin&(-yocto-8.6.gitS...re0ote: Co&nting objects: %6417#H done.re0ote: Co0pressing objects: 1##Q L47%7/47%7MH done.re0ote: Total %6417# Ldelta %86"671MH re&sed %6%"487 Ldelta %876#8Mecei)ing objects: 1##Q L%6417#/%6417#MH 7#. 3i ' % i/sH done.esol)ing deltas: 1##Q L%86"671/%86"671MH done.Chec!ing o&t *iles: 1##Q L14%1/14%1MH done.

    6ote+ ,lonin$ the 'ernel can ta'e a lon$ time. You can s*eed u* the clone i( %ou

    Hands-on Kernel a! www.yoctoproject.orgPa"e 2$ o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    30/39

    alread% have a local clone that %ou can "ase the ne& one o(( o( Q see )$it-clone Qre(erence) (or details.

    6o& cd into the cloned 'ernel and create a &or'in$ "ranch named)standard8common-*c8"ase)+

    $ cd 9/po!y-dylan-".#.#/lin&(-yocto-8.6.git$ git chec!o&t -b standard/co00on-pc/base re0otes/origin/standard/co00on-pc/base

    You should see somethin$ li'e the (ollo&in$ as out*ut+ranch standard/co00on-pc/base set &p to trac! re0ote branch standard/co00on-pc/base *ro0 origin.witched to a new branch Sstandard/co00on-pc/baseS

    &'itch to the lab2 la(er

    ;or this5 %ou)ll "e reusin$ la"5 &hich uses the linux-%octo 'ernel alread%+

    C*en local.con( don)t (or$et to cd "ac' into the "uild director%+

    $ cd 9/po!y-dylan-".#.#/b&ild$ gedit con*/local.con*

    0dd the (ollo&in$ line just a"ove the line that sa%s )30,H26 KKL AEemuxIJB+

    3AC=, B> ?lab%-5e0&(67?1ave %our chan$es and close $edit.

    6o& o*en ""la%ers.con(+

    $ gedit con*/bblayers.con*

    and add the )meta-la"-EemuxIJ) la%er to the 44!0Y:1 varia"le. The (inalresult should loo' li'e this5 assumin$ %our account is called )m%acct) sim*l% co*%the line containin$ )meta-%octo-"s*) and re*lace )meta-%octo-"s*) &ith )meta-la"-EemuxIJ)+

    A B> ? D/ho0e/0yacct/po!y-dylan-".#.#/0eta D

    /ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto D/ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto-bsp D/ho0e/0yacct/po!y-dylan-".#.#/0eta-lab%-5e0&(67 D?

    You should not need to ma'e an% (urther chan$es. 1ave %our chan$es and close$edit.

    !odif( the lab2 )ernel to use the local linu*+(octo repo

    dit the linux-%octo 'ernel reci*e+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab%-5e0&(67/recipes-!ernel/lin&(/lin&(-yocto;8.6.bbappend

    You)ll need to add a ne& 1:,M/:2 to *oint to the local clone %ou just created5 "utto do that5 %ou need to start &ith a 1:,M/:2 that ma'es sense (or the linux-%octo-.I 'ernel. 2n $edit5 use );ile C*en) to navi$ate to and o*en the "ase linux-%octo-.I reci*e+ U8*o'%-d%lan-G.?.?8meta8reci*es-'ernel8linux8linux-%octoM.I."".,o*% the (ollo&in$ 1:,M/:2 line (rom the linux-%octoM.I "" (ile to the linux-%octoM.I.""a**end in the la"-EemuxIJ la%er+

    Hands-on Kernel a! www.yoctoproject.orgPa"e 30 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    31/39

    C; ?git://git.yoctoproject.org/lin&(-yocto-8.6.gitVprotocol>gitVnochec!o&t>1Vbranch>$WAC=ZH0etaVna0e>0achineH0eta?

    :e*lace the )$it.%octo*roject.or$8linux-%octo-.I.$it) 'ernel &ith the *ath to thelocal linux-%octo-.I 'ernel that %ou just cloned "e care(ul to use the (ull *ath tothe local re*o in the 1:,M/:2 i.e. the tri*le (or&ard slash in the 1:,M/:2 is not amista'e. 0lso5 chan$e the )*rotocol) to )(ile) and re*lace )nochec'outL=) &ith)"arecloneL=). The (inal 1:,M/:2 should loo' somethin$ li'e this+

    C; ?git:///ho0e/tr/po!y-dylan-".#.#/lin&(-yocto-

    8.6.gitVprotocol>*ileVbareclone>1Vbranch>$WAC=ZH0etaVna0e>0achineH0eta?0lso5 comment out the current 1:,:O lines and uncomment the (ollo&in$1:,:O lines+

    CE;0achine;pn-lin&(-yocto;lab%-5e0&(67 B> ?$WA ?$WA

  • 8/9/2019 kernel-lab-1.4

    32/39

    Cloning into bare repository Slin&(-yocto-8.6-bare.gitS...re0ote: Co&nting objects: %6417#H done.re0ote: Co0pressing objects: 1##Q L47%7/47%7MH done.re0ote: Total %6417# Ldelta %86"644MH re&sed %6%"4% Ldelta %876#8Mecei)ing objects: 1##Q L%6417#/%6417#MH 7#.6 3i ' 477 i/sH done.esol)ing deltas: 1##Q L%86"644/%86"644MH done.

    6o& create a local &or'in$ clone o( the local "are clone+$ git clone lin&(-yocto-8.6-bare.git lin&(-yocto-8.6-wor!

    You should see somethin$ li'e the (ollo&in$ as out*ut+Cloning into Slin&(-yocto-8.6-wor!S...done.Chec!ing o&t *iles: 1##Q L14%1/14%1MH done.

    6o& cd into the &or'in$ clone and create a &or'in$ "ranch named)standard8common-*c8"ase)+

    $ cd lin&(-yocto-8.6-wor!/$ git chec!o&t -b standard/co00on-pc/base re0otes/origin/standard/co00on-pc/base

    You should see somethin$ li'e the (ollo&in$ as out*ut+ranch standard/co00on-pc/base set &p to trac! re0ote branch standard/co00on-pc/base *ro0 origin.

    witched to a new branch Sstandard/co00on-pc/baseS

    dit the linux-%octo 'ernel reci*e and chan$e the 1:,M/:2 to *oint to the "areclone+

    $ gedit 9/po!y-dylan-".#.#/0eta-lab%-5e0&(67/recipes-!ernel/lin&(/lin&(-yocto;8.6.bbappend

    The (inal 1:,M/:2 should loo' somethin$ li'e this+C; ?git:///ho0e/tr/po!y-dylan-".#.#/lin&(-yocto-8.6-bare.gitVprotocol>*ileVbareclone>1Vbranch>$WAC=ZH0etaVna0e>0achineH0eta?

    6o& re"uild the 'ernel+

    $ cd 9/po!y-dylan-".#.#/b&ild$ bitba!e -c deploy )irt&al/!ernel$ r&n5e0& t0p/deploy/i0ages/b,0age-lab%-5e0&(67.bin t0p/deploy/i0ages/core-i0age-0ini0al-lab%-5e0&(67.e(t8

    0t this *oint5 %ou have the same setu* &ith the linux-%octo-"ased 'ernel as %oudid &ith the linux-%octo-custom-"ased 'ernel5 so %ou should "e a"le to (ollo& thesame seEuence o( ste*s outlined in the *revious section titled )!odif( the local)ernel,to modi(% the 'ernel. The di((erence in this case is that %ou)ll "emodi(%in$ the code in the linux-%octo-.I-&or' clone o( the "are clone5 and once%ou)ve committed %our chan$e in the &or' clone+

    $ cd 9/po!y-dylan-".#.#/lin&(-yocto-8.6-wor!$ gedit *s/*ilesyste0s.c$ git co00it -a -0 ?*s/*ilesyste0s.c: =eyH this is the co00it , p&shed *ro0 awor!ing clone into this bare clone[ eatH ehB?

    %ou need to *ush it to the "are clone+

    $ git p&sh origin standard/co00on-pc/base:standard/co00on-pc/base

    You should see somethin$ li'e the (ollo&in$ as out*ut+Co&nting objects: H done.2elta co0pression &sing &p to 6 threads.Co0pressing objects: 1##Q L/MH done.

    Hands-on Kernel a! www.yoctoproject.orgPa"e 32 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    33/39

    Priting objects: 1##Q L/MH 1% bytesH done.Total Ldelta 8MH re&sed # Ldelta #M

  • 8/9/2019 kernel-lab-1.4

    34/39

    Lab 3" #%e Yocto BSP #ool

    /* until no&5 %ou have modi(ied existin$ la%ers "% manuall% editin$ individual(iles and directl% mani*ulatin$ the con(i$uration o( the 'ernel. This is a s'ill %ouneed to have in order to understand and &or' &ith existin$ 41Ps. Ho&ever5 thereis an easier &a% to create an initial la%er &ith the customizations %ou &ant.

    The Yocto 41P Tool consists o( a small set o( scri*ts &hich $enerate a

    standardized Yocto 41P la%er5 includin$ machine con(i$uration5 su**ortin$reci*es5 and A23(iles. 2t also allo&s the user to add and remove *atches and'ernel con(i$ (ra$ments to a linux-%octo 'ernel &ithout havin$ to edit or learn thesordid details o( the linux-%octo meta-data.

    (reate t%e Lab 3 Layer

    You &ill use the yocto-bspcommand to create a ne& la%er (or a machine calledla"V-Eemuarm. ,reate the la%er alon$side the other la" la%ers in 9/po!y-dylan-".#.#+

    $ cd 9/po!y-dylan-".#.#/

    $ so&rce oe-init-b&ild-en)$ cd 9/po!y-dylan-".#.#/$ yocto-bsp create lab4-5e0&ar0 5e0&

    1elect the (ollo&in$ ans&ers (or the Eueries *resented &hen *rom*ted "%enterin$ the $iven num"ers or Ly/nMvalues as a**ro*riate5 (ollo&ed "% the nter'e% i( %ou don)t ex*licitl% select an%thin$ "% just *ressin$ nter5 the de(ault valuelisted &ill "e chosen (or %ou. Cnl% the non-de(ault values are hi$hli$hted red+

    Phich 5e0& architect&re wo&ld yo& li!e to &seB Ide*a&lt: i867K1M i867 L8%-bitM%M (67;7 L7-bitM8M A3 L8%-bitMM @ower@C L8%-bitM

    4M 3,@ L8%-bitM8Po&ld yo& li!e to &se the de*a&lt L8.6M !ernelB Ly/nM Ide*a&lt: yK2o yo& need a new 0achine branch *or this @ Lthe alternati)e is to re-&sean e(isting branchMB Iy/nK Ide*a&lt: yKetting branches *ro0 re0ote repo git://git.yoctoproject.org/lin&(-yocto-8.6.git...@lease choose a 0achine branch to base yo&r new @ branch on: Ide*a&lt:standard/baseK

    1M standard/ar0-)ersatile-"%7ejs%M standard/base8M standard/beagleboard.

    .1Po&ld yo& li!e 3@ s&pportB Ly/nM Ide*a&lt: yK2oes yo&r @ ha)e a to&chscreenB Ly/nM Ide*a&lt: nK2oes yo&r @ ha)e a !eyboardB Ly/nM Ide*a&lt: yK

    Cn success5 the tool &ill re*ort+

    ew 5e0& @ created in 0eta-lab4-5e0&ar0

    Hands-on Kernel a! www.yoctoproject.orgPa"e 34 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    35/39

    Set up t%e Enironment

    ,han$e directories "ac' into the "uild director%+

    $ cd b&ild

    C*en local.con(+

    $ gedit con*/local.con*

    0dd the (ollo&in$ line just a"ove the line that sa%s )30,H26 KKL AEemuxIJB+

    3AC=, B> ?lab4-5e0&ar0?1ave %our chan$es and close $edit.

    6o& o*en ""la%ers.con(+

    $ gedit con*/bblayers.con*

    and add the )meta-la"V-Eemuarm) la%er to the 44!0Y:1 varia"le. The (inalresult should loo' li'e this5 assumin$ %our account is called )m%acct) sim*l% co*%the line containin$ )meta-%octo-"s*) and re*lace )meta-%octo-"s*) &ith )meta-la"V-EemuxIJ)+

    A B> ? D/ho0e/0yacct/po!y-dylan-".#.#/0eta D

    /ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto D/ho0e/0yacct/po!y-dylan-".#.#/0eta-yocto-bsp D/ho0e/0yacct/po!y-dylan-".#.#/0eta-lab4-5e0&ar0 D?

    You should not need to ma'e an% (urther chan$es. 1ave %our chan$es and close$edit.

    Build the Image

    C5 %ou have done this "e(ore don)t (or$et to cd "ac' into the "uild director%+

    $ cd 9/po!y-dylan-".#.#/b&ild$ bitba!e core-i0age-0ini0al$ r&n5e0& t0p/deploy/i0ages/,0age-lab4-5e0&ar0.bin t0p/deploy/i0ages/core-

    i0age-0ini0al-lab4-5e0&ar0.e(t8

    Hands-on Kernel a! www.yoctoproject.orgPa"e 3% o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    36/39

    *odi&y t%e Kernel $ecipe

    :ather than manuall% editin$ the reci*e (iles as in *revious la"s5 %ou are $oin$ touse the Yocto 41P Tool to add the driver *atch and u*date the con(i$uration.

    :emem"er that the "ase lin&(-yoctoreci*e ta'es care o( the standard hard&arereEuirements (or the Eemu machine5 "ut %ou &ill still need to tell it a"out theo*tions to ena"le the test driver. ;or the 'ernel *atch5 %ou)ll just re-use the %octo-

    testmod.*atch (rom la"+0dd the *atch usin$ the )%octo-'ernel *atch add) command+

    $ yocto-!ernel patch add lab4-5e0&ar0 9/po!y-dylan-".#.#/0eta-lab%-5e0&(67/recipes-!ernel/lin&(/*iles/yocto-test0od.patch

    You should see the (ollo&in$ out*ut (rom the command+

    Added patches:yocto-test0od.patch

    You can veri(% that the *atch is included in the la"V-Eemuarm 'ernel "% usin$ the)%octo-'ernel *atch list) command +

    $ yocto-!ernel patch list lab4-5e0&ar0

    The c&rrent set o* 0achine-speci*ic patches *or lab4-5e0&ar0 is:1M yocto-test0od.patch

    1imilarl%5 %ou can add con(i$ o*tions usin$ the )%octo-'ernel con(i$ add)command+

    $ yocto-!ernel con*ig add lab4-5e0&ar0 COF,;OCTO;TT3O2>y

    You should see the (ollo&in$ out*ut (rom the command+

    Added ite0s:COF,;OCTO;TT3O2>y

    You can veri(% that the con(i$ item &as added to the la"V-Eemuarm 'ernelcon(i$uration "% usin$ the )%octo-'ernel con(i$ list) command +

    $ yocto-!ernel con*ig list lab4-5e0&ar0The c&rrent set o* 0achine-speci*ic !ernel con*ig ite0s *or lab4-5e0&ar0 is:

    1M COF,;OCTO;TT3O2>y

    $eiew t%e Layer

    The meta-la"V-Eemuarm la%er contains the (ollo&in$ set o( (iles (or the 'ernel+

    0eta-lab4-5e0&ar0/recipes-!ernel/lin&( /

    *iles / lab4-5e0&ar0.c*g lab4-5e0&ar0-pree0pt-rt.scc lab4-5e0&ar0-tiny.scc lab4-5e0&ar0.scc lab4-5e0&ar0-standard.scc

    lab4-5e0&ar0-&ser-con*ig.c*g lab4-5e0&ar0-&ser-patches.scc lab4-5e0&ar0-&ser-*eat&res.scc yocto-test0od.patch

    lin&(-yocto;8.6.bbappendlin&(-yocto;8.6.bbappend.pre)

    Hands-on Kernel a! www.yoctoproject.orgPa"e 3& o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    37/39

    0t the to* level o( the lin&(/director%5 %ou can see the .bbappend(ile5 &hich is anextension o( the lin&(-yocto-8.6!inux 'ernel reci*e.

    The lin&(-yocto;8.6.bbappendis similar to la")s !inux 'ernel reci*e extension. 2(%ou o*en it u* and loo' at it5 %ou &ill see that the (iles in the *ilessu"director%are re(erenced in the C;

  • 8/9/2019 kernel-lab-1.4

    38/39

    4#ES

    Hands-on Kernel a! www.yoctoproject.orgPa"e 3 o# 3$

    http://www.yoctoproject.org/http://www.yoctoproject.org/
  • 8/9/2019 kernel-lab-1.4

    39/39

    4#ES