1*4882a593Smuzhiyun// -*- mode:doc; -*- 2*4882a593Smuzhiyun// vim: set syntax=asciidoc: 3*4882a593Smuzhiyun 4*4882a593Smuzhiyun== Buildroot quick start 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun*Important*: you can and should *build everything as a normal user*. There 7*4882a593Smuzhiyunis no need to be root to configure and use Buildroot. By running all 8*4882a593Smuzhiyuncommands as a regular user, you protect your system against packages 9*4882a593Smuzhiyunbehaving badly during compilation and installation. 10*4882a593Smuzhiyun 11*4882a593SmuzhiyunThe first step when using Buildroot is to create a configuration. 12*4882a593SmuzhiyunBuildroot has a nice configuration tool similar to the one you can 13*4882a593Smuzhiyunfind in the http://www.kernel.org/[Linux kernel] or in 14*4882a593Smuzhiyunhttp://www.busybox.net/[BusyBox]. 15*4882a593Smuzhiyun 16*4882a593SmuzhiyunFrom the buildroot directory, run 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun-------------------- 19*4882a593Smuzhiyun $ make menuconfig 20*4882a593Smuzhiyun-------------------- 21*4882a593Smuzhiyun 22*4882a593Smuzhiyunfor the original curses-based configurator, or 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun-------------------- 25*4882a593Smuzhiyun $ make nconfig 26*4882a593Smuzhiyun-------------------- 27*4882a593Smuzhiyun 28*4882a593Smuzhiyunfor the new curses-based configurator, or 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun-------------------- 31*4882a593Smuzhiyun $ make xconfig 32*4882a593Smuzhiyun-------------------- 33*4882a593Smuzhiyun 34*4882a593Smuzhiyunfor the Qt-based configurator, or 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun-------------------- 37*4882a593Smuzhiyun $ make gconfig 38*4882a593Smuzhiyun-------------------- 39*4882a593Smuzhiyun 40*4882a593Smuzhiyunfor the GTK-based configurator. 41*4882a593Smuzhiyun 42*4882a593SmuzhiyunAll of these "make" commands will need to build a configuration 43*4882a593Smuzhiyunutility (including the interface), so you may need to install 44*4882a593Smuzhiyun"development" packages for relevant libraries used by the 45*4882a593Smuzhiyunconfiguration utilities. Refer to xref:requirement[] for more details, 46*4882a593Smuzhiyunspecifically the xref:requirement-optional[optional requirements] 47*4882a593Smuzhiyunto get the dependencies of your favorite interface. 48*4882a593Smuzhiyun 49*4882a593SmuzhiyunFor each menu entry in the configuration tool, you can find associated 50*4882a593Smuzhiyunhelp that describes the purpose of the entry. Refer to xref:configure[] 51*4882a593Smuzhiyunfor details on some specific configuration aspects. 52*4882a593Smuzhiyun 53*4882a593SmuzhiyunOnce everything is configured, the configuration tool generates a 54*4882a593Smuzhiyun+.config+ file that contains the entire configuration. This file will be 55*4882a593Smuzhiyunread by the top-level Makefile. 56*4882a593Smuzhiyun 57*4882a593SmuzhiyunTo start the build process, simply run: 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun-------------------- 60*4882a593Smuzhiyun $ make 61*4882a593Smuzhiyun-------------------- 62*4882a593Smuzhiyun 63*4882a593SmuzhiyunBy default, Buildroot does not support top-level parallel build, so 64*4882a593Smuzhiyunrunning +make -jN+ is not necessary. There is however experimental 65*4882a593Smuzhiyunsupport for top-level parallel build, see 66*4882a593Smuzhiyunxref:top-level-parallel-build[]. 67*4882a593Smuzhiyun 68*4882a593SmuzhiyunThe `make` command will generally perform the following steps: 69*4882a593Smuzhiyun 70*4882a593Smuzhiyun* download source files (as required); 71*4882a593Smuzhiyun* configure, build and install the cross-compilation toolchain, or 72*4882a593Smuzhiyun simply import an external toolchain; 73*4882a593Smuzhiyun* configure, build and install selected target packages; 74*4882a593Smuzhiyun* build a kernel image, if selected; 75*4882a593Smuzhiyun* build a bootloader image, if selected; 76*4882a593Smuzhiyun* create a root filesystem in selected formats. 77*4882a593Smuzhiyun 78*4882a593SmuzhiyunBuildroot output is stored in a single directory, +output/+. 79*4882a593SmuzhiyunThis directory contains several subdirectories: 80*4882a593Smuzhiyun 81*4882a593Smuzhiyun* +images/+ where all the images (kernel image, bootloader and root 82*4882a593Smuzhiyun filesystem images) are stored. These are the files you need to put 83*4882a593Smuzhiyun on your target system. 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun* +build/+ where all the components are built (this includes tools 86*4882a593Smuzhiyun needed by Buildroot on the host and packages compiled for the 87*4882a593Smuzhiyun target). This directory contains one subdirectory for each of these 88*4882a593Smuzhiyun components. 89*4882a593Smuzhiyun 90*4882a593Smuzhiyun* +host/+ contains both the tools built for the host, and the sysroot 91*4882a593Smuzhiyun of the target toolchain. The former is an installation of tools 92*4882a593Smuzhiyun compiled for the host that are needed for the proper execution of 93*4882a593Smuzhiyun Buildroot, including the cross-compilation toolchain. The latter 94*4882a593Smuzhiyun is a hierarchy similar to a root filesystem hierarchy. It contains 95*4882a593Smuzhiyun the headers and libraries of all user-space packages that provide 96*4882a593Smuzhiyun and install libraries used by other packages. However, this 97*4882a593Smuzhiyun directory is 'not' intended to be the root filesystem for the target: 98*4882a593Smuzhiyun it contains a lot of development files, unstripped binaries and 99*4882a593Smuzhiyun libraries that make it far too big for an embedded system. These 100*4882a593Smuzhiyun development files are used to compile libraries and applications for 101*4882a593Smuzhiyun the target that depend on other libraries. 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun* +staging/+ is a symlink to the target toolchain sysroot inside 104*4882a593Smuzhiyun +host/+, which exists for backwards compatibility. 105*4882a593Smuzhiyun 106*4882a593Smuzhiyun* +target/+ which contains 'almost' the complete root filesystem for 107*4882a593Smuzhiyun the target: everything needed is present except the device files in 108*4882a593Smuzhiyun +/dev/+ (Buildroot can't create them because Buildroot doesn't run 109*4882a593Smuzhiyun as root and doesn't want to run as root). Also, it doesn't have the correct 110*4882a593Smuzhiyun permissions (e.g. setuid for the busybox binary). Therefore, this directory 111*4882a593Smuzhiyun *should not be used on your target*. Instead, you should use one of 112*4882a593Smuzhiyun the images built in the +images/+ directory. If you need an 113*4882a593Smuzhiyun extracted image of the root filesystem for booting over NFS, then 114*4882a593Smuzhiyun use the tarball image generated in +images/+ and extract it as 115*4882a593Smuzhiyun root. Compared to +staging/+, +target/+ contains only the files and 116*4882a593Smuzhiyun libraries needed to run the selected target applications: the 117*4882a593Smuzhiyun development files (headers, etc.) are not present, the binaries are 118*4882a593Smuzhiyun stripped. 119*4882a593Smuzhiyun 120*4882a593SmuzhiyunThese commands, +make menuconfig|nconfig|gconfig|xconfig+ and +make+, are the 121*4882a593Smuzhiyunbasic ones that allow to easily and quickly generate images fitting 122*4882a593Smuzhiyunyour needs, with all the features and applications you enabled. 123*4882a593Smuzhiyun 124*4882a593SmuzhiyunMore details about the "make" command usage are given in 125*4882a593Smuzhiyunxref:make-tips[]. 126