From 7c61ca6f0c76c66adfdb4b09341f42e18b805857 Mon Sep 17 00:00:00 2001
From: Ulf Samuelsson Buildroot usage and documentation by Thomas Petazzoni. Contributions from
- Karsten Kruse, Ned Ludd, Martin Herren and others.
$LastChangedDate$
@@ -47,12 +47,12 @@ generate both a cross-compilation toolchain and a root filesystem for your target. The cross-compilation toolchain uses uClibc (http://www.uclibc.org/), a tiny C standard - library. + library.Buildroot is useful mainly for people working with embedded systems. Embedded systems often use processors that are not the regular x86 processors everyone is used to have on his PC. It can be PowerPC - processors, MIPS processors, ARM processors, etc.
+ processors, MIPS processors, ARM processors, etc.A compilation toolchain is the set of tools that allows to compile code for your system. It consists of a compiler (in our @@ -71,7 +71,7 @@ generally, the machine on which it is running, and on which you're working is called the "host system". The compilation toolchain is provided by your distribution, and Buildroot has nothing to do - with it.
+ with it.As said above, the compilation toolchain that comes with your system runs and generates code for the processor of your host system. As your @@ -81,7 +81,7 @@ example, if your host system uses x86 and your target system uses ARM, the regular compilation toolchain of your host runs on x86 and generates code for x86, while the cross-compilation toolchain runs on x86 and generates - code for ARM.
+ code for ARM.Even if your embedded system uses a x86 processor, you might interested in Buildroot, for two reasons:
@@ -92,10 +92,10 @@ Libc on your target system, you can use uClibc which is a tiny C standard library. If you want to use this C library, then you need a compilation toolchain to generate binaries linked with it. Buildroot can do it for - you. + you.You might wonder why such a tool is needed when you can compile
@@ -105,17 +105,17 @@
version it very time-consuming and uninteresting. Buildroot automates this
process through the use of Makefiles, and has a collection of patches for
each gcc
and binutils
version to make them work
- on most architectures.
Buildroot is available as daily SVN snapshots or directly using - SVN.
+ SVN.The latest snapshot is always available at http://buildroot.uclibc.org/downloads/snapshots/buildroot-snapshot.tar.bz2, and previous snapshots are also available at http://buildroot.uclibc.org/downloads/snapshots/.
+ href="http://buildroot.uclibc.org/downloads/snapshots/">http://buildroot.uclibc.org/downloads/snapshots/.To download Buildroot using SVN, you can simply follow
the rules described on the "Accessing SVN"-page (
For each entry of the configuration tool, you can find associated help
- that describes the purpose of the entry.
One of the key configuration items is the PROJECT
which
determines where some board specific packages are built and where the
@@ -152,7 +152,7 @@
Once everything is configured, the configuration tool has generated a
.config
file that contains the description of your
- configuration. It will be used by the Makefiles to do what's needed.
Let's go:
@@ -176,7 +176,7 @@ $ make sourceYou can now disconnect or copy the content of your dl
- directory to the build-host.
target/generic/target_skeleton/
. You can customize
@@ -222,7 +222,7 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
is not yet present, because it's created during the compilation process.
So you can't do everything on this target filesystem skeleton, but
changes to it remain even if you completely rebuild the cross-compilation
- toolchain and the tools.target/generic/device_table.txt
file which is used by the tools that generate the target filesystem image
to properly set permissions and create device nodes. The
@@ -230,11 +230,11 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
directories of a root filesystem and there is no obvious reason for which
it should be changed. These main directories are in an tarball inside of
inside the skeleton because it contains symlinks that would be broken
- otherwise.project_build_ARCH/root/
just before the actual image
is made. So simply rebuilding the image by running
- make should propagate any new changes to the image.make menuconfig
,
you can specify the contents of the /etc/hostname and /etc/issue
@@ -247,17 +247,17 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
Busybox is very configurable, and you may want to customize it. You can follow these simple steps to do it. It's not an optimal way, but it's - simple and it works.
+ simple and it works.make busybox-menuconfig
.
The nice configuration tool appears and you can
- customize everything.Otherwise, you can simply change the @@ -265,7 +265,7 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD know the options you want to change without using the configuration tool.
If you want to use an existing config file for busybox, then see - section environment variables.
+ section environment variables.Just like BusyBox, uClibc offers a lot of configuration options. They allow to select various - functionalities, depending on your needs and limitations.
+ functionalities, depending on your needs and limitations.The easiest way to modify the configuration of uClibc is to follow these steps :
@@ -281,19 +281,19 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEADmake uclibc-menuconfig
.
The nice configuration assistant, similar to
the one used in the Linux Kernel or in Buildroot appears. Make
- your configuration as appropriate..config
file to
toolchain/uClibc/uClibc.config
or
toolchain/uClibc/uClibc.config-locale
. The former
is used if you haven't selected locale support in Buildroot
configuration, and the latter is used if you have selected
- locale support.Otherwise, you can simply change
toolchain/uClibc/uClibc.config
or
toolchain/uClibc/uClibc.config-locale
without running
- the configuration assistant.
If you want to use an existing config file for uclibc, then see - section environment variables.
+ section environment variables.gcc
, binutils
and
- uClibc).
+ uClibc).
There is basically one Makefile per software, and they are named with
the .mk
extension. Makefiles are split into three
@@ -324,13 +324,13 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
package/
directory) contains the
Makefiles and associated files for all user-space tools that Buildroot
can compile and add to the target root filesystem. There is one
- sub-directory per tool.toolchain/
directory) contains
the Makefiles and associated files for all software related to the
cross-compilation toolchain : binutils
, ccache
,
gcc
, gdb
, kernel-headers
and
- uClibc
.uClibc
.
target
directory) contains the
Makefiles and associated files for software related to the generation of
@@ -338,18 +338,18 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
: ext2, jffs2, cramfs and squashfs. For each of them, there's a
sub-directory with the required files. There is also a
default/
directory that contains the target filesystem
- skeleton.Each directory contains at least 2 files :
something.mk
is the Makefile that downloads, configures,
- compiles and installs the software something
.something
.
Config.in
is a part of the configuration tool
description file. It describes the option related to the current
- software.dl/
by default). This is
where the tarballs will be downloaded. It is interesting to know that the
tarballs are in this directory because it may be useful to save them
- somewhere to avoid further downloads.build_ARCH/
by
default, where ARCH
is your architecture). This is where all
@@ -381,7 +381,7 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
binaries/$(PROJECT)
by default, where ARCH
- is your architecture). This is where the root file system images are
+ is your architecture). This is where the root filesystem images are
stored, It is also used to store the linux kernel image and any
utilities, boot-loaders etc. needed for a target.
toolchain_build_ARCH/
by default, where ARCH
is your architecture). This is where the cross compilation toolchain will
- be compiled.build_ARCH/staging_dir/
by
default). This is where the cross-compilation toolchain will be
@@ -398,7 +398,7 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
build_ARCH/staging_dir/usr/bin
to your PATH, and then use
arch-linux-gcc
to compile your application. In order to
setup this staging directory, it first removes it, and then it creates
- various subdirectories and symlinks inside it.project_build_ARCH/root/
by
default) and the target filesystem skeleton. This directory will contain
@@ -406,12 +406,12 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
uncompress the target/generic/skel.tar.gz
file to create the
main subdirectories and symlinks, copies the skeleton available in
target/generic/target_skeleton
and then removes useless
- .svn/
directories..svn/
directories.
TARGETS
dependency. This should generally check
if the configuration option for this package is enabled, and if so then
"subscribe" this package to be compiled by adding it to the
- TARGETS global variable.You may want to compile your own programs or other software that are not packaged in Buildroot. In order to do this, you can - use the toolchain that was generated by Buildroot.
+ use the toolchain that was generated by Buildroot.The toolchain generated by Buildroot by default is located in
build_ARCH/staging_dir/
. The simplest way to use it
is to add build_ARCH/staging_dir/usr/bin/
to your PATH
environnement variable, and then to use
arch-linux-gcc
, arch-linux-objdump
,
- arch-linux-ld
, etc.
arch-linux-ld
, etc.
For example, you may add the following to your
.bashrc
(considering you're building for the MIPS
@@ -448,10 +448,10 @@ mips-linux-gcc -o foo foo.c
gcc configuration. If the default toolchain directory
doesn't suit your needs, please refer to the Using the uClibc toolchain outside of
- buildroot section.
If you are using a current gcc-4.x, then use --sysroot and -isysroot since these toolchains have fully functional sysroot support. No - hardcoded paths do exist in these configurations.
+ hardcoded paths do exist in these configurations.build_ARCH/staging_dir/
directory elsewhere is not possible if using gcc-3.x, because they
are some hardcoded paths in the toolchain configuration. This works, thanks
- to sysroot support, with current, stable gcc-4.x toolchains, of course.
+ to sysroot support, with current, stable gcc-4.x toolchains, of course.
If you want to use the generated gcc-3.x toolchain for other purposes,
you can configure Buildroot to generate it elsewhere using the
option of the configuration tool : Build options ->
Toolchain and header file location
, which defaults to
- $(BUILD_DIR)/staging_dir/
.
$(BUILD_DIR)/staging_dir/
.
This section will only consider the case in which you want to - add user-space software.
+ add user-space software.First of all, create a directory under the package
- directory for your software, for example foo
.
foo
.
Config.in
fileOf course, you can add other options to configure particular - things in your software.
+ things in your software.foo.mk
. It will contain the Makefile rules that
are in charge of downloading, configuring, compiling and installing
the software. Below is an example that we will comment
- afterwards.
+ afterwards.
1 ############################################################# @@ -587,7 +587,7 @@ config BR2_PACKAGE_FOO binary software. For other software such as libraries or more complex stuff with multiple binaries, it should be adapted. Look at the other*.mk
files in thepackage
- directory. + directory.At lines 6-11, a couple of useful variables are defined :
@@ -595,33 +595,33 @@ config BR2_PACKAGE_FOO
FOO_VERSION
: The version of foo that
- should be downloaded.FOO_SOURCE
: The name of the tarball of
foo on the download website of FTP site. As you can see
- FOO_VERSION
is used.FOO_VERSION
is used.
FOO_SITE
: The HTTP or FTP site from which
foo archive is downloaded. It must include the complete
path to the directory where FOO_SOURCE
can be
- found.FOO_DIR
: The directory into which the software
will be configured and compiled. Basically, it's a subdirectory
of BUILD_DIR
which is created upon decompression of
- the tarball.FOO_BINARY
: Software binary name. As said
- previously, this is an example for a single binary software.FOO_TARGET_BINARY
: The full path of the binary
- inside the target filesystem.Lines 13-14 defines a target that downloads the
tarball from the remote site to the download directory
- (DL_DIR
).
DL_DIR
).
Lines 16-18 defines a target and associated rules that uncompress the downloaded tarball. As you can see, this target @@ -631,7 +631,7 @@ config BR2_PACKAGE_FOO to mark the software has having been uncompressed. This trick is used everywhere in Buildroot Makefile to split steps (download, uncompress, configure, compile, install) while still - having correct dependencies.
+ having correct dependencies.Lines 20-31 defines a target and associated rules
that configures the software. It depends on the previous target (the
@@ -643,14 +643,14 @@ config BR2_PACKAGE_FOO
/usr
, not because the software will be installed in
/usr
on your host system, but in the target
filesystem. Finally it creates a .configured
file to
- mark the software as configured.
Lines 33-34 defines a target and a rule that
compiles the software. This target will create the binary file in the
compilation directory, and depends on the software being already
configured (hence the reference to the .configured
file). It basically runs make
inside the source
- directory.
Lines 36-38 defines a target and associated rules
that install the software inside the target filesystem. It depends on the
@@ -661,7 +661,7 @@ config BR2_PACKAGE_FOO
the software inside host /usr
but inside target
/usr
. After the installation, the
/usr/man
directory inside the target filesystem is
- removed to save space.
Line 40 defines the main target of the software,
the one that will be eventually be used by the top level
@@ -678,18 +678,18 @@ config BR2_PACKAGE_FOO
once for later offline build. Note that if you add a new package providing
a foo-source
target is mandatory to support
users that wish to do offline-builds. Furthermore it eases checking
- if all package-sources are downloadable.
Lines 44-46 define a simple target to clean the
software build by calling the Makefiles with the appropriate option.
The -clean
target should run make clean
on $(BUILD_DIR)/package-version and MUST uninstall all files of the
- package from $(STAGING_DIR) and from $(TARGET_DIR).
Lines 48-49 define a simple target to completely
remove the directory in which the software was uncompressed, configured and
compiled. The -dirclean
target MUST completely rm $(BUILD_DIR)/
- package-version.
Lines 51-58 adds the target foo
to
the list of targets to be compiled by Buildroot by first checking if
@@ -699,7 +699,7 @@ config BR2_PACKAGE_FOO
global variable. The name added to the TARGETS global
variable is the name of this package's target, as defined on
line 40, which is used by Buildroot to download,
- compile, and then install this package.
As you can see, adding a software to buildroot is simply a matter of writing a Makefile using an already existing example and to modify it according to the compilation process of - the software.
+ the software.If you package software that might be useful for other persons, don't forget to send a patch to Buildroot developers !
-- cgit v1.2.3