bsp.xml 101 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120
  1. <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  2. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
  3. [<!ENTITY % poky SYSTEM "../poky.ent"> %poky; ] >
  4. <chapter id='bsp'>
  5. <title>Board Support Packages (BSP) - Developer's Guide</title>
  6. <para>
  7. A Board Support Package (BSP) is a collection of information that
  8. defines how to support a particular hardware device, set of devices, or
  9. hardware platform.
  10. The BSP includes information about the hardware features
  11. present on the device and kernel configuration information along with any
  12. additional hardware drivers required.
  13. The BSP also lists any additional software
  14. components required in addition to a generic Linux software stack for both
  15. essential and optional platform features.
  16. </para>
  17. <para>
  18. This guide presents information about BSP Layers, defines a structure for components
  19. so that BSPs follow a commonly understood layout, discusses how to customize
  20. a recipe for a BSP, addresses BSP licensing, and provides information that
  21. shows you how to create a
  22. <link linkend='bsp-layers'>BSP Layer</link> using the
  23. <link linkend='creating-a-new-bsp-layer-using-the-bitbake-layers-script'><filename>bitbake-layers</filename></link>
  24. tool.
  25. </para>
  26. <section id='bsp-layers'>
  27. <title>BSP Layers</title>
  28. <para>
  29. A BSP consists of a file structure inside a base directory.
  30. Collectively, you can think of the base directory, its file structure,
  31. and the contents as a BSP Layer.
  32. Although not a strict requirement, BSP layers in the Yocto Project
  33. use the following well-established naming convention:
  34. <literallayout class='monospaced'>
  35. meta-<replaceable>bsp_root_name</replaceable>
  36. </literallayout>
  37. The string "meta-" is prepended to the machine or platform name, which is
  38. <replaceable>bsp_root_name</replaceable> in the above form.
  39. <note><title>Tip</title>
  40. Because the BSP layer naming convention is well-established,
  41. it is advisable to follow it when creating layers.
  42. Technically speaking, a BSP layer name does not need to
  43. start with <filename>meta-</filename>.
  44. However, various scripts and tools in the Yocto Project
  45. development environment assume this convention.
  46. </note>
  47. </para>
  48. <para>
  49. To help understand the BSP layer concept, consider the BSPs that the
  50. Yocto Project supports and provides with each release.
  51. You can see the layers in the
  52. <ulink url='&YOCTO_DOCS_OM_URL;#yocto-project-repositories'>Yocto Project Source Repositories</ulink>
  53. through a web interface at
  54. <ulink url='&YOCTO_GIT_URL;'></ulink>.
  55. If you go to that interface, you will find a list of repositories
  56. under "Yocto Metadata Layers".
  57. <note>
  58. Layers that are no longer actively supported as part of the
  59. Yocto Project appear under the heading "Yocto Metadata Layer
  60. Archive."
  61. </note>
  62. Each repository is a BSP layer supported by the Yocto Project
  63. (e.g. <filename>meta-raspberrypi</filename> and
  64. <filename>meta-intel</filename>).
  65. Each of these layers is a repository unto itself and clicking on a
  66. layer reveals information that includes two links from which you can choose
  67. to set up a clone of the layer's repository on your local host system.
  68. Here is an example that clones the Raspberry Pi BSP layer:
  69. <literallayout class='monospaced'>
  70. $ git clone git://git.yoctoproject.org/meta-raspberrypi
  71. </literallayout>
  72. </para>
  73. <para>
  74. In addition to BSP layers, the
  75. <filename>meta-yocto-bsp</filename> layer is part of the
  76. shipped <filename>poky</filename> repository.
  77. The <filename>meta-yocto-bsp</filename> layer maintains several
  78. BSPs such as the Beaglebone, EdgeRouter, and generic versions of
  79. both 32-bit and 64-bit IA machines.
  80. </para>
  81. <para>
  82. For information on the BSP development workflow, see the
  83. "<link linkend='developing-a-board-support-package-bsp'>Developing a Board Support Package (BSP)</link>"
  84. section.
  85. For more information on how to set up a local copy of source files
  86. from a Git repository, see the
  87. "<ulink url='&YOCTO_DOCS_DEV_URL;#locating-yocto-project-source-files'>Locating Yocto Project Source Files</ulink>"
  88. section in the Yocto Project Development Tasks Manual.
  89. </para>
  90. <para>
  91. The layer's base directory
  92. (<filename>meta-<replaceable>bsp_root_name</replaceable></filename>)
  93. is the root directory of the BSP Layer.
  94. This directory is what you add to the
  95. <ulink url='&YOCTO_DOCS_REF_URL;#var-BBLAYERS'><filename>BBLAYERS</filename></ulink>
  96. variable in the <filename>conf/bblayers.conf</filename> file found in the
  97. <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>,
  98. which is established after you run the OpenEmbedded build environment
  99. setup script (i.e.
  100. <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink>).
  101. Adding the root directory allows the
  102. <ulink url='&YOCTO_DOCS_REF_URL;#build-system-term'>OpenEmbedded build system</ulink>
  103. to recognize the BSP layer and from it build an image.
  104. Here is an example:
  105. <literallayout class='monospaced'>
  106. BBLAYERS ?= " \
  107. /usr/local/src/yocto/meta \
  108. /usr/local/src/yocto/meta-poky \
  109. /usr/local/src/yocto/meta-yocto-bsp \
  110. /usr/local/src/yocto/meta-mylayer \
  111. "
  112. </literallayout>
  113. <note><title>Tip</title>
  114. Ordering and
  115. <ulink url='&YOCTO_DOCS_REF_URL;#var-BBFILE_PRIORITY'><filename>BBFILE_PRIORITY</filename></ulink>
  116. for the layers listed in <filename>BBLAYERS</filename>
  117. matter.
  118. For example, if multiple layers define a machine
  119. configuration, the OpenEmbedded build system uses
  120. the last layer searched given similar layer
  121. priorities.
  122. The build system works from the top-down through
  123. the layers listed in <filename>BBLAYERS</filename>.
  124. </note>
  125. </para>
  126. <para>
  127. Some BSPs require or depend on additional layers
  128. beyond the BSP's root layer in order to be functional.
  129. In this case, you need to specify these layers in the
  130. <filename>README</filename> "Dependencies" section of the
  131. BSP's root layer.
  132. Additionally, if any build instructions exist for the
  133. BSP, you must add them to the "Dependencies" section.
  134. </para>
  135. <para>
  136. Some layers function as a layer to hold other BSP layers.
  137. These layers are knows as
  138. "<ulink url='&YOCTO_DOCS_REF_URL;#term-container-layer'>container layers</ulink>".
  139. An example of this type of layer is the
  140. <filename>meta-intel</filename> layer.
  141. This layer contains BSP layers for the Intel-core2-32
  142. <trademark class='registered'>Intel</trademark> Common Core
  143. (Intel-core2-32) and the Intel-corei7-64
  144. <trademark class='registered'>Intel</trademark> Common Core
  145. (Intel-corei7-64).
  146. the <filename>meta-intel</filename> layer also contains
  147. the <filename>common/</filename> directory, which contains
  148. common content across those layers.
  149. </para>
  150. <para>
  151. For more information on layers, see the
  152. "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers</ulink>"
  153. section of the Yocto Project Development Tasks Manual.
  154. </para>
  155. </section>
  156. <section id='preparing-your-build-host-to-work-with-bsp-layers'>
  157. <title>Preparing Your Build Host to Work With BSP Layers</title>
  158. <para>
  159. This section describes how to get your build host ready
  160. to work with BSP layers.
  161. Once you have the host set up, you can create the layer
  162. as described in the
  163. "<link linkend='creating-a-new-bsp-layer-using-the-bitbake-layers-script'>Creating a new BSP Layer Using the <filename>bitbake-layers</filename> Script</link>"
  164. section.
  165. <note>
  166. For structural information on BSPs, see the
  167. <link linkend='bsp-filelayout'>Example Filesystem Layout</link>
  168. section.
  169. </note>
  170. <orderedlist>
  171. <listitem><para>
  172. <emphasis>Set Up the Build Environment:</emphasis>
  173. Be sure you are set up to use BitBake in a shell.
  174. See the
  175. "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-preparing-the-build-host'>Preparing the Build Host</ulink>"
  176. section in the Yocto Project Development Tasks Manual for information
  177. on how to get a build host ready that is either a native
  178. Linux machine or a machine that uses CROPS.
  179. </para></listitem>
  180. <listitem><para>
  181. <emphasis>Clone the <filename>poky</filename> Repository:</emphasis>
  182. You need to have a local copy of the Yocto Project
  183. <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
  184. (i.e. a local <filename>poky</filename> repository).
  185. See the
  186. "<ulink url='&YOCTO_DOCS_DEV_URL;#cloning-the-poky-repository'>Cloning the <filename>poky</filename> Repository</ulink>"
  187. and possibly the
  188. "<ulink url='&YOCTO_DOCS_DEV_URL;#checking-out-by-branch-in-poky'>Checking Out by Branch in Poky</ulink>"
  189. or
  190. "<ulink url='&YOCTO_DOCS_DEV_URL;#checkout-out-by-tag-in-poky'>Checking Out by Tag in Poky</ulink>"
  191. sections all in the Yocto Project Development Tasks Manual for
  192. information on how to clone the <filename>poky</filename>
  193. repository and check out the appropriate branch for your work.
  194. </para></listitem>
  195. <listitem><para>
  196. <emphasis>Determine the BSP Layer You Want:</emphasis>
  197. The Yocto Project supports many BSPs, which are maintained in
  198. their own layers or in layers designed to contain several
  199. BSPs.
  200. To get an idea of machine support through BSP layers, you can
  201. look at the
  202. <ulink url='&YOCTO_RELEASE_DL_URL;/machines'>index of machines</ulink>
  203. for the release.
  204. </para></listitem>
  205. <listitem><para>
  206. <emphasis>Optionally Clone the
  207. <filename>meta-intel</filename> BSP Layer:</emphasis>
  208. If your hardware is based on current Intel CPUs and devices,
  209. you can leverage this BSP layer.
  210. For details on the <filename>meta-intel</filename> BSP layer,
  211. see the layer's
  212. <ulink url='http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel/tree/README'><filename>README</filename></ulink>
  213. file.
  214. <orderedlist>
  215. <listitem><para>
  216. <emphasis>Navigate to Your Source Directory:</emphasis>
  217. Typically, you set up the
  218. <filename>meta-intel</filename> Git repository
  219. inside the
  220. <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
  221. (e.g. <filename>poky</filename>).
  222. <literallayout class='monospaced'>
  223. $ cd /home/<replaceable>you</replaceable>/poky
  224. </literallayout>
  225. </para></listitem>
  226. <listitem><para>
  227. <emphasis>Clone the Layer:</emphasis>
  228. <literallayout class='monospaced'>
  229. $ git clone git://git.yoctoproject.org/meta-intel.git
  230. Cloning into 'meta-intel'...
  231. remote: Counting objects: 17179, done.
  232. remote: Compressing objects: 100% (5307/5307), done.
  233. remote: Total 17179 (delta 10209), reused 17139 (delta 10169)
  234. Receiving objects: 100% (17179/17179), 4.76 MiB | 4.39 MiB/s, done.
  235. Resolving deltas: 100% (10209/10209), done.
  236. Checking connectivity... done.
  237. </literallayout>
  238. </para></listitem>
  239. <listitem><para>
  240. <emphasis>Check Out the Proper Branch:</emphasis>
  241. The branch you check out for
  242. <filename>meta-intel</filename> must match the same
  243. branch you are using for the Yocto Project release
  244. (e.g. &DISTRO_NAME_NO_CAP;):
  245. <literallayout class='monospaced'>
  246. $ cd meta-intel
  247. $ git checkout -b &DISTRO_NAME_NO_CAP; remotes/origin/&DISTRO_NAME_NO_CAP;
  248. Branch &DISTRO_NAME_NO_CAP; set up to track remote branch &DISTRO_NAME_NO_CAP; from origin.
  249. Switched to a new branch '&DISTRO_NAME_NO_CAP;'
  250. </literallayout>
  251. <note>
  252. To see the available branch names in a cloned repository,
  253. use the <filename>git branch -al</filename> command.
  254. See the
  255. "<ulink url='&YOCTO_DOCS_DEV_URL;#checking-out-by-branch-in-poky'>Checking Out By Branch in Poky</ulink>"
  256. section in the Yocto Project Development Tasks
  257. Manual for more information.
  258. </note>
  259. </para></listitem>
  260. </orderedlist>
  261. </para></listitem>
  262. <listitem><para>
  263. <emphasis>Optionally Set Up an Alternative BSP Layer:</emphasis>
  264. If your hardware can be more closely leveraged to an
  265. existing BSP not within the <filename>meta-intel</filename>
  266. BSP layer, you can clone that BSP layer.</para>
  267. <para>The process is identical to the process used for the
  268. <filename>meta-intel</filename> layer except for the layer's
  269. name.
  270. For example, if you determine that your hardware most
  271. closely matches the <filename>meta-raspberrypi</filename>,
  272. clone that layer:
  273. <literallayout class='monospaced'>
  274. $ git clone git://git.yoctoproject.org/meta-raspberrypi
  275. Cloning into 'meta-raspberrypi'...
  276. remote: Counting objects: 6205, done.
  277. remote: Compressing objects: 100% (2700/2700), done.
  278. remote: Total 6205 (delta 3342), reused 5916 (delta 3146)
  279. Receiving objects: 100% (6205/6205), 1.43 MiB | 0 bytes/s, done.
  280. Resolving deltas: 100% (3342/3342), done.
  281. Checking connectivity... done. </literallayout>
  282. </para></listitem>
  283. <listitem><para>
  284. <emphasis>Initialize the Build Environment:</emphasis>
  285. While in the root directory of the Source Directory (i.e.
  286. <filename>poky</filename>), run the
  287. <ulink url='&YOCTO_DOCS_REF_URL;#structure-core-script'><filename>&OE_INIT_FILE;</filename></ulink>
  288. environment setup script to define the OpenEmbedded
  289. build environment on your build host.
  290. <literallayout class='monospaced'>
  291. $ source &OE_INIT_FILE;
  292. </literallayout>
  293. Among other things, the script creates the
  294. <ulink url='&YOCTO_DOCS_REF_URL;#build-directory'>Build Directory</ulink>,
  295. which is <filename>build</filename> in this case
  296. and is located in the
  297. <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>.
  298. After the script runs, your current working directory
  299. is set to the <filename>build</filename> directory.
  300. </para></listitem>
  301. </orderedlist>
  302. </para>
  303. </section>
  304. <section id="bsp-filelayout">
  305. <title>Example Filesystem Layout</title>
  306. <para>
  307. Defining a common BSP directory structure allows
  308. end-users to understand and become familiar with
  309. that standard.
  310. A common format also encourages standardization
  311. of software support for hardware.
  312. </para>
  313. <para>
  314. The proposed form described in this section does
  315. have elements that are specific to the OpenEmbedded
  316. build system.
  317. It is intended that developers can use this structure
  318. with other build systems besides the OpenEmbedded build
  319. system.
  320. It is also intended that it will be be simple to extract
  321. information and convert it to other formats if required.
  322. The OpenEmbedded build system, through its standard
  323. <ulink url='&YOCTO_DOCS_OM_URL;#the-yocto-project-layer-model'>layers mechanism</ulink>,
  324. can directly accept the format described as a layer.
  325. The BSP layer captures all the hardware-specific details
  326. in one place using a standard format, which is useful
  327. for any person wishing to use the hardware platform
  328. regardless of the build system they are using.
  329. </para>
  330. <para>
  331. The BSP specification does not include a build system
  332. or other tools - the specification is concerned with
  333. the hardware-specific components only.
  334. At the end-distribution point, you can ship the BSP
  335. layer combined with a build system and other tools.
  336. Realize that it is important to maintain the distinction
  337. that the BSP layer, a build system, and tools are
  338. separate components that could to be combined in
  339. certain end products.
  340. </para>
  341. <para>
  342. Before looking at the common form for the file structure
  343. inside a BSP Layer, you should be aware that some
  344. requirements do exist in order for a BSP layer to
  345. be considered compliant with the Yocto Project.
  346. For that list of requirements, see the
  347. "<link linkend='released-bsp-requirements'>Released BSP Requirements</link>"
  348. section.
  349. </para>
  350. <para>
  351. Below is the common form for the file structure
  352. inside a BSP Layer.
  353. While this basic form represents the standard,
  354. realize that the actual file structures for specific
  355. BSPs could differ.
  356. <literallayout class='monospaced'>
  357. meta-<replaceable>bsp_root_name</replaceable>/
  358. meta-<replaceable>bsp_root_name</replaceable>/<replaceable>bsp_license_file</replaceable>
  359. meta-<replaceable>bsp_root_name</replaceable>/README
  360. meta-<replaceable>bsp_root_name</replaceable>/README.sources
  361. meta-<replaceable>bsp_root_name</replaceable>/binary/<replaceable>bootable_images</replaceable>
  362. meta-<replaceable>bsp_root_name</replaceable>/conf/layer.conf
  363. meta-<replaceable>bsp_root_name</replaceable>/conf/machine/*.conf
  364. meta-<replaceable>bsp_root_name</replaceable>/recipes-bsp/*
  365. meta-<replaceable>bsp_root_name</replaceable>/recipes-core/*
  366. meta-<replaceable>bsp_root_name</replaceable>/recipes-graphics/*
  367. meta-<replaceable>bsp_root_name</replaceable>/recipes-kernel/linux/linux-yocto_<replaceable>kernel_rev</replaceable>.bbappend
  368. </literallayout>
  369. </para>
  370. <para>
  371. You can examine the Raspberry Pi BSP
  372. layer that is available from the
  373. <ulink url='&YOCTO_GIT_URL;'>Source Repositories</ulink> by
  374. following this link:
  375. <ulink url='https://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/tree/?h=&DISTRO_NAME_NO_CAP;'></ulink>.
  376. Following the link puts you in the Source Repositories and the
  377. Raspberry Pi BSP layer for the "&DISTRO_NAME_NO_CAP;" release.
  378. You can use the interface to explore the configuration, docs, and
  379. recipe files.
  380. </para>
  381. <para>
  382. The following sections describe each part of the proposed
  383. BSP format.
  384. </para>
  385. <section id="bsp-filelayout-license">
  386. <title>License Files</title>
  387. <para>
  388. You can find these files in the BSP Layer at:
  389. <literallayout class='monospaced'>
  390. meta-<replaceable>bsp_root_name</replaceable>/<replaceable>bsp_license_file</replaceable>
  391. </literallayout>
  392. </para>
  393. <para>
  394. These optional files satisfy licensing requirements
  395. for the BSP.
  396. The type or types of files here can vary depending
  397. on the licensing requirements.
  398. For example, in the Raspberry Pi BSP all licensing
  399. requirements are handled with the
  400. <filename>COPYING.MIT</filename> file.
  401. </para>
  402. <para>
  403. Licensing files can be MIT, BSD, GPLv*, and so forth.
  404. These files are recommended for the BSP but are
  405. optional and totally up to the BSP developer.
  406. For information on how to maintain license
  407. compliance, see the
  408. "<ulink url='&YOCTO_DOCS_DEV_URL;#maintaining-open-source-license-compliance-during-your-products-lifecycle'>Maintaining Open Source License Compliance During Your Product's Lifecycle</ulink>"
  409. section in the Yocto Project Development Tasks
  410. Manual.
  411. </para>
  412. </section>
  413. <section id="bsp-filelayout-readme">
  414. <title>README File</title>
  415. <para>
  416. You can find this file in the BSP Layer at:
  417. <literallayout class='monospaced'>
  418. meta-<replaceable>bsp_root_name</replaceable>/README
  419. </literallayout>
  420. </para>
  421. <para>
  422. This file provides information on how to boot the live
  423. images that are optionally included in the
  424. <filename>binary/</filename> directory.
  425. The <filename>README</filename> file also provides
  426. information needed for building the image.
  427. </para>
  428. <para>
  429. At a minimum, the <filename>README</filename> file must
  430. contain a list of dependencies, such as the names of
  431. any other layers on which the BSP depends and the name of
  432. the BSP maintainer with his or her contact information.
  433. </para>
  434. </section>
  435. <section id="bsp-filelayout-readme-sources">
  436. <title>README.sources File</title>
  437. <para>
  438. You can find this file in the BSP Layer at:
  439. <literallayout class='monospaced'>
  440. meta-<replaceable>bsp_root_name</replaceable>/README.sources
  441. </literallayout>
  442. </para>
  443. <para>
  444. This file provides information on where to locate the BSP
  445. source files used to build the images (if any) that
  446. reside in
  447. <filename>meta-<replaceable>bsp_root_name</replaceable>/binary</filename>.
  448. Images in the <filename>binary</filename> would be images
  449. released with the BSP.
  450. The information in the <filename>README.sources</filename>
  451. file also helps you find the
  452. <ulink url='&YOCTO_DOCS_REF_URL;#metadata'>Metadata</ulink>
  453. used to generate the images that ship with the BSP.
  454. <note>
  455. If the BSP's <filename>binary</filename> directory is
  456. missing or the directory has no images, an existing
  457. <filename>README.sources</filename> file is
  458. meaningless and usually does not exist.
  459. </note>
  460. </para>
  461. </section>
  462. <section id="bsp-filelayout-binary">
  463. <title>Pre-built User Binaries</title>
  464. <para>
  465. You can find these files in the BSP Layer at:
  466. <literallayout class='monospaced'>
  467. meta-<replaceable>bsp_root_name</replaceable>/binary/<replaceable>bootable_images</replaceable>
  468. </literallayout>
  469. </para>
  470. <para>
  471. This optional area contains useful pre-built kernels
  472. and user-space filesystem images released with the
  473. BSP that are appropriate to the target system.
  474. This directory typically contains graphical (e.g. Sato)
  475. and minimal live images when the BSP tarball has been
  476. created and made available in the
  477. <ulink url='&YOCTO_HOME_URL;'>Yocto Project</ulink>
  478. website.
  479. You can use these kernels and images to get a system
  480. running and quickly get started on development tasks.
  481. </para>
  482. <para>
  483. The exact types of binaries present are highly
  484. hardware-dependent.
  485. The
  486. <link linkend='bsp-filelayout-readme'><filename>README</filename></link>
  487. file should be present in the BSP Layer and it
  488. explains how to use the images with the target hardware.
  489. Additionally, the
  490. <link linkend='bsp-filelayout-readme-sources'><filename>README.sources</filename></link>
  491. file should be present to locate the sources used to
  492. build the images and provide information on the
  493. Metadata.
  494. </para>
  495. </section>
  496. <section id='bsp-filelayout-layer'>
  497. <title>Layer Configuration File</title>
  498. <para>
  499. You can find this file in the BSP Layer at:
  500. <literallayout class='monospaced'>
  501. meta-<replaceable>bsp_root_name</replaceable>/conf/layer.conf
  502. </literallayout>
  503. </para>
  504. <para>
  505. The <filename>conf/layer.conf</filename> file
  506. identifies the file structure as a layer,
  507. identifies the contents of the layer, and
  508. contains information about how the build system should
  509. use it.
  510. Generally, a standard boilerplate file such as the
  511. following works.
  512. In the following example, you would replace
  513. <replaceable>bsp</replaceable> with the actual
  514. name of the BSP (i.e.
  515. <replaceable>bsp_root_name</replaceable> from the example
  516. template).
  517. </para>
  518. <para>
  519. <literallayout class='monospaced'>
  520. # We have a conf and classes directory, add to BBPATH
  521. BBPATH .= ":${LAYERDIR}"
  522. # We have a recipes directory, add to BBFILES
  523. BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
  524. ${LAYERDIR}/recipes-*/*/*.bbappend"
  525. BBFILE_COLLECTIONS += "<replaceable>bsp</replaceable>"
  526. BBFILE_PATTERN_<replaceable>bsp</replaceable> = "^${LAYERDIR}/"
  527. BBFILE_PRIORITY_<replaceable>bsp</replaceable> = "6"
  528. LAYERDEPENDS_<replaceable>bsp</replaceable> = "intel"
  529. </literallayout>
  530. </para>
  531. <para>
  532. To illustrate the string substitutions, here are
  533. the corresponding statements from the Raspberry
  534. Pi <filename>conf/layer.conf</filename> file:
  535. <literallayout class='monospaced'>
  536. # We have a conf and classes directory, append to BBPATH
  537. BBPATH .= ":${LAYERDIR}"
  538. # We have a recipes directory containing .bb and .bbappend files, add to BBFILES
  539. BBFILES += "${LAYERDIR}/recipes*/*/*.bb \
  540. ${LAYERDIR}/recipes*/*/*.bbappend"
  541. BBFILE_COLLECTIONS += "raspberrypi"
  542. BBFILE_PATTERN_raspberrypi := "^${LAYERDIR}/"
  543. BBFILE_PRIORITY_raspberrypi = "9"
  544. # Additional license directories.
  545. LICENSE_PATH += "${LAYERDIR}/files/custom-licenses"
  546. .
  547. .
  548. .
  549. </literallayout>
  550. </para>
  551. <para>
  552. This file simply makes
  553. <ulink url='&YOCTO_DOCS_REF_URL;#bitbake-term'>BitBake</ulink>
  554. aware of the recipes and configuration directories.
  555. The file must exist so that the OpenEmbedded build system
  556. can recognize the BSP.
  557. </para>
  558. </section>
  559. <section id="bsp-filelayout-machine">
  560. <title>Hardware Configuration Options</title>
  561. <para>
  562. You can find these files in the BSP Layer at:
  563. <literallayout class='monospaced'>
  564. meta-<replaceable>bsp_root_name</replaceable>/conf/machine/*.conf
  565. </literallayout>
  566. </para>
  567. <para>
  568. The machine files bind together all the information
  569. contained elsewhere in the BSP into a format that
  570. the build system can understand.
  571. Each BSP Layer requires at least one machine file.
  572. If the BSP supports multiple machines, multiple
  573. machine configuration files can exist.
  574. These filenames correspond to the values to which
  575. users have set the
  576. <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE'><filename>MACHINE</filename></ulink> variable.
  577. </para>
  578. <para>
  579. These files define things such as the kernel package
  580. to use
  581. (<ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER</filename></ulink>
  582. of
  583. <ulink url='&YOCTO_DOCS_DEV_URL;#metadata-virtual-providers'>virtual/kernel</ulink>),
  584. the hardware drivers to include in different types
  585. of images, any special software components that are
  586. needed, any bootloader information, and also any
  587. special image format requirements.
  588. </para>
  589. <para>
  590. This configuration file could also include a hardware
  591. "tuning" file that is commonly used to define the
  592. package architecture and specify optimization flags,
  593. which are carefully chosen to give best performance
  594. on a given processor.
  595. </para>
  596. <para>
  597. Tuning files are found in the
  598. <filename>meta/conf/machine/include</filename>
  599. directory within the
  600. <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>.
  601. For example, many <filename>tune-*</filename> files
  602. (e.g. <filename>tune-arm1136jf-s.inc</filename>,
  603. <filename>tun-1586-nlp.inc</filename>, and so forth)
  604. reside in the
  605. <filename>poky/meta/conf/machine/include</filename>
  606. directory.
  607. </para>
  608. <para>
  609. To use an include file, you simply include them in the
  610. machine configuration file.
  611. For example, the Raspberry Pi BSP
  612. <filename>raspberrypi3.conf</filename> contains the
  613. following statement:
  614. <literallayout class='monospaced'>
  615. include conf/machine/include/rpi-base.inc
  616. </literallayout>
  617. </para>
  618. </section>
  619. <section id='bsp-filelayout-misc-recipes'>
  620. <title>Miscellaneous BSP-Specific Recipe Files</title>
  621. <para>
  622. You can find these files in the BSP Layer at:
  623. <literallayout class='monospaced'>
  624. meta-<replaceable>bsp_root_name</replaceable>/recipes-bsp/*
  625. </literallayout>
  626. </para>
  627. <para>
  628. This optional directory contains miscellaneous recipe
  629. files for the BSP.
  630. Most notably would be the formfactor files.
  631. For example, in the Raspberry Pi BSP there is the
  632. <filename>formfactor_%.bbappend</filename> file,
  633. which is an append file used to augment the recipe
  634. that starts the build.
  635. Furthermore, there are machine-specific settings used
  636. during the build that are defined by the
  637. <filename>machconfig</filename> file further down in
  638. the directory (i.e. <filename>formfactor/rpi/</filename>).
  639. Here is the <filename>machconfig</filename> file for
  640. the Raspberry Pi BSP:
  641. <literallayout class='monospaced'>
  642. HAVE_TOUCHSCREEN=0
  643. HAVE_KEYBOARD=1
  644. DISPLAY_CAN_ROTATE=0
  645. DISPLAY_ORIENTATION=0
  646. DISPLAY_DPI=133
  647. </literallayout>
  648. </para>
  649. <note><para>
  650. If a BSP does not have a formfactor entry, defaults
  651. are established according to the formfactor
  652. configuration file that is installed by the main
  653. formfactor recipe
  654. <filename>meta/recipes-bsp/formfactor/formfactor_0.0.bb</filename>,
  655. which is found in the
  656. <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
  657. (i.e. <filename>poky</filename>).
  658. </para></note>
  659. </section>
  660. <section id='bsp-filelayout-recipes-graphics'>
  661. <title>Display Support Files</title>
  662. <para>
  663. You can find these files in the BSP Layer at:
  664. <literallayout class='monospaced'>
  665. meta-<replaceable>bsp_root_name</replaceable>/recipes-graphics/*
  666. </literallayout>
  667. </para>
  668. <para>
  669. This optional directory contains recipes for the
  670. BSP if it has special requirements for graphics
  671. support.
  672. All files that are needed for the BSP to support
  673. a display are kept here.
  674. </para>
  675. </section>
  676. <section id='bsp-filelayout-kernel'>
  677. <title>Linux Kernel Configuration</title>
  678. <para>
  679. You can find these files in the BSP Layer at:
  680. <literallayout class='monospaced'>
  681. meta-<replaceable>bsp_root_name</replaceable>/recipes-kernel/linux/linux*.bbappend
  682. meta-<replaceable>bsp_root_name</replaceable>/recipes-kernel/linux/*.bb
  683. </literallayout>
  684. </para>
  685. <para>
  686. Append files (<filename>*.bbappend</filename>) modify
  687. the main kernel recipe being used to build the image.
  688. The <filename>*.bb</filename> files would be a
  689. developer-supplied kernel recipe.
  690. This area of the BSP hierarchy can contain both these
  691. types of files, although in practice, it is likely that
  692. you would have one or the other.
  693. </para>
  694. <para>
  695. For your BSP, you typically want to use an existing Yocto
  696. Project kernel recipe found in the
  697. <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
  698. at <filename>meta/recipes-kernel/linux</filename>.
  699. You can append machine-specific changes to the
  700. kernel recipe by using a similarly named append
  701. file, which is located in the BSP Layer for your
  702. target device (e.g. the
  703. <filename>meta-<replaceable>bsp_root_name</replaceable>/recipes-kernel/linux</filename> directory).
  704. </para>
  705. <para>
  706. Suppose you are using the
  707. <filename>linux-yocto_4.4.bb</filename> recipe to
  708. build the kernel.
  709. In other words, you have selected the kernel in your
  710. <replaceable>bsp_root_name</replaceable><filename>.conf</filename>
  711. file by adding
  712. <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER</filename></ulink>
  713. and
  714. <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_VERSION'><filename>PREFERRED_VERSION</filename></ulink>
  715. statements as follows:
  716. <literallayout class='monospaced'>
  717. PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
  718. PREFERRED_VERSION_linux-yocto ?= "4.4%"
  719. </literallayout>
  720. <note>
  721. When the preferred provider is assumed by
  722. default, the
  723. <filename>PREFERRED_PROVIDER</filename>
  724. statement does not appear in the
  725. <replaceable>bsp_root_name</replaceable><filename>.conf</filename> file.
  726. </note>
  727. You would use the
  728. <filename>linux-yocto_4.4.bbappend</filename>
  729. file to append specific BSP settings to the kernel,
  730. thus configuring the kernel for your particular BSP.
  731. </para>
  732. <para>
  733. You can find more information on what your append file
  734. should contain in the
  735. "<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#creating-the-append-file'>Creating the Append File</ulink>"
  736. section in the Yocto Project Linux Kernel Development
  737. Manual.
  738. </para>
  739. <para>
  740. An alternate scenario is when you create your own
  741. kernel recipe for the BSP.
  742. A good example of this is the Raspberry Pi BSP.
  743. If you examine the
  744. <filename>recipes-kernel/linux</filename> directory
  745. you see the following:
  746. <literallayout class='monospaced'>
  747. linux-raspberrypi-dev.bb
  748. linux-raspberrypi.inc
  749. linux-raspberrypi_4.14.bb
  750. linux-raspberrypi_4.9.bb
  751. </literallayout>
  752. The directory contains three kernel recipes and a
  753. common include file.
  754. </para>
  755. </section>
  756. </section>
  757. <section id='developing-a-board-support-package-bsp'>
  758. <title>Developing a Board Support Package (BSP)</title>
  759. <para>
  760. This section contains the high-level procedure you can
  761. follow to create a BSP.
  762. Although not required for BSP creation, the
  763. <filename>meta-intel</filename> repository, which
  764. contains many BSPs supported by the Yocto Project,
  765. is part of the example.
  766. </para>
  767. <para>
  768. For an example that shows how to create a new
  769. layer using the tools, see the
  770. "<link linkend='creating-a-new-bsp-layer-using-the-bitbake-layers-script'>Creating a New BSP Layer Using the <filename>bitbake-layers</filename> Script</link>"
  771. section.
  772. </para>
  773. <para>
  774. The following illustration and list summarize the BSP
  775. creation general workflow.
  776. </para>
  777. <para>
  778. <imagedata fileref="figures/bsp-dev-flow.png" width="7in" depth="5in" align="center" scalefit="1" />
  779. </para>
  780. <para>
  781. <orderedlist>
  782. <listitem><para>
  783. <emphasis>Set up Your Host Development System
  784. to Support Development Using the Yocto
  785. Project</emphasis>:
  786. See the
  787. "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-preparing-the-build-host'>Preparing the Build Host</ulink>"
  788. section in the Yocto Project Development Tasks
  789. Manual for options on how to get a system ready
  790. to use the Yocto Project.
  791. </para></listitem>
  792. <listitem><para>
  793. <emphasis>Establish the
  794. <filename>meta-intel</filename>
  795. Repository on Your System:</emphasis>
  796. Having local copies of these supported BSP layers
  797. on your system gives you access to layers you
  798. might be able to leverage when creating your BSP.
  799. For information on how to get these files, see the
  800. "<link linkend='preparing-your-build-host-to-work-with-bsp-layers'>Preparing Your Build Host to Work with BSP Layers</link>"
  801. section.
  802. </para></listitem>
  803. <listitem><para>
  804. <emphasis>Create Your Own BSP Layer Using the
  805. <filename>bitbake-layers</filename>
  806. Script:</emphasis>
  807. Layers are ideal for isolating and storing work
  808. for a given piece of hardware.
  809. A layer is really just a location or area in which you
  810. place the recipes and configurations for your BSP.
  811. In fact, a BSP is, in itself, a special type of layer.
  812. The simplest way to create a new BSP layer that is
  813. compliant with the Yocto Project is to use the
  814. <filename>bitbake-layers</filename> script.
  815. For information about that script, see the
  816. "<link linkend='creating-a-new-bsp-layer-using-the-bitbake-layers-script'>Creating a New BSP Layer Using the <filename>bitbake-layers</filename> Script</link>"
  817. section.</para>
  818. <para>Another example that illustrates a layer
  819. is an application.
  820. Suppose you are creating an application that has
  821. library or other dependencies in order for it to
  822. compile and run.
  823. The layer, in this case, would be where all the
  824. recipes that define those dependencies are kept.
  825. The key point for a layer is that it is an
  826. isolated area that contains all the relevant
  827. information for the project that the
  828. OpenEmbedded build system knows about.
  829. For more information on layers, see the
  830. "<ulink url='&YOCTO_DOCS_OM_URL;#the-yocto-project-layer-model'>The Yocto Project Layer Model</ulink>"
  831. section in the Yocto Project Overview and Concepts
  832. Manual.
  833. You can also reference the
  834. "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers</ulink>"
  835. section in the Yocto Project Development Tasks
  836. Manual.
  837. For more information on BSP layers, see the
  838. "<link linkend='bsp-layers'>BSP Layers</link>"
  839. section.
  840. <note><title>Notes</title>
  841. <itemizedlist>
  842. <listitem><para>
  843. Five hardware reference BSPs exist
  844. that are part of the Yocto Project release
  845. and are located in the
  846. <filename>poky/meta-yocto-bsp</filename> BSP
  847. layer:
  848. <itemizedlist>
  849. <listitem><para>
  850. Texas Instruments Beaglebone
  851. (<filename>beaglebone-yocto</filename>)
  852. </para></listitem>
  853. <listitem><para>
  854. Freescale MPC8315E-RDB
  855. (<filename>mpc8315e-rdb</filename>)
  856. </para></listitem>
  857. <listitem><para>
  858. Ubiquiti Networks EdgeRouter Lite
  859. (<filename>edgerouter</filename>)
  860. </para></listitem>
  861. <listitem><para>
  862. Two general IA platforms
  863. (<filename>genericx86</filename> and
  864. <filename>genericx86-64</filename>)
  865. </para></listitem>
  866. </itemizedlist>
  867. </para></listitem>
  868. <listitem><para>
  869. Three core Intel BSPs exist as part of
  870. the Yocto Project release in the
  871. <filename>meta-intel</filename> layer:
  872. <itemizedlist>
  873. <listitem><para>
  874. <filename>intel-core2-32</filename>,
  875. which is a BSP optimized for the Core2
  876. family of CPUs as well as all CPUs
  877. prior to the Silvermont core.
  878. </para></listitem>
  879. <listitem><para>
  880. <filename>intel-corei7-64</filename>,
  881. which is a BSP optimized for Nehalem
  882. and later Core and Xeon CPUs as well
  883. as Silvermont and later Atom CPUs,
  884. such as the Baytrail SoCs.
  885. </para></listitem>
  886. <listitem><para>
  887. <filename>intel-quark</filename>,
  888. which is a BSP optimized for the
  889. Intel Galileo gen1 &amp; gen2
  890. development boards.
  891. </para></listitem>
  892. </itemizedlist>
  893. </para></listitem>
  894. </itemizedlist>
  895. </note></para>
  896. <para>When you set up a layer for a new BSP,
  897. you should follow a standard layout.
  898. This layout is described in the
  899. "<link linkend='bsp-filelayout'>Example Filesystem Layout</link>"
  900. section.
  901. In the standard layout, notice the suggested
  902. structure for recipes and configuration
  903. information.
  904. You can see the standard layout for a BSP
  905. by examining any supported BSP found in the
  906. <filename>meta-intel</filename> layer inside
  907. the Source Directory.
  908. </para></listitem>
  909. <listitem><para>
  910. <emphasis>Make Configuration Changes to Your New
  911. BSP Layer:</emphasis>
  912. The standard BSP layer structure organizes the
  913. files you need to edit in
  914. <filename>conf</filename> and several
  915. <filename>recipes-*</filename> directories
  916. within the BSP layer.
  917. Configuration changes identify where your new
  918. layer is on the local system and identifies the
  919. kernel you are going to use.
  920. When you run the
  921. <filename>bitbake-layers</filename> script,
  922. you are able to interactively configure many
  923. things for the BSP (e.g. keyboard, touchscreen,
  924. and so forth).
  925. </para></listitem>
  926. <listitem><para>
  927. <emphasis>Make Recipe Changes to Your New BSP
  928. Layer:</emphasis>
  929. Recipe changes include altering recipes
  930. (<filename>*.bb</filename> files), removing
  931. recipes you do not use, and adding new recipes
  932. or append files (<filename>.bbappend</filename>)
  933. that support your hardware.
  934. </para></listitem>
  935. <listitem><para>
  936. <emphasis>Prepare for the Build:</emphasis>
  937. Once you have made all the changes to your BSP
  938. layer, there remains a few things you need to
  939. do for the OpenEmbedded build system in order
  940. for it to create your image.
  941. You need to get the build environment ready by
  942. sourcing an environment setup script
  943. (i.e. <filename>oe-init-build-env</filename>)
  944. and you need to be sure two key configuration
  945. files are configured appropriately: the
  946. <filename>conf/local.conf</filename> and the
  947. <filename>conf/bblayers.conf</filename> file.
  948. You must make the OpenEmbedded build system aware
  949. of your new layer.
  950. See the
  951. "<ulink url='&YOCTO_DOCS_DEV_URL;#enabling-your-layer'>Enabling Your Layer</ulink>"
  952. section in the Yocto Project Development Tasks Manual
  953. for information on how to let the build system
  954. know about your new layer.
  955. </para></listitem>
  956. <listitem><para>
  957. <emphasis>Build the Image:</emphasis>
  958. The OpenEmbedded build system uses the BitBake tool
  959. to build images based on the type of image you want to
  960. create.
  961. You can find more information about BitBake in the
  962. <ulink url='&YOCTO_DOCS_BB_URL;'>BitBake User Manual</ulink>.
  963. </para>
  964. <para>The build process supports several types of
  965. images to satisfy different needs.
  966. See the
  967. "<ulink url='&YOCTO_DOCS_REF_URL;#ref-images'>Images</ulink>"
  968. chapter in the Yocto Project Reference Manual for
  969. information on supported images.
  970. </para></listitem>
  971. </orderedlist>
  972. </para>
  973. </section>
  974. <section id='requirements-and-recommendations-for-released-bsps'>
  975. <title>Requirements and Recommendations for Released BSPs</title>
  976. <para>
  977. Certain requirements exist for a released BSP to be
  978. considered compliant with the Yocto Project.
  979. Additionally, recommendations also exist.
  980. This section describes the requirements and
  981. recommendations for released BSPs.
  982. </para>
  983. <section id='released-bsp-requirements'>
  984. <title>Released BSP Requirements</title>
  985. <para>
  986. Before looking at BSP requirements, you should consider
  987. the following:
  988. <itemizedlist>
  989. <listitem><para>
  990. The requirements here assume the BSP layer
  991. is a well-formed, "legal" layer that can be
  992. added to the Yocto Project.
  993. For guidelines on creating a layer that meets
  994. these base requirements, see the
  995. "<link linkend='bsp-layers'>BSP Layers</link>"
  996. section in this manual and the
  997. "<ulink url='&YOCTO_DOCS_DEV_URL;#understanding-and-creating-layers'>Understanding and Creating Layers"</ulink>"
  998. section in the Yocto Project Development Tasks
  999. Manual.
  1000. </para></listitem>
  1001. <listitem><para>
  1002. The requirements in this section apply
  1003. regardless of how you package a BSP.
  1004. You should consult the packaging and distribution
  1005. guidelines for your specific release process.
  1006. For an example of packaging and distribution
  1007. requirements, see the
  1008. "<ulink url='https://wiki.yoctoproject.org/wiki/Third_Party_BSP_Release_Process'>Third Party BSP Release Process</ulink>"
  1009. wiki page.
  1010. </para></listitem>
  1011. <listitem><para>
  1012. The requirements for the BSP as it is made
  1013. available to a developer are completely
  1014. independent of the released form of the BSP.
  1015. For example, the BSP Metadata can be contained
  1016. within a Git repository and could have a directory
  1017. structure completely different from what appears
  1018. in the officially released BSP layer.
  1019. </para></listitem>
  1020. <listitem><para>
  1021. It is not required that specific packages or
  1022. package modifications exist in the BSP layer,
  1023. beyond the requirements for general
  1024. compliance with the Yocto Project.
  1025. For example, no requirement exists dictating
  1026. that a specific kernel or kernel version be
  1027. used in a given BSP.
  1028. </para></listitem>
  1029. </itemizedlist>
  1030. </para>
  1031. <para>
  1032. Following are the requirements for a released BSP
  1033. that conform to the Yocto Project:
  1034. <itemizedlist>
  1035. <listitem><para>
  1036. <emphasis>Layer Name:</emphasis>
  1037. The BSP must have a layer name that follows
  1038. the Yocto Project standards.
  1039. For information on BSP layer names, see the
  1040. "<link linkend='bsp-layers'>BSP Layers</link>" section.
  1041. </para></listitem>
  1042. <listitem><para>
  1043. <emphasis>File System Layout:</emphasis>
  1044. When possible, use the same directory names
  1045. in your BSP layer as listed in the
  1046. <filename>recipes.txt</filename> file, which
  1047. is found in <filename>poky/meta</filename>
  1048. directory of the
  1049. <ulink url='&YOCTO_DOCS_REF_URL;#source-directory'>Source Directory</ulink>
  1050. or in the OpenEmbedded-Core Layer
  1051. (<filename>openembedded-core</filename>) at
  1052. <ulink url='http://git.openembedded.org/openembedded-core/tree/meta'></ulink>.
  1053. </para>
  1054. <para>You should place recipes
  1055. (<filename>*.bb</filename> files) and recipe
  1056. modifications (<filename>*.bbappend</filename>
  1057. files) into <filename>recipes-*</filename>
  1058. subdirectories by functional area as outlined
  1059. in <filename>recipes.txt</filename>.
  1060. If you cannot find a category in
  1061. <filename>recipes.txt</filename> to fit a
  1062. particular recipe, you can make up your own
  1063. <filename>recipes-*</filename> subdirectory.
  1064. </para>
  1065. <para>Within any particular
  1066. <filename>recipes-*</filename> category, the
  1067. layout should match what is found in the
  1068. OpenEmbedded-Core Git repository
  1069. (<filename>openembedded-core</filename>)
  1070. or the Source Directory (<filename>poky</filename>).
  1071. In other words, make sure you place related
  1072. files in appropriately related
  1073. <filename>recipes-*</filename> subdirectories
  1074. specific to the recipe's function, or within
  1075. a subdirectory containing a set of closely-related
  1076. recipes.
  1077. The recipes themselves should follow the general
  1078. guidelines for recipes used in the Yocto Project
  1079. found in the
  1080. "<ulink url='http://openembedded.org/wiki/Styleguide'>OpenEmbedded Style Guide</ulink>".
  1081. </para></listitem>
  1082. <listitem><para>
  1083. <emphasis>License File:</emphasis>
  1084. You must include a license file in the
  1085. <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
  1086. directory.
  1087. This license covers the BSP Metadata as a whole.
  1088. You must specify which license to use since no
  1089. default license exists when one not specified.
  1090. See the
  1091. <ulink url='&YOCTO_GIT_URL;/cgit.cgi/meta-raspberrypi/tree/COPYING.MIT'><filename>COPYING.MIT</filename></ulink>
  1092. file for the Raspberry Pi BSP in the
  1093. <filename>meta-raspberrypi</filename> BSP layer
  1094. as an example.
  1095. </para></listitem>
  1096. <listitem><para>
  1097. <emphasis>README File:</emphasis>
  1098. You must include a <filename>README</filename>
  1099. file in the
  1100. <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
  1101. directory.
  1102. See the
  1103. <ulink url='&YOCTO_GIT_URL;/cgit.cgi/meta-raspberrypi/tree/README.md'><filename>README.md</filename></ulink>
  1104. file for the Raspberry Pi BSP in the
  1105. <filename>meta-raspberrypi</filename> BSP layer
  1106. as an example.</para>
  1107. <para>At a minimum, the <filename>README</filename>
  1108. file should contain the following:
  1109. <itemizedlist>
  1110. <listitem><para>
  1111. A brief description about the hardware the BSP
  1112. targets.
  1113. </para></listitem>
  1114. <listitem><para>
  1115. A list of all the dependencies
  1116. on which a BSP layer depends.
  1117. These dependencies are typically a list
  1118. of required layers needed to build the
  1119. BSP.
  1120. However, the dependencies should also
  1121. contain information regarding any other
  1122. dependencies the BSP might have.
  1123. </para></listitem>
  1124. <listitem><para>
  1125. Any required special licensing information.
  1126. For example, this information includes
  1127. information on special variables needed
  1128. to satisfy a EULA, or instructions on
  1129. information needed to build or distribute
  1130. binaries built from the BSP Metadata.
  1131. </para></listitem>
  1132. <listitem><para>
  1133. The name and contact information for the
  1134. BSP layer maintainer.
  1135. This is the person to whom patches and
  1136. questions should be sent.
  1137. For information on how to find the right
  1138. person, see the
  1139. "<ulink url='&YOCTO_DOCS_DEV_URL;#how-to-submit-a-change'>Submitting a Change to the Yocto Project</ulink>"
  1140. section in the Yocto Project Development
  1141. Tasks Manual.
  1142. </para></listitem>
  1143. <listitem><para>
  1144. Instructions on how to build the BSP using
  1145. the BSP layer.
  1146. </para></listitem>
  1147. <listitem><para>
  1148. Instructions on how to boot the BSP build
  1149. from the BSP layer.
  1150. </para></listitem>
  1151. <listitem><para>
  1152. Instructions on how to boot the binary
  1153. images contained in the
  1154. <filename>binary</filename> directory,
  1155. if present.
  1156. </para></listitem>
  1157. <listitem><para>
  1158. Information on any known bugs or issues
  1159. that users should know about when either
  1160. building or booting the BSP binaries.
  1161. </para></listitem>
  1162. </itemizedlist>
  1163. </para></listitem>
  1164. <listitem><para>
  1165. <emphasis>README.sources File:</emphasis>
  1166. If you BSP contains binary images in the
  1167. <filename>binary</filename> directory, you must
  1168. include a <filename>README.sources</filename>
  1169. file in the
  1170. <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
  1171. directory.
  1172. This file specifies exactly where you can find
  1173. the sources used to generate the binary images.
  1174. </para></listitem>
  1175. <listitem><para>
  1176. <emphasis>Layer Configuration File:</emphasis>
  1177. You must include a
  1178. <filename>conf/layer.conf</filename> file in
  1179. the
  1180. <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
  1181. directory.
  1182. This file identifies the
  1183. <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
  1184. BSP layer as a layer to the build system.
  1185. </para></listitem>
  1186. <listitem><para>
  1187. <emphasis>Machine Configuration File:</emphasis>
  1188. You must include one or more
  1189. <filename>conf/machine/</filename><replaceable>bsp_root_name</replaceable><filename>.conf</filename>
  1190. files in the
  1191. <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
  1192. directory.
  1193. These configuration files define machine targets
  1194. that can be built using the BSP layer.
  1195. Multiple machine configuration files define
  1196. variations of machine configurations that the
  1197. BSP supports.
  1198. If a BSP supports multiple machine variations,
  1199. you need to adequately describe each variation
  1200. in the BSP <filename>README</filename> file.
  1201. Do not use multiple machine configuration files
  1202. to describe disparate hardware.
  1203. If you do have very different targets, you should
  1204. create separate BSP layers for each target.
  1205. <note>
  1206. It is completely possible for a developer to
  1207. structure the working repository as a
  1208. conglomeration of unrelated BSP files, and to
  1209. possibly generate BSPs targeted for release
  1210. from that directory using scripts or some
  1211. other mechanism
  1212. (e.g. <filename>meta-yocto-bsp</filename> layer).
  1213. Such considerations are outside the scope of
  1214. this document.
  1215. </note>
  1216. </para></listitem>
  1217. </itemizedlist>
  1218. </para>
  1219. </section>
  1220. <section id='released-bsp-recommendations'>
  1221. <title>Released BSP Recommendations</title>
  1222. <para>
  1223. Following are recommendations for released BSPs that
  1224. conform to the Yocto Project:
  1225. <itemizedlist>
  1226. <listitem><para>
  1227. <emphasis>Bootable Images:</emphasis>
  1228. Released BSPs can contain one or more bootable
  1229. images.
  1230. Including bootable images allows users to easily
  1231. try out the BSP using their own hardware.</para>
  1232. <para>In some cases, it might not be convenient
  1233. to include a bootable image.
  1234. If so, you might want to make two versions of the
  1235. BSP available: one that contains binary images, and
  1236. one that does not.
  1237. The version that does not contain bootable images
  1238. avoids unnecessary download times for users not
  1239. interested in the images.</para>
  1240. <para>If you need to distribute a BSP and include
  1241. bootable images or build kernel and filesystems
  1242. meant to allow users to boot the BSP for evaluation
  1243. purposes, you should put the images and artifacts
  1244. within a
  1245. <filename>binary/</filename> subdirectory located
  1246. in the
  1247. <filename>meta-</filename><replaceable>bsp_root_name</replaceable>
  1248. directory.
  1249. <note>
  1250. If you do include a bootable image as part
  1251. of the BSP and the image was built by software
  1252. covered by the GPL or other open source licenses,
  1253. it is your responsibility to understand
  1254. and meet all licensing requirements, which could
  1255. include distribution of source files.
  1256. </note>
  1257. </para></listitem>
  1258. <listitem><para>
  1259. <emphasis>Use a Yocto Linux Kernel:</emphasis>
  1260. Kernel recipes in the BSP should be based on a
  1261. Yocto Linux kernel.
  1262. Basing your recipes on these kernels reduces
  1263. the costs for maintaining the BSP and increases
  1264. its scalability.
  1265. See the <filename>Yocto Linux Kernel</filename>
  1266. category in the
  1267. <ulink url='&YOCTO_GIT_URL;'>Source Repositories</ulink>
  1268. for these kernels.
  1269. </para></listitem>
  1270. </itemizedlist>
  1271. </para>
  1272. </section>
  1273. </section>
  1274. <section id='customizing-a-recipe-for-a-bsp'>
  1275. <title>Customizing a Recipe for a BSP</title>
  1276. <para>
  1277. If you plan on customizing a recipe for a particular BSP,
  1278. you need to do the following:
  1279. <itemizedlist>
  1280. <listitem><para>
  1281. Create a <filename>*.bbappend</filename> file for
  1282. the modified recipe.
  1283. For information on using append files, see the
  1284. "<ulink url='&YOCTO_DOCS_DEV_URL;#using-bbappend-files'>Using .bbappend Files in Your Layer</ulink>"
  1285. section in the Yocto Project Development Tasks
  1286. Manual.
  1287. </para></listitem>
  1288. <listitem><para>
  1289. Ensure your directory structure in the BSP layer
  1290. that supports your machine is such that the
  1291. OpenEmbedded build system can find it.
  1292. See the example later in this section for more
  1293. information.
  1294. </para></listitem>
  1295. <listitem><para>
  1296. Put the append file in a directory whose name matches
  1297. the machine's name and is located in an appropriate
  1298. sub-directory inside the BSP layer (i.e.
  1299. <filename>recipes-bsp</filename>,
  1300. <filename>recipes-graphics</filename>,
  1301. <filename>recipes-core</filename>, and so forth).
  1302. </para></listitem>
  1303. <listitem><para>
  1304. Place the BSP-specific files in the proper
  1305. directory inside the BSP layer.
  1306. How expansive the layer is affects where you must
  1307. place these files.
  1308. For example, if your layer supports several
  1309. different machine types, you need to be sure your
  1310. layer's directory structure includes hierarchy
  1311. that separates the files according to machine.
  1312. If your layer does not support multiple machines,
  1313. the layer would not have that additional hierarchy
  1314. and the files would obviously not be able to reside
  1315. in a machine-specific directory.
  1316. </para></listitem>
  1317. </itemizedlist>
  1318. </para>
  1319. <para>
  1320. Following is a specific example to help you better understand
  1321. the process.
  1322. This example customizes customizes a recipe by adding a
  1323. BSP-specific configuration file named
  1324. <filename>interfaces</filename> to the
  1325. <filename>init-ifupdown_1.0.bb</filename> recipe for machine
  1326. "xyz" where the BSP layer also supports several other
  1327. machines:
  1328. <orderedlist>
  1329. <listitem><para>
  1330. Edit the
  1331. <filename>init-ifupdown_1.0.bbappend</filename> file
  1332. so that it contains the following:
  1333. <literallayout class='monospaced'>
  1334. FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
  1335. </literallayout>
  1336. The append file needs to be in the
  1337. <filename>meta-xyz/recipes-core/init-ifupdown</filename>
  1338. directory.
  1339. </para></listitem>
  1340. <listitem><para>
  1341. Create and place the new
  1342. <filename>interfaces</filename> configuration file in
  1343. the BSP's layer here:
  1344. <literallayout class='monospaced'>
  1345. meta-xyz/recipes-core/init-ifupdown/files/xyz-machine-one/interfaces
  1346. </literallayout>
  1347. <note>
  1348. If the <filename>meta-xyz</filename> layer did
  1349. not support multiple machines, you would place
  1350. the <filename>interfaces</filename> configuration
  1351. file in the layer here:
  1352. <literallayout class='monospaced'>
  1353. meta-xyz/recipes-core/init-ifupdown/files/interfaces
  1354. </literallayout>
  1355. </note>
  1356. The
  1357. <ulink url='&YOCTO_DOCS_REF_URL;#var-FILESEXTRAPATHS'><filename>FILESEXTRAPATHS</filename></ulink>
  1358. variable in the append files extends the search path
  1359. the build system uses to find files during the build.
  1360. Consequently, for this example you need to have the
  1361. <filename>files</filename> directory in the same
  1362. location as your append file.
  1363. </para></listitem>
  1364. </orderedlist>
  1365. </para>
  1366. </section>
  1367. <section id='bsp-licensing-considerations'>
  1368. <title>BSP Licensing Considerations</title>
  1369. <para>
  1370. In some cases, a BSP contains separately licensed
  1371. Intellectual Property (IP) for a component or components.
  1372. For these cases, you are required to accept the terms
  1373. of a commercial or other type of license that requires
  1374. some kind of explicit End User License Agreement (EULA).
  1375. Once you accept the license, the OpenEmbedded build system
  1376. can then build and include the corresponding component
  1377. in the final BSP image.
  1378. If the BSP is available as a pre-built image, you can
  1379. download the image after agreeing to the license or EULA.
  1380. </para>
  1381. <para>
  1382. You could find that some separately licensed components
  1383. that are essential for normal operation of the system might
  1384. not have an unencumbered (or free) substitute.
  1385. Without these essential components, the system would be
  1386. non-functional.
  1387. Then again, you might find that other licensed components
  1388. that are simply 'good-to-have' or purely elective do have
  1389. an unencumbered, free replacement component that you can
  1390. use rather than agreeing to the separately licensed
  1391. component.
  1392. Even for components essential to the system, you might
  1393. find an unencumbered component that is not identical but
  1394. will work as a less-capable version of the licensed version
  1395. in the BSP recipe.
  1396. </para>
  1397. <para>
  1398. For cases where you can substitute a free component and
  1399. still maintain the system's functionality, the "DOWNLOADS"
  1400. selection from the "SOFTWARE" tab on the
  1401. <ulink url='&YOCTO_HOME_URL;'>Yocto Project website</ulink>
  1402. makes available de-featured BSPs that are completely free
  1403. of any IP encumbrances.
  1404. For these cases, you can use the substitution directly and
  1405. without any further licensing requirements.
  1406. If present, these fully de-featured BSPs are named
  1407. appropriately different as compared to the names of their
  1408. respective encumbered BSPs.
  1409. If available, these substitutions are your simplest and
  1410. most preferred options.
  1411. Obviously, use of these substitutions assumes the resulting
  1412. functionality meets system requirements.
  1413. <note>
  1414. If however, a non-encumbered version is unavailable or
  1415. it provides unsuitable functionality or quality, you can
  1416. use an encumbered version.
  1417. </note>
  1418. </para>
  1419. <para>
  1420. A couple different methods exist within the OpenEmbedded
  1421. build system to satisfy the licensing requirements for an
  1422. encumbered BSP.
  1423. The following list describes them in order of preference:
  1424. <orderedlist>
  1425. <listitem><para>
  1426. <emphasis>Use the
  1427. <ulink url='&YOCTO_DOCS_REF_URL;#var-LICENSE_FLAGS'><filename>LICENSE_FLAGS</filename></ulink>
  1428. Variable to Define the Recipes that Have Commercial
  1429. or Other Types of Specially-Licensed Packages:</emphasis>
  1430. For each of those recipes, you can specify a
  1431. matching license string in a
  1432. <filename>local.conf</filename> variable named
  1433. <ulink url='&YOCTO_DOCS_REF_URL;#var-LICENSE_FLAGS_WHITELIST'><filename>LICENSE_FLAGS_WHITELIST</filename></ulink>.
  1434. Specifying the matching license string signifies
  1435. that you agree to the license.
  1436. Thus, the build system can build the corresponding
  1437. recipe and include the component in the image.
  1438. See the
  1439. "<ulink url='&YOCTO_DOCS_DEV_URL;#enabling-commercially-licensed-recipes'>Enabling Commercially Licensed Recipes</ulink>"
  1440. section in the Yocto Project Development Tasks
  1441. Manual for details on how to use these variables.
  1442. </para>
  1443. <para>If you build as you normally would, without
  1444. specifying any recipes in the
  1445. <filename>LICENSE_FLAGS_WHITELIST</filename>, the
  1446. build stops and provides you with the list of recipes
  1447. that you have tried to include in the image that
  1448. need entries in the
  1449. <filename>LICENSE_FLAGS_WHITELIST</filename>.
  1450. Once you enter the appropriate license flags into
  1451. the whitelist, restart the build to continue where
  1452. it left off.
  1453. During the build, the prompt will not appear again
  1454. since you have satisfied the requirement.</para>
  1455. <para>Once the appropriate license flags are on the
  1456. white list in the
  1457. <filename>LICENSE_FLAGS_WHITELIST</filename> variable,
  1458. you can build the encumbered image with no change
  1459. at all to the normal build process.
  1460. </para></listitem>
  1461. <listitem><para>
  1462. <emphasis>Get a Pre-Built Version of the BSP:</emphasis>
  1463. You can get this type of BSP by selecting the
  1464. "DOWNLOADS" item from the "SOFTWARE" tab on the
  1465. <ulink url='&YOCTO_HOME_URL;'>Yocto Project website</ulink>.
  1466. You can download BSP tarballs that contain
  1467. proprietary components after agreeing to the
  1468. licensing requirements of each of the individually
  1469. encumbered packages as part of the download process.
  1470. Obtaining the BSP this way allows you to access an
  1471. encumbered image immediately after agreeing to the
  1472. click-through license agreements presented by the
  1473. website.
  1474. If you want to build the image yourself using
  1475. the recipes contained within the BSP tarball,
  1476. you will still need to create an appropriate
  1477. <filename>LICENSE_FLAGS_WHITELIST</filename>
  1478. to match the encumbered recipes in the BSP.
  1479. </para></listitem>
  1480. </orderedlist>
  1481. <note>
  1482. Pre-compiled images are bundled with a time-limited
  1483. kernel that runs for a predetermined amount of time
  1484. (10 days) before it forces the system to reboot.
  1485. This limitation is meant to discourage direct
  1486. redistribution of the image.
  1487. You must eventually rebuild the image if you want
  1488. to remove this restriction.
  1489. </note>
  1490. </para>
  1491. </section>
  1492. <section id='creating-a-new-bsp-layer-using-the-bitbake-layers-script'>
  1493. <title>Creating a new BSP Layer Using the <filename>bitbake-layers</filename> Script</title>
  1494. <para>
  1495. The <filename>bitbake-layers create-layer</filename> script
  1496. automates creating a BSP layer.
  1497. What makes a layer a "BSP layer", is the presence of a machine
  1498. configuration file.
  1499. Additionally, a BSP layer usually has a kernel recipe
  1500. or an append file that leverages off an existing kernel recipe.
  1501. The primary requirement, however, is the machine configuration.
  1502. </para>
  1503. <para>
  1504. Use these steps to create a BSP layer:
  1505. <itemizedlist>
  1506. <listitem><para>
  1507. <emphasis>Create a General Layer:</emphasis>
  1508. Use the <filename>bitbake-layers</filename> script with the
  1509. <filename>create-layer</filename> subcommand to create a
  1510. new general layer.
  1511. For instructions on how to create a general layer using the
  1512. <filename>bitbake-layers</filename> script, see the
  1513. "<ulink url='&YOCTO_DOCS_DEV_URL;#creating-a-general-layer-using-the-bitbake-layers-script'>Creating a General Layer Using the <filename>bitbake-layers</filename> Script</ulink>"
  1514. section in the Yocto Project Development Tasks Manual.
  1515. </para></listitem>
  1516. <listitem><para>
  1517. <emphasis>Create a Layer Configuration File:</emphasis>
  1518. Every layer needs a layer configuration file.
  1519. This configuration file establishes locations for the
  1520. layer's recipes, priorities for the layer, and so forth.
  1521. You can find examples of <filename>layer.conf</filename>
  1522. files in the Yocto Project
  1523. <ulink url='&YOCTO_GIT_URL;'>Source Repositories</ulink>.
  1524. To get examples of what you need in your configuration
  1525. file, locate a layer (e.g. "meta-ti") and examine the
  1526. <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/meta-ti/tree/conf/layer.conf'></ulink>
  1527. file.
  1528. </para></listitem>
  1529. <listitem><para>
  1530. <emphasis>Create a Machine Configuration File:</emphasis>
  1531. Create a <filename>conf/machine/</filename><replaceable>bsp_root_name</replaceable><filename>.conf</filename>
  1532. file.
  1533. See
  1534. <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta-yocto-bsp/conf/machine'><filename>meta-yocto-bsp/conf/machine</filename></ulink>
  1535. for sample
  1536. <replaceable>bsp_root_name</replaceable><filename>.conf</filename>
  1537. files.
  1538. Other samples such as
  1539. <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/meta-ti/tree/conf/machine'><filename>meta-ti</filename></ulink>
  1540. and
  1541. <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/meta-freescale/tree/conf/machine'><filename>meta-freescale</filename></ulink>
  1542. exist from other vendors that have more specific machine
  1543. and tuning examples.
  1544. </para></listitem>
  1545. <listitem><para>
  1546. <emphasis>Create a Kernel Recipe:</emphasis>
  1547. Create a kernel recipe in <filename>recipes-kernel/linux</filename>
  1548. by either using a kernel append file or a new custom kernel
  1549. recipe file (e.g. <filename>yocto-linux_4.12.bb</filename>).
  1550. The BSP layers mentioned in the previous step also contain different
  1551. kernel examples.
  1552. See the
  1553. "<ulink url='&YOCTO_DOCS_KERNEL_DEV_URL;#modifying-an-existing-recipe'>Modifying an Existing Recipe</ulink>"
  1554. section in the Yocto Project Linux Kernel Development Manual
  1555. for information on how to create a custom kernel.
  1556. </para></listitem>
  1557. </itemizedlist>
  1558. </para>
  1559. <para>
  1560. The remainder of this section provides a description of
  1561. the Yocto Project reference BSP for Beaglebone, which
  1562. resides in the
  1563. <ulink url='&YOCTO_DOCS_REF_URL;#term-container-layer'>Container Layer</ulink>
  1564. (i.e.
  1565. <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta-yocto-bsp'><filename>meta-yocto-bsp</filename></ulink>).
  1566. </para>
  1567. <section id='bsp-layer-configuration-example'>
  1568. <title>BSP Layer Configuration Example</title>
  1569. <para>
  1570. The layer's <filename>conf</filename> directory
  1571. contains the <filename>layer.conf</filename>
  1572. configuration file.
  1573. In this example, the
  1574. <filename>conf/layer.conf</filename> is the
  1575. following:
  1576. <literallayout class='monospaced'>
  1577. # We have a conf and classes directory, add to BBPATH
  1578. BBPATH .= ":${LAYERDIR}"
  1579. # We have recipes-* directories, add to BBFILES
  1580. BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
  1581. ${LAYERDIR}/recipes-*/*/*.bbappend"
  1582. BBFILE_COLLECTIONS += "yoctobsp"
  1583. BBFILE_PATTERN_yoctobsp = "^${LAYERDIR}/"
  1584. BBFILE_PRIORITY_yoctobsp = "5"
  1585. LAYERVERSION_yoctobsp = "4"
  1586. LAYERSERIES_COMPAT_yoctobsp = "&DISTRO_NAME_NO_CAP;"
  1587. </literallayout>
  1588. The variables used in this file configure the
  1589. layer.
  1590. A good way to learn about layer configuration
  1591. files is to examine various files for BSP from
  1592. the
  1593. <ulink url='&YOCTO_GIT_URL;'>Source Repositories</ulink>.
  1594. </para>
  1595. <para>
  1596. For a detailed description of this particular
  1597. layer configuration file, see
  1598. "<ulink url='&YOCTO_DOCS_DEV_URL;#dev-layer-config-file-description'>step 3</ulink>
  1599. in the discussion that describes how to create
  1600. layers in the Yocto Project Development Tasks Manual.
  1601. </para>
  1602. </section>
  1603. <section id='bsp-machine-configuration-example'>
  1604. <title>BSP Machine Configuration Example</title>
  1605. <para>
  1606. As mentioned earlier in this section, the existence
  1607. of a machine configuration file is what makes a
  1608. layer a BSP layer as compared to a general or
  1609. kernel layer.
  1610. </para>
  1611. <para>
  1612. Machine configuration files exist in the
  1613. <replaceable>bsp_layer</replaceable><filename>/conf/machine/</filename>
  1614. directory of the layer:
  1615. <literallayout class='monospaced'>
  1616. <replaceable>bsp_layer</replaceable><filename>/conf/machine/</filename><replaceable>machine</replaceable><filename>.conf</filename>
  1617. </literallayout>
  1618. For example, the machine configuration file for the
  1619. <ulink url='http://beagleboard.org/bone'>BeagleBone and BeagleBone Black development boards</ulink>
  1620. is located in the container layer
  1621. <filename>poky/meta-yocto-bsp/conf/machine</filename>
  1622. and is named <filename>beaglebone-yocto.conf</filename>:
  1623. <literallayout class='monospaced'>
  1624. #@TYPE: Machine
  1625. #@NAME: Beaglebone-yocto machine
  1626. #@DESCRIPTION: Reference machine configuration for http://beagleboard.org/bone and http://beagleboard.org/black boards
  1627. PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg"
  1628. XSERVER ?= "xserver-xorg \
  1629. xf86-video-modesetting \
  1630. "
  1631. MACHINE_EXTRA_RRECOMMENDS = "kernel-modules kernel-devicetree"
  1632. EXTRA_IMAGEDEPENDS += "u-boot"
  1633. DEFAULTTUNE ?= "cortexa8hf-neon"
  1634. include conf/machine/include/tune-cortexa8.inc
  1635. IMAGE_FSTYPES += "tar.bz2 jffs2 wic wic.bmap"
  1636. EXTRA_IMAGECMD_jffs2 = "-lnp "
  1637. WKS_FILE ?= "beaglebone-yocto.wks"
  1638. IMAGE_INSTALL_append = " kernel-devicetree kernel-image-zimage"
  1639. do_image_wic[depends] += "mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot"
  1640. SERIAL_CONSOLES = "115200;ttyO0"
  1641. PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
  1642. PREFERRED_VERSION_linux-yocto ?= "4.12%"
  1643. KERNEL_IMAGETYPE = "zImage"
  1644. KERNEL_DEVICETREE = "am335x-bone.dtb am335x-boneblack.dtb am335x-bonegreen.dtb"
  1645. KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
  1646. SPL_BINARY = "MLO"
  1647. UBOOT_SUFFIX = "img"
  1648. UBOOT_MACHINE = "am335x_boneblack_config"
  1649. UBOOT_ENTRYPOINT = "0x80008000"
  1650. UBOOT_LOADADDRESS = "0x80008000"
  1651. MACHINE_FEATURES = "usbgadget usbhost vfat alsa"
  1652. IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} MLO"
  1653. </literallayout>
  1654. The variables used to configure the machine define
  1655. machine-specific properties.
  1656. For example, machine-dependent packages, machine
  1657. tunings, the type of kernel to build, and
  1658. U-Boot configurations.
  1659. </para>
  1660. <para>
  1661. The following list provides some explanation
  1662. for the statements found in the example reference
  1663. machine configuration file for the BeagleBone
  1664. development boards.
  1665. Realize that much more can be defined as part of
  1666. a machines configuration file.
  1667. In general, you can learn about related variables
  1668. that this example does not have by locating the
  1669. variables in the
  1670. "<ulink url='&YOCTO_DOCS_REF_URL;#ref-variables-glos'>Yocto Project Variables Glossary</ulink>"
  1671. in the Yocto Project Reference Manual.
  1672. <itemizedlist>
  1673. <listitem><para>
  1674. <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER_virtual/xserver</filename></ulink>:
  1675. The recipe that provides "virtual/xserver" when
  1676. more than one provider is found.
  1677. In this case, the recipe that provides
  1678. "virtual/xserver" is "xserver-xorg", which
  1679. exists in
  1680. <filename>poky/meta/recipes-graphics/xserver-xorg</filename>.
  1681. </para></listitem>
  1682. <listitem><para>
  1683. <ulink url='&YOCTO_DOCS_REF_URL;#var-XSERVER'><filename>XSERVER</filename></ulink>:
  1684. The packages that should be installed to provide
  1685. an X server and drivers for the machine.
  1686. In this example, the "xserver-xorg" and
  1687. "xf86-video-modesetting" are installed.
  1688. </para></listitem>
  1689. <listitem><para>
  1690. <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE_EXTRA_RRECOMMENDS'><filename>MACHINE_EXTRA_RRECOMMENDS</filename></ulink>:
  1691. A list of machine-dependent packages
  1692. not essential for booting the image.
  1693. Thus, the build does not fail if the packages
  1694. do not exist.
  1695. However, the packages are required for a
  1696. fully-featured image.
  1697. <note><title>Tip</title>
  1698. Many <filename>MACHINE*</filename> variables
  1699. exist that help you configure a particular
  1700. piece of hardware.
  1701. </note>
  1702. </para></listitem>
  1703. <listitem><para>
  1704. <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_IMAGEDEPENDS'><filename>EXTRA_IMAGEDEPENDS</filename></ulink>:
  1705. Recipes to build that do not provide packages
  1706. for installing into the root filesystem
  1707. but building the image depends on the
  1708. recipes.
  1709. Sometimes a recipe is required to build
  1710. the final image but is not needed in the
  1711. root filesystem.
  1712. In this case, the U-Boot recipe must be
  1713. built for the image.
  1714. </para></listitem>
  1715. <listitem><para>
  1716. <ulink url='&YOCTO_DOCS_REF_URL;#var-DEFAULTTUNE'><filename>DEFAULTTUNE</filename></ulink>:
  1717. Machines use tunings to optimize machine,
  1718. CPU, and application performance.
  1719. These features, which are collectively known
  1720. as "tuning features", exist in the
  1721. <ulink url='&YOCTO_DOCS_REF_URL;#oe-core'>OpenEmbedded-Core (OE-Core)</ulink>
  1722. layer (e.g.
  1723. <filename>poky/meta/conf/machine/include</filename>).
  1724. In this example, the default tunning file is
  1725. "cortexa8hf-neon".
  1726. <note>
  1727. The <filename>include</filename> statement
  1728. that pulls in the
  1729. <filename>conf/machine/include/tune-cortexa8.inc</filename>
  1730. file provides many tuning possibilities.
  1731. </note>
  1732. </para></listitem>
  1733. <listitem><para>
  1734. <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_FSTYPES'><filename>IMAGE_FSTYPES</filename></ulink>:
  1735. The formats the OpenEmbedded build system
  1736. uses during the build when creating the
  1737. root filesystem.
  1738. In this example, four types of images are
  1739. supported.
  1740. </para></listitem>
  1741. <listitem><para>
  1742. <ulink url='&YOCTO_DOCS_REF_URL;#var-EXTRA_IMAGECMD'><filename>EXTRA_IMAGECMD</filename></ulink>:
  1743. Specifies additional options for image
  1744. creation commands.
  1745. In this example, the "-lnp " option is used
  1746. when creating the
  1747. <ulink url='https://en.wikipedia.org/wiki/JFFS2'>JFFS2</ulink>
  1748. image.
  1749. </para></listitem>
  1750. <listitem><para>
  1751. <ulink url='&YOCTO_DOCS_REF_URL;#var-WKS_FILE'><filename>WKS_FILE</filename></ulink>:
  1752. The location of the
  1753. <ulink url='&YOCTO_DOCS_REF_URL;#ref-kickstart'>Wic kickstart</ulink>
  1754. file used by the OpenEmbedded build system to
  1755. create a partitioned image (image.wic).
  1756. </para></listitem>
  1757. <listitem><para>
  1758. <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_INSTALL'><filename>IMAGE_INSTALL</filename></ulink>:
  1759. Specifies packages to install into an image
  1760. through the
  1761. <ulink url='&YOCTO_DOCS_REF_URL;#ref-classes-image'><filename>image</filename></ulink>
  1762. class.
  1763. Recipes use the <filename>IMAGE_INSTALL</filename>
  1764. variable.
  1765. </para></listitem>
  1766. <listitem><para>
  1767. <filename>do_image_wic[depends]</filename>:
  1768. A task that is constructed during the build.
  1769. In this example, the task depends on specific tools
  1770. in order to create the sysroot when buiding a Wic
  1771. image.
  1772. </para></listitem>
  1773. <listitem><para>
  1774. <ulink url='&YOCTO_DOCS_REF_URL;#var-SERIAL_CONSOLES'><filename>SERIAL_CONSOLES</filename></ulink>:
  1775. Defines a serial console (TTY) to enable using
  1776. getty.
  1777. In this case, the baud rate is "115200" and the
  1778. device name is "ttyO0".
  1779. </para></listitem>
  1780. <listitem><para>
  1781. <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_PROVIDER'><filename>PREFERRED_PROVIDER_virtual/kernel</filename></ulink>:
  1782. Specifies the recipe that provides
  1783. "virtual/kernel" when more than one provider
  1784. is found.
  1785. In this case, the recipe that provides
  1786. "virtual/kernel" is "linux-yocto", which
  1787. exists in the layer's
  1788. <filename>recipes-kernel/linux</filename> directory.
  1789. </para></listitem>
  1790. <listitem><para>
  1791. <ulink url='&YOCTO_DOCS_REF_URL;#var-PREFERRED_VERSION'><filename>PREFERRED_VERSION_linux-yocto</filename></ulink>:
  1792. Defines the version of the recipe used
  1793. to build the kernel, which is "4.12" in this
  1794. case.
  1795. </para></listitem>
  1796. <listitem><para>
  1797. <ulink url='&YOCTO_DOCS_REF_URL;#var-KERNEL_IMAGETYPE'><filename>KERNEL_IMAGETYPE</filename></ulink>:
  1798. The type of kernel to build for the device.
  1799. In this case, the OpenEmbedded build system
  1800. creates a "zImage" image type.
  1801. </para></listitem>
  1802. <listitem><para>
  1803. <ulink url='&YOCTO_DOCS_REF_URL;#var-KERNEL_DEVICETREE'><filename>KERNEL_DEVICETREE</filename></ulink>:
  1804. The name of the generated Linux kernel device
  1805. tree (i.e. the <filename>.dtb</filename>) file.
  1806. All the device trees for the various BeagleBone
  1807. devices are included.
  1808. <!--
  1809. You have to include some *.inc files according to the definition of KERNEL_DEVICETREE.
  1810. I don't see where these are being provided.
  1811. -->
  1812. </para></listitem>
  1813. <listitem><para>
  1814. <ulink url='&YOCTO_DOCS_REF_URL;#var-KERNEL_EXTRA_ARGS'><filename>KERNEL_EXTRA_ARGS</filename></ulink>:
  1815. Additional <filename>make</filename>
  1816. command-line arguments the OpenEmbedded build
  1817. system passes on when compiling the kernel.
  1818. In this example, "LOADADDR=${UBOOT_ENTRYPOINT}"
  1819. is passed as a command-line argument.
  1820. </para></listitem>
  1821. <listitem><para>
  1822. <ulink url='&YOCTO_DOCS_REF_URL;#var-SPL_BINARY'><filename>SPL_BINARY</filename></ulink>:
  1823. Defines the Secondary Program Loader (SPL) binary
  1824. type.
  1825. In this case, the SPL binary is set to
  1826. "MLO", which stands for Multimedia card LOader.
  1827. </para>
  1828. <para>The BeagleBone development board requires an
  1829. SPL to boot and that SPL file type must be MLO.
  1830. Consequently, the machine configuration needs to
  1831. define <filename>SPL_BINARY</filename> as "MLO".
  1832. <note>
  1833. For more information on how the SPL variables
  1834. are used, see the
  1835. <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta/recipes-bsp/u-boot/u-boot.inc'><filename>u-boot.inc</filename></ulink>
  1836. include file.
  1837. </note>
  1838. </para></listitem>
  1839. <listitem><para>
  1840. <ulink url='&YOCTO_DOCS_REF_URL;#var-UBOOT_ENTRYPOINT'><filename>UBOOT_*</filename></ulink>:
  1841. Defines various U-Boot configurations needed
  1842. to build a U-Boot image.
  1843. In this example, a U-Boot image is required
  1844. to boot the BeagleBone device.
  1845. See the following variables for more information:
  1846. <itemizedlist>
  1847. <listitem><para>
  1848. <ulink url='&YOCTO_DOCS_REF_URL;#var-UBOOT_SUFFIX'><filename>UBOOT_SUFFIX</filename></ulink>:
  1849. Points to the generated U-Boot extension.
  1850. </para></listitem>
  1851. <listitem><para>
  1852. <ulink url='&YOCTO_DOCS_REF_URL;#var-UBOOT_MACHINE'><filename>UBOOT_MACHINE</filename></ulink>:
  1853. Specifies the value passed on the make command line when building a U-Boot image.
  1854. </para></listitem>
  1855. <listitem><para>
  1856. <ulink url='&YOCTO_DOCS_REF_URL;#var-UBOOT_ENTRYPOINT'><filename>UBOOT_ENTRYPOINT</filename></ulink>:
  1857. Specifies the entry point for the U-Boot image.
  1858. </para></listitem>
  1859. <listitem><para>
  1860. <ulink url='&YOCTO_DOCS_REF_URL;#var-UBOOT_LOADADDRESS'><filename>UBOOT_LOADADDRESS</filename></ulink>:
  1861. Specifies the load address for the U-Boot image.
  1862. </para></listitem>
  1863. </itemizedlist>
  1864. </para></listitem>
  1865. <listitem><para>
  1866. <ulink url='&YOCTO_DOCS_REF_URL;#var-MACHINE_FEATURES'><filename>MACHINE_FEATURES</filename></ulink>:
  1867. Specifies the list of hardware features the
  1868. BeagleBone device is capable of supporting.
  1869. In this case, the device supports
  1870. "usbgadget usbhost vfat alsa".
  1871. </para></listitem>
  1872. <listitem><para>
  1873. <ulink url='&YOCTO_DOCS_REF_URL;#var-IMAGE_BOOT_FILES'><filename>IMAGE_BOOT_FILES</filename></ulink>:
  1874. Files installed into the device's boot partition
  1875. when preparing the image using the Wic tool
  1876. with the <filename>bootimg-partition</filename>
  1877. source plugin.
  1878. In this case, the "u-boot.${UBOOT_SUFFIX}" and
  1879. "MLO" files are installed.
  1880. </para></listitem>
  1881. </itemizedlist>
  1882. </para>
  1883. </section>
  1884. <section id='bsp-kernel-recipe-example'>
  1885. <title>BSP Kernel Recipe Example</title>
  1886. <para>
  1887. The kernel recipe used to build the kernel image
  1888. for the BeagleBone device was established in the
  1889. machine configuration:
  1890. <literallayout class='monospaced'>
  1891. PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
  1892. PREFERRED_VERSION_linux-yocto ?= "4.12%"
  1893. </literallayout>
  1894. The <filename>meta-yocto-bsp/recipes-kernel/linux</filename>
  1895. directory in the layer contains metadata used
  1896. to build the kernel.
  1897. In this case, a kernel append file is used to
  1898. override an established kernel recipe, which is
  1899. located in
  1900. <ulink url='&YOCTO_GIT_URL;/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/linux'></ulink>
  1901. and named
  1902. <filename>linux-yocto_4.12.bb</filename>.
  1903. </para>
  1904. <para>
  1905. Following is the contents of the append file:
  1906. <literallayout class='monospaced'>
  1907. KBRANCH_genericx86 = "standard/base"
  1908. KBRANCH_genericx86-64 = "standard/base"
  1909. KMACHINE_genericx86 ?= "common-pc"
  1910. KMACHINE_genericx86-64 ?= "common-pc-64"
  1911. KBRANCH_edgerouter = "standard/edgerouter"
  1912. KBRANCH_beaglebone-yocto = "standard/beaglebone"
  1913. KMACHINE_beaglebone-yocto = "beaglebone"
  1914. KBRANCH_mpc8315e-rdb = "standard/fsl-mpc8315e-rdb"
  1915. SRCREV_machine_genericx86 ?= "1c4ad569af3e23a77994235435040e322908687f"
  1916. SRCREV_machine_genericx86-64 ?= "1c4ad569af3e23a77994235435040e322908687f"
  1917. SRCREV_machine_edgerouter ?= "257f843ea367744620f1d92910afd2f454e31483"
  1918. SRCREV_machine_beaglebone-yocto ?= "257f843ea367744620f1d92910afd2f454e31483"
  1919. SRCREV_machine_mpc8315e-rdb ?= "014560874f9eb2a86138c9cc35046ff1720485e1"
  1920. COMPATIBLE_MACHINE_genericx86 = "genericx86"
  1921. COMPATIBLE_MACHINE_genericx86-64 = "genericx86-64"
  1922. COMPATIBLE_MACHINE_edgerouter = "edgerouter"
  1923. COMPATIBLE_MACHINE_beaglebone-yocto = "beaglebone-yocto"
  1924. COMPATIBLE_MACHINE_mpc8315e-rdb = "mpc8315e-rdb"
  1925. LINUX_VERSION_genericx86 = "4.12.20"
  1926. LINUX_VERSION_genericx86-64 = "4.12.20"
  1927. LINUX_VERSION_edgerouter = "4.12.19"
  1928. LINUX_VERSION_beaglebone-yocto = "4.12.19"
  1929. LINUX_VERSION_mpc8315e-rdb = "4.12.19"
  1930. </literallayout>
  1931. This particular append file works for all the
  1932. machines that are part of the
  1933. <filename>meta-yocto-bsp</filename> container
  1934. layer.
  1935. The relevant statements are appended with
  1936. the "beaglebone-yocto" string.
  1937. The OpenEmbedded build system uses these
  1938. statements to override similar statements
  1939. in the kernel recipe:
  1940. <itemizedlist>
  1941. <listitem><para>
  1942. <ulink url='&YOCTO_DOCS_REF_URL;#var-KBRANCH'><filename>KBRANCH</filename></ulink>:
  1943. Identifies the kernel branch that is validated,
  1944. patched, and configured during the build.
  1945. </para></listitem>
  1946. <listitem><para>
  1947. <ulink url='&YOCTO_DOCS_REF_URL;#var-KMACHINE'><filename>KMACHINE</filename></ulink>:
  1948. Identifies the machine name as known by the
  1949. kernel, which is sometimes a different name
  1950. than what is known by the OpenEmbedded build
  1951. system.
  1952. </para></listitem>
  1953. <listitem><para>
  1954. <ulink url='&YOCTO_DOCS_REF_URL;#var-SRCREV'><filename>SRCREV</filename></ulink>:
  1955. Identifies the revision of the source code used
  1956. to build the image.
  1957. <!--
  1958. You find out about that point in the kernel source tree by
  1959. doing the following command:
  1960. git log &dash;&dash;decorate 257f843ea367744620f1d92910afd2f454e31483
  1961. Returns information about the commit, which is usually
  1962. that it is a merge point for a stable kernel release.
  1963. -->
  1964. </para></listitem>
  1965. <listitem><para>
  1966. <ulink url='&YOCTO_DOCS_REF_URL;#var-COMPATIBLE_MACHINE'><filename>COMPATIBLE_MACHINE</filename></ulink>:
  1967. A regular expression that resolves to one or
  1968. more target machines with which the recipe
  1969. is compatible.
  1970. </para></listitem>
  1971. <listitem><para>
  1972. <ulink url='&YOCTO_DOCS_REF_URL;#var-LINUX_VERSION'><filename>LINUX_VERSION</filename></ulink>:
  1973. The Linux version from kernel.org used by
  1974. the OpenEmbedded build system to build the
  1975. kernel image.
  1976. </para></listitem>
  1977. </itemizedlist>
  1978. </para>
  1979. </section>
  1980. </section>
  1981. </chapter>