using.txt 4.3 KB

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