using.txt 4.4 KB

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