using.txt 4.6 KB

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