bsp.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  2. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
  3. <chapter id='bsp'>
  4. <title>Board Support Packages (BSP) - Developers Guide</title>
  5. <para>
  6. A Board Support Package (BSP) is a collection of information which together
  7. defines how to support a particular hardware device, set of devices, or
  8. hardware platform. It will include information about the hardware features
  9. present on the device and kernel configuration information along with any
  10. additional hardware drivers required. It will also list any additional software
  11. components required in addition to a generic Linux software stack for both
  12. essential and optional platform features.
  13. </para>
  14. <para>
  15. The intent of this document is to define a structure for these components
  16. so that BSPs follow a commonly understood layout, allowing them to be
  17. provided in a common form that everyone understands. It also allows end-users
  18. to become familiar with one common format and encourages standardisation
  19. of software support of hardware.
  20. </para>
  21. <para>
  22. The proposed format does have elements that are specific to the Poky and
  23. OpenEmbedded build systems. It is intended that this information can be
  24. used by other systems besides Poky/OpenEmbedded and that it will be simple
  25. to extract information and convert to other formats if required. The format
  26. described can be directly accepted as a layer by Poky using its standard
  27. layers mechanism, but it is important to recognise that the BSP captures all
  28. the hardware specific details in one place in a standard format, which is
  29. useful for any person wishing to use the hardware platform regardless of
  30. the build system in use.
  31. </para>
  32. <para>
  33. The BSP specification does not include a build system or other tools -
  34. it is concerned with the hardware specific components only. At the end
  35. distribution point the BSP may be shipped combined with a build system
  36. and other tools, but it is important to maintain the distinction that these
  37. are separate components which may just be combined in certain end products.
  38. </para>
  39. <section id='bsp-filelayout'>
  40. <title>Example Filesystem Layout</title>
  41. <para>
  42. The BSP consists of a file structure inside a base directory, meta-bsp in this example, where "bsp" is a placeholder for the machine or platform name. Examples of some files that it could contain are:
  43. </para>
  44. <para>
  45. <programlisting>
  46. meta-bsp/
  47. meta-bsp/binary/zImage
  48. meta-bsp/binary/poky-image-minimal.directdisk
  49. meta-bsp/conf/layer.conf
  50. meta-bsp/conf/machine/*.conf
  51. meta-bsp/conf/machine/include/tune-*.inc
  52. meta-bsp/packages/bootloader/bootloader_0.1.bb
  53. meta-bsp/packages/linux/linux-bsp-2.6.50/*.patch
  54. meta-bsp/packages/linux/linux-bsp-2.6.50/defconfig-bsp
  55. meta-bsp/packages/linux/linux-bsp_2.6.50.bb
  56. meta-bsp/packages/modem/modem-driver_0.1.bb
  57. meta-bsp/packages/modem/modem-daemon_0.1.bb
  58. meta-bsp/packages/image-creator/image-creator-native_0.1.bb
  59. meta-bsp/prebuilds/
  60. </programlisting>
  61. </para>
  62. <para>
  63. The following sections detail what these files and directories could contain.
  64. </para>
  65. </section>
  66. <section id='bsp-filelayout-binary'>
  67. <title>Prebuilt User Binaries (meta-bsp/binary/*)</title>
  68. <para>
  69. This optional area contains useful prebuilt kernels and userspace filesystem
  70. images appropriate to the target system. Users could use these to get a system
  71. running and quickly get started on development tasks. The exact types of binaries
  72. present will be highly hardware-dependent but a README file should be present
  73. explaining how to use them with the target hardware. If prebuilt binaries are
  74. present, source code to meet licensing requirements must also be provided in
  75. some form.
  76. </para>
  77. </section>
  78. <section id='bsp-filelayout-layer'>
  79. <title>Layer Configuration (meta-bsp/conf/layer.conf)</title>
  80. <para>
  81. This file identifies the structure as a Poky layer. This file identifies the
  82. contents of the layer and contains information about how Poky should use
  83. it. In general it will most likely be a standard boilerplate file consisting of:
  84. </para>
  85. <para>
  86. <programlisting>
  87. # We have a conf directory, add to BBPATH
  88. BBPATH := "${BBPATH}${LAYERDIR}"
  89. # We have a packages directory, add to BBFILES
  90. BBFILES := "${BBFILES} ${LAYERDIR}/packages/*/*.bb"
  91. BBFILE_COLLECTIONS += "bsp"
  92. BBFILE_PATTERN_bsp := "^${LAYERDIR}/"
  93. BBFILE_PRIORITY_bsp = "5"
  94. </programlisting>
  95. </para>
  96. <para>
  97. which simply makes bitbake aware of the packages and conf directories.
  98. </para>
  99. <para>
  100. This file is required for recognition of the BSP by Poky.
  101. </para>
  102. </section>
  103. <section id='bsp-filelayout-machine'>
  104. <title>Hardware Configuration Options (meta-bsp/conf/machine/*.conf)</title>
  105. <para>
  106. The machine files bind together all the information contained elsewhere
  107. in the BSP into a format that Poky/OpenEmbedded can understand. If
  108. the BSP supports multiple machines, multiple machine configuration files
  109. can be present. These filenames correspond to the values users set the
  110. MACHINE variable to.
  111. </para>
  112. <para>
  113. These files would define things like which kernel package to use
  114. (PREFERRED_PROVIDER of virtual/kernel), which hardware drivers to
  115. include in different types of images, any special software components
  116. that are needed, any bootloader information, and also any special image
  117. format requirements.
  118. </para>
  119. <para>
  120. At least one machine file is required for a Poky BSP layer but more than one may be present.
  121. </para>
  122. </section>
  123. <section id='bsp-filelayout-tune'>
  124. <title>Hardware Optimisation Options (meta-bsp/conf/machine/include/tune-*.inc)</title>
  125. <para>
  126. These are shared hardware "tuning" definitions and are commonly used to
  127. pass specific optimisation flags to the compiler. An example is
  128. tune-atom.inc:
  129. </para>
  130. <para>
  131. <programlisting>
  132. BASE_PACKAGE_ARCH = "core2"
  133. TARGET_CC_ARCH = "-m32 -march=core2 -msse3 -mtune=generic -mfpmath=sse"
  134. </programlisting>
  135. </para>
  136. <para>
  137. which defines a new package architecture called "core2" and uses the
  138. optimization flags specified, which are carefully chosen to give best
  139. performance on atom cpus.
  140. </para>
  141. <para>
  142. The tune file would be included by the machine definition and can be
  143. contained in the BSP or reference one from the standard core set of
  144. files included with Poky itself.
  145. </para>
  146. <para>
  147. These files are optional for a Poky BSP layer.
  148. </para>
  149. </section>
  150. <section id='bsp-filelayout-kernel'>
  151. <title>Linux Kernel Configuration (meta-bsp/packages/linux/*)</title>
  152. <para>
  153. These files make up the definition of a kernel to use with this
  154. hardware. In this case it is a complete self-contained kernel with its own
  155. configuration and patches but kernels can be shared between many
  156. machines as well. Taking some specific example files:
  157. </para>
  158. <para>
  159. <programlisting>
  160. meta-bsp/packages/linux/linux-bsp_2.6.50.bb
  161. </programlisting>
  162. </para>
  163. <para>
  164. which is the core kernel recipe which firstly details where to get the kernel
  165. source from. All standard source code locations are supported so this could
  166. be a release tarball, some git repository, or source included in
  167. the directory within the BSP itself. It then contains information about which
  168. patches to apply and how to configure and build it. It can reuse the main
  169. Poky kernel build class, so the definitions here can remain very simple.
  170. </para>
  171. <para>
  172. <programlisting>
  173. linux-bsp-2.6.50/*.patch
  174. </programlisting>
  175. </para>
  176. <para>
  177. which are patches which may be applied against the base kernel, wherever
  178. they may have been obtained from.
  179. </para>
  180. <para>
  181. <programlisting>
  182. meta-bsp/packages/linux/linux-bsp-2.6.50/defconfig-bsp
  183. </programlisting>
  184. </para>
  185. <para>
  186. which is the configuration information to use to configure the kernel.
  187. </para>
  188. <para>
  189. Examples of kernel recipes are available in Poky itself. These files are
  190. optional since a kernel from Poky itself could be selected, although it
  191. would be unusual not to have a kernel configuration.
  192. </para>
  193. </section>
  194. <section id='bsp-filelayout-packages'>
  195. <title>Other Software (meta-bsp/packages/*)</title>
  196. <para>
  197. This area includes other pieces of software which the hardware may need for best
  198. operation. These are just examples of the kind of things that may be
  199. encountered. These are standard .bb file recipes in the usual Poky format,
  200. so for examples, see standard Poky recipes. The source can be included directly,
  201. referred to in source control systems or release tarballs of external software projects.
  202. </para>
  203. <para>
  204. <programlisting>
  205. meta-bsp/packages/bootloader/bootloader_0.1.bb
  206. </programlisting>
  207. </para>
  208. <para>
  209. Some kind of bootloader recipe which may be used to generate a new
  210. bootloader binary. Sometimes these are included in the final image
  211. format and needed to reflash hardware.
  212. </para>
  213. <para>
  214. <programlisting>
  215. meta-bsp/packages/modem/modem-driver_0.1.bb
  216. meta-bsp/packages/modem/modem-daemon_0.1.bb
  217. </programlisting>
  218. </para>
  219. <para>
  220. These are examples of a hardware driver and also a hardware daemon which
  221. may need to be included in images to make the hardware useful. "modem"
  222. is one example but there may be other components needed like firmware.
  223. </para>
  224. <para>
  225. <programlisting>
  226. meta-bsp/packages/image-creator/image-creator-native_0.1.bb
  227. </programlisting>
  228. </para>
  229. <para>
  230. Sometimes the device will need an image in a very specific format for
  231. its update mechanism to accept and reflash with it. Recipes to build the
  232. tools needed to do this can be included with the BSP.
  233. </para>
  234. <para>
  235. These files only need be provided if the platform requires them.
  236. </para>
  237. </section>
  238. <section id='bs-filelayout-bbappend'>
  239. <title>Append BSP specific information to existing recipes</title>
  240. <para>
  241. Say you have a recipe like pointercal which has machine-specific information in it,
  242. and then you have your new BSP code in a layer. Before the .bbappend extension was
  243. introduced, you'd have to copy the whole pointercal recipe and files into your layer,
  244. and then add the single file for your machine, which is ugly.
  245. .bbappend makes the above work much easier, to allow BSP-specific information to be merged
  246. with the original recipe easily. When bitbake finds any X.bbappend files, they will be
  247. included after bitbake loads X.bb but before finalise or anonymous methods run.
  248. This allows the BSP layer to poke around and do whatever it might want to customise
  249. the original recipe.
  250. .bbappend is expected to include the below two lines in the head (which may be changed
  251. in the future):
  252. </para>
  253. <programlisting>
  254. THISDIR := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
  255. FILESPATH =. "${@base_set_filespath(["${THISDIR}/${PN}"], d)}:"
  256. </programlisting>
  257. <para>
  258. Then the BSP could add machine-specific config files in layer directory, which will be
  259. added by bitbake. You can look at meta-emenlow/packages/formfactor as an example.
  260. </para>
  261. </section>
  262. <section id='bsp-filelayout-prebuilds'>
  263. <title>Prebuild Data (meta-bsp/prebuilds/*)</title>
  264. <para>
  265. The location can contain a precompiled representation of the source code
  266. contained elsewhere in the BSP layer. It can be processed and used by
  267. Poky to provide much faster build times, assuming a compatible configuration is used.
  268. </para>
  269. <para>
  270. These files are optional.
  271. </para>
  272. </section>
  273. <section id='bsp-click-through-licensing'>
  274. <title>BSP 'Click-through' Licensing Procedure</title>
  275. <note><para> This section is here as a description of how
  276. click-through licensing is expected to work, and is
  277. not yet not impemented.
  278. </para></note>
  279. <para>
  280. In some cases, a BSP may contain separately licensed IP
  281. (Intellectual Property) for a component, which imposes
  282. upon the user a requirement to accept the terms of a
  283. 'click-through' license. Once the license is accepted
  284. (in whatever form that may be, see details below) the
  285. Poky build system can then build and include the
  286. corresponding component in the final BSP image. Some
  287. affected components may be essential to the normal
  288. functioning of the system and have no 'free' replacement
  289. i.e. the resulting system would be non-functional
  290. without them. Other components may be simply
  291. 'good-to-have' or purely elective, or if essential
  292. nonetheless have a 'free' (possibly less-capable)
  293. version which may substituted for in the BSP recipe.
  294. </para>
  295. <para>
  296. For the latter cases, where it is possible to do so from
  297. a functionality perspective, the Poky website will make
  298. available a 'de-featured' BSP completely free of
  299. encumbered IP, which can be used directly and without
  300. any further licensing requirements. If present, this
  301. fully 'de-featured' BSP will be named meta-bsp (i.e. the
  302. normal default naming convention). This is the simplest
  303. and therefore preferred option if available, assuming
  304. the resulting functionality meets requirements.
  305. </para>
  306. <para>
  307. If however, a non-encumbered version is unavailable or
  308. the 'free' version would provide unsuitable
  309. functionality or quality, an encumbered version can be
  310. used. Encumbered versions of a BSP are given names of
  311. the form meta-bsp-nonfree. There are several ways
  312. within the Poky build system to satisfy the licensing
  313. requirements for an encumbered BSP, in roughly the
  314. following order of preference:
  315. </para>
  316. <itemizedlist>
  317. <listitem>
  318. <para>
  319. Get a license key (or keys) for the encumbered BSP
  320. by
  321. visiting <ulink url='https://pokylinux.org/bsp-keys.html'>https://pokylinux.org/bsp-keys.html</ulink>
  322. and give the web form there the name of the BSP
  323. and your e-mail address.
  324. </para>
  325. <programlisting>
  326. [screenshot of dialog box]
  327. </programlisting>
  328. <para>
  329. After agreeing to any applicable license terms, the
  330. BSP key(s) will be immediately sent to the address
  331. given and can be used by specifying BSPKEY_&lt;keydomain&gt;
  332. environment variables when building the image:
  333. </para>
  334. <programlisting>
  335. $ BSPKEY_&lt;keydomain&gt;=&lt;key&gt; bitbake poky-image-sato
  336. </programlisting>
  337. <para>
  338. This will allow the encumbered image to be built
  339. with no change at all to the normal build process.
  340. </para>
  341. <para>
  342. Equivalently and probably more conveniently, a line
  343. for each key can instead be put into the user's
  344. local.conf file.
  345. </para>
  346. <para>
  347. The &lt;keydomain&gt; component of the
  348. BSPKEY_&lt;keydomain&gt; is required because there
  349. may be multiple licenses in effect for a give BSP; a
  350. given &lt;keydomain&gt; in such cases corresponds to
  351. a particular license. In order for an encumbered
  352. BSP encompassing multiple key domains to be built
  353. successfully, a &lt;keydomain&gt; entry for each
  354. applicable license must be present in local.conf or
  355. supplied on the command-line.
  356. </para>
  357. </listitem>
  358. <listitem>
  359. <para>
  360. Do nothing - build as you normally would, and follow
  361. any license prompts that originate from the
  362. encumbered BSP (the build will cleanly stop at this
  363. point). These usually take the form of instructions
  364. needed to manually fetch the encumbered package(s)
  365. and md5 sums into e.g. the poky/build/downloads
  366. directory. Once the manual package fetch has been
  367. completed, restarting the build will continue where
  368. it left off, this time without the prompt since the
  369. license requirements will have been satisfied.
  370. </para>
  371. </listitem>
  372. <listitem>
  373. <para>
  374. Get a full-featured BSP recipe rather than a key, by
  375. visiting
  376. <ulink url='https://pokylinux.org/bsps.html'>https://pokylinux.org/bsps.html</ulink>.
  377. Accepting the license agreement(s) presented will
  378. subsequently allow you to download a tarball
  379. containing a full-featured BSP legally cleared for
  380. your use by the just-given license agreement(s).
  381. This method will also allow the encumbered image to
  382. be built with no change at all to the normal build
  383. process.
  384. </para>
  385. </listitem>
  386. </itemizedlist>
  387. <para>
  388. Note that method 3 is also the only option available
  389. when downloading pre-compiled images generated from
  390. non-free BSPs. Those images are likewise available at
  391. <ulink url='https://pokylinux.org/bsps.html'>https://pokylinux.org/bsps.html</ulink>.
  392. </para>
  393. </section>
  394. </chapter>