]>
Commit | Line | Data |
---|---|---|
1 | // -*- mode:doc; -*- | |
2 | // vim: set syntax=asciidoc: | |
3 | ||
4 | == How Buildroot works | |
5 | ||
6 | As mentioned above, Buildroot is basically a set of Makefiles that | |
7 | download, configure, and compile software with the correct options. It | |
8 | also includes patches for various software packages - mainly the ones | |
9 | involved in the cross-compilation toolchain (+gcc+, +binutils+ and | |
10 | +uClibc+). | |
11 | ||
12 | There is basically one Makefile per software package, and they are | |
13 | named with the +.mk+ extension. Makefiles are split into many different | |
14 | parts. | |
15 | ||
16 | * The +toolchain/+ directory contains the Makefiles | |
17 | and associated files for all software related to the | |
18 | cross-compilation toolchain: +binutils+, +gcc+, +gdb+, | |
19 | +kernel-headers+ and +uClibc+. | |
20 | ||
21 | * The +arch/+ directory contains the definitions for all the processor | |
22 | architectures that are supported by Buildroot. | |
23 | ||
24 | * The +package/+ directory contains the Makefiles and | |
25 | associated files for all user-space tools and libraries that Buildroot | |
26 | can compile and add to the target root filesystem. There is one | |
27 | sub-directory per package. | |
28 | ||
29 | * The +linux/+ directory contains the Makefiles and associated files for | |
30 | the Linux kernel. | |
31 | ||
32 | * The +boot/+ directory contains the Makefiles and associated files for | |
33 | the bootloaders supported by Buildroot. | |
34 | ||
35 | * The +system/+ directory contains support for system integration, e.g. | |
36 | the target filesystem skeleton and the selection of an init system. | |
37 | ||
38 | * The +fs/+ directory contains the Makefiles and | |
39 | associated files for software related to the generation of the | |
40 | target root filesystem image. | |
41 | ||
42 | Each directory contains at least 2 files: | |
43 | ||
44 | * +something.mk+ is the Makefile that downloads, configures, | |
45 | compiles and installs the package +something+. | |
46 | ||
47 | * +Config.in+ is a part of the configuration tool | |
48 | description file. It describes the options related to the | |
49 | package. | |
50 | ||
51 | The main Makefile performs the following steps (once the | |
52 | configuration is done): | |
53 | ||
54 | * Create all the output directories: +staging+, +target+, +build+, | |
55 | etc. in the output directory (+output/+ by default, | |
56 | another value can be specified using +O=+) | |
57 | ||
58 | * Generate the toolchain target. When an internal toolchain is used, this | |
59 | means generating the cross-compilation toolchain. When an external | |
60 | toolchain is used, this means checking the features of the external | |
61 | toolchain and importing it into the Buildroot environment. | |
62 | ||
63 | * Generate all the targets listed in the +TARGETS+ variable. This | |
64 | variable is filled by all the individual components' | |
65 | Makefiles. Generating these targets will trigger the compilation of | |
66 | the userspace packages (libraries, programs), the kernel, the | |
67 | bootloader and the generation of the root filesystem images, | |
68 | depending on the configuration. | |
69 |