using.txt 4.4 KB

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