buildroot.html 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <title>Buildroot - Usage and documentation</title>
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  8. <link rel="stylesheet" type="text/css" href="stylesheet.css" />
  9. </head>
  10. <body>
  11. <div class="main">
  12. <div class="titre">
  13. <h1>Buildroot</h1>
  14. </div>
  15. <p><a href="http://buildroot.uclibc.org/">Buildroot</a>
  16. usage and documentation by Thomas Petazzoni. Contributions from
  17. Karsten Kruse, Ned Ludd, Martin Herren and others. </p>
  18. <p><small>$LastChangedDate$</small></p>
  19. <ul>
  20. <li><a href="#about">About Buildroot</a></li>
  21. <li><a href="#download">Obtaining Buildroot</a></li>
  22. <li><a href="#using">Using Buildroot</a></li>
  23. <li><a href="#custom_targetfs">Customizing the target filesystem</a></li>
  24. <li><a href="#custom_busybox">Customizing the Busybox
  25. configuration</a></li>
  26. <li><a href="#custom_uclibc">Customizing the uClibc
  27. configuration</a></li>
  28. <li><a href="#buildroot_innards">How Buildroot works</a></li>
  29. <li><a href="#using_toolchain">Using the uClibc toolchain</a></li>
  30. <li><a href="#toolchain_standalone">Using the uClibc toolchain
  31. outside of Buildroot</a></li>
  32. <li><a href="#downloaded_packages">Location of downloaded packages</a>
  33. </li>
  34. <li><a href="#add_software">Extending Buildroot with more
  35. Software</a></li>
  36. <li><a href="#links">Resources</a></li>
  37. </ul>
  38. <h2><a name="about" id="about"></a>About Buildroot</h2>
  39. <p>Buildroot is a set of Makefiles and patches that allow to easily
  40. generate both a cross-compilation toolchain and a root filesystem for your
  41. target. The cross-compilation toolchain uses uClibc (<a href=
  42. "http://www.uclibc.org/">http://www.uclibc.org/</a>), a tiny C standard
  43. library. </p>
  44. <p>Buildroot is useful mainly for people working with embedded systems.
  45. Embedded systems often use processors that are not the regular x86
  46. processors everyone is used to have on his PC. It can be PowerPC
  47. processors, MIPS processors, ARM processors, etc. </p>
  48. <p>A compilation toolchain is the set of tools that allows to
  49. compile code for your system. It consists of a compiler (in our
  50. case, <code>gcc</code>), binary utils like assembler and linker
  51. (in our case, <code>binutils</code>) and a C standard library (for
  52. example <a href="http://www.gnu.org/software/libc/libc.html">GNU
  53. Libc</a>, <a href="http://www.uclibc.org/">uClibc</a> or <a
  54. href="http://www.fefe.de/dietlibc/">dietlibc</a>). The system
  55. installed on your development station certainly already has a
  56. compilation toolchain that you can use to compile application that
  57. runs on your system. If you're using a PC, your compilation
  58. toolchain runs on an x86 processor and generates code for a x86
  59. processor. Under most Linux systems, the compilation toolchain
  60. uses the GNU libc as C standard library. This compilation
  61. toolchain is called the &quot;host compilation toolchain&quot;, and more
  62. generally, the machine on which it is running, and on which you're
  63. working is called the &quot;host system&quot;. The compilation toolchain
  64. is provided by your distribution, and Buildroot has nothing to do
  65. with it. </p>
  66. <p>As said above, the compilation toolchain that comes with your system
  67. runs and generates code for the processor of your host system. As your
  68. embedded system has a different processor, you need a cross-compilation
  69. toolchain: it's a compilation toolchain that runs on your host system but
  70. that generates code for your target system (and target processor). For
  71. example, if your host system uses x86 and your target system uses ARM, the
  72. regular compilation toolchain of your host runs on x86 and generates code
  73. for x86, while the cross-compilation toolchain runs on x86 and generates
  74. code for ARM. </p>
  75. <p>Even if your embedded system uses a x86 processor, you might interested
  76. in Buildroot, for two reasons:</p>
  77. <ul>
  78. <li>The compilation toolchain of your host certainly uses the GNU Libc
  79. which is a complete but huge C standard library. Instead of using GNU
  80. Libc on your target system, you can use uClibc which is a tiny C standard
  81. library. If you want to use this C library, then you need a compilation
  82. toolchain to generate binaries linked with it. Buildroot can do it for
  83. you. </li>
  84. <li>Buildroot automates the building of a root filesystem with all needed
  85. tools like busybox. It makes it much easier than doing it by hand. </li>
  86. </ul>
  87. <p>You might wonder why such a tool is needed when you can compile
  88. <code>gcc</code>, <code>binutils</code>, uClibc and all the tools by hand.
  89. Of course, doing so is possible. But dealing with all configure options,
  90. with all problems of every <code>gcc</code> or <code>binutils</code>
  91. version it very time-consuming and uninteresting. Buildroot automates this
  92. process through the use of Makefiles, and has a collection of patches for
  93. each <code>gcc</code> and <code>binutils</code> version to make them work
  94. on most architectures. </p>
  95. <h2><a name="download" id="download"></a>Obtaining Buildroot</h2>
  96. <p>Buildroot is available as daily SVN snapshots or directly using
  97. SVN. </p>
  98. <p>The latest snapshot is always available at <a
  99. href="http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2">http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2</a>,
  100. and previous snapshots are also available at <a
  101. href="http://buildroot.uclibc.org/downloads/snapshots/">http://buildroot.uclibc.org/downloads/snapshots/</a>. </p>
  102. <p>To download Buildroot using SVN, you can simply follow
  103. the rules described on the &quot;Accessing SVN&quot;-page (<a href=
  104. "http://buildroot.uclibc.org/subversion.html">http://buildroot.uclibc.org/subversion.html</a>)
  105. of the uClibc buildroot website (<a href=
  106. "http://buildroot.uclibc.org">http://buildroot.uclibc.org</a>), and download the
  107. <code>buildroot</code> SVN module. For the impatient, here's a quick
  108. recipe:</p>
  109. <pre>
  110. $ svn co svn://uclibc.org/trunk/buildroot
  111. </pre>
  112. <h2><a name="using" id="using"></a>Using Buildroot</h2>
  113. <p>Buildroot has a nice configuration tool similar to the one you can find
  114. in the Linux Kernel (<a href=
  115. "http://www.kernel.org/">http://www.kernel.org/</a>) or in Busybox
  116. (<a href="http://www.busybox.org/">http://www.busybox.org/</a>). Note that
  117. you can build everything as a normal user. There is no need to be root to
  118. configure and use Buildroot. The first step is to run the configuration
  119. assistant:</p>
  120. <pre>
  121. $ make menuconfig
  122. </pre>
  123. <p>For each entry of the configuration tool, you can find associated help
  124. that describes the purpose of the entry. </p>
  125. <p>One of the key configuration items is the <code>PROJECT</code> which
  126. determines where some board specific packages are built and where the
  127. results are stored. </p>
  128. <p>Once everything is configured, the configuration tool has generated a
  129. <code>.config</code> file that contains the description of your
  130. configuration. It will be used by the Makefiles to do what's needed. </p>
  131. <p>Let's go:</p>
  132. <pre>
  133. $ make
  134. </pre>
  135. <p>This command will download, configure and compile all the selected
  136. tools, and finally generate a target filesystem. The target filesystem will
  137. be named <code>root_fs_ARCH.EXT</code> where <code>ARCH</code> is your
  138. architecture and <code>EXT</code> depends on the type of target filesystem
  139. selected in the <code>Target options</code> section of the configuration
  140. tool.
  141. The file is stored in the "binaries/<code>$(PROJECT)</code>/" directory</p>
  142. <h3><a name="local_board_support" id="local_board_support"></a>
  143. Creating your own board support</h3>
  144. <p>Once a package has been unpacked, it is possible to manually update
  145. configuration files. Buildroot can automatically save the configuration
  146. of buildroot, linux, busybox, uclibc and u-boot in "local/$(PROJECT) by
  147. using the command:
  148. </p>
  149. <pre>
  150. $ make saveconfig
  151. </pre>
  152. <p>Once a buildroot configuration has been created by saveconfig,
  153. the default "$(TOPDIR)/.config" file can be overridden by</p>
  154. <pre>
  155. $ make BOARD=&lt;project&gt;
  156. </pre>
  157. <p>Buildroot will then use "local/&lt;project&gt;/&lt;project&gt;.config"
  158. instead of ".config". </p>
  159. <p>If you want to modify your board, you can copy the project configuration
  160. file to ".config" by using the command:</p>
  161. <pre>
  162. $ make BOARD=&lt;project&gt; getconfig
  163. </pre>
  164. <p>You can share your custom board support directory between several buildroot trees
  165. by setting the environment variable <code>BUILDROOT_LOCAL</code> to this directory,
  166. </p>
  167. <h3><a name="offline_builds" id="offline_builds"></a>
  168. Offline builds</h3>
  169. <p>If you intend to do an offline-build and just want to download all
  170. sources that you previously selected in &quot;make menuconfig&quot; then
  171. issue:</p>
  172. <pre>
  173. $ make source
  174. </pre>
  175. <p>You can now disconnect or copy the content of your <code>dl</code>
  176. directory to the build-host. </p>
  177. <h3><a name="environment_variables" id="environment_variables"></a>
  178. Environment variables</h3>
  179. <p>Buildroot optionally honors some environment variables that are passed
  180. to <code>make</code> :</p>
  181. <ul>
  182. <li>HOSTCXX</li>
  183. <li>HOSTCC</li>
  184. <li>UCLIBC_CONFIG_FILE=&lt;path/to/.config&gt;</li>
  185. <li>BUSYBOX_CONFIG_FILE=&lt;path/to/.config&gt;</li>
  186. </ul>
  187. <p>An example that uses config files located in the toplevel directory and
  188. in your $HOME:</p>
  189. <pre>
  190. $ make UCLIBC_CONFIG_FILE=uClibc.config BUSYBOX_CONFIG_FILE=$HOME/bb.config
  191. </pre>
  192. <p>If you want to use a compiler other than the default <code>gcc</code>
  193. or <code>g++</code> for building helper-binaries on your host, then do</p>
  194. <pre>
  195. $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
  196. </pre>
  197. <h3><a name="helper_completion" id="helper_completion"></a>
  198. Using auto-completion</h3>
  199. <p>If you are lazy enough that you don't want to type the entire <i>make
  200. menuconfig</i> command line, you can enable auto-completion in your shell.
  201. Here is how you can do that using <i>bash</i>:</p>
  202. <pre>
  203. $ complete -W menuconfig make
  204. </pre>
  205. <p>Then just enter the beginning of the line, and ask <i>bash</i> to
  206. complete it for you by pressing the <i>TAB</i> key:</p>
  207. <pre>
  208. $ make me&lt;TAB&gt;
  209. </pre>
  210. <p>will result in <i>bash</i> to append <i>nuconfig</i> for you!</p>
  211. <p>Alternatively, some distributions (of which Debian and Mandriva are but
  212. an example) have more powerful make completion. Depending on you
  213. distribution, you may have to install a package to enable completion. Under
  214. Mandriva, this is <i>bash-completion</i>, while Debian ships it as part of
  215. the <i>bash</i> package.</p>
  216. <p>Other shells, such as <i>zsh</i>, also have completion facilities. See
  217. the documentation for your shell.</p>
  218. <h2><a name="custom_targetfs" id="custom_targetfs"></a>Customizing the
  219. target filesystem</h2>
  220. <p>There are a few ways to customize the resulting target filesystem:</p>
  221. <ul>
  222. <li>Customize the target filesystem directly, and rebuild the image. The
  223. target filesystem is available under <code>project_build_ARCH/root/</code>
  224. where <code>ARCH</code> is the chosen target architecture.
  225. You can simply make your changes here, and run make afterwards, which will
  226. rebuild the target filesystem image. This method allows to do everything
  227. on the target filesystem, but if you decide to completely rebuild your
  228. toolchain and tools, these changes will be lost. </li>
  229. <li>Customize the target filesystem skeleton, available under
  230. <code>target/generic/target_skeleton/</code>. You can customize
  231. configuration files or other stuff here. However, the full file hierarchy
  232. is not yet present, because it's created during the compilation process.
  233. So you can't do everything on this target filesystem skeleton, but
  234. changes to it remain even if you completely rebuild the cross-compilation
  235. toolchain and the tools. <br />
  236. You can also customize the <code>target/generic/device_table.txt</code>
  237. file which is used by the tools that generate the target filesystem image
  238. to properly set permissions and create device nodes. The
  239. <code>target/generic/skel.tar.gz</code> file contains the main
  240. directories of a root filesystem and there is no obvious reason for which
  241. it should be changed. These main directories are in an tarball inside of
  242. inside the skeleton because it contains symlinks that would be broken
  243. otherwise. <br />
  244. These customizations are deployed into
  245. <code>project_build_ARCH/root/</code> just before the actual image
  246. is made. So simply rebuilding the image by running
  247. make should propagate any new changes to the image. </li>
  248. <li>When configuring the build system, using <code>make menuconfig</code>,
  249. you can specify the contents of the /etc/hostname and /etc/issue
  250. (the welcome banner) in the <code>PROJECT</code> section</li>
  251. </ul>
  252. <h2><a name="custom_busybox" id="custom_busybox"></a>Customizing the
  253. Busybox configuration</h2>
  254. <p><a href="http://www.busybox.net/">Busybox</a> is very configurable, and
  255. you may want to customize it. You can
  256. follow these simple steps to do it. It's not an optimal way, but it's
  257. simple and it works. </p>
  258. <ol>
  259. <li>Make a first compilation of buildroot with busybox without trying to
  260. customize it. </li>
  261. <li>Invoke <code>make busybox-menuconfig</code>.
  262. The nice configuration tool appears and you can
  263. customize everything. </li>
  264. <li>Run the compilation of buildroot again. </li>
  265. </ol>
  266. <p>Otherwise, you can simply change the
  267. <code>package/busybox/busybox-&lt;version&gt;.config</code> file if you
  268. know the options you want to change without using the configuration tool.
  269. </p>
  270. <p>If you want to use an existing config file for busybox, then see
  271. section <a href="#environment_variables">environment variables</a>. </p>
  272. <h2><a name="custom_uclibc" id="custom_uclibc"></a>Customizing the uClibc
  273. configuration</h2>
  274. <p>Just like <a href="#custom_busybox">BusyBox</a>, <a
  275. href="http://www.uclibc.org/">uClibc</a> offers a lot of
  276. configuration options. They allow to select various
  277. functionalities, depending on your needs and limitations. </p>
  278. <p>The easiest way to modify the configuration of uClibc is to
  279. follow these steps :</p>
  280. <ol>
  281. <li>Make a first compilation of buildroot without trying to
  282. customize uClibc. </li>
  283. <li>Invoke <code>make uclibc-menuconfig</code>.
  284. The nice configuration assistant, similar to
  285. the one used in the Linux Kernel or in Buildroot appears. Make
  286. your configuration as appropriate. </li>
  287. <li>Copy the <code>.config</code> file to
  288. <code>toolchain/uClibc/uClibc.config</code> or
  289. <code>toolchain/uClibc/uClibc.config-locale</code>. The former
  290. is used if you haven't selected locale support in Buildroot
  291. configuration, and the latter is used if you have selected
  292. locale support. </li>
  293. <li>Run the compilation of Buildroot again</li>
  294. </ol>
  295. <p>Otherwise, you can simply change
  296. <code>toolchain/uClibc/uClibc.config</code> or
  297. <code>toolchain/uClibc/uClibc.config-locale</code> without running
  298. the configuration assistant. </p>
  299. <p>If you want to use an existing config file for uclibc, then see
  300. section <a href="#environment_variables">environment variables</a>. </p>
  301. <h2><a name="buildroot_innards" id="buildroot_innards"></a>How Buildroot
  302. works</h2>
  303. <p>As said above, Buildroot is basically a set of Makefiles that download,
  304. configure and compiles software with the correct options. It also includes
  305. some patches for various software, mainly the ones involved in the
  306. cross-compilation tool chain (<code>gcc</code>, <code>binutils</code> and
  307. uClibc). </p>
  308. <p>There is basically one Makefile per software, and they are named with
  309. the <code>.mk</code> extension. Makefiles are split into four
  310. sections:</p>
  311. <ul>
  312. <li><b>project</b> (in the <code>project/</code> directory) contains
  313. the Makefiles and associated files for all software related to the
  314. building several root file systems in the same buildroot tree. </li>
  315. <li><b>toolchain</b> (in the <code>toolchain/</code> directory) contains
  316. the Makefiles and associated files for all software related to the
  317. cross-compilation toolchain : <code>binutils</code>, <code>ccache</code>,
  318. <code>gcc</code>, <code>gdb</code>, <code>kernel-headers</code> and
  319. <code>uClibc</code>. </li>
  320. <li><b>package</b> (in the <code>package/</code> directory) contains the
  321. Makefiles and associated files for all user-space tools that Buildroot
  322. can compile and add to the target root filesystem. There is one
  323. sub-directory per tool. </li>
  324. <li><b>target</b> (in the <code>target</code> directory) contains the
  325. Makefiles and associated files for software related to the generation of
  326. the target root filesystem image. Four types of filesystems are supported
  327. : ext2, jffs2, cramfs and squashfs. For each of them, there's a
  328. sub-directory with the required files. There is also a
  329. <code>default/</code> directory that contains the target filesystem
  330. skeleton. </li>
  331. </ul>
  332. <p>Each directory contains at least 2 files :</p>
  333. <ul>
  334. <li><code>something.mk</code> is the Makefile that downloads, configures,
  335. compiles and installs the software <code>something</code>. </li>
  336. <li><code>Config.in</code> is a part of the configuration tool
  337. description file. It describes the option related to the current
  338. software. </li>
  339. </ul>
  340. <p>The main Makefile do the job through the following steps (once the
  341. configuration is done):</p>
  342. <ol>
  343. <li>Create the download directory (<code>dl/</code> by default). This is
  344. where the tarballs will be downloaded. It is interesting to know that the
  345. tarballs are in this directory because it may be useful to save them
  346. somewhere to avoid further downloads. </li>
  347. <li>Create the shared build directory (<code>build_ARCH/</code> by
  348. default, where <code>ARCH</code> is your architecture). This is where all
  349. non configurable user-space tools will be compiled.When building two or
  350. more targets using the same architecture, the first build will go through
  351. the full download, configure, make process, but the second and later
  352. builds will only copy the result from the first build to its project
  353. specific target directory significantly speeding up the build process</li>
  354. <li>Create the project specific build directory
  355. (<code>project_build_ARCH/$(PROJECT)</code> by default, where
  356. <code>ARCH</code> is your architecture). This is where all configurable
  357. user-space tools will be compiled. The project specific build directory
  358. is neccessary, if two different targets needs to use a specific package,
  359. but the packages have different configuration for both targets. Some
  360. examples of packages built in this directory are busybox and linux.
  361. </li>
  362. <li>Create the project specific result directory
  363. (<code>binaries/$(PROJECT)</code> by default, where <code>ARCH</code>
  364. is your architecture). This is where the root filesystem images are
  365. stored, It is also used to store the linux kernel image and any
  366. utilities, boot-loaders etc. needed for a target.
  367. </li>
  368. <li>Create the toolchain build directory
  369. (<code>toolchain_build_ARCH/</code> by default, where <code>ARCH</code>
  370. is your architecture). This is where the cross compilation toolchain will
  371. be compiled. </li>
  372. <li>Setup the staging directory (<code>build_ARCH/staging_dir/</code> by
  373. default). This is where the cross-compilation toolchain will be
  374. installed. If you want to use the same cross-compilation toolchain for
  375. other purposes, such as compiling third-party applications, you can add
  376. <code>build_ARCH/staging_dir/usr/bin</code> to your PATH, and then use
  377. <code>arch-linux-gcc</code> to compile your application. In order to
  378. setup this staging directory, it first removes it, and then it creates
  379. various subdirectories and symlinks inside it. </li>
  380. <li>Create the target directory (<code>project_build_ARCH/root/</code> by
  381. default) and the target filesystem skeleton. This directory will contain
  382. the final root filesystem. To setup it up, it first deletes it, then it
  383. uncompress the <code>target/generic/skel.tar.gz</code> file to create the
  384. main subdirectories and symlinks, copies the skeleton available in
  385. <code>target/generic/target_skeleton</code> and then removes useless
  386. <code>.svn/</code> directories. </li>
  387. <li>Add the <code>TARGETS</code> dependency. This should generally check
  388. if the configuration option for this package is enabled, and if so then
  389. &quot;subscribe&quot; this package to be compiled by adding it to the
  390. TARGETS global variable. </li>
  391. </ol>
  392. <h2><a name="multi_project" id="multi_project"></a>Building several
  393. projects in the same buildroot source tree</h2>
  394. <p><b>BACKGROUND</b></p>
  395. <p>Buildroot has always supported building several projects in the same
  396. tree if each project was for a different architecture. </p>
  397. <p>The root file system has been created in the
  398. <code>&quot;build_&lt;ARCH&gt;/root&quot;</code>
  399. directory which is unique for each architecture.
  400. Toolchains have been built in
  401. <code>&quot;toolchain_build_&lt;ARCH&gt;&quot;</code>. </p>
  402. <p> It the user wanted to build several root file systems for the same
  403. architecture, a prefix or suffix could be added in the configuration file
  404. so the root file system would be built in
  405. <code>&quot;&lt;PREFIX&gt;_build_&lt;ARCH&gt;_&lt;SUFFIX&gt;/root&quot;</code>
  406. By supplying <u>unique</u> combinations of
  407. <code>&quot;&lt;PREFIX&gt;&quot;</code> and
  408. <code>&quot;&lt;SUFFIX&gt;&quot;</code>
  409. each project would get a <u>unique</u> root file system tree. </p>
  410. <p>The disadvantage of this approach is that a new toolchain was
  411. built for each project, adding considerable time to the build
  412. process, even if it was two projects for the same chip. </p>
  413. <p>This drawback has been somewhat lessened with
  414. <code>gcc-4.x.y</code> which allows buildroot to use an external
  415. toolchain. Certain packages requires special
  416. features in the toolchain, and if an external toolchain is selected,
  417. this may lack the neccessary features to complete the build of the root
  418. file system.</p>
  419. <p>A bigger problem was that the
  420. <code>&quot;build_&lt;ARCH&gt;&quot;</code> tree
  421. was also duplicated, so each </code>package</code> would also
  422. be rebuilt once per project, resulting in even longer build times.</p>
  423. <p><b>PROJECT TO SHARE TOOLCHAIN AND PACKAGE BUILDS</b></p>
  424. <p>Work has started on a project which will allow the user to build
  425. multiple root file systems for the same architecture in the same tree.
  426. The toolchain and the package build directory will be shared, but each
  427. project will have a dedicated directory tree for project specific
  428. builds. </p>
  429. <p>With this approach, most, if not all packages will be compiled
  430. when the first project is built.
  431. The process is almost identical to the original process.
  432. Packages are downloaded and extracted to the shared
  433. <code>&quot;build_&lt;ARCH&gt;/&lt;package&gt;&quot;</code>
  434. directory. They are configured and compiled. </p>
  435. <p>Package libraries and headers are installed in the shared $(STAGING_DIR),
  436. and then the project specific root file system &quot;$(TARGET_DIR)&quot;
  437. is populated. </p>
  438. <p>At the end of the build, the root file system will be used
  439. to generate the resulting root file system binaries. </p>
  440. <p>Once the first project has been built, building other projects will
  441. typically involve populating the new project's root file system directory
  442. from the existing binaries generated in the shared
  443. <code>&quot;build_&lt;ARCH&gt;/&lt;&gt;&quot;</code> directory. </p>
  444. <p>Only packages, not used by the first project, will have to go
  445. through the normal extract-configure-compile flow. </p>
  446. <p><b>IMPLEMENTATION</b></p>
  447. <p>The core of the solution is the introduction
  448. of two new directories: </p>
  449. <ul>
  450. <li><code>project_build_&lt;ARCH&gt;</code></li>
  451. <li><code>binaries;</code></li>
  452. </ul>
  453. <p>Each of the directories contain one subdirectory per project.
  454. The name of the subdirectory is configured by the user in the
  455. normal buildroot configuration, using the value of: </p>
  456. <p><code>Project Options ---> Project name</code></p>
  457. <p>The configuration defines the $(PROJECT) variable.</p>
  458. <p>The default project name is <code>&quot;uclibc&quot;</code>.</p>
  459. <p><code>&quot;package/Makefile.in&quot;</code> defines:
  460. <pre>
  461. <code>PROJECT_BUILD_DIR:=project_build_$(ARCH)/$(PROJECT)</code>
  462. <code>BINARIES_DIR:=binaries/$(PROJECT)</code>
  463. </pre>
  464. </p>
  465. <p>It also defines the location for the target root file system:
  466. <pre>
  467. <code>TARGET_DIR:=$(PROJECT_BUILD_DIR)/$(PROJECT)/root</code>
  468. </pre>
  469. </p>
  470. <p>I.E: If the user has choosen
  471. <code>&quot;myproject&quot;</code>
  472. as the $(PROJECT) name:
  473. <ul>
  474. <li><code>&quot;project_build_&lt;ARCH&gt;/myproject&quot;</code></li>
  475. <li><code>&quot;binaries/myproject&quot;</code></li>
  476. </ul>
  477. <p>will be created. </p>
  478. <p>Currently, the <u>root file system</u>, <u>busybox</u> and an Atmel
  479. customized version of
  480. <u><code>U-Boot</code></u>, as well as some Atmel specific
  481. bootloaders like <u>at91-bootstrap</u> and <u>dataflashboot.bin</u>
  482. are built in
  483. <code>&quot;$(PROJECT_BUILD_DIR)&quot;</code>
  484. <p>The resulting binaries for all architectures are stored in the
  485. <code>&quot;$(BINARIES_DIR)&quot;</code> directory. <p>
  486. <p><b>SUMMARY</b></p>
  487. <p>The project will share directories which can be share without
  488. conflicts, but will use unique build directories, where the user
  489. can configure the build. </p>
  490. <p><b>THINGS TO DO</b></p>
  491. <ol>
  492. <li>Linux</li>
  493. <p>The current Linux implementation is flawed. It only works
  494. if the user chooses to use one of the few kernels selected
  495. as base for the kernel-headers. While the Makefile seems to have
  496. hooks, allowing the developer to specify whatever version he/she
  497. wants in the target/device/*/* Makefiles, the build will fail
  498. if another kernel version is choosen.</p>
  499. <p>The reason for this is that the kernel patches are not
  500. applied by the <code>&quot;target/linux/linux.mk&quot;</code>
  501. build script fragment. They are only applied by the
  502. <code>&quot;toolchain/kernel-headers/*.makefile&quot;</code>
  503. build script fragments</p>
  504. <p>If the kernel-header version and the linux version differs,
  505. there will be two <code>&quot;linux-2.6.X.Y&quot;</code>
  506. directories in
  507. <code>&quot;build_&lt;ARCH&gt;/&lt;&gt;&quot;</code>,
  508. each with its own set of patches. </p>
  509. <p>The solution in the works, is to move the build of Linux to
  510. <code>&quot;project_build_&lt;ARCH&gt;/&lt;project name&gt;/linux-2.6.X.Y&quot;</code> combined with method to configure
  511. which patches can be applied. Possibly, the linux source tree
  512. used to generate the kernel headers will be moved to the
  513. <code>&quot;toolchain_build_&lt;ARCH&gt;&quot;</code>
  514. directory
  515. </p>
  516. <p>The user will be able to select from three different
  517. Linux strategies:
  518. <ul>
  519. <li>Conservative Strategy: Only use version ssupported by the kernel headers</li>
  520. <li>Stable Linux Strategy: Allow any 2.6.X.Y combination.
  521. (Minimum 2.6.19)</li>
  522. <li>Power-User Strategy: Allow
  523. <code>&quot;-git&quot;</code>, or
  524. <code>&quot;-mm&quot;</code>, or user downloadable kernels</li>
  525. </ul>
  526. <p>The current kernel patches can be configured to be applied to the
  527. linux source tree even if the version differs from the
  528. kernel header version. </p>
  529. <p>Since the user can select any kernel-patch
  530. he/she will be able to select a non-working combination.
  531. If the patch fails, the user will have to generate a new
  532. proprietary kernel-patch or decide to not apply the kernel
  533. patches</p>
  534. <p>Other optional patches will be <u>board specific</u> or
  535. <u>architecture specific</u> patches. </p>
  536. <p>There will also be a way for the user to supply absolute
  537. or relative paths to patches, possibly outside the main tree.
  538. This can be used to apply custom kernel-header-patches, if
  539. the versions available in buildroot cannot be applied to the
  540. specific linux version used</p>
  541. <p>Maybe, there will also be a possibility to supply an
  542. <code>&quot;URL&quot;</code> to a patch available on Internet. </p>
  543. <li>Configurable packages</li>
  544. <p>Many packages can, on top of the simple
  545. &quot;enable/disable build&quot;,
  546. be further configured using Kconfig.
  547. Currently these packages will be compiled using the
  548. configuration specified in the
  549. <code>&quot;.config&quot;</code> file of the <u>first</u>
  550. project demanding the build of the package.</p>
  551. <p>If <u>another</u> project uses the same packages, but with
  552. a different configuration,these packages will <u>not</u> be rebuilt,
  553. and the root file system for the new project will be populated
  554. with files from the build of the <u>first</u> project</p>
  555. <p>If multiple project are built, and a specific package
  556. needs two different configuration, then the user must
  557. delete the package from the
  558. <code>&quot;build_&lt;ARCH&gt;&quot;</code> directory
  559. before rebuilding the new project.<p>
  560. <p>A long term solution is to edit the package makefile and move
  561. the build of the configurable packages from
  562. <code>&quot;build_&lt;ARCH&gt;&quot;</code> to
  563. <code>&quot;project_build_&lt;ARCH&gt;/&lt;project name&gt;&quot;</code>
  564. and send a patch to the buildroot mailing list.
  565. <li>Naming conventions</li>
  566. <p>Names of resulting binaries should reflect the
  567. &quot;project name&quot;
  568. <li>Generating File System binaries</li>
  569. <p>
  570. Packages which needs to be installed with the &quot;root&quot;
  571. as owner, will generate a
  572. <code>&quot;.fakeroot.&lt;package&gt;&quot;</code> file
  573. which will be used for the final build of the root file system binary. </p>
  574. <p>This was previously located in the
  575. <code>&quot;$(STAGING_DIR)&quot;</code> directory, but was
  576. recently moved to the
  577. <code>&quot;$(PROJECT_BUILD_DIR)&quot;</code> directory. </p>
  578. <p>Currently only three packages:
  579. <code>&quot;at&quot;</code>,
  580. <code>&quot;ltp-testsuite&quot;</code> and
  581. <code>&quot;nfs-utils&quot;</code>
  582. requests fakeroot. <p>
  583. <p>The makefile fragments for each file system type like
  584. <code>&quot;ext2&quot;</code>,
  585. <code>&quot;jffs2&quot;</code> or
  586. <code>&quot;squashfs&quot;</code>
  587. will, when the file system binary is generated,
  588. collect all present
  589. <code>&quot;.fakeroot.&lt;package&gt;&quot;</code> files
  590. to a single <code>&quot;_fakeroot.&lt;file system&gt;&quot;</code>
  591. file and call fakeroot.</p>
  592. <code>&quot;.fakeroot.&lt;package&gt;&quot;</code>
  593. files are deleted as the last action of the Buildroot Makefile. </p>
  594. <p>It needs to be evaluated if any further action for the
  595. file system binary build is needed. </p>
  596. </ol>
  597. <h2><a name="using_toolchain" id="using_toolchain"></a>Using the
  598. uClibc toolchain</h2>
  599. <p>You may want to compile your own programs or other software
  600. that are not packaged in Buildroot. In order to do this, you can
  601. use the toolchain that was generated by Buildroot. </p>
  602. <p>The toolchain generated by Buildroot by default is located in
  603. <code>build_ARCH/staging_dir/</code>. The simplest way to use it
  604. is to add <code>build_ARCH/staging_dir/usr/bin/</code> to your PATH
  605. environnement variable, and then to use
  606. <code>arch-linux-gcc</code>, <code>arch-linux-objdump</code>,
  607. <code>arch-linux-ld</code>, etc. </p>
  608. <p>For example, you may add the following to your
  609. <code>.bashrc</code> (considering you're building for the MIPS
  610. architecture and that Buildroot is located in
  611. <code>~/buildroot/</code>) :</p>
  612. <pre>
  613. export PATH=&quot;$PATH:~/buildroot/build_mips/staging_dir/usr/bin/&quot;
  614. </pre>
  615. <p>Then you can simply do :</p>
  616. <pre>
  617. mips-linux-gcc -o foo foo.c
  618. </pre>
  619. <p><b>Important</b> : do not try to move a gcc-3.x toolchain to an other
  620. directory, it won't work. There are some hardcoded paths in the
  621. <i>gcc</i> configuration. If the default toolchain directory
  622. doesn't suit your needs, please refer to the <a
  623. href="#toolchain_standalone">Using the uClibc toolchain outside of
  624. buildroot</a> section. </p>
  625. <p>If you are using a current gcc-4.x, then use --sysroot and -isysroot
  626. since these toolchains have fully functional sysroot support. No
  627. hardcoded paths do exist in these configurations. </p>
  628. <h2><a name="toolchain_standalone" id="toolchain_standalone"></a>Using the
  629. uClibc toolchain outside of buildroot</h2>
  630. <p>By default, the cross-compilation toolchain is generated inside
  631. <code>build_ARCH/staging_dir/</code>. But sometimes, it may be useful to
  632. install it somewhere else, so that it can be used to compile other programs
  633. or by other users. Moving the <code>build_ARCH/staging_dir/</code>
  634. directory elsewhere is <b>not possible if using gcc-3.x</b>, because there
  635. are some hardcoded paths in the toolchain configuration. This works, thanks
  636. to sysroot support, with current, stable gcc-4.x toolchains, of course. </p>
  637. <p>If you want to use the generated gcc-3.x toolchain for other purposes,
  638. you can configure Buildroot to generate it elsewhere using the
  639. option of the configuration tool : <code>Build options -&gt;
  640. Toolchain and header file location</code>, which defaults to
  641. <code>$(BUILD_DIR)/staging_dir/</code>. </p>
  642. <h2><a name="downloaded_packages"
  643. id="downloaded_packages"></a>Location of downloaded packages</h2>
  644. <p>It might be useful to know that the various tarballs that are
  645. downloaded by the <i>Makefiles</i> are all stored in the
  646. <code>DL_DIR</code> which by default is the <code>dl</code>
  647. directory. It's useful for example if you want to keep a complete
  648. version of Buildroot which is know to be working with the
  649. associated tarballs. This will allow you to regenerate the
  650. toolchain and the target filesystem with exactly the same
  651. versions. </p>
  652. <p>If you maintain several buildroot trees, it might be better to have
  653. a shared download location. This can be accessed by creating a symbolic link
  654. from the <code>dl</code> directory to the shared download location. </p>
  655. <p>I.E:</p>
  656. <pre>
  657. ln -s &lt;shared download location&gt; dl
  658. </pre>
  659. <p>Another way of accessing a shared download location is to
  660. create the <code>BUILDROOT_DL_DIR</code> environment variable.
  661. If this is set, then the value of DL_DIR in the project is
  662. overridden. The following line should be added to
  663. <code>&quot;~/.bashrc&quot;</code>. <p>
  664. <pre>
  665. export BUILDROOT_DL_DIR &lt;shared download location&gt;
  666. </pre>
  667. <h2><a name="add_software" id="add_software"></a>Extending Buildroot with
  668. more software</h2>
  669. <p>This section will only consider the case in which you want to
  670. add user-space software. </p>
  671. <h3>Package directory</h3>
  672. <p>First of all, create a directory under the <code>package</code>
  673. directory for your software, for example <code>foo</code>. </p>
  674. <h3><code>Config.in</code> file</h3>
  675. <p>Then, create a file named <code>Config.in</code>. This file
  676. will contain the portion of options description related to our
  677. <code>foo</code> software that will be used and displayed in the
  678. configuration tool. It should basically contain :</p>
  679. <pre>
  680. config BR2_PACKAGE_FOO
  681. bool "foo"
  682. default n
  683. help
  684. This is a comment that explains what foo is.
  685. http://foosoftware.org/foo/
  686. </pre>
  687. <p>Of course, you can add other options to configure particular
  688. things in your software. </p>
  689. <h3>The real <i>Makefile</i></h3>
  690. <p>Finally, here's the hardest part. Create a file named
  691. <code>foo.mk</code>. It will contain the <i>Makefile</i> rules that
  692. are in charge of downloading, configuring, compiling and installing
  693. the software. Below is an example that we will comment
  694. afterwards. </p>
  695. <pre>
  696. <a name="line1" id="line1">1</a> #############################################################
  697. <a name="line2" id="line2">2</a> #
  698. <a name="line3" id="line3">3</a> # foo
  699. <a name="line4" id="line4">4</a> #
  700. <a name="line5" id="line5">5</a> #############################################################
  701. <a name="line6" id="line6">6</a> FOO_VERSION:=1.0
  702. <a name="line7" id="line7">7</a> FOO_SOURCE:=foo-$(FOO_VERSION).tar.gz
  703. <a name="line8" id="line8">8</a> FOO_SITE:=http://www.foosoftware.org/downloads
  704. <a name="line9" id="line9">9</a> FOO_DIR:=$(BUILD_DIR)/foo-$(FOO_VERSION)
  705. <a name="line10" id="line10">10</a> FOO_BINARY:=foo
  706. <a name="line11" id="line11">11</a> FOO_TARGET_BINARY:=usr/bin/foo
  707. <a name="line12" id="line12">12</a>
  708. <a name="line13" id="line13">13</a> $(DL_DIR)/$(FOO_SOURCE):
  709. <a name="line14" id="line14">14</a> $(WGET) -P $(DL_DIR) $(FOO_SITE)/$(FOO_SOURCE)
  710. <a name="line15" id="line15">15</a>
  711. <a name="line16" id="line16">16</a> $(FOO_DIR)/.source: $(DL_DIR)/$(FOO_SOURCE)
  712. <a name="line17" id="line17">17</a> $(ZCAT) $(DL_DIR)/$(FOO_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
  713. <a name="line18" id="line18">18</a> touch $@
  714. <a name="line19" id="line19">19</a>
  715. <a name="line20" id="line20">20</a> $(FOO_DIR)/.configured: $(FOO_DIR)/.source
  716. <a name="line21" id="line21">21</a> (cd $(FOO_DIR); rm -rf config.cache; \
  717. <a name="line22" id="line22">22</a> $(TARGET_CONFIGURE_OPTS) \
  718. <a name="line23" id="line23">23</a> $(TARGET_CONFIGURE_ARGS) \
  719. <a name="line24" id="line24">24</a> ./configure \
  720. <a name="line25" id="line25">25</a> --target=$(GNU_TARGET_NAME) \
  721. <a name="line26" id="line26">26</a> --host=$(GNU_TARGET_NAME) \
  722. <a name="line27" id="line27">27</a> --build=$(GNU_HOST_NAME) \
  723. <a name="line28" id="line28">28</a> --prefix=/usr \
  724. <a name="line29" id="line29">29</a> --sysconfdir=/etc \
  725. <a name="line30" id="line30">30</a> )
  726. <a name="line31" id="line31">31</a> touch $@
  727. <a name="line32" id="line32">32</a>
  728. <a name="line33" id="line33">33</a> $(FOO_DIR)/$(FOO_BINARY): $(FOO_DIR)/.configured
  729. <a name="line34" id="line34">34</a> $(MAKE) CC=$(TARGET_CC) -C $(FOO_DIR)
  730. <a name="line35" id="line35">35</a>
  731. <a name="line36" id="line36">36</a> $(TARGET_DIR)/$(FOO_TARGET_BINARY): $(FOO_DIR)/$(FOO_BINARY)
  732. <a name="line37" id="line37">37</a> $(MAKE) prefix=$(TARGET_DIR)/usr -C $(FOO_DIR) install
  733. <a name="line38" id="line38">38</a> rm -Rf $(TARGET_DIR)/usr/man
  734. <a name="line39" id="line39">39</a>
  735. <a name="line40" id="line40">40</a> foo: uclibc ncurses $(TARGET_DIR)/$(FOO_TARGET_BINARY)
  736. <a name="line41" id="line41">41</a>
  737. <a name="line42" id="line42">42</a> foo-source: $(DL_DIR)/$(FOO_SOURCE)
  738. <a name="line43" id="line43">43</a>
  739. <a name="line44" id="line44">44</a> foo-clean:
  740. <a name="line45" id="line45">45</a> $(MAKE) prefix=$(TARGET_DIR)/usr -C $(FOO_DIR) uninstall
  741. <a name="line46" id="line46">46</a> -$(MAKE) -C $(FOO_DIR) clean
  742. <a name="line47" id="line47">47</a>
  743. <a name="line48" id="line48">48</a> foo-dirclean:
  744. <a name="line49" id="line49">49</a> rm -rf $(FOO_DIR)
  745. <a name="line50" id="line50">50</a>
  746. <a name="line51" id="line51">51</a> #############################################################
  747. <a name="line52" id="line52">52</a> #
  748. <a name="line53" id="line53">53</a> # Toplevel Makefile options
  749. <a name="line54" id="line54">54</a> #
  750. <a name="line55" id="line55">55</a> #############################################################
  751. <a name="line56" id="line56">56</a> ifeq ($(strip $(BR2_PACKAGE_FOO)),y)
  752. <a name="line57" id="line57">57</a> TARGETS+=foo
  753. <a name="line58" id="line58">58</a> endif
  754. </pre>
  755. <p>First of all, this <i>Makefile</i> example works for a single
  756. binary software. For other software such as libraries or more
  757. complex stuff with multiple binaries, it should be adapted. Look at
  758. the other <code>*.mk</code> files in the <code>package</code>
  759. directory. </p>
  760. <p>At lines <a href="#line6">6-11</a>, a couple of useful variables are
  761. defined :</p>
  762. <ul>
  763. <li><code>FOO_VERSION</code> : The version of <i>foo</i> that
  764. should be downloaded. </li>
  765. <li><code>FOO_SOURCE</code> : The name of the tarball of
  766. <i>foo</i> on the download website of FTP site. As you can see
  767. <code>FOO_VERSION</code> is used. </li>
  768. <li><code>FOO_SITE</code> : The HTTP or FTP site from which
  769. <i>foo</i> archive is downloaded. It must include the complete
  770. path to the directory where <code>FOO_SOURCE</code> can be
  771. found. </li>
  772. <li><code>FOO_DIR</code> : The directory into which the software
  773. will be configured and compiled. Basically, it's a subdirectory
  774. of <code>BUILD_DIR</code> which is created upon decompression of
  775. the tarball. </li>
  776. <li><code>FOO_BINARY</code> : Software binary name. As said
  777. previously, this is an example for a single binary software. </li>
  778. <li><code>FOO_TARGET_BINARY</code> : The full path of the binary
  779. inside the target filesystem. </li>
  780. </ul>
  781. <p>Lines <a href="#line13">13-14</a> defines a target that downloads the
  782. tarball from the remote site to the download directory
  783. (<code>DL_DIR</code>). </p>
  784. <p>Lines <a href="#line16">16-18</a> defines a target and associated rules
  785. that uncompress the downloaded tarball. As you can see, this target
  786. depends on the tarball file, so that the previous target (line
  787. <a href="#line13">13-14</a>) is called before executing the rules of the
  788. current target. Uncompressing is followed by <i>touching</i> a hidden file
  789. to mark the software has having been uncompressed. This trick is
  790. used everywhere in Buildroot <i>Makefile</i> to split steps
  791. (download, uncompress, configure, compile, install) while still
  792. having correct dependencies. </p>
  793. <p>Lines <a href="#line20">20-31</a> defines a target and associated rules
  794. that configures the software. It depends on the previous target (the
  795. hidden <code>.source</code> file) so that we are sure the software has
  796. been uncompressed. In order to configure it, it basically runs the
  797. well-known <code>./configure</code> script. As we may be doing
  798. cross-compilation, <code>target</code>, <code>host</code> and
  799. <code>build</code> arguments are given. The prefix is also set to
  800. <code>/usr</code>, not because the software will be installed in
  801. <code>/usr</code> on your host system, but in the target
  802. filesystem. Finally it creates a <code>.configured</code> file to
  803. mark the software as configured. </p>
  804. <p>Lines <a href="#line33">33-34</a> defines a target and a rule that
  805. compiles the software. This target will create the binary file in the
  806. compilation directory, and depends on the software being already
  807. configured (hence the reference to the <code>.configured</code>
  808. file). It basically runs <code>make</code> inside the source
  809. directory. </p>
  810. <p>Lines <a href="#line36">36-38</a> defines a target and associated rules
  811. that install the software inside the target filesystem. It depends on the
  812. binary file in the source directory, to make sure the software has
  813. been compiled. It uses the <code>install</code> target of the
  814. software <code>Makefile</code> by passing a <code>prefix</code>
  815. argument, so that the <code>Makefile</code> doesn't try to install
  816. the software inside host <code>/usr</code> but inside target
  817. <code>/usr</code>. After the installation, the
  818. <code>/usr/man</code> directory inside the target filesystem is
  819. removed to save space. </p>
  820. <p>Line <a href="#line40">40</a> defines the main target of the software,
  821. the one that will be eventually be used by the top level
  822. <code>Makefile</code> to download, compile, and then install
  823. this package. This target should first of all depends on all
  824. needed dependecies of the software (in our example,
  825. <i>uclibc</i> and <i>ncurses</i>), and also depend on the
  826. final binary. This last dependency will call all previous
  827. dependencies in the correct order. </p>
  828. <p>Line <a href="#line42">42</a> defines a simple target that only
  829. downloads the code source. This is not used during normal operation of
  830. Buildroot, but is needed if you intend to download all required sources at
  831. once for later offline build. Note that if you add a new package providing
  832. a <code>foo-source</code> target is <i>mandatory</i> to support
  833. users that wish to do offline-builds. Furthermore it eases checking
  834. if all package-sources are downloadable. </p>
  835. <p>Lines <a href="#line44">44-46</a> define a simple target to clean the
  836. software build by calling the <i>Makefiles</i> with the appropriate option.
  837. The <code>-clean</code> target should run <code>make clean</code>
  838. on $(BUILD_DIR)/package-version and MUST uninstall all files of the
  839. package from $(STAGING_DIR) and from $(TARGET_DIR). </p>
  840. <p>Lines <a href="#line48">48-49</a> define a simple target to completely
  841. remove the directory in which the software was uncompressed, configured and
  842. compiled. The <code>-dirclean</code> target MUST completely rm $(BUILD_DIR)/
  843. package-version. </p>
  844. <p>Lines <a href="#line51">51-58</a> adds the target <code>foo</code> to
  845. the list of targets to be compiled by Buildroot by first checking if
  846. the configuration option for this package has been enabled
  847. using the configuration tool, and if so then &quot;subscribes&quot;
  848. this package to be compiled by adding it to the TARGETS
  849. global variable. The name added to the TARGETS global
  850. variable is the name of this package's target, as defined on
  851. line <a href="#line40">40</a>, which is used by Buildroot to download,
  852. compile, and then install this package. </p>
  853. <h3>Conclusion</h3>
  854. <p>As you can see, adding a software to buildroot is simply a
  855. matter of writing a <i>Makefile</i> using an already existing
  856. example and to modify it according to the compilation process of
  857. the software. </p>
  858. <p>If you package software that might be useful for other persons,
  859. don't forget to send a patch to Buildroot developers !</p>
  860. <h2><a name="links" id="links"></a>Resources</h2>
  861. <p>To learn more about Buildroot you can visit these
  862. websites:</p>
  863. <ul>
  864. <li><a href="http://www.uclibc.org/">http://www.uclibc.org/</a></li>
  865. <li><a href="http://www.busybox.net/">http://www.busybox.net/</a></li>
  866. </ul>
  867. </div>
  868. <!--
  869. <a href="http://validator.w3.org/check?uri=referer"><img
  870. border="0" height="31" width="88"
  871. src="images/valid-html401.png"
  872. alt="Valid HTML"></img></a>
  873. -->
  874. </body>
  875. </html>