mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 22:26:31 +00:00
buildroot.html: html code clean-up and other issues - Part1
The current DocType declaration was incorrect. It is neither xhtml strict nor xhtml transitional. So, instead of dealing with that issue, converted it to validated Html5. Fixed white-space errors. Removed validator html4.01 code. Color corrected the code sections. Removed redundant or useless html code. Changed foo to libfoo, for consistency. Changed page bookmarking to use header id's. Re-flowed paragraphs to line break at 80 characters. Re-formatted the code sections for consistency and correctness. Kept all list items, headings, and href's on a single line (where possible). Signed-off-by: Martin Banky <Martin.Banky@gmail.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
parent
a454cb61c0
commit
8113c8162b
@ -1,12 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<!DOCTYPE html>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
<html lang="en">
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
<head>
|
||||||
<title>Buildroot - Usage and documentation</title>
|
<title>Buildroot - Usage and documentation</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||||
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
|
<link rel="stylesheet" href="stylesheet.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@ -15,26 +13,21 @@
|
|||||||
<h1>Buildroot</h1>
|
<h1>Buildroot</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p><a href="http://buildroot.net/">Buildroot</a>
|
<p><a href="http://buildroot.net/">Buildroot</a> usage and documentation
|
||||||
usage and documentation by Thomas Petazzoni. Contributions from
|
by Thomas Petazzoni. Contributions from Karsten Kruse, Ned Ludd, Martin
|
||||||
Karsten Kruse, Ned Ludd, Martin Herren and others. </p>
|
Herren and others.</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li><a href="#about">About Buildroot</a></li>
|
<li><a href="#about">About Buildroot</a></li>
|
||||||
<li><a href="#download">Obtaining Buildroot</a></li>
|
<li><a href="#download">Obtaining Buildroot</a></li>
|
||||||
<li><a href="#using">Using Buildroot</a></li>
|
<li><a href="#using">Using Buildroot</a></li>
|
||||||
<li><a href="#custom_targetfs">Customizing the generated target filesystem</a></li>
|
<li><a href="#custom_targetfs">Customizing the generated target filesystem</a></li>
|
||||||
<li><a href="#custom_busybox">Customizing the Busybox
|
<li><a href="#custom_busybox">Customizing the Busybox configuration</a></li>
|
||||||
configuration</a></li>
|
<li><a href="#custom_uclibc">Customizing the uClibc configuration</a></li>
|
||||||
<li><a href="#custom_uclibc">Customizing the uClibc
|
<li><a href="#custom_linux26">Customizing the Linux kernel configuration</a></li>
|
||||||
configuration</a></li>
|
|
||||||
<li><a href="#custom_linux26">Customizing the Linux kernel
|
|
||||||
configuration</a></li>
|
|
||||||
<li><a href="#rebuilding_packages">Understanding how to rebuild packages</a></li>
|
<li><a href="#rebuilding_packages">Understanding how to rebuild packages</a></li>
|
||||||
<li><a href="#buildroot_innards">How Buildroot works</a></li>
|
<li><a href="#buildroot_innards">How Buildroot works</a></li>
|
||||||
<li><a href="#using_toolchain">Using the uClibc toolchain
|
<li><a href="#using_toolchain">Using the uClibc toolchain outside Buildroot</a></li>
|
||||||
outside Buildroot</a></li>
|
|
||||||
<li><a href="#external_toolchain">Use an external toolchain</a></li>
|
<li><a href="#external_toolchain">Use an external toolchain</a></li>
|
||||||
<li><a href="#downloaded_packages">Location of downloaded packages</a></li>
|
<li><a href="#downloaded_packages">Location of downloaded packages</a></li>
|
||||||
<li><a href="#add_packages">Adding new packages to Buildroot</a></li>
|
<li><a href="#add_packages">Adding new packages to Buildroot</a></li>
|
||||||
@ -42,12 +35,12 @@
|
|||||||
<li><a href="#links">Resources</a></li>
|
<li><a href="#links">Resources</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2><a name="about" id="about"></a>About Buildroot</h2>
|
<h2 id="about">About Buildroot</h2>
|
||||||
|
|
||||||
<p>Buildroot is a set of Makefiles and patches that allows you to
|
<p>Buildroot is a set of Makefiles and patches that allows you to easily
|
||||||
easily generate a cross-compilation toolchain, a root filesystem
|
generate a cross-compilation toolchain, a root filesystem and a Linux
|
||||||
and a Linux kernel image for your target. Buildroot can be used
|
kernel image for your target. Buildroot can be used for one, two or all
|
||||||
for one, two or all of these options, independently.</p>
|
of these options, independently.</p>
|
||||||
|
|
||||||
<p>Buildroot is useful mainly for people working with embedded systems.
|
<p>Buildroot is useful mainly for people working with embedded systems.
|
||||||
Embedded systems often use processors that are not the regular x86
|
Embedded systems often use processors that are not the regular x86
|
||||||
@ -55,45 +48,45 @@
|
|||||||
processors, MIPS processors, ARM processors, etc.</p>
|
processors, MIPS processors, ARM processors, etc.</p>
|
||||||
|
|
||||||
<p>A compilation toolchain is the set of tools that allows you to
|
<p>A compilation toolchain is the set of tools that allows you to
|
||||||
compile code for your system. It consists of a compiler (in our
|
compile code for your system. It consists of a compiler (in our case,
|
||||||
case, <code>gcc</code>), binary utils like assembler and linker
|
<code>gcc</code>), binary utils like assembler and linker (in our case,
|
||||||
(in our case, <code>binutils</code>) and a C standard library (for
|
<code>binutils</code>) and a C standard library (for example
|
||||||
example <a href="http://www.gnu.org/software/libc/libc.html">GNU
|
<a href="http://www.gnu.org/software/libc/libc.html">GNU Libc</a>,
|
||||||
Libc</a>, <a href="http://www.uclibc.org/">uClibc</a> or <a
|
<a href="http://www.uclibc.org/">uClibc</a> or
|
||||||
href="http://www.fefe.de/dietlibc/">dietlibc</a>). The system
|
<a href="http://www.fefe.de/dietlibc/">dietlibc</a>). The system installed
|
||||||
installed on your development station certainly already has a
|
on your development station certainly already has a compilation
|
||||||
compilation toolchain that you can use to compile an application that
|
toolchain that you can use to compile an application that runs on your
|
||||||
runs on your system. If you're using a PC, your compilation
|
system. If you're using a PC, your compilation toolchain runs on an x86
|
||||||
toolchain runs on an x86 processor and generates code for an x86
|
processor and generates code for an x86 processor. Under most Linux
|
||||||
processor. Under most Linux systems, the compilation toolchain
|
systems, the compilation toolchain uses the GNU libc (glibc) as the C
|
||||||
uses the GNU libc (glibc) as the C standard library. This compilation
|
standard library. This compilation toolchain is called the "host
|
||||||
toolchain is called the "host compilation toolchain".
|
compilation toolchain". The machine on which it is running, and on
|
||||||
The machine on which it is running, and on which you're
|
which you're working, is called the "host system". The
|
||||||
working, is called the "host system". The compilation toolchain
|
compilation toolchain is provided by your distribution, and Buildroot
|
||||||
is provided by your distribution, and Buildroot has nothing to do
|
has nothing to do with it (other than using it to build a
|
||||||
with it (other than using it to build a cross-compilation toolchain
|
cross-compilation toolchain and other tools that are run on the
|
||||||
and other tools that are run on the development host). </p>
|
development host).</p>
|
||||||
|
|
||||||
<p>As said above, the compilation toolchain that comes with your system
|
<p>As said above, the compilation toolchain that comes with your system
|
||||||
runs on and generates code for the processor in your host system. As your
|
runs on and generates code for the processor in your host system. As
|
||||||
embedded system has a different processor, you need a cross-compilation
|
your embedded system has a different processor, you need a
|
||||||
toolchain — a compilation toolchain that runs on your host system but
|
cross-compilation toolchain — a compilation toolchain that runs on
|
||||||
generates code for your target system (and target processor). For
|
your host system but generates code for your target system (and target
|
||||||
example, if your host system uses x86 and your target system uses ARM, the
|
processor). For example, if your host system uses x86 and your target
|
||||||
regular compilation toolchain on your host runs on x86 and generates code
|
system uses ARM, the regular compilation toolchain on your host runs on
|
||||||
for x86, while the cross-compilation toolchain runs on x86 and generates
|
x86 and generates code for x86, while the cross-compilation toolchain
|
||||||
code for ARM. </p>
|
runs on x86 and generates code for ARM.</p>
|
||||||
|
|
||||||
<p>Even if your embedded system uses an x86 processor, you might be interested
|
<p>Even if your embedded system uses an x86 processor, you might be
|
||||||
in Buildroot for two reasons:</p>
|
interested in Buildroot for two reasons:</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>The compilation toolchain on your host certainly uses the GNU Libc
|
<li>The compilation toolchain on your host certainly uses the GNU Libc
|
||||||
which is a complete but huge C standard library. Instead of using GNU
|
which is a complete but huge C standard library. Instead of using GNU
|
||||||
Libc on your target system, you can use uClibc which is a tiny C standard
|
Libc on your target system, you can use uClibc which is a tiny C
|
||||||
library. If you want to use this C library, then you need a compilation
|
standard library. If you want to use this C library, then you need a
|
||||||
toolchain to generate binaries linked with it. Buildroot can do that for
|
compilation toolchain to generate binaries linked with it. Buildroot
|
||||||
you. </li>
|
can do that for you.</li>
|
||||||
|
|
||||||
<li>Buildroot automates the building of a root filesystem with all needed
|
<li>Buildroot automates the building of a root filesystem with all needed
|
||||||
tools like busybox. That makes it much easier than doing it by hand.</li>
|
tools like busybox. That makes it much easier than doing it by hand.</li>
|
||||||
@ -101,55 +94,53 @@
|
|||||||
|
|
||||||
<p>You might wonder why such a tool is needed when you can compile
|
<p>You might wonder why such a tool is needed when you can compile
|
||||||
<code>gcc</code>, <code>binutils</code>, <code>uClibc</code> and all
|
<code>gcc</code>, <code>binutils</code>, <code>uClibc</code> and all
|
||||||
the other tools by hand.
|
the other tools by hand. Of course doing so is possible. But, dealing with
|
||||||
Of course doing so is possible. But, dealing with all of the configure options
|
all of the configure options and problems of every <code>gcc</code> or
|
||||||
and problems of every <code>gcc</code> or <code>binutils</code>
|
<code>binutils</code> version is very time-consuming and uninteresting.
|
||||||
version is very time-consuming and uninteresting. Buildroot automates this
|
Buildroot automates this process through the use of Makefiles and has a
|
||||||
process through the use of Makefiles and has a collection of patches for
|
collection of patches for each <code>gcc</code> and <code>binutils</code>
|
||||||
each <code>gcc</code> and <code>binutils</code> version to make them work
|
version to make them work on most architectures.</p>
|
||||||
on most architectures. </p>
|
|
||||||
|
|
||||||
<p>Moreover, Buildroot provides an infrastructure for reproducing
|
<p>Moreover, Buildroot provides an infrastructure for reproducing
|
||||||
the build process of your kernel, cross-toolchain, and embedded root filesystem. Being able to
|
the build process of your kernel, cross-toolchain, and embedded root
|
||||||
reproduce the build process will be useful when a component needs
|
filesystem. Being able to reproduce the build process will be useful when a
|
||||||
to be patched or updated or when another person is supposed to
|
component needs to be patched or updated or when another person is supposed
|
||||||
take over the project.</p>
|
to take over the project.</p>
|
||||||
|
|
||||||
<h2><a name="download" id="download"></a>Obtaining Buildroot</h2>
|
<h2 id="download">Obtaining Buildroot</h2>
|
||||||
|
|
||||||
<p>Buildroot releases are made approximately every 3
|
<p>Buildroot releases are made approximately every 3
|
||||||
months. Direct Git access and daily snapshots are also
|
months. Direct Git access and daily snapshots are also
|
||||||
available if you want more bleeding edge.</p>
|
available if you want more bleeding edge.</p>
|
||||||
|
|
||||||
<p>Releases are available at <a
|
<p>Releases are available at
|
||||||
href="http://buildroot.net/downloads/">http://buildroot.net/downloads/</a>.</p>
|
<a href="http://buildroot.net/downloads/">http://buildroot.net/downloads/</a>.</p>
|
||||||
|
|
||||||
<p>The latest snapshot is always available at <a
|
<p>The latest snapshot is always available at
|
||||||
href="http://buildroot.net/downloads/snapshots/buildroot-snapshot.tar.bz2">http://buildroot.net/downloads/snapshots/buildroot-snapshot.tar.bz2</a>,
|
<a href="http://buildroot.net/downloads/snapshots/buildroot-snapshot.tar.bz2">http://buildroot.net/downloads/snapshots/buildroot-snapshot.tar.bz2</a>,
|
||||||
and previous snapshots are also available at <a
|
and previous snapshots are also available at
|
||||||
href="http://buildroot.net/downloads/snapshots/">http://buildroot.net/downloads/snapshots/</a>. </p>
|
<a href="http://buildroot.net/downloads/snapshots/">http://buildroot.net/downloads/snapshots/</a>.</p>
|
||||||
|
|
||||||
<p>To download Buildroot using Git you can simply follow
|
<p>To download Buildroot using Git you can simply follow
|
||||||
the rules described on the "Accessing Git" page (<a href=
|
the rules described on the "Accessing Git" page
|
||||||
"http://buildroot.net/git.html">http://buildroot.net/git.html</a>)
|
(<a href= "http://buildroot.net/git.html">http://buildroot.net/git.html</a>)
|
||||||
of the Buildroot website (<a href=
|
of the Buildroot website
|
||||||
"http://buildroot.net">http://buildroot.net</a>).
|
(<a href="http://buildroot.net">http://buildroot.net</a>).
|
||||||
For the impatient, here's a quick
|
For the impatient, here's a quick recipe:</p>
|
||||||
recipe:</p>
|
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
$ git clone git://git.buildroot.net/buildroot
|
$ git clone git://git.buildroot.net/buildroot
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h2><a name="using" id="using"></a>Using Buildroot</h2>
|
<h2 id="using">Using Buildroot</h2>
|
||||||
|
|
||||||
<p>Buildroot has a nice configuration tool similar to the one you can find
|
<p>Buildroot has a nice configuration tool similar to the one you can find
|
||||||
in the Linux kernel (<a href=
|
in the Linux kernel
|
||||||
"http://www.kernel.org/">http://www.kernel.org/</a>) or in Busybox
|
(<a href="http://www.kernel.org/">http://www.kernel.org/</a>) or in Busybox
|
||||||
(<a href="http://www.busybox.org/">http://www.busybox.org/</a>). Note that
|
(<a href="http://www.busybox.org/">http://www.busybox.org/</a>). Note that
|
||||||
you can (and should) build everything as a normal user. There is no need to be root to
|
you can (and should) build everything as a normal user. There is no need to
|
||||||
configure and use Buildroot. The first step is to run the configuration
|
be root to configure and use Buildroot. The first step is to run the
|
||||||
assistant:</p>
|
configuration assistant:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
$ make menuconfig
|
$ make menuconfig
|
||||||
@ -161,7 +152,7 @@
|
|||||||
$ make xconfig
|
$ make xconfig
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
or
|
<p>or</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
$ make gconfig
|
$ make gconfig
|
||||||
@ -170,17 +161,15 @@ or
|
|||||||
<p>to run the Qt3 or GTK-based configurators.</p>
|
<p>to run the Qt3 or GTK-based configurators.</p>
|
||||||
|
|
||||||
<p>All of these "make" commands will need to build a configuration
|
<p>All of these "make" commands will need to build a configuration
|
||||||
utility, so you may need to install "development" packages for
|
utility, so you may need to install "development" packages for relevant
|
||||||
relevant libraries used by the configuration utilities.
|
libraries used by the configuration utilities. On Debian-like systems,
|
||||||
On Debian-like systems, the
|
the <code>libncurses5-dev</code> package is required to use the <i>
|
||||||
<code>libncurses5-dev</code> package is required to use the
|
menuconfig</i> interface, <code>libqt3-mt-dev</code> is required to use
|
||||||
<i>menuconfig</i> interface, <code>libqt3-mt-dev</code> is
|
the <i>xconfig</i> interface, and <code>libglib2.0-dev, libgtk2.0-dev
|
||||||
required to use the <i>xconfig</i> interface, and
|
and libglade2-dev</code> are needed to used the <i>gconfig</i> interface.</p>
|
||||||
<code>libglib2.0-dev, libgtk2.0-dev and libglade2-dev</code> are
|
|
||||||
needed to used the <i>gconfig</i> interface.</p>
|
|
||||||
|
|
||||||
<p>For each menu entry in the configuration tool, you can find associated help
|
<p>For each menu entry in the configuration tool, you can find associated
|
||||||
that describes the purpose of the entry. </p>
|
help that describes the purpose of the entry.</p>
|
||||||
|
|
||||||
<p>Once everything is configured, the configuration tool generates a
|
<p>Once everything is configured, the configuration tool generates a
|
||||||
<code>.config</code> file that contains the description of your
|
<code>.config</code> file that contains the description of your
|
||||||
@ -192,6 +181,7 @@ or
|
|||||||
<pre>
|
<pre>
|
||||||
$ make
|
$ make
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>This command will generally perform the following steps:</p>
|
<p>This command will generally perform the following steps:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Download source files (as required)</li>
|
<li>Download source files (as required)</li>
|
||||||
@ -205,74 +195,69 @@ or
|
|||||||
selected in the Buildroot configuration.
|
selected in the Buildroot configuration.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>Buildroot output is stored in a single directory,
|
<p>Buildroot output is stored in a single directory, <code>output/</code>.
|
||||||
<code>output/</code>. This directory contains several
|
This directory contains several subdirectories:</p>
|
||||||
subdirectories:</p>
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li><code>images/</code> where all the images (kernel image,
|
<li><code>images/</code> where all the images (kernel image,
|
||||||
bootloader and root filesystem images) are stored.</li>
|
bootloader and root filesystem images) are stored.</li>
|
||||||
|
|
||||||
<li><code>build/</code> where all the components except for the
|
<li><code>build/</code> where all the components except for the
|
||||||
cross-compilation toolchain are built
|
cross-compilation toolchain are built (this includes tools needed to
|
||||||
(this includes tools needed to run Buildroot on the host and packages compiled
|
run Buildroot on the host and packages compiled for the target). The
|
||||||
for the target). The <code>build/</code> directory contains one
|
<code>build/</code> directory contains one subdirectory for each of
|
||||||
subdirectory for each of these components.</li>
|
these components.</li>
|
||||||
|
|
||||||
<li><code>staging/</code> which contains a hierarchy similar to
|
<li><code>staging/</code> which contains a hierarchy similar to a root
|
||||||
a root filesystem hierarchy. This directory contains the
|
filesystem hierarchy. This directory contains the installation of the
|
||||||
installation of the cross-compilation toolchain and all the
|
cross-compilation toolchain and all the userspace packages selected
|
||||||
userspace packages selected for the target. However, this
|
for the target. However, this directory is <i>not</i> intended to be
|
||||||
directory is <i>not</i> intended to be the root filesystem for
|
the root filesystem for the target: it contains a lot of development
|
||||||
the target: it contains a lot of development files, unstripped
|
files, unstripped binaries and libraries that make it far too big for
|
||||||
binaries and libraries that make it far too big for an embedded
|
an embedded system. These development files are used to compile
|
||||||
system. These development files are used to compile libraries
|
libraries and applications for the target that depend on other
|
||||||
and applications for the target that depend on other
|
|
||||||
libraries.</li>
|
libraries.</li>
|
||||||
|
|
||||||
<li><code>target/</code> which contains <i>almost</i> the root
|
<li><code>target/</code> which contains <i>almost</i> the root
|
||||||
filesystem for the target: everything needed is present except
|
filesystem for the target: everything needed is present except the
|
||||||
the device files in <code>/dev/</code> (Buildroot can't create
|
device files in <code>/dev/</code> (Buildroot can't create them
|
||||||
them because Buildroot doesn't run as root and does not want to
|
because Buildroot doesn't run as root and does not want to run as
|
||||||
run as root). Therefore, this directory <b>should not be used on
|
root). Therefore, this directory <b>should not be used on your target</b>.
|
||||||
your target</b>. Instead, you should use one of the images
|
Instead, you should use one of the images built in the
|
||||||
built in the <code>images/</code> directory. If you need an
|
<code>images/</code> directory. If you need an extracted image of the
|
||||||
extracted image of the root filesystem for booting over NFS,
|
root filesystem for booting over NFS, then use the tarball image
|
||||||
then use the tarball image generated in <code>images/</code> and
|
generated in <code>images/</code> and extract it as root.<br/>Compared
|
||||||
extract it as root.<br/>Compared to <code>staging/</code>,
|
to <code>staging/</code>, <code>target/</code> contains only the
|
||||||
<code>target/</code> contains only the files and libraries needed
|
files and libraries needed to run the selected target applications:
|
||||||
to run the selected target applications: the development files
|
the development files (headers, etc.) are not present.</li>
|
||||||
(headers, etc.) are not present.</li>
|
|
||||||
|
|
||||||
<li><code>host/</code> contains the installation of tools
|
<li><code>host/</code> contains the installation of tools compiled for
|
||||||
compiled for the host that are needed for the proper execution
|
the host that are needed for the proper execution of Buildroot except
|
||||||
of Buildroot except for the cross-compilation toolchain which is
|
for the cross-compilation toolchain which is installed under
|
||||||
installed under <code>staging/</code>.</li>
|
<code>staging/</code>.</li>
|
||||||
|
|
||||||
<li><code>toolchain/</code> contains the build directories for
|
|
||||||
the various components of the cross-compilation toolchain.</li>
|
|
||||||
|
|
||||||
|
<li><code>toolchain/</code> contains the build directories for the
|
||||||
|
various components of the cross-compilation toolchain.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3><a name="offline_builds" id="offline_builds"></a>
|
<h3 id="offline_builds">Offline builds</h3>
|
||||||
Offline builds</h3>
|
|
||||||
|
|
||||||
<p>If you intend to do an offline build and just want to download
|
<p>If you intend to do an offline build and just want to download
|
||||||
all sources that you previously selected in the configurator
|
all sources that you previously selected in the configurator
|
||||||
(<i>menuconfig</i>, <i>xconfig</i> or <i>gconfig</i>), then issue:</p>
|
(<i>menuconfig</i>, <i>xconfig</i> or <i>gconfig</i>), then issue:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
$ make source
|
$ make source
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>You can now disconnect or copy the content of your <code>dl</code>
|
<p>You can now disconnect or copy the content of your <code>dl</code>
|
||||||
directory to the build-host.</p>
|
directory to the build-host.</p>
|
||||||
|
|
||||||
<h3><a name="building_out_of_tree" id="building_out_of_tree"></a>
|
<h3 id="building_out_of_tree">Building out-of-tree</h3>
|
||||||
Building out-of-tree</h3>
|
|
||||||
|
|
||||||
<p>Buildroot supports building out of tree with a syntax similar
|
<p>Buildroot supports building out of tree with a syntax similar to the
|
||||||
to the Linux kernel. To use it, add O=<directory> to the
|
Linux kernel. To use it, add O=<directory> to the make command
|
||||||
make command line:</p>
|
line:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
$ make O=/tmp/build
|
$ make O=/tmp/build
|
||||||
@ -284,115 +269,110 @@ or
|
|||||||
$ cd /tmp/build; make O=$PWD -C path/to/buildroot
|
$ cd /tmp/build; make O=$PWD -C path/to/buildroot
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>All the output files will be located under
|
<p>All the output files will be located under <code>/tmp/build</code>.</p>
|
||||||
<code>/tmp/build</code>.</p>
|
|
||||||
|
|
||||||
<p>When using out-of-tree builds, the Buildroot
|
<p>When using out-of-tree builds, the Buildroot <code>.config</code> and
|
||||||
<code>.config</code> and temporary files are also stored in the
|
temporary files are also stored in the output directory. This means that
|
||||||
output directory. This means that you can safely run multiple
|
you can safely run multiple builds in parallel using the same source
|
||||||
builds in parallel using the same source tree as long as they use
|
tree as long as they use unique output directories.</p>
|
||||||
unique output directories.</p>
|
|
||||||
|
|
||||||
<p>For ease of use, Buildroot generates a Makefile wrapper in the
|
<p>For ease of use, Buildroot generates a Makefile wrapper in the output
|
||||||
output directory - So after the first run, you no longer need to
|
directory - So after the first run, you no longer need to pass
|
||||||
pass <code>O=..</code> and <code>-C ..</code>, simply run (in the
|
<code>O=..</code> and <code>-C ..</code>, simply run (in the output
|
||||||
output directory):</p>
|
directory):</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
$ make <target>
|
$ make <target>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h3><a name="environment_variables" id="environment_variables"></a>
|
<h3 id="environment_variables">Environment variables</h3>
|
||||||
Environment variables</h3>
|
|
||||||
|
|
||||||
<p>Buildroot also honors some environment variables when they are passed
|
<p>Buildroot also honors some environment variables when they are passed
|
||||||
to <code>make</code> or set in the environment:</p>
|
to <code>make</code> or set in the environment:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>HOSTCXX</code>, the host C++ compiler to use</li>
|
<li><code>HOSTCXX</code>, the host C++ compiler to use</li>
|
||||||
<li><code>HOSTCC</code>, the host C compiler to use</li>
|
<li><code>HOSTCC</code>, the host C compiler to use</li>
|
||||||
<li><code>UCLIBC_CONFIG_FILE=<path/to/.config></code>, path
|
<li><code>UCLIBC_CONFIG_FILE=<path/to/.config></code>, path to
|
||||||
to the uClibc configuration file to use to compile uClibc if an
|
the uClibc configuration file to use to compile uClibc if an
|
||||||
internal toolchain is being built</li>
|
internal toolchain is being built</li>
|
||||||
<li><code>BUSYBOX_CONFIG_FILE=<path/to/.config></code>, path
|
<li><code>BUSYBOX_CONFIG_FILE=<path/to/.config></code>, path to
|
||||||
to the Busybox configuration file</li>
|
the Busybox configuration file</li>
|
||||||
<li><code>BUILDROOT_DL_DIR</code> to override the directory in
|
<li><code>BUILDROOT_DL_DIR</code> to override the directory in which
|
||||||
which Buildroot stores/retrieves downloaded files</li>
|
Buildroot stores/retrieves downloaded files</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>An example that uses config files located in the toplevel directory and
|
<p>An example that uses config files located in the toplevel directory and
|
||||||
in your $HOME:</p>
|
in your $HOME:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
$ make UCLIBC_CONFIG_FILE=uClibc.config BUSYBOX_CONFIG_FILE=$HOME/bb.config
|
$ make UCLIBC_CONFIG_FILE=uClibc.config BUSYBOX_CONFIG_FILE=$HOME/bb.config
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>If you want to use a compiler other than the default <code>gcc</code>
|
<p>If you want to use a compiler other than the default <code>gcc</code>
|
||||||
or <code>g++</code> for building helper-binaries on your host, then do</p>
|
or <code>g++</code> for building helper-binaries on your host, then do</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
$ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
|
$ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h2><a name="custom_targetfs" id="custom_targetfs"></a>Customizing the
|
<h2 id="custom_targetfs">Customizing the generated target filesystem</h2>
|
||||||
generated target filesystem</h2>
|
|
||||||
|
|
||||||
<p>There are a few ways to customize the resulting target filesystem:</p>
|
<p>There are a few ways to customize the resulting target filesystem:</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Customize the target filesystem directly and rebuild the image. The
|
<li>Customize the target filesystem directly and rebuild the image.
|
||||||
target filesystem is available under <code>output/target/</code>.
|
The target filesystem is available under <code>output/target/</code>.
|
||||||
You can simply make your changes here and run make afterwards — this will
|
You can simply make your changes here and run make afterwards —
|
||||||
rebuild the target filesystem image. This method allows you to do anything
|
this will rebuild the target filesystem image. This method allows you
|
||||||
to the target filesystem, but if you decide to completely rebuild your
|
to do anything to the target filesystem, but if you decide to
|
||||||
toolchain and tools, these changes will be lost. </li>
|
completely rebuild your toolchain and tools, these changes will be
|
||||||
|
lost.</li>
|
||||||
|
|
||||||
<li>Customize the target filesystem skeleton available under
|
<li>Customize the target filesystem skeleton available under <code>
|
||||||
<code>fs/skeleton/</code>. You can customize
|
fs/skeleton/</code>. You can customize configuration files or other
|
||||||
configuration files or other stuff here. However, the full file hierarchy
|
stuff here. However, the full file hierarchy is not yet present
|
||||||
is not yet present because it's created during the compilation process.
|
because it's created during the compilation process. Therefore, you
|
||||||
Therefore, you can't do everything on this target filesystem skeleton, but
|
can't do everything on this target filesystem skeleton, but changes to
|
||||||
changes to it do remain even if you completely rebuild the cross-compilation
|
it do remain even if you completely rebuild the cross-compilation
|
||||||
toolchain and the tools. <br />
|
toolchain and the tools. <br /> You can also customize the <code>
|
||||||
You can also customize the <code>target/generic/device_table.txt</code>
|
target/generic/device_table.txt</code> file which is used by the
|
||||||
file which is used by the tools that generate the target filesystem image
|
tools that generate the target filesystem image to properly set
|
||||||
to properly set permissions and create device nodes.<br />
|
permissions and create device nodes.<br /> These customizations are
|
||||||
These customizations are deployed into
|
deployed into <code>output/target/</code> just before the actual image
|
||||||
<code>output/target/</code> just before the actual image
|
is made. Simply rebuilding the image by running make should propagate
|
||||||
is made. Simply rebuilding the image by running
|
any new changes to the image.</li>
|
||||||
make should propagate any new changes to the image. </li>
|
|
||||||
|
|
||||||
<li>Add support for your own target in Buildroot so that you
|
<li>Add support for your own target in Buildroot so that you
|
||||||
have your own target skeleton (see <a href="#board_support">this
|
have your own target skeleton (see <a href="#board_support">this
|
||||||
section</a> for details).</li>
|
section</a> for details).</li>
|
||||||
|
|
||||||
<li>In the Buildroot configuration, you can specify the path to a
|
<li>In the Buildroot configuration, you can specify the path to a
|
||||||
post-build script that gets called <i>after</i> Buildroot builds
|
post-build script that gets called <i>after</i> Buildroot builds all
|
||||||
all the selected software but <i>before</i> the the rootfs
|
the selected software but <i>before</i> the the rootfs packages are
|
||||||
packages are assembled. The destination root filesystem folder
|
assembled. The destination root filesystem folder is given as the
|
||||||
is given as the first argument to this script, and this script can
|
first argument to this script, and this script can then be used to
|
||||||
then be used to copy programs, static data or any other needed
|
copy programs, static data or any other needed file to your target
|
||||||
file to your target filesystem.<br/>You should, however, use
|
filesystem.<br/>You should, however, use this feature with care.
|
||||||
this feature with care. Whenever you find that a certain package
|
Whenever you find that a certain package generates wrong or unneeded
|
||||||
generates wrong or unneeded files, you should fix that
|
files, you should fix that package rather than work around it with a
|
||||||
package rather than work around it with a post-build cleanup script.</li>
|
post-build cleanup script.</li>
|
||||||
|
|
||||||
<li>A special package, <i>customize</i>, stored in
|
<li>A special package, <i>customize</i>, stored in
|
||||||
<code>package/customize</code> can be used. You can put all the
|
<code>package/customize</code> can be used. You can put all the
|
||||||
files that you want to see in the final target root filesystem
|
files that you want to see in the final target root filesystem
|
||||||
in <code>package/customize/source</code> and then enable this
|
in <code>package/customize/source</code> and then enable this
|
||||||
special package in the configuration system.</li>
|
special package in the configuration system.</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2><a name="custom_busybox" id="custom_busybox"></a>Customizing the
|
<h2 id="custom_busybox">Customizing the Busybox configuration</h2>
|
||||||
Busybox configuration</h2>
|
|
||||||
|
|
||||||
<p><a href="http://www.busybox.net/">Busybox</a> is very configurable, and
|
<p><a href="http://www.busybox.net/">Busybox</a> is very configurable,
|
||||||
you may want to customize it. You can
|
and you may want to customize it. You can follow these simple steps to
|
||||||
follow these simple steps to do so. This method isn't optimal, but it's
|
do so. This method isn't optimal, but it's simple and it works:</p>
|
||||||
simple and it works:</p>
|
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>Do an initial compilation of Buildroot with busybox without trying to
|
<li>Do an initial compilation of Buildroot with busybox without
|
||||||
customize it. </li>
|
trying to customize it.</li>
|
||||||
|
|
||||||
<li>Invoke <code>make busybox-menuconfig</code>.
|
<li>Invoke <code>make busybox-menuconfig</code>.
|
||||||
The nice configuration tool appears, and you can
|
The nice configuration tool appears, and you can
|
||||||
@ -405,11 +385,11 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
|
|||||||
<code>package/busybox/busybox-<version>.config</code> file if you
|
<code>package/busybox/busybox-<version>.config</code> file if you
|
||||||
know the options you want to change without using the configuration tool.
|
know the options you want to change without using the configuration tool.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>If you want to use an existing config file for busybox, then see
|
<p>If you want to use an existing config file for busybox, then see
|
||||||
section <a href="#environment_variables">environment variables</a>.</p>
|
section <a href="#environment_variables">environment variables</a>.</p>
|
||||||
|
|
||||||
<h2><a name="custom_uclibc" id="custom_uclibc"></a>Customizing the uClibc
|
<h2 id="custom_uclibc">Customizing the uClibc configuration</h2>
|
||||||
configuration</h2>
|
|
||||||
|
|
||||||
<p>Just like <a href="#custom_busybox">BusyBox</a>, <a
|
<p>Just like <a href="#custom_busybox">BusyBox</a>, <a
|
||||||
href="http://www.uclibc.org/">uClibc</a> offers a lot of
|
href="http://www.uclibc.org/">uClibc</a> offers a lot of
|
||||||
@ -420,7 +400,6 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
|
|||||||
follow these steps:</p>
|
follow these steps:</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<li>Do an initial compilation of Buildroot without trying to
|
<li>Do an initial compilation of Buildroot without trying to
|
||||||
customize uClibc.</li>
|
customize uClibc.</li>
|
||||||
|
|
||||||
@ -437,7 +416,6 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
|
|||||||
locale support.</li>
|
locale support.</li>
|
||||||
|
|
||||||
<li>Run the compilation of Buildroot again.</li>
|
<li>Run the compilation of Buildroot again.</li>
|
||||||
|
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<p>Otherwise, you can simply change
|
<p>Otherwise, you can simply change
|
||||||
@ -448,8 +426,7 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
|
|||||||
<p>If you want to use an existing config file for uclibc, then see
|
<p>If you want to use an existing config file for uclibc, then see
|
||||||
section <a href="#environment_variables">environment variables</a>.</p>
|
section <a href="#environment_variables">environment variables</a>.</p>
|
||||||
|
|
||||||
<h2><a name="custom_linux26" id="custom_linux26"></a>Customizing
|
<h2 id="custom_linux26">Customizing the Linux kernel configuration</h2>
|
||||||
the Linux kernel configuration</h2>
|
|
||||||
|
|
||||||
<p>The Linux kernel configuration can be customized just like <a
|
<p>The Linux kernel configuration can be customized just like <a
|
||||||
href="#custom_busybox">BusyBox</a> and <a href="#custom_uclibc">uClibc</a>
|
href="#custom_busybox">BusyBox</a> and <a href="#custom_uclibc">uClibc</a>
|
||||||
@ -460,9 +437,7 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
|
|||||||
<p>If you want to use an existing config file for Linux, then see
|
<p>If you want to use an existing config file for Linux, then see
|
||||||
section <a href="#environment_variables">environment variables</a>.</p>
|
section <a href="#environment_variables">environment variables</a>.</p>
|
||||||
|
|
||||||
<h2><a name="#rebuilding_packages"
|
<h2 id="rebuilding_packages">Understanding how to rebuild packages</h2>
|
||||||
id="rebuilding_packages">Understanding how to rebuild
|
|
||||||
packages</a></h2>
|
|
||||||
|
|
||||||
<p>One of the most common questions asked by Buildroot
|
<p>One of the most common questions asked by Buildroot
|
||||||
users is how to rebuild a given package or how to
|
users is how to rebuild a given package or how to
|
||||||
@ -494,7 +469,6 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
|
|||||||
following stamp files are relevant:</p>
|
following stamp files are relevant:</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li><code>output/build/packagename-version/.stamp_configured</code>. If
|
<li><code>output/build/packagename-version/.stamp_configured</code>. If
|
||||||
removed, Buildroot will trigger the recompilation of the package
|
removed, Buildroot will trigger the recompilation of the package
|
||||||
from the configuration step (execution of
|
from the configuration step (execution of
|
||||||
@ -503,13 +477,11 @@ $ make HOSTCXX=g++-4.3-HEAD HOSTCC=gcc-4.3-HEAD
|
|||||||
<li><code>output/build/packagename-version/.stamp_built</code>. If
|
<li><code>output/build/packagename-version/.stamp_built</code>. If
|
||||||
removed, Buildroot will trigger the recompilation of the package
|
removed, Buildroot will trigger the recompilation of the package
|
||||||
from the compilation step (execution of <code>make</code>).</li>
|
from the compilation step (execution of <code>make</code>).</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>For other packages, an analysis of the specific
|
<p>For other packages, an analysis of the specific <i>package.mk</i>
|
||||||
<i>package.mk</i> file is needed. For example, the zlib Makefile
|
file is needed. For example, the zlib Makefile used to look like this
|
||||||
used to look like this (before it was converted to the generic
|
(before it was converted to the generic package infrastructure):</p>
|
||||||
package infrastructure):</p>
|
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
$(ZLIB_DIR)/.configured: $(ZLIB_DIR)/.patched
|
$(ZLIB_DIR)/.configured: $(ZLIB_DIR)/.patched
|
||||||
@ -532,18 +504,17 @@ $(ZLIB_DIR)/libz.a: $(ZLIB_DIR)/.configured
|
|||||||
ported over the generic or the autotools infrastructure, making it
|
ported over the generic or the autotools infrastructure, making it
|
||||||
much easier to rebuild individual packages.</p>
|
much easier to rebuild individual packages.</p>
|
||||||
|
|
||||||
<h2><a name="buildroot_innards" id="buildroot_innards"></a>How Buildroot
|
<h2 id="buildroot_innards">How Buildroot works</h2>
|
||||||
works</h2>
|
|
||||||
|
|
||||||
<p>As mentioned above, Buildroot is basically a set of Makefiles that downloads,
|
<p>As mentioned above, Buildroot is basically a set of Makefiles that
|
||||||
configures and compiles software with the correct options. It also includes
|
downloads, configures and compiles software with the correct options. It
|
||||||
patches for various software packages — mainly the ones involved in the
|
also includes patches for various software packages — mainly the
|
||||||
cross-compilation tool chain (<code>gcc</code>, <code>binutils</code> and
|
ones involved in the cross-compilation tool chain (<code>gcc</code>,
|
||||||
<code>uClibc</code>). </p>
|
<code>binutils</code> and <code>uClibc</code>).</p>
|
||||||
|
|
||||||
<p>There is basically one Makefile per software package, and they are named with
|
<p>There is basically one Makefile per software package, and they are
|
||||||
the <code>.mk</code> extension. Makefiles are split into three main
|
named with the <code>.mk</code> extension. Makefiles are split into
|
||||||
sections:</p>
|
three main sections:</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><b>toolchain</b> (in the <code>toolchain/</code> directory) contains
|
<li><b>toolchain</b> (in the <code>toolchain/</code> directory) contains
|
||||||
@ -575,14 +546,12 @@ $(ZLIB_DIR)/libz.a: $(ZLIB_DIR)/.configured
|
|||||||
<li><code>Config.in</code> is a part of the configuration tool
|
<li><code>Config.in</code> is a part of the configuration tool
|
||||||
description file. It describes the options related to the
|
description file. It describes the options related to the
|
||||||
package.</li>
|
package.</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>The main Makefile performs the following steps (once the
|
<p>The main Makefile performs the following steps (once the
|
||||||
configuration is done):</p>
|
configuration is done):</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<li>Create all the output directories: <code>staging</code>,
|
<li>Create all the output directories: <code>staging</code>,
|
||||||
<code>target</code>, <code>build</code>, <code>stamps</code>,
|
<code>target</code>, <code>build</code>, <code>stamps</code>,
|
||||||
etc. in the output directory (<code>output/</code> by default,
|
etc. in the output directory (<code>output/</code> by default,
|
||||||
@ -601,11 +570,9 @@ $(ZLIB_DIR)/libz.a: $(ZLIB_DIR)/.configured
|
|||||||
trigger the compilation of the userspace packages (libraries,
|
trigger the compilation of the userspace packages (libraries,
|
||||||
programs), the kernel, the bootloader and the generation of the
|
programs), the kernel, the bootloader and the generation of the
|
||||||
root filesystem images, depending on the configuration.</li>
|
root filesystem images, depending on the configuration.</li>
|
||||||
|
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<h2><a name="board_support" id="board_support"></a>
|
<h2 id="board_support"> Creating your own board support</h2>
|
||||||
Creating your own board support</h2>
|
|
||||||
|
|
||||||
<p>Creating your own board support in Buildroot allows you to have
|
<p>Creating your own board support in Buildroot allows you to have
|
||||||
a convenient place to store your project's target filesystem skeleton
|
a convenient place to store your project's target filesystem skeleton
|
||||||
@ -614,7 +581,6 @@ $(ZLIB_DIR)/libz.a: $(ZLIB_DIR)/.configured
|
|||||||
<p>Follow these steps to integrate your board in Buildroot:</p>
|
<p>Follow these steps to integrate your board in Buildroot:</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<li>Create a new directory in <code>target/device/</code> named
|
<li>Create a new directory in <code>target/device/</code> named
|
||||||
after your company or organization</li>
|
after your company or organization</li>
|
||||||
|
|
||||||
@ -657,6 +623,7 @@ ifeq ($(BR2_TARGET_COMPANY_PROJECT_FOOBAR),y)
|
|||||||
include target/device/yourcompany/project-foobar/Makefile.in
|
include target/device/yourcompany/project-foobar/Makefile.in
|
||||||
endif
|
endif
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>Create the
|
<li>Create the
|
||||||
@ -666,18 +633,14 @@ endif
|
|||||||
<code>target/device/yourcompany/project-foobar</code> as it
|
<code>target/device/yourcompany/project-foobar</code> as it
|
||||||
will simplify further definitions. Then, the file might define
|
will simplify further definitions. Then, the file might define
|
||||||
one or several of the following variables:
|
one or several of the following variables:
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li><code>TARGET_SKELETON</code> to a directory that contains
|
<li><code>TARGET_SKELETON</code> to a directory that contains
|
||||||
the target skeleton for your project. If this variable is
|
the target skeleton for your project. If this variable is
|
||||||
defined, this target skeleton will be used instead of the
|
defined, this target skeleton will be used instead of the
|
||||||
default one. If defined, the convention is to define it to
|
default one. If defined, the convention is to define it to
|
||||||
<code>$(BOARD_PATH)/target_skeleton</code> so that the target
|
<code>$(BOARD_PATH)/target_skeleton</code> so that the target
|
||||||
skeleton is stored in the board specific directory.</li>
|
skeleton is stored in the board specific directory.</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>In the
|
<li>In the
|
||||||
@ -691,51 +654,45 @@ endif
|
|||||||
<code>configs/</code> directory. Your users will then be able
|
<code>configs/</code> directory. Your users will then be able
|
||||||
to run <code>make something_defconfig</code> and get the right
|
to run <code>make something_defconfig</code> and get the right
|
||||||
configuration for your project</li>
|
configuration for your project</li>
|
||||||
|
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<h2><a name="using_toolchain" id="using_toolchain"></a>Using the
|
<h2 id="using_toolchain">Using the generated toolchain outside Buildroot</h2>
|
||||||
generated toolchain outside Buildroot</h2>
|
|
||||||
|
|
||||||
<p>You may want to compile for your target your own programs or other software
|
<p>You may want to compile for your target your own programs or other
|
||||||
that are not packaged in Buildroot. In order to do this you can
|
software that are not packaged in Buildroot. In order to do this you can
|
||||||
use the toolchain that was generated by Buildroot.</p>
|
use the toolchain that was generated by Buildroot.</p>
|
||||||
|
|
||||||
<p>The toolchain generated by Buildroot is located by default in
|
<p>The toolchain generated by Buildroot is located by default in
|
||||||
<code>output/staging/</code>. The simplest way to use it
|
<code>output/staging/</code>. The simplest way to use it is to add
|
||||||
is to add <code>output/staging/usr/bin/</code> to your PATH
|
<code>output/staging/usr/bin/</code> to your PATH environment variable and
|
||||||
environment variable and then to use
|
then to use <code>ARCH-linux-gcc</code>, <code>ARCH-linux-objdump</code>,
|
||||||
<code>ARCH-linux-gcc</code>, <code>ARCH-linux-objdump</code>,
|
|
||||||
<code>ARCH-linux-ld</code>, etc.</p>
|
<code>ARCH-linux-ld</code>, etc.</p>
|
||||||
|
|
||||||
<p><b>Important</b>: do not try to move a gcc-3.x toolchain to another
|
<p><b>Important</b>: do not try to move a gcc-3.x toolchain to another
|
||||||
directory — it won't work because there are some hardcoded paths in the
|
directory — it won't work because there are some hardcoded paths
|
||||||
gcc-3.x configuration. If you are using a current gcc-4.x, it
|
in the gcc-3.x configuration. If you are using a current gcc-4.x, it is
|
||||||
is possible to relocate the toolchain — but then
|
possible to relocate the toolchain — but then <code>--sysroot</code>
|
||||||
<code>--sysroot</code> must be passed every time the compiler is
|
must be passed every time the compiler is called to tell where the
|
||||||
called to tell where the libraries and header files are.</p>
|
libraries and header files are.</p>
|
||||||
|
|
||||||
<p>It is also possible to generate the Buildroot toolchain in
|
<p>It is also possible to generate the Buildroot toolchain in a
|
||||||
a directory other than <code>output/staging</code> by using the
|
directory other than <code>output/staging</code> by using the <code>
|
||||||
<code>Build options -> Toolchain and header file
|
Build options -> Toolchain and header file location</code> options.
|
||||||
location</code> options. This could be useful if the toolchain
|
This could be useful if the toolchain must be shared with other users.</p>
|
||||||
must be shared with other users.</p>
|
|
||||||
|
|
||||||
<h2><a name="downloaded_packages"
|
<h2 id="downloaded_packages">Location of downloaded packages</h2>
|
||||||
id="downloaded_packages"></a>Location of downloaded packages</h2>
|
|
||||||
|
|
||||||
<p>It might be useful to know that the various tarballs that are
|
<p>It might be useful to know that the various tarballs that are
|
||||||
downloaded by the Makefiles are all stored in the
|
downloaded by the Makefiles are all stored in the <code>DL_DIR</code>
|
||||||
<code>DL_DIR</code> which by default is the <code>dl</code>
|
which by default is the <code>dl</code> directory. It's useful, for
|
||||||
directory. It's useful, for example, if you want to keep a complete
|
example, if you want to keep a complete version of Buildroot which is
|
||||||
version of Buildroot which is know to be working with the
|
know to be working with the associated tarballs. This will allow you to
|
||||||
associated tarballs. This will allow you to regenerate the
|
regenerate the toolchain and the target filesystem with exactly the same
|
||||||
toolchain and the target filesystem with exactly the same
|
|
||||||
versions.</p>
|
versions.</p>
|
||||||
|
|
||||||
<p>If you maintain several Buildroot trees, it might be better to have
|
<p>If you maintain several Buildroot trees, it might be better to have a
|
||||||
a shared download location. This can be accessed by creating a symbolic link
|
shared download location. This can be accessed by creating a symbolic
|
||||||
from the <code>dl</code> directory to the shared download location: </p>
|
link from the <code>dl</code> directory to the shared download location:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
ln -s <shared download location> dl
|
ln -s <shared download location> dl
|
||||||
@ -745,14 +702,13 @@ ln -s <shared download location> dl
|
|||||||
create the <code>BUILDROOT_DL_DIR</code> environment variable.
|
create the <code>BUILDROOT_DL_DIR</code> environment variable.
|
||||||
If this is set, then the value of DL_DIR in the project is
|
If this is set, then the value of DL_DIR in the project is
|
||||||
overridden. The following line should be added to
|
overridden. The following line should be added to
|
||||||
<code>"~/.bashrc"</code>. <p>
|
<code>"~/.bashrc"</code>.</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
export BUILDROOT_DL_DIR <shared download location>
|
export BUILDROOT_DL_DIR <shared download location>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h2><a name="external_toolchain" id="external_toolchain"></a>Using
|
<h2 id="external_toolchain">Using an external toolchain</h2>
|
||||||
an external toolchain</h2>
|
|
||||||
|
|
||||||
<p>It might be useful not to use the toolchain generated by
|
<p>It might be useful not to use the toolchain generated by
|
||||||
Buildroot, for example if you already have a toolchain that is known
|
Buildroot, for example if you already have a toolchain that is known
|
||||||
@ -763,7 +719,7 @@ need to generate a system with <i>glibc</i> instead of
|
|||||||
toolchain</i>.</p>
|
toolchain</i>.</p>
|
||||||
|
|
||||||
<p>To enable the use of an external toolchain, go in the
|
<p>To enable the use of an external toolchain, go in the
|
||||||
<code>Toolchain</code> menu, and :</p>
|
<code>Toolchain</code> menu, and :</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Select the <code>External binary toolchain</code> toolchain
|
<li>Select the <code>External binary toolchain</code> toolchain
|
||||||
@ -783,52 +739,46 @@ should already have correct values. However, if your external
|
|||||||
toolchain is based on <i>glibc</i>, you'll have to change these values
|
toolchain is based on <i>glibc</i>, you'll have to change these values
|
||||||
according to your cross-compiling toolchain.</p>
|
according to your cross-compiling toolchain.</p>
|
||||||
|
|
||||||
<p>To generate external toolchains, we recommend using <a
|
<p>To generate external toolchains, we recommend using
|
||||||
href="http://ymorin.is-a-geek.org/dokuwiki/projects/crosstool">Crosstool-NG</a>.
|
<a href="http://ymorin.is-a-geek.org/dokuwiki/projects/crosstool">Crosstool-NG</a>.
|
||||||
It allows generating toolchains based on <i>uClibc</i>, <i>glibc</i>
|
It allows generating toolchains based on <i>uClibc</i>, <i>glibc</i>
|
||||||
and <i>eglibc</i> for a wide range of architectures and has good
|
and <i>eglibc</i> for a wide range of architectures and has good
|
||||||
community support.</p>
|
community support.</p>
|
||||||
|
|
||||||
<h2><a name="add_packages" id="add_packages"></a>Adding new
|
<h2 id="add_packages">Adding new packages to Buildroot</h2>
|
||||||
packages to Buildroot</h2>
|
|
||||||
|
|
||||||
<p>This section covers how new packages (userspace libraries or
|
<p>This section covers how new packages (userspace libraries or
|
||||||
applications) can be integrated into Buildroot. It also allows to
|
applications) can be integrated into Buildroot. It also allows to
|
||||||
understand how existing packages are integrated, which is needed
|
understand how existing packages are integrated, which is needed to fix
|
||||||
to fix issues or tune their configuration.</p>
|
issues or tune their configuration.</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#package-directory">Package directory</a></li>
|
<li><a href="#package-directory">Package directory</a></li>
|
||||||
<li><a href="#config-in-file"><code>Config.in</code> file</a></li>
|
<li><a href="#config-in-file"><code>Config.in</code> file</a></li>
|
||||||
<li><a href="#mk-file">The <code>.mk</code> file</a>
|
<li><a href="#mk-file">The <code>.mk</code> file</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#generic-tutorial">Makefile for generic
|
<li><a href="#generic-tutorial">Makefile for generic packages : tutorial</a></li>
|
||||||
packages : tutorial</a></li>
|
<li><a href="#generic-reference">Makefile for generic packages : reference</a></li>
|
||||||
<li><a href="#generic-reference">Makefile for
|
<li><a href="#autotools-tutorial">Makefile for autotools-based packages : tutorial</a></li>
|
||||||
generic packages : reference</a></li>
|
<li><a href="#autotools-reference">Makefile for autotools-based packages : reference</a></li>
|
||||||
<li><a href="#autotools-tutorial">Makefile for autotools-based
|
|
||||||
packages : tutorial</a></li>
|
|
||||||
<li><a href="#autotools-reference">Makefile for autotools-based
|
|
||||||
packages : reference</a></li>
|
|
||||||
<li><a href="#manual-tutorial">Manual Makefile : tutorial</a></li>
|
<li><a href="#manual-tutorial">Manual Makefile : tutorial</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="#gettext-integration">Gettext integration and
|
<li><a href="#gettext-integration">Gettext integration and interaction with packages</a></li>
|
||||||
interaction with packages</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3><a name="package-directory"></a>Package directory</h3>
|
<h3 id="package-directory">Package directory</h3>
|
||||||
|
|
||||||
<p>First of all, create a directory under the <code>package</code>
|
<p>First of all, create a directory under the <code>package</code>
|
||||||
directory for your software, for example <code>foo</code>.</p>
|
directory for your software, for example <code>foo</code>.</p>
|
||||||
|
|
||||||
<p>Some packages have been grouped by topic in a sub-directory:
|
<p>Some packages have been grouped by topic in a sub-directory:
|
||||||
<code>multimedia</code>, <code>java</code>,
|
<code>multimedia</code>, <code>java</code>, <code>databases</code>,
|
||||||
<code>databases</code>, <code>editors</code>, <code>x11r7</code>,
|
<code>editors</code>, <code>x11r7</code>, <code>games</code>. If your
|
||||||
<code>games</code>. If your package fits in one of these
|
package fits in one of these categories, then create your package
|
||||||
categories, then create your package directory in these.</p>
|
directory in these.</p>
|
||||||
|
|
||||||
<h3><a name="config-in-file"></a><code>Config.in</code> file</h3>
|
<h3 id="config-in-file"><code>Config.in</code> file</h3>
|
||||||
|
|
||||||
<p>Then, create a file named <code>Config.in</code>. This file
|
<p>Then, create a file named <code>Config.in</code>. This file
|
||||||
will contain the option descriptions related to our
|
will contain the option descriptions related to our
|
||||||
@ -848,8 +798,9 @@ config BR2_PACKAGE_LIBFOO
|
|||||||
things in your software. You can look at examples in other
|
things in your software. You can look at examples in other
|
||||||
packages. The syntax of the Config.in file is the same as the one
|
packages. The syntax of the Config.in file is the same as the one
|
||||||
for the kernel Kconfig file. The documentation for this syntax is
|
for the kernel Kconfig file. The documentation for this syntax is
|
||||||
available at <a
|
available at
|
||||||
href="http://lxr.free-electrons.com/source/Documentation/kbuild/kconfig-language.txt">http://lxr.free-electrons.com/source/Documentation/kbuild/kconfig-language.txt</a></p>
|
<a href="http://lxr.free-electrons.com/source/Documentation/kbuild/kconfig-language.txt">http://lxr.free-electrons.com/source/Documentation/kbuild/kconfig-language.txt</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>Finally you have to add your new <code>libfoo/Config.in</code> to
|
<p>Finally you have to add your new <code>libfoo/Config.in</code> to
|
||||||
<code>package/Config.in</code> (or in a category subdirectory if
|
<code>package/Config.in</code> (or in a category subdirectory if
|
||||||
|
Loading…
x
Reference in New Issue
Block a user