using.txt 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. Using Buildroot
  4. ---------------
  5. Buildroot has a nice configuration tool similar to the one you can
  6. find in the http://www.kernel.org/[Linux kernel] or in
  7. http://www.busybox.net/[Busybox]. Note that you can *and should build
  8. everything as a normal user*. There is no need to be root to configure
  9. and use Buildroot. The first step is to run the configuration
  10. assistant:
  11. --------------------
  12. $ make menuconfig
  13. --------------------
  14. or
  15. --------------------
  16. $ make nconfig
  17. --------------------
  18. to run the old or new curses-based configurator, or
  19. --------------------
  20. $ make xconfig
  21. --------------------
  22. or
  23. --------------------
  24. $ make gconfig
  25. --------------------
  26. to run the Qt or GTK-based configurators.
  27. All of these "make" commands will need to build a configuration
  28. utility (including the interface), so you may need to install
  29. "development" packages for relevant libraries used by the
  30. configuration utilities. Check xref:requirement[] to know what
  31. Buildroot needs, and specifically the xref:requirement-optional[optional requirements]
  32. to get the dependencies of your favorite interface.
  33. For each menu entry in the configuration tool, you can find associated
  34. help that describes the purpose of the entry.
  35. Once everything is configured, the configuration tool generates a
  36. +.config+ file that contains the description of your
  37. configuration. It will be used by the Makefiles to do what's needed.
  38. Let's go:
  39. --------------------
  40. $ make
  41. --------------------
  42. You *should never* use +make -jN+ with Buildroot: it does not support
  43. 'top-level parallel make'. Instead, use the +BR2_JLEVEL+ option to
  44. tell Buildroot to run each package compilation with +make -jN+.
  45. The `make` command will generally perform the following steps:
  46. * download source files (as required);
  47. * configure, build and install the cross-compiling toolchain using the
  48. appropriate toolchain backend, or simply import an external toolchain;
  49. * build/install selected target packages;
  50. * build a kernel image, if selected;
  51. * build a bootloader image, if selected;
  52. * create a root filesystem in selected formats.
  53. Buildroot output is stored in a single directory, +output/+.
  54. This directory contains several subdirectories:
  55. * +images/+ where all the images (kernel image, bootloader and root
  56. filesystem images) are stored.
  57. * +build/+ where all the components except for the cross-compilation
  58. toolchain are built (this includes tools needed to run Buildroot on
  59. the host and packages compiled for the target). The +build/+
  60. directory contains one subdirectory for each of these components.
  61. * +staging/+ which contains a hierarchy similar to a root filesystem
  62. hierarchy. This directory contains the installation of the
  63. cross-compilation toolchain and all the userspace packages selected
  64. for the target. However, this directory is 'not' intended to be
  65. the root filesystem for the target: it contains a lot of development
  66. files, unstripped binaries and libraries that make it far too big
  67. for an embedded system. These development files are used to compile
  68. libraries and applications for the target that depend on other
  69. libraries.
  70. * +target/+ which contains 'almost' the complete root filesystem for
  71. the target: everything needed is present except the device files in
  72. +/dev/+ (Buildroot can't create them because Buildroot doesn't run
  73. as root and doesn't want to run as root). Also, it doesn't have the correct
  74. permissions (e.g. setuid for the busybox binary). Therefore, this directory
  75. *should not be used on your target*. Instead, you should use one of
  76. the images built in the +images/+ directory. If you need an
  77. extracted image of the root filesystem for booting over NFS, then
  78. use the tarball image generated in +images/+ and extract it as
  79. root. Compared to +staging/+, +target/+ contains only the files and
  80. libraries needed to run the selected target applications: the
  81. development files (headers, etc.) are not present, the binaries are
  82. stripped.
  83. * +host/+ contains the installation of tools compiled for the host
  84. that are needed for the proper execution of Buildroot, including the
  85. cross-compilation toolchain.
  86. * +toolchain/+ contains the build directories for the various
  87. components of the cross-compilation toolchain.
  88. These commands, +make menuconfig|nconfig|gconfig|xconfig+ and +make+, are the
  89. basic ones that allow to easily and quickly generate images fitting
  90. your needs, with all the supports and applications you enabled.
  91. More details about the "make" command usage are given in
  92. xref:make-tips[].