2007-02-24 11:00:05 +00:00
|
|
|
File.........: overview.txt
|
2007-07-02 19:40:54 +00:00
|
|
|
Content......: Overview of how crosstool-NG works.
|
2007-05-13 21:11:54 +00:00
|
|
|
Copyrigth....: (C) 2007 Yann E. MORIN <yann.morin.1998@anciens.enib.fr>
|
2007-07-02 17:47:17 +00:00
|
|
|
License......: Creative Commons Attribution Share Alike (CC-by-sa), v2.5
|
2007-05-13 21:11:54 +00:00
|
|
|
|
2008-06-27 13:58:53 +00:00
|
|
|
____________________
|
|
|
|
/
|
|
|
|
Table Of Content /
|
|
|
|
_________________/
|
|
|
|
|
|
|
|
|
|
|
|
Introduction
|
|
|
|
History
|
2009-10-12 17:31:50 +00:00
|
|
|
Referring to crosstool-NG
|
2008-06-27 13:58:53 +00:00
|
|
|
Installing crosstool-NG
|
|
|
|
Install method
|
|
|
|
The hacker's way
|
2008-11-16 22:19:57 +00:00
|
|
|
Preparing for packaging
|
2008-09-05 10:57:06 +00:00
|
|
|
Shell completion
|
2008-06-27 13:58:53 +00:00
|
|
|
Contributed code
|
|
|
|
Configuring crosstool-NG
|
|
|
|
Interesting config options
|
|
|
|
Re-building an existing toolchain
|
2010-03-05 08:19:56 +00:00
|
|
|
Using as a backend for a build-system
|
2008-06-27 13:58:53 +00:00
|
|
|
Running crosstool-NG
|
|
|
|
Stopping and restarting a build
|
|
|
|
Testing all toolchains at once
|
|
|
|
Overriding the number of // jobs
|
2009-08-29 22:30:45 +00:00
|
|
|
Note on // jobs
|
2009-08-29 22:27:12 +00:00
|
|
|
Tools wrapper
|
2008-06-27 13:58:53 +00:00
|
|
|
Using the toolchain
|
2009-10-03 15:23:17 +00:00
|
|
|
The 'populate' script
|
2008-06-27 13:58:53 +00:00
|
|
|
Toolchain types
|
2009-10-02 20:10:38 +00:00
|
|
|
Seemingly-native toolchains
|
2009-10-10 10:55:17 +00:00
|
|
|
Contributing
|
|
|
|
Sending a bug report
|
|
|
|
Sending patches
|
2008-06-27 13:58:53 +00:00
|
|
|
Internals
|
|
|
|
Makefile front-end
|
|
|
|
Kconfig parser
|
|
|
|
Architecture-specific
|
|
|
|
Adding a new version of a component
|
|
|
|
Build scripts
|
|
|
|
|
2009-10-12 17:25:41 +00:00
|
|
|
|
2007-02-24 11:00:05 +00:00
|
|
|
________________
|
|
|
|
/
|
|
|
|
Introduction /
|
|
|
|
_____________/
|
|
|
|
|
|
|
|
crosstool-NG aims at building toolchains. Toolchains are an essential component
|
|
|
|
in a software development project. It will compile, assemble and link the code
|
2008-02-20 08:01:12 +00:00
|
|
|
that is being developed. Some pieces of the toolchain will eventually end up
|
2007-02-24 11:00:05 +00:00
|
|
|
in the resulting binary/ies: static libraries are but an example.
|
|
|
|
|
|
|
|
So, a toolchain is a very sensitive piece of software, as any bug in one of the
|
|
|
|
components, or a poorly configured component, can lead to execution problems,
|
|
|
|
ranging from poor performance, to applications ending unexpectedly, to
|
|
|
|
mis-behaving software (which more than often is hard to detect), to hardware
|
2008-02-20 08:01:12 +00:00
|
|
|
damage, or even to human risks (which is more than regrettable).
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
Toolchains are made of different piece of software, each being quite complex
|
|
|
|
and requiring specially crafted options to build and work seamlessly. This
|
|
|
|
is usually not that easy, even in the not-so-trivial case of native toolchains.
|
|
|
|
The work reaches a higher degree of complexity when it comes to cross-
|
2007-04-17 22:22:46 +00:00
|
|
|
compilation, where it can become quite a nightmare...
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2007-04-17 22:22:46 +00:00
|
|
|
Some cross-toolchains exist on the internet, and can be used for general
|
2007-02-24 11:00:05 +00:00
|
|
|
development, but they have a number of limitations:
|
|
|
|
- they can be general purpose, in that they are configured for the majority:
|
|
|
|
no optimisation for your specific target,
|
|
|
|
- they can be prepared for a specific target and thus are not easy to use,
|
|
|
|
nor optimised for, or even supporting your target,
|
2008-02-20 08:01:12 +00:00
|
|
|
- they often are using aging components (compiler, C library, etc...) not
|
2007-02-24 11:00:05 +00:00
|
|
|
supporting special features of your shiny new processor;
|
|
|
|
On the other side, these toolchain offer some advantages:
|
|
|
|
- they are ready to use and quite easy to install and setup,
|
|
|
|
- they are proven if used by a wide community.
|
|
|
|
|
|
|
|
But once you want to get all the juice out of your specific hardware, you will
|
2007-07-02 19:40:54 +00:00
|
|
|
want to build your own toolchain. This is where crosstool-NG comes into play.
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2008-02-20 08:01:12 +00:00
|
|
|
There are also a number of tools that build toolchains for specific needs,
|
|
|
|
which are not really scalable. Examples are:
|
|
|
|
- buildroot (buildroot.uclibc.org) whose main purpose is to build root file
|
2007-02-24 11:00:05 +00:00
|
|
|
systems, hence the name. But once you have your toolchain with buildroot,
|
|
|
|
part of it is installed in the root-to-be, so if you want to build a whole
|
|
|
|
new root, you either have to save the existing one as a template and
|
|
|
|
restore it later, or restart again from scratch. This is not convenient,
|
|
|
|
- ptxdist (www.pengutronix.de/software/ptxdist), whose purpose is very
|
|
|
|
similar to buildroot,
|
2008-07-20 16:59:04 +00:00
|
|
|
- other projects (openembedded.org for example), which are again used to
|
2007-02-24 11:00:05 +00:00
|
|
|
build root file systems.
|
|
|
|
|
2008-02-20 08:01:12 +00:00
|
|
|
crosstool-NG is really targeted at building toolchains, and only toolchains.
|
2007-02-24 11:00:05 +00:00
|
|
|
It is then up to you to use it the way you want.
|
|
|
|
|
2009-10-12 17:25:41 +00:00
|
|
|
|
2007-02-24 11:00:05 +00:00
|
|
|
___________
|
|
|
|
/
|
|
|
|
History /
|
|
|
|
________/
|
|
|
|
|
2008-02-20 08:01:12 +00:00
|
|
|
crosstool was first 'conceived' by Dan Kegel, who offered it to the community
|
2007-02-24 11:00:05 +00:00
|
|
|
as a set of scripts, a repository of patches, and some pre-configured, general
|
|
|
|
purpose setup files to be used to configure crosstool. This is available at
|
2007-07-04 17:37:48 +00:00
|
|
|
http://www.kegel.com/crosstool, and the subversion repository is hosted on
|
|
|
|
google at http://code.google.com/p/crosstool/.
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
I once managed to add support for uClibc-based toolchains, but it did not make
|
2008-02-20 22:48:35 +00:00
|
|
|
into mainline, mostly because I didn't have time to port the patch forward to
|
2007-02-24 11:00:05 +00:00
|
|
|
the new versions, due in part to the big effort it was taking.
|
|
|
|
|
|
|
|
So I decided to clean up crosstool in the state it was, re-order the things
|
2008-02-20 22:48:35 +00:00
|
|
|
in place, add appropriate support for what I needed, that is uClibc support
|
|
|
|
and a menu-driven configuration, named the new implementation crosstool-NG,
|
|
|
|
(standing for crosstool Next Generation, as many other comunity projects do,
|
|
|
|
and as a wink at the TV series "Star Trek: The Next Generation" ;-) ) and
|
|
|
|
made it available to the community, in case it was of interest to any one.
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2009-10-12 17:25:41 +00:00
|
|
|
|
2009-10-12 17:31:50 +00:00
|
|
|
_____________________________
|
|
|
|
/
|
|
|
|
Referring to crosstool-NG /
|
|
|
|
__________________________/
|
|
|
|
|
|
|
|
|
|
|
|
The long name of the project is crosstool-NG:
|
|
|
|
* no leading uppercase (except as first word in a sentence)
|
|
|
|
* crosstool and NG separated with a hyphen (dash)
|
|
|
|
* NG in uppercase
|
|
|
|
|
|
|
|
Crosstool-NG can also be referred to by its short name CT-NG:
|
|
|
|
* all in uppercase
|
|
|
|
* CT and NG separated with a hyphen (dash)
|
|
|
|
|
|
|
|
The long name is preferred over the short name, except in mail subjects, where
|
|
|
|
the short name is a better fit.
|
|
|
|
|
|
|
|
When referring to a specific version of crosstool-NG, append the version number
|
|
|
|
either as:
|
|
|
|
* crosstool-NG X.Y.Z
|
|
|
|
- the long name, a space, and the version string
|
|
|
|
* crosstool-ng-X.Y.Z
|
|
|
|
- the long name in lowercase, a hyphen (dash), and the version string
|
|
|
|
- this is used to name the release tarballs
|
|
|
|
* crosstool-ng-X.Y.Z+hg_id
|
|
|
|
- the long name in lowercase, a hyphen, the version string, and the Hg id
|
|
|
|
(as returned by: ct-ng version)
|
|
|
|
- this is used to differentiate between releases and snapshots
|
|
|
|
|
|
|
|
The frontend to crosstool-NG is the command ct-ng:
|
|
|
|
* all in lowercase
|
|
|
|
* ct and ng separated by a hyphen (dash)
|
|
|
|
|
|
|
|
|
2007-07-24 21:51:24 +00:00
|
|
|
___________________________
|
|
|
|
/
|
|
|
|
Installing crosstool-NG /
|
|
|
|
________________________/
|
|
|
|
|
|
|
|
There are two ways you can use crosstool-NG:
|
|
|
|
- build and install it, then get rid of the sources like you'd do for most
|
|
|
|
programs,
|
|
|
|
- or only build it and run from the source directory.
|
|
|
|
|
|
|
|
The former should be used if you got crosstool-NG from a packaged tarball, see
|
2008-02-20 08:01:12 +00:00
|
|
|
"Install method", below, while the latter is most useful for developpers that
|
2009-10-10 11:12:28 +00:00
|
|
|
use a clone of the repository, and want to submit patches, see "The Hacker's
|
2007-07-24 21:51:24 +00:00
|
|
|
way", below.
|
|
|
|
|
|
|
|
Install method |
|
|
|
|
---------------+
|
|
|
|
|
|
|
|
If you go for the install, then you just follow the classical, but yet easy
|
|
|
|
./configure way:
|
|
|
|
./configure --prefix=/some/place
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
export PATH="${PATH}:/some/place/bin"
|
|
|
|
|
|
|
|
You can then get rid of crosstool-NG source. Next create a directory to serve
|
|
|
|
as a working place, cd in there and run:
|
|
|
|
ct-ng help
|
|
|
|
|
|
|
|
See below for complete usage.
|
|
|
|
|
|
|
|
The Hacker's way |
|
|
|
|
-----------------+
|
|
|
|
|
|
|
|
If you go the hacker's way, then the usage is a bit different, although very
|
|
|
|
simple:
|
|
|
|
./configure --local
|
|
|
|
make
|
|
|
|
|
|
|
|
Now, *do not* remove crosstool-NG sources. They are needed to run crosstool-NG!
|
|
|
|
Stay in the directory holding the sources, and run:
|
|
|
|
./ct-ng help
|
|
|
|
|
|
|
|
See below for complete usage.
|
|
|
|
|
2009-10-03 15:23:17 +00:00
|
|
|
Now, provided you used a clone of the repository, you can send me your changes.
|
2009-10-10 10:55:17 +00:00
|
|
|
See the section titled CONTRIBUTING, below, for how to submit changees.
|
2007-07-24 21:51:24 +00:00
|
|
|
|
2008-11-16 22:19:57 +00:00
|
|
|
Preparing for packaging |
|
|
|
|
------------------------+
|
|
|
|
|
|
|
|
If you plan on packaging crosstool-NG, you surely don't want to install it
|
|
|
|
in your root file system. The install procedure of crosstool-NG honors the
|
|
|
|
DESTDIR variable:
|
|
|
|
|
|
|
|
./configure --prefix=/usr
|
|
|
|
make
|
2009-04-17 20:45:47 +00:00
|
|
|
make DESTDIR=/packaging/place install
|
2008-11-16 22:19:57 +00:00
|
|
|
|
2008-09-05 10:57:06 +00:00
|
|
|
Shell completion |
|
|
|
|
-----------------+
|
|
|
|
|
|
|
|
crosstool-NG comes with a shell script fragment that defines bash-compatible
|
|
|
|
completion. That shell fragment is currently not installed automatically, but
|
|
|
|
this is planned.
|
|
|
|
|
|
|
|
To install the shell script fragment, you have two options:
|
|
|
|
- install system-wide, most probably by copying ct-ng.comp into
|
|
|
|
/etc/bash_completion.d/
|
|
|
|
- install for a single user, by copying ct-ng.comp into ${HOME}/ and
|
|
|
|
sourcing this file from your ${HOME}/.bashrc
|
|
|
|
|
2008-04-27 09:57:50 +00:00
|
|
|
Contributed code |
|
|
|
|
-----------------+
|
|
|
|
|
|
|
|
Some people contibuted code that couldn't get merged for various reasons. This
|
2009-10-10 09:24:31 +00:00
|
|
|
code is available as lzma-compressed patches, in the contrib/ sub-directory.
|
|
|
|
These patches are to be applied to the source of crosstool-NG, prior to
|
|
|
|
installing, using something like the following:
|
|
|
|
lzcat contrib/foobar.patch.lzma |patch -p1
|
2008-06-25 14:06:49 +00:00
|
|
|
|
|
|
|
There is no guarantee that a particuliar contribution applies to the current
|
|
|
|
version of crosstool-ng, or that it will work at all. Use contributions at
|
|
|
|
your own risk.
|
|
|
|
|
2009-10-12 17:25:41 +00:00
|
|
|
|
2007-06-17 12:11:16 +00:00
|
|
|
____________________________
|
|
|
|
/
|
|
|
|
Configuring crosstool-NG /
|
|
|
|
_________________________/
|
|
|
|
|
2008-06-25 14:06:49 +00:00
|
|
|
crosstool-NG is configured with a configurator presenting a menu-stuctured set
|
|
|
|
of options. These options let you specify the way you want your toolchain
|
|
|
|
built, where you want it installed, what architecture and specific processor it
|
2007-07-17 21:49:43 +00:00
|
|
|
will support, the version of the components you want to use, etc... The
|
|
|
|
value for those options are then stored in a configuration file.
|
|
|
|
|
2008-05-02 21:53:09 +00:00
|
|
|
The configurator works the same way you configure your Linux kernel. It is
|
2007-07-17 21:49:43 +00:00
|
|
|
assumed you now how to handle this.
|
2007-06-17 12:11:16 +00:00
|
|
|
|
|
|
|
To enter the menu, type:
|
2007-07-02 17:47:17 +00:00
|
|
|
ct-ng menuconfig
|
2007-06-17 12:11:16 +00:00
|
|
|
|
2007-07-04 17:37:48 +00:00
|
|
|
Almost every config item has a help entry. Read them carefully.
|
2007-06-17 12:11:16 +00:00
|
|
|
|
|
|
|
String and number options can refer to environment variables. In such a case,
|
2007-07-02 17:47:17 +00:00
|
|
|
you must use the shell syntax: ${VAR}. You shall neither single- nor double-
|
2007-07-24 21:51:24 +00:00
|
|
|
quote the string/number options.
|
2007-06-17 12:11:16 +00:00
|
|
|
|
2007-07-02 17:47:17 +00:00
|
|
|
There are three environment variables that are computed by crosstool-NG, and
|
2007-06-17 12:11:16 +00:00
|
|
|
that you can use:
|
|
|
|
|
|
|
|
CT_TARGET:
|
2007-08-15 16:18:35 +00:00
|
|
|
It represents the target tuple you are building for. You can use it for
|
2007-06-17 12:11:16 +00:00
|
|
|
example in the installation/prefix directory, such as:
|
|
|
|
/opt/x-tools/${CT_TARGET}
|
|
|
|
|
|
|
|
CT_TOP_DIR:
|
2007-07-01 19:04:20 +00:00
|
|
|
The top directory where crosstool-NG is running. You shouldn't need it in
|
|
|
|
most cases. There is one case where you may need it: if you have local
|
|
|
|
patches and you store them in your running directory, you can refer to them
|
2007-06-17 12:11:16 +00:00
|
|
|
by using CT_TOP_DIR, such as:
|
|
|
|
${CT_TOP_DIR}/patches.myproject
|
|
|
|
|
|
|
|
CT_VERSION:
|
2007-07-02 17:47:17 +00:00
|
|
|
The version of crosstool-NG you are using. Not much use for you, but it's
|
2007-06-17 12:11:16 +00:00
|
|
|
there if you need it.
|
|
|
|
|
|
|
|
Interesting config options |
|
2008-05-02 21:53:09 +00:00
|
|
|
---------------------------+
|
2007-06-17 12:11:16 +00:00
|
|
|
|
|
|
|
CT_LOCAL_TARBALLS_DIR:
|
2007-07-17 21:49:43 +00:00
|
|
|
If you already have some tarballs in a direcotry, enter it here. That will
|
2007-07-02 19:40:54 +00:00
|
|
|
speed up the retrieving phase, where crosstool-NG would otherwise download
|
2007-06-17 12:11:16 +00:00
|
|
|
those tarballs.
|
|
|
|
|
|
|
|
CT_PREFIX_DIR:
|
|
|
|
This is where the toolchain will be installed in (and for now, where it
|
2008-02-20 22:48:35 +00:00
|
|
|
will run from). Common use is to add the target tuple in the directory
|
2007-07-17 21:49:43 +00:00
|
|
|
path, such as (see above):
|
|
|
|
/opt/x-tools/${CT_TARGET}
|
2007-06-17 12:11:16 +00:00
|
|
|
|
|
|
|
CT_TARGET_VENDOR:
|
|
|
|
An identifier for your toolchain, will take place in the vendor part of the
|
2007-08-15 16:18:35 +00:00
|
|
|
target tuple. It shall *not* contain spaces or dashes. Usually, keep it
|
2007-06-17 12:11:16 +00:00
|
|
|
to a one-word string, or use underscores to separate words if you need.
|
|
|
|
Avoid dots, commas, and special characters.
|
|
|
|
|
|
|
|
CT_TARGET_ALIAS:
|
|
|
|
An alias for the toolchian. It will be used as a prefix to the toolchain
|
|
|
|
tools. For example, you will have ${CT_TARGET_ALIAS}-gcc
|
|
|
|
|
2007-07-13 14:25:06 +00:00
|
|
|
Also, if you think you don't see enough versions, you can try to enable one of
|
|
|
|
those:
|
|
|
|
|
|
|
|
CT_OBSOLETE:
|
|
|
|
Show obsolete versions or tools. Most of the time, you don't want to base
|
|
|
|
your toolchain on too old a version (of gcc, for example). But at times, it
|
|
|
|
can come handy to use such an old version for regression tests. Those old
|
2009-04-20 21:30:25 +00:00
|
|
|
versions are hidden behind CT_OBSOLETE. Those versions (or features) are so
|
|
|
|
marked because maintaining support for those in crosstool-NG would be too
|
|
|
|
costly, time-wise, and time is dear.
|
2007-07-13 14:25:06 +00:00
|
|
|
|
|
|
|
CT_EXPERIMENTAL:
|
|
|
|
Show experimental versions or tools. Again, you might not want to base your
|
|
|
|
toolchain on too recent tools (eg. gcc) for production. But if you need a
|
|
|
|
feature present only in a recent version, or a new tool, you can find them
|
2009-04-20 21:30:25 +00:00
|
|
|
hidden behind CT_EXPERIMENTAL. Those versions (or features) did not (yet)
|
|
|
|
receive thorough testing in crosstool-NG, and/or are not mature enough to
|
|
|
|
be blindly trusted.
|
2007-07-13 14:25:06 +00:00
|
|
|
|
2007-07-17 21:44:33 +00:00
|
|
|
Re-building an existing toolchain |
|
|
|
|
----------------------------------+
|
|
|
|
|
|
|
|
If you have an existing toolchain, you can re-use the options used to build it
|
|
|
|
to create a new toolchain. That needs a very little bit of effort on your side
|
2008-10-01 18:10:40 +00:00
|
|
|
but is quite easy. The options to build a toolchain are saved with the
|
|
|
|
toolchain, and you can retrieve this configuration by running:
|
2010-02-11 20:28:10 +00:00
|
|
|
${CT_TARGET}-ct-ng.config
|
2007-07-17 21:44:33 +00:00
|
|
|
|
2010-02-11 20:28:10 +00:00
|
|
|
An alternate method is to extract the configuration from a build.log file.
|
|
|
|
This will be necessary if your toolchain was build with crosstool-NG prior
|
|
|
|
to 1.4.0, but can be used with build.log files from any version:
|
|
|
|
ct-ng extractconfig <build.log >.config
|
|
|
|
|
|
|
|
Or, if your build.log file is compressed (most probably!):
|
|
|
|
bzcat build.log.bz2 |ct-ng extractconfig >.config
|
|
|
|
|
|
|
|
The above commands will dump the configuration to stdout, so to rebuild a
|
|
|
|
toolchain with this configuration, just redirect the output to the
|
|
|
|
.config file:
|
|
|
|
${CT_TARGET}-ct-ng.config >.config
|
2008-12-11 18:21:18 +00:00
|
|
|
ct-ng oldconfig
|
2007-07-17 21:44:33 +00:00
|
|
|
|
2008-10-01 18:10:40 +00:00
|
|
|
Then, you can review and change the configuration by running:
|
|
|
|
ct-ng menuconfig
|
2007-07-17 21:44:33 +00:00
|
|
|
|
2010-03-05 08:19:56 +00:00
|
|
|
Using as a backend for a build-system |
|
|
|
|
--------------------------------------+
|
|
|
|
|
|
|
|
Crosstool-NG can be used as a backend for an automated build-system. In this
|
|
|
|
case, some components that are expected to run on the target (eg. the native
|
|
|
|
gdb, ltrace, DUMA...) are not available in the menuconfig, and they are not
|
|
|
|
build either, as it is considered the responsibility of the build-system to
|
|
|
|
build its own versions of those tools.
|
|
|
|
|
|
|
|
If you want to use crosstool-NG as a backend to generate your toolchains for
|
|
|
|
your build-system, you have to set and export this environment variable:
|
|
|
|
CT_IS_A_BACKEND=y
|
|
|
|
|
|
|
|
(case is not sensitive, you can say Y).
|
|
|
|
|
2009-10-12 17:25:41 +00:00
|
|
|
|
2007-06-17 12:11:16 +00:00
|
|
|
________________________
|
|
|
|
/
|
|
|
|
Running crosstool-NG /
|
|
|
|
_____________________/
|
2007-02-24 11:00:05 +00:00
|
|
|
|
2007-06-17 12:11:16 +00:00
|
|
|
To build the toolchain, simply type:
|
2007-07-04 17:37:48 +00:00
|
|
|
ct-ng build
|
2007-05-25 19:30:42 +00:00
|
|
|
|
|
|
|
This will use the above configuration to retrieve, extract and patch the
|
|
|
|
components, build, install and eventually test your newly built toolchain.
|
2007-02-24 11:00:05 +00:00
|
|
|
|
|
|
|
You are then free to add the toolchain /bin directory in your PATH to use
|
|
|
|
it at will.
|
|
|
|
|
2007-05-25 19:30:42 +00:00
|
|
|
In any case, you can get some terse help. Just type:
|
2007-07-02 17:47:17 +00:00
|
|
|
ct-ng help
|
2007-07-04 17:37:48 +00:00
|
|
|
or:
|
|
|
|
man 1 ct-ng
|
2007-05-25 19:30:42 +00:00
|
|
|
|
2008-02-20 08:01:12 +00:00
|
|
|
Stopping and restarting a build |
|
2008-05-02 21:53:09 +00:00
|
|
|
--------------------------------+
|
2007-05-25 19:30:42 +00:00
|
|
|
|
|
|
|
If you want to stop the build after a step you are debugging, you can pass the
|
|
|
|
variable STOP to make:
|
2009-11-17 18:01:22 +00:00
|
|
|
ct-ng build STOP=some_step
|
2007-05-25 19:30:42 +00:00
|
|
|
|
|
|
|
Conversely, if you want to restart a build at a specific step you are
|
|
|
|
debugging, you can pass the RESTART variable to make:
|
2009-11-17 18:01:22 +00:00
|
|
|
ct-ng build RESTART=some_step
|
2007-05-25 19:30:42 +00:00
|
|
|
|
2007-05-27 20:22:06 +00:00
|
|
|
Alternatively, you can call make with the name of a step to just do that step:
|
2007-07-02 17:47:17 +00:00
|
|
|
ct-ng libc_headers
|
2007-05-27 20:22:06 +00:00
|
|
|
is equivalent to:
|
2009-11-17 18:01:22 +00:00
|
|
|
ct-ng build RESTART=libc_headers STOP=libc_headers
|
2007-05-27 20:22:06 +00:00
|
|
|
|
2007-07-30 19:35:39 +00:00
|
|
|
The shortcuts +step_name and step_name+ allow to respectively stop or restart
|
2007-05-27 20:22:06 +00:00
|
|
|
at that step. Thus:
|
2009-11-17 18:01:22 +00:00
|
|
|
ct-ng +libc_headers and: ct-ng libc_headers+
|
2007-05-27 20:22:06 +00:00
|
|
|
are equivalent to:
|
2009-11-17 18:01:22 +00:00
|
|
|
ct-ng build STOP=libc_headers and: ct-ng build RESTART=libc_headers
|
2007-05-27 20:22:06 +00:00
|
|
|
|
2007-06-26 21:23:05 +00:00
|
|
|
To obtain the list of acceptable steps, please call:
|
2008-06-01 21:12:00 +00:00
|
|
|
ct-ng list-steps
|
2007-06-26 21:23:05 +00:00
|
|
|
|
2007-06-17 12:11:16 +00:00
|
|
|
Note that in order to restart a build, you'll have to say 'Y' to the config
|
|
|
|
option CT_DEBUG_CT_SAVE_STEPS, and that the previous build effectively went
|
|
|
|
that far.
|
2007-05-13 21:11:54 +00:00
|
|
|
|
2008-10-31 18:31:01 +00:00
|
|
|
Building all toolchains at once |
|
|
|
|
--------------------------------+
|
2007-05-13 21:11:54 +00:00
|
|
|
|
2008-10-31 18:31:01 +00:00
|
|
|
You can build all samples; simply call:
|
|
|
|
ct-ng build-all
|
2007-04-17 22:22:46 +00:00
|
|
|
|
2007-08-15 16:18:35 +00:00
|
|
|
Overriding the number of // jobs |
|
2008-05-02 21:53:09 +00:00
|
|
|
---------------------------------+
|
2007-08-15 16:18:35 +00:00
|
|
|
|
|
|
|
If you want to override the number of jobs to run in // (the -j option to
|
|
|
|
make), you can either re-enter the menuconfig, or simply add it on the command
|
|
|
|
line, as such:
|
|
|
|
ct-ng build.4
|
|
|
|
|
|
|
|
which tells crosstool-NG to override the number of // jobs to 4.
|
|
|
|
|
|
|
|
You can see the actions that support overriding the number of // jobs in
|
|
|
|
the help menu. Those are the ones with [.#] after them (eg. build[.#] or
|
2008-10-31 18:31:01 +00:00
|
|
|
build-all[.#], and so on...).
|
|
|
|
|
|
|
|
Note on // jobs |
|
|
|
|
----------------+
|
|
|
|
|
|
|
|
The crosstool-NG script 'ct-ng' is a Makefile-script. It does *not* execute
|
|
|
|
in parallel (there is not much to gain). When speaking of // jobs, we are
|
|
|
|
refering to the number of // jobs when making the *components*. That is, we
|
|
|
|
speak of the number of // jobs used to build gcc, glibc, and so on...
|
|
|
|
|
2009-08-29 22:27:12 +00:00
|
|
|
Tools wrapper |
|
|
|
|
--------------+
|
|
|
|
|
|
|
|
Starting with gcc-4.3 come two new dependencies: GMP and MPFR. With gcc-4.4,
|
|
|
|
come three new ones: GMP, PPL and CLooG/ppl. These are libraries that enable
|
|
|
|
advanced features to gcc. Additionally, some of the libraries can be used by
|
|
|
|
binutils and gdb. Unfortunately, not all systems on which crosstool-NG runs
|
|
|
|
have all of those libraries. And for those that do, the versions of those
|
|
|
|
libraries may be older than the version required by gcc.
|
|
|
|
|
|
|
|
This is why crosstool-NG builds its own set of libraries as part of the
|
|
|
|
toolchain.
|
|
|
|
|
|
|
|
The libraries are built as shared libraries, because building them as static
|
|
|
|
libraries has some short-comings. This poses no problem at build time, as
|
2009-09-06 08:45:31 +00:00
|
|
|
crosstool-NG correctly points gcc (and binutils and gdb) to the correct
|
2009-08-29 22:27:12 +00:00
|
|
|
place where our own version of the libraries are installed. But it poses
|
|
|
|
a problem when gcc et al. are run: the place where the libraries are is most
|
|
|
|
probably not known to the host dynamic linker. Still worse, if the host system
|
|
|
|
has its own versions, then ld.so would load the wrong library!
|
|
|
|
|
|
|
|
So we have to force the dynamic linker to load the correct version. We do this
|
|
|
|
by using the LD_LIBRARY_PATH variable, that informs the dynamic linker where
|
|
|
|
to look for shared libraries prior to searching its standard places. But we
|
|
|
|
can't impose that burden on all the system (because it'd be a nightmare to
|
2009-09-06 08:45:31 +00:00
|
|
|
configure, and because two toolchains on the same system may use different
|
2009-08-29 22:27:12 +00:00
|
|
|
versions of the libraries); so we have to do it on a per-toolchain basis.
|
|
|
|
|
|
|
|
So we rename all binaries of the toolchain (by adding a dot '.' as their first
|
|
|
|
character), and add a small program, the so-called "tools wrapper", that
|
|
|
|
correctly sets LD_LIBRARY_PATH prior to running the real tool.
|
|
|
|
|
|
|
|
First, the wrapper was written as a POSIX-compliant shell script. That shell
|
|
|
|
script is very simple, if not trivial, and works great. The only drawback is
|
|
|
|
that it does not work on host systems that lack a shell, for example the
|
|
|
|
MingW32 environment. To solve the issue, the wrapper has been re-written in C,
|
|
|
|
and compiled at build time. This C wrapper is much more complex than the shell
|
|
|
|
script, and although it sems to be working, it's been only lightly tested.
|
|
|
|
Some of the expected short-comings with this C wrapper are;
|
|
|
|
- multi-byte file names may not be handled correctly
|
|
|
|
- it's really big for what it does
|
|
|
|
|
|
|
|
So, the default wrapper installed with your toolchain is the shell script.
|
|
|
|
If you know that your system is missing a shell, then you shall use the C
|
|
|
|
wrapper (and report back whether it works, or does not work, for you).
|
|
|
|
|
2007-08-15 16:18:35 +00:00
|
|
|
|
2007-07-09 17:35:45 +00:00
|
|
|
_______________________
|
|
|
|
/
|
|
|
|
Using the toolchain /
|
|
|
|
____________________/
|
|
|
|
|
|
|
|
Using the toolchain is as simple as adding the toolchain's bin directory in
|
|
|
|
your PATH, such as:
|
|
|
|
export PATH="${PATH}:/your/toolchain/path/bin"
|
|
|
|
|
2007-08-15 16:18:35 +00:00
|
|
|
and then using the target tuple to tell the build systems to use your
|
2007-07-09 17:35:45 +00:00
|
|
|
toolchain:
|
2007-08-15 16:18:35 +00:00
|
|
|
./configure --target=your-target-tuple
|
2007-07-24 21:51:24 +00:00
|
|
|
or
|
2007-08-15 16:18:35 +00:00
|
|
|
make CC=your-target-tuple-gcc
|
2007-07-24 21:51:24 +00:00
|
|
|
or
|
2007-08-15 16:18:35 +00:00
|
|
|
make CROSS_COMPILE=your-target-tuple-
|
2007-07-24 21:51:24 +00:00
|
|
|
and so on...
|
2007-07-09 17:35:45 +00:00
|
|
|
|
2008-05-02 21:53:09 +00:00
|
|
|
It is strongly advised not to use the toolchain sys-root directory as an
|
2008-06-25 14:06:49 +00:00
|
|
|
install directory for your programs/packages. If you do so, you will not be
|
2008-05-02 21:53:09 +00:00
|
|
|
able to use your toolchain for another project. It is even strongly advised
|
|
|
|
that your toolchain is chmod-ed to read-only once successfully build, so that
|
2008-06-25 14:06:49 +00:00
|
|
|
you don't go polluting your toolchain with your programs/packages' files.
|
2008-05-02 21:53:09 +00:00
|
|
|
|
|
|
|
Thus, when you build a program/package, install it in a separate directory,
|
|
|
|
eg. /your/root. This directory is the /image/ of what would be in the root file
|
2008-06-25 14:06:49 +00:00
|
|
|
system of your target, and will contain all that your programs/packages have
|
2008-05-02 21:53:09 +00:00
|
|
|
installed.
|
|
|
|
|
2009-06-14 19:43:55 +00:00
|
|
|
The 'populate' script |
|
|
|
|
----------------------+
|
|
|
|
|
2007-07-09 17:35:45 +00:00
|
|
|
When your root directory is ready, it is still missing some important bits: the
|
|
|
|
toolchain's libraries. To populate your root directory with those libs, just
|
|
|
|
run:
|
2007-08-15 16:18:35 +00:00
|
|
|
your-target-tuple-populate -s /your/root -d /your/root-populated
|
2007-07-09 17:35:45 +00:00
|
|
|
|
|
|
|
This will copy /your/root into /your/root-populated, and put the needed and only
|
|
|
|
the needed libraries there. Thus you don't polute /your/root with any cruft that
|
|
|
|
would no longer be needed should you have to remove stuff. /your/root always
|
|
|
|
contains only those things you install in it.
|
|
|
|
|
|
|
|
You can then use /your/root-populated to build up your file system image, a
|
|
|
|
tarball, or to NFS-mount it from your target, or whatever you need.
|
|
|
|
|
2009-06-14 19:43:55 +00:00
|
|
|
The populate script accepts the following options:
|
|
|
|
|
|
|
|
-s src_dir
|
|
|
|
Use 'src_dir' as the un-populated root directory.
|
2007-07-24 21:51:24 +00:00
|
|
|
|
2009-06-14 19:43:55 +00:00
|
|
|
-d dst_dir
|
|
|
|
Put the populated root directory in 'dst_dir'.
|
2007-07-24 21:51:24 +00:00
|
|
|
|
2009-06-14 19:43:55 +00:00
|
|
|
-l lib1 [...]
|
|
|
|
Always add specified libraries.
|
|
|
|
|
|
|
|
-L file
|
|
|
|
Always add libraries listed in 'file'.
|
2007-07-24 21:51:24 +00:00
|
|
|
|
|
|
|
-f
|
2009-06-14 19:43:55 +00:00
|
|
|
Remove 'dst_dir' if it previously existed; continue even if any library
|
|
|
|
specified with -l or -L is missing.
|
2007-07-24 21:51:24 +00:00
|
|
|
|
|
|
|
-v
|
|
|
|
Be verbose, and tell what's going on (you can see exactly where libs are
|
|
|
|
coming from).
|
|
|
|
|
|
|
|
-h
|
2009-06-14 19:43:55 +00:00
|
|
|
Print the help.
|
|
|
|
|
|
|
|
See 'your-target-tuple-populate -h' for more information on the options.
|
2007-07-24 21:51:24 +00:00
|
|
|
|
2009-06-14 19:44:33 +00:00
|
|
|
Here is how populate works:
|
|
|
|
|
|
|
|
1) performs some sanity checks:
|
|
|
|
- src_dir and dst_dir are specified
|
|
|
|
- src_dir exists
|
|
|
|
- unless forced, dst_dir does not exist
|
|
|
|
- src_dir != dst_dir
|
|
|
|
|
|
|
|
2) copy src_dir to dst_dir
|
|
|
|
|
|
|
|
3) add forced libraries to dst_dir
|
|
|
|
- build the list from -l and -L options
|
|
|
|
- get forced libraries from the sysroot (see below for heuristics)
|
|
|
|
- abort on the first missing library, unless -f is specified
|
|
|
|
|
|
|
|
4) add all missing libraries to dst_dir
|
|
|
|
- scan dst_dir for every ELF files that are 'executable' or
|
|
|
|
'shared object'
|
|
|
|
- list the "NEEDED Shared library" fields
|
|
|
|
- check if the library is already in dst_dir/lib or dst_dir/usr/lib
|
|
|
|
- if not, get the library from the sysroot
|
|
|
|
- if it's in sysroot/lib, copy it to dst_dir/lib
|
|
|
|
- if it's in sysroot/usr/lib, copy it to dst_dir/usr/lib
|
|
|
|
- in both cases, use the SONAME of the library to create the file
|
|
|
|
in dst_dir
|
|
|
|
- if it was not found in the sysroot, this is an error.
|
|
|
|
|
2009-10-12 17:25:41 +00:00
|
|
|
|
2007-04-17 22:22:46 +00:00
|
|
|
___________________
|
|
|
|
/
|
|
|
|
Toolchain types /
|
|
|
|
________________/
|
|
|
|
|
|
|
|
There are four kinds of toolchains you could encounter.
|
|
|
|
|
|
|
|
First off, you must understand the following: when it comes to compilers there
|
|
|
|
are up to four machines involved:
|
|
|
|
1) the machine configuring the toolchain components: the config machine
|
|
|
|
2) the machine building the toolchain components: the build machine
|
|
|
|
3) the machine running the toolchain: the host machine
|
2007-07-04 17:37:48 +00:00
|
|
|
4) the machine the toolchain is generating code for: the target machine
|
2007-04-17 22:22:46 +00:00
|
|
|
|
|
|
|
We can most of the time assume that the config machine and the build machine
|
|
|
|
are the same. Most of the time, this will be true. The only time it isn't
|
|
|
|
is if you're using distributed compilation (such as distcc). Let's forget
|
|
|
|
this for the sake of simplicity.
|
|
|
|
|
|
|
|
So we're left with three machines:
|
|
|
|
- build
|
|
|
|
- host
|
|
|
|
- target
|
|
|
|
|
|
|
|
Any toolchain will involve those three machines. You can be as pretty sure of
|
|
|
|
this as "2 and 2 are 4". Here is how they come into play:
|
|
|
|
|
|
|
|
1) build == host == target
|
|
|
|
This is a plain native toolchain, targetting the exact same machine as the
|
|
|
|
one it is built on, and running again on this exact same machine. You have
|
|
|
|
to build such a toolchain when you want to use an updated component, such
|
|
|
|
as a newer gcc for example.
|
2007-07-02 19:40:54 +00:00
|
|
|
crosstool-NG calls it "native".
|
2007-04-17 22:22:46 +00:00
|
|
|
|
|
|
|
2) build == host != target
|
|
|
|
This is a classic cross-toolchain, which is expected to be run on the same
|
|
|
|
machine it is compiled on, and generate code to run on a second machine,
|
|
|
|
the target.
|
2007-07-02 19:40:54 +00:00
|
|
|
crosstool-NG calls it "cross".
|
2007-04-17 22:22:46 +00:00
|
|
|
|
|
|
|
3) build != host == target
|
|
|
|
Such a toolchain is also a native toolchain, as it targets the same machine
|
|
|
|
as it runs on. But it is build on another machine. You want such a
|
|
|
|
toolchain when porting to a new architecture, or if the build machine is
|
|
|
|
much faster than the host machine.
|
2007-07-02 19:40:54 +00:00
|
|
|
crosstool-NG calls it "cross-native".
|
2007-04-17 22:22:46 +00:00
|
|
|
|
|
|
|
4) build != host != target
|
2007-05-13 21:11:54 +00:00
|
|
|
This one is called a canadian-toolchain (*), and is tricky. The three
|
2007-04-17 22:22:46 +00:00
|
|
|
machines in play are different. You might want such a toolchain if you
|
|
|
|
have a fast build machine, but the users will use it on another machine,
|
|
|
|
and will produce code to run on a third machine.
|
2007-07-02 19:40:54 +00:00
|
|
|
crosstool-NG calls it "canadian".
|
2007-04-17 22:22:46 +00:00
|
|
|
|
2007-07-02 19:40:54 +00:00
|
|
|
crosstool-NG can build all these kinds of toolchains (or is aiming at it,
|
|
|
|
anyway!)
|
2007-04-17 22:22:46 +00:00
|
|
|
|
|
|
|
(*) The term Canadian Cross came about because at the time that these issues
|
|
|
|
were all being hashed out, Canada had three national political parties.
|
|
|
|
http://en.wikipedia.org/wiki/Cross_compiler
|
|
|
|
|
2009-10-02 20:10:38 +00:00
|
|
|
|
2009-10-10 10:55:17 +00:00
|
|
|
________________
|
|
|
|
/
|
|
|
|
Contributing /
|
|
|
|
_____________/
|
|
|
|
|
|
|
|
Sending a bug report |
|
|
|
|
---------------------+
|
|
|
|
|
|
|
|
If you need to send a bug report, please send a mail with subject
|
|
|
|
prefixed with "[CT_NG]" with to following destinations:
|
|
|
|
TO: yann.morin.1998 (at) anciens.enib.fr
|
|
|
|
CC: crossgcc (at) sourceware.org
|
|
|
|
|
|
|
|
Sending patches |
|
|
|
|
----------------+
|
|
|
|
|
|
|
|
If you want to enhance crosstool-NG, there's a to-do list in the TODO file.
|
|
|
|
|
|
|
|
Patches should come with the appropriate SoB line. A SoB line is typically
|
|
|
|
something like:
|
|
|
|
Signed-off-by: John DOE <john.doe@somewhere.net>
|
|
|
|
|
|
|
|
The SoB line is clearly described in Documentation/SubmittingPatches , section
|
|
|
|
12, of your favourite Linux kernel source tree.
|
|
|
|
|
|
|
|
Then you'll need to correctly configure Mercurial. There are two extensions
|
|
|
|
that you may find usefull:
|
|
|
|
- mq : http://mercurial.selenic.com/wiki/MqExtension
|
|
|
|
- patchbomb : http://mercurial.selenic.com/wiki/PatchbombExtension
|
|
|
|
|
|
|
|
Commit messages should look like (without leading pipes):
|
|
|
|
|component: short, one-line description
|
|
|
|
|
|
|
|
|
|optional longer description
|
|
|
|
|on multiple lines if needed
|
|
|
|
|
|
|
|
Here is an example commit message (see revision a53a5e1d61db):
|
|
|
|
|comp-libs/cloog: fix building
|
|
|
|
|
|
|
|
|
|For CLooG/PPL 0.15.3, the directory name was simply cloog-ppl.
|
|
|
|
|For any later versions, the directory name does have the version, such as
|
|
|
|
|cloog-ppl-0.15.4.
|
|
|
|
|
|
|
|
Here's a typical hacking session:
|
|
|
|
hg clone http://ymorin.is-a-geek.org/hg/crosstool-ng crosstool-ng
|
|
|
|
cd crosstool-ng
|
|
|
|
hg qinit
|
|
|
|
hg qnew -D -U -e my_first_patch
|
|
|
|
*edit patch description*
|
|
|
|
*hack* *hack* *check* *fails* *hack* *hack* *check* *works*
|
|
|
|
hg qref -D -e
|
|
|
|
*edit patch description, serving as commit message*
|
|
|
|
hg qnew -D -U -e my_second_patch
|
|
|
|
*edit patch description*
|
|
|
|
*hack* *hack* *check* *fails* *hack* *hack* *check* *works*
|
|
|
|
hg qref -D -e
|
|
|
|
*edit patch description, serving as commit message*
|
|
|
|
hg email --outgoing --intro \
|
|
|
|
--from '"Your Full NAME" <your.email (at) your.domain>' \
|
|
|
|
--to '"Yann E. MORIN" <yann.morin.1998 (at) anciens.enib.fr>' \
|
|
|
|
--cc 'crossgcc (at) sourceware.org'
|
|
|
|
*edit introductory message*
|
|
|
|
*wait for feedback*
|
|
|
|
*re-send if no answer for a few days*
|
|
|
|
|
|
|
|
Note: replace '(at)' above with a plain '@'.
|
|
|
|
|
|
|
|
|
2007-02-24 11:00:05 +00:00
|
|
|
_____________
|
|
|
|
/
|
|
|
|
Internals /
|
|
|
|
__________/
|
|
|
|
|
2007-05-13 21:11:54 +00:00
|
|
|
Internally, crosstool-NG is script-based. To ease usage, the frontend is
|
|
|
|
Makefile-based.
|
|
|
|
|
|
|
|
Makefile front-end |
|
2008-05-02 21:53:09 +00:00
|
|
|
-------------------+
|
2007-05-13 21:11:54 +00:00
|
|
|
|
2007-07-04 17:37:48 +00:00
|
|
|
The entry point to crosstool-NG is the Makefile script "ct-ng". Calling this
|
|
|
|
script with an action will act exactly as if the Makefile was in the current
|
|
|
|
working directory and make was called with the action as rule. Thus:
|
|
|
|
ct-ng menuconfig
|
2007-07-24 21:51:24 +00:00
|
|
|
|
2007-07-04 17:37:48 +00:00
|
|
|
is equivalent to having the Makefile in CWD, and calling:
|
|
|
|
make menuconfig
|
|
|
|
|
|
|
|
Having ct-ng as it is avoids copying the Makefile everywhere, and acts as a
|
|
|
|
traditional command.
|
|
|
|
|
|
|
|
ct-ng loads sub- Makefiles from the library directory $(CT_LIB_DIR), as set up
|
|
|
|
at configuration time with ./configure.
|
|
|
|
|
2008-02-20 22:48:35 +00:00
|
|
|
ct-ng also searches for config files, sub-tools, samples, scripts and patches in
|
2007-07-04 17:37:48 +00:00
|
|
|
that library directory.
|
2007-05-13 21:11:54 +00:00
|
|
|
|
2007-07-24 21:51:24 +00:00
|
|
|
Because of a stupid make behavior/bug I was unable to track down, implicit make
|
|
|
|
rules are disabled: installing with --local would triger those rules, and mconf
|
|
|
|
was unbuildable.
|
|
|
|
|
2007-07-01 19:04:20 +00:00
|
|
|
Kconfig parser |
|
2008-05-02 21:53:09 +00:00
|
|
|
---------------+
|
2007-05-13 21:11:54 +00:00
|
|
|
|
2008-10-23 13:45:48 +00:00
|
|
|
The kconfig language is a hacked version, vampirised from the Linux kernel
|
|
|
|
(http://www.kernel.org/), and (heavily) adapted to my needs.
|
2007-05-13 21:11:54 +00:00
|
|
|
|
2008-11-13 17:55:16 +00:00
|
|
|
The list of the most notable changes (at least the ones I remember) follows:
|
|
|
|
- the CONFIG_ prefix has been replaced with CT_
|
|
|
|
- a leading | in prompts is skipped, and subsequent leading spaces are not
|
2010-03-05 08:43:00 +00:00
|
|
|
trimmed; otherwise leading spaces are silently trimmed
|
|
|
|
- removed the warning about undefined environment variable
|
2008-11-13 17:55:16 +00:00
|
|
|
|
2007-07-04 17:37:48 +00:00
|
|
|
The kconfig parsers (conf and mconf) are not installed pre-built, but as
|
|
|
|
source files. Thus you can have the directory where crosstool-NG is installed,
|
|
|
|
exported (via NFS or whatever) and have clients with different architectures
|
|
|
|
use the same crosstool-NG installation, and most notably, the same set of
|
|
|
|
patches.
|
|
|
|
|
2007-09-14 19:30:56 +00:00
|
|
|
Architecture-specific |
|
2008-05-02 21:53:09 +00:00
|
|
|
----------------------+
|
2007-09-14 19:30:56 +00:00
|
|
|
|
2008-06-27 13:58:53 +00:00
|
|
|
Note: this chapter is not really well written, and might thus be a little bit
|
|
|
|
complex to understand. To get a better grasp of what an architecture is, the
|
|
|
|
reader is kindly encouraged to look at the "arch/" sub-directory, and to the
|
|
|
|
existing architectures to see how things are laid out.
|
|
|
|
|
2007-09-14 19:30:56 +00:00
|
|
|
An architecture is defined by:
|
|
|
|
|
|
|
|
- a human-readable name, in lower case letters, with numbers as appropriate.
|
2008-06-27 13:58:53 +00:00
|
|
|
The underscore is allowed; space and special characters are not.
|
|
|
|
Eg.: arm, x86_64
|
2008-10-05 15:32:00 +00:00
|
|
|
- a file in "config/arch/", named after the architecture's name, and suffixed
|
|
|
|
with ".in".
|
|
|
|
Eg.: config/arch/arm.in
|
|
|
|
- a file in "scripts/build/arch/", named after the architecture's name, and
|
|
|
|
suffixed with ".sh".
|
|
|
|
Eg.: scripts/build/arch/arm.sh
|
|
|
|
|
|
|
|
The architecture's ".in" file API:
|
2008-06-27 13:58:53 +00:00
|
|
|
> the config option "ARCH_%arch%" (where %arch% is to be replaced with the
|
|
|
|
actual architecture name).
|
|
|
|
That config option must have *neither* a type, *nor* a prompt! Also, it can
|
|
|
|
*not* depend on any other config option (EXPERIMENTAL is managed as above).
|
|
|
|
Eg.:
|
|
|
|
config ARCH_arm
|
2008-06-27 14:55:22 +00:00
|
|
|
+ mandatory:
|
2008-07-20 16:59:04 +00:00
|
|
|
defines a (terse) help entry for this architecture:
|
2008-06-27 14:55:22 +00:00
|
|
|
Eg.:
|
|
|
|
config ARCH_arm
|
|
|
|
help
|
|
|
|
The ARM architecture.
|
2008-06-27 13:58:53 +00:00
|
|
|
+ optional:
|
|
|
|
selects adequate associated config options.
|
2008-11-07 08:09:42 +00:00
|
|
|
Note: 64-bit architectures *shall* select ARCH_64
|
2008-06-27 13:58:53 +00:00
|
|
|
Eg.:
|
|
|
|
config ARCH_arm
|
|
|
|
select ARCH_SUPPORTS_BOTH_ENDIAN
|
|
|
|
select ARCH_DEFAULT_LE
|
2008-06-27 14:55:22 +00:00
|
|
|
help
|
|
|
|
The ARM architecture.
|
2008-11-07 08:09:42 +00:00
|
|
|
Eg.:
|
|
|
|
config ARCH_x86_64
|
|
|
|
select ARCH_64
|
|
|
|
help
|
|
|
|
The x86_64 architecture.
|
2008-06-27 13:58:53 +00:00
|
|
|
|
|
|
|
> other target-specific options, at your discretion. Note however that to
|
|
|
|
avoid name-clashing, such options shall be prefixed with "ARCH_%arch%",
|
|
|
|
where %arch% is again replaced by the actual architecture name.
|
|
|
|
(Note: due to historical reasons, and lack of time to clean up the code,
|
|
|
|
I may have left some config options that do not completely conform to
|
|
|
|
this, as the architecture name was written all upper case. However, the
|
|
|
|
prefix is unique among architectures, and does not cause harm).
|
2007-09-14 19:30:56 +00:00
|
|
|
|
2008-10-05 15:32:00 +00:00
|
|
|
The architecture's ".sh" file API:
|
2008-10-23 13:45:48 +00:00
|
|
|
> the function "CT_DoArchTupleValues"
|
2007-09-14 19:30:56 +00:00
|
|
|
+ parameters: none
|
|
|
|
+ environment:
|
2008-10-03 20:00:36 +00:00
|
|
|
- all variables from the ".config" file,
|
|
|
|
- the two variables "target_endian_eb" and "target_endian_el" which are
|
|
|
|
the endianness suffixes
|
2007-09-14 19:30:56 +00:00
|
|
|
+ return value: 0 upon success, !0 upon failure
|
2007-09-14 21:57:17 +00:00
|
|
|
+ provides:
|
2007-09-14 21:58:55 +00:00
|
|
|
- mandatory
|
2007-09-15 21:44:18 +00:00
|
|
|
- the environment variable CT_TARGET_ARCH
|
2007-09-14 21:58:55 +00:00
|
|
|
- contains:
|
|
|
|
the architecture part of the target tuple.
|
|
|
|
Eg.: "armeb" for big endian ARM
|
|
|
|
"i386" for an i386
|
|
|
|
+ provides:
|
2007-09-14 21:17:59 +00:00
|
|
|
- optional
|
2007-09-15 21:44:18 +00:00
|
|
|
- the environment variable CT_TARGET_SYS
|
2008-04-27 09:57:50 +00:00
|
|
|
- contains:
|
2007-09-14 21:17:59 +00:00
|
|
|
the sytem part of the target tuple.
|
|
|
|
Eg.: "gnu" for glibc on most architectures
|
|
|
|
"gnueabi" for glibc on an ARM EABI
|
|
|
|
- defaults to:
|
|
|
|
- for glibc-based toolchain: "gnu"
|
|
|
|
- for uClibc-based toolchain: "uclibc"
|
2007-09-15 21:44:18 +00:00
|
|
|
+ provides:
|
|
|
|
- optional
|
2008-08-07 15:18:18 +00:00
|
|
|
- the environment variables to configure the cross-gcc (defaults)
|
|
|
|
- CT_ARCH_WITH_ARCH : the gcc ./configure switch to select architecture level ( "--with-arch=${CT_ARCH_ARCH}" )
|
|
|
|
- CT_ARCH_WITH_ABI : the gcc ./configure switch to select ABI level ( "--with-abi=${CT_ARCH_ABI}" )
|
|
|
|
- CT_ARCH_WITH_CPU : the gcc ./configure switch to select CPU instruction set ( "--with-cpu=${CT_ARCH_CPU}" )
|
|
|
|
- CT_ARCH_WITH_TUNE : the gcc ./configure switch to select scheduling ( "--with-tune=${CT_ARCH_TUNE}" )
|
|
|
|
- CT_ARCH_WITH_FPU : the gcc ./configure switch to select FPU type ( "--with-fpu=${CT_ARCH_FPU}" )
|
|
|
|
- CT_ARCH_WITH_FLOAT : the gcc ./configure switch to select floating point arithmetics ( "--with-float=soft" or /empty/ )
|
2007-09-15 21:44:18 +00:00
|
|
|
+ provides:
|
|
|
|
- optional
|
2008-08-07 15:18:18 +00:00
|
|
|
- the environment variables to pass to the cross-gcc to build target binaries (defaults)
|
2007-09-15 21:44:18 +00:00
|
|
|
- CT_ARCH_ARCH_CFLAG : the gcc switch to select architecture level ( "-march=${CT_ARCH_ARCH}" )
|
2008-04-27 09:57:50 +00:00
|
|
|
- CT_ARCH_ABI_CFLAG : the gcc switch to select ABI level ( "-mabi=${CT_ARCH_ABI}" )
|
2007-09-15 21:44:18 +00:00
|
|
|
- CT_ARCH_CPU_CFLAG : the gcc switch to select CPU instruction set ( "-mcpu=${CT_ARCH_CPU}" )
|
|
|
|
- CT_ARCH_TUNE_CFLAG : the gcc switch to select scheduling ( "-mtune=${CT_ARCH_TUNE}" )
|
|
|
|
- CT_ARCH_FPU_CFLAG : the gcc switch to select FPU type ( "-mfpu=${CT_ARCH_FPU}" )
|
|
|
|
- CT_ARCH_FLOAT_CFLAG : the gcc switch to choose floating point arithmetics ( "-msoft-float" or /empty/ )
|
|
|
|
- CT_ARCH_ENDIAN_CFLAG : the gcc switch to choose big or little endian ( "-mbig-endian" or "-mlittle-endian" )
|
|
|
|
- default to:
|
|
|
|
see above.
|
2008-08-07 15:18:18 +00:00
|
|
|
+ provides:
|
|
|
|
- optional
|
|
|
|
- the environement variables to configure the core and final compiler, specific to this architecture:
|
|
|
|
- CT_ARCH_CC_CORE_EXTRA_CONFIG : additional, architecture specific core gcc ./configure flags
|
|
|
|
- CT_ARCH_CC_EXTRA_CONFIG : additional, architecture specific final gcc ./configure flags
|
|
|
|
- default to:
|
|
|
|
- all empty
|
|
|
|
+ provides:
|
|
|
|
- optional
|
|
|
|
- the architecture-specific CFLAGS and LDFLAGS:
|
|
|
|
- CT_ARCH_TARGET_CLFAGS
|
|
|
|
- CT_ARCH_TARGET_LDFLAGS
|
|
|
|
- default to:
|
|
|
|
- all empty
|
2008-06-27 13:58:53 +00:00
|
|
|
|
2008-10-05 15:32:00 +00:00
|
|
|
You can have a look at "config/arch/arm.in" and "scripts/build/arch/arm.sh" for
|
|
|
|
a quite complete example of what an actual architecture description looks like.
|
2008-10-03 20:00:36 +00:00
|
|
|
|
2008-09-29 20:19:45 +00:00
|
|
|
Kernel specific |
|
|
|
|
----------------+
|
|
|
|
|
|
|
|
A kernel is defined by:
|
|
|
|
|
|
|
|
- a human-readable name, in lower case letters, with numbers as appropriate.
|
|
|
|
The underscore is allowed; space and special characters are not (although
|
|
|
|
they are internally replaced with underscores.
|
|
|
|
Eg.: linux, bare-metal
|
|
|
|
- a file in "config/kernel/", named after the kernel name, and suffixed with
|
|
|
|
".in".
|
|
|
|
Eg.: config/kernel/linux.in, config/kernel/bare-metal.in
|
2008-10-03 20:00:36 +00:00
|
|
|
- a file in "scripts/build/kernel/", named after the kernel name, and suffixed
|
|
|
|
with ".sh".
|
|
|
|
Eg.: scripts/build/kernel/linux.sh, scripts/build/kernel/bare-metal.sh
|
2008-09-29 20:19:45 +00:00
|
|
|
|
|
|
|
The kernel's ".in" file must contain:
|
|
|
|
> an optional lines containing exactly "# EXPERIMENTAL", starting on the
|
|
|
|
first column, and without any following space or other character.
|
|
|
|
If this line is present, then this kernel is considered EXPERIMENTAL,
|
|
|
|
and correct dependency on EXPERIMENTAL will be set.
|
2008-10-03 20:00:36 +00:00
|
|
|
|
2008-09-29 20:19:45 +00:00
|
|
|
> the config option "KERNEL_%kernel_name%" (where %kernel_name% is to be
|
|
|
|
replaced with the actual kernel name, with all special characters and
|
|
|
|
spaces replaced by underscores).
|
|
|
|
That config option must have *neither* a type, *nor* a prompt! Also, it can
|
|
|
|
*not* depends on EXPERIMENTAL.
|
|
|
|
Eg.: KERNEL_linux, KERNEL_bare_metal
|
|
|
|
+ mandatory:
|
|
|
|
defines a (terse) help entry for this kernel.
|
|
|
|
Eg.:
|
|
|
|
config KERNEL_bare_metal
|
|
|
|
help
|
|
|
|
Build a compiler for use without any kernel.
|
|
|
|
+ optional:
|
|
|
|
selects adequate associated config options.
|
|
|
|
Eg.:
|
|
|
|
config KERNEL_bare_metal
|
|
|
|
select BARE_METAL
|
|
|
|
help
|
|
|
|
Build a compiler for use without any kernel.
|
|
|
|
|
|
|
|
> other kernel specific options, at your discretion. Note however that, to
|
|
|
|
avoid name-clashing, such options should be prefixed with
|
|
|
|
"KERNEL_%kernel_name%", where %kernel_name% is again tp be replaced with
|
|
|
|
the actual kernel name.
|
|
|
|
(Note: due to historical reasons, and lack of time to clean up the code,
|
|
|
|
I may have left some config options that do not completely conform to
|
|
|
|
this, as the kernel name was written all upper case. However, the prefix
|
|
|
|
is unique among kernels, and does not cause harm).
|
|
|
|
|
2008-10-03 20:00:36 +00:00
|
|
|
The kernel's ".sh" file API:
|
|
|
|
> is a bash script fragment
|
|
|
|
|
2008-10-23 13:45:48 +00:00
|
|
|
> defines the function CT_DoKernelTupleValues
|
|
|
|
+ see the architecture's CT_DoArchTupleValues, except for:
|
|
|
|
+ set the environment variable CT_TARGET_KERNEL, the kernel part of the
|
|
|
|
target tuple
|
|
|
|
+ return value: ignored
|
|
|
|
|
2008-10-03 20:00:36 +00:00
|
|
|
> defines the function "do_kernel_get":
|
|
|
|
+ parameters: none
|
|
|
|
+ environment:
|
|
|
|
- all variables from the ".config" file.
|
|
|
|
+ return value: 0 for success, !0 for failure.
|
|
|
|
+ behavior: download the kernel's sources, and store the tarball into
|
|
|
|
"${CT_TARBALLS_DIR}". To this end, a functions is available, that
|
|
|
|
abstracts downloading tarballs:
|
|
|
|
- CT_DoGet <tarball_base_name> <URL1 [URL...]>
|
|
|
|
Eg.: CT_DoGet linux-2.6.26.5 ftp://ftp.kernel.org/pub/linux/kernel/v2.6
|
|
|
|
Note: retrieving sources from svn, cvs, git and the likes is not supported
|
|
|
|
by CT_DoGet. You'll have to do this by hand, as it is done for eglibc in
|
|
|
|
"scripts/build/libc/eglibc.sh"
|
|
|
|
|
|
|
|
> defines the function "do_kernel_extract":
|
|
|
|
+ parameters: none
|
|
|
|
+ environment:
|
|
|
|
- all variables from the ".config" file,
|
|
|
|
+ return value: 0 for success, !0 for failure.
|
|
|
|
+ behavior: extract the kernel's tarball into "${CT_SRC_DIR}", and apply
|
|
|
|
required patches. To this end, a function is available, that abstracts
|
|
|
|
extracting tarballs:
|
|
|
|
- CT_ExtractAndPatch <tarball_base_name>
|
|
|
|
Eg.: CT_ExtractAndPatch linux-2.6.26.5
|
|
|
|
|
|
|
|
> defines the function "do_kernel_headers":
|
|
|
|
+ parameters: none
|
|
|
|
+ environment:
|
|
|
|
- all variables from the ".config" file,
|
|
|
|
+ return value: 0 for success, !0 for failure.
|
|
|
|
+ behavior: install the kernel headers (if any) in "${CT_SYSROOT_DIR}/usr/include"
|
|
|
|
|
|
|
|
> defines any kernel-specific helper functions
|
|
|
|
These functions, if any, must be prefixed with "do_kernel_%CT_KERNEL%_",
|
|
|
|
where '%CT_KERNEL%' is to be replaced with the actual kernel name, to avoid
|
|
|
|
any name-clashing.
|
|
|
|
|
|
|
|
You can have a look at "config/kernel/linux.in" and "scripts/build/kernel/linux.sh"
|
2008-10-05 15:32:00 +00:00
|
|
|
as an example of what a complex kernel description looks like.
|
2008-10-03 20:00:36 +00:00
|
|
|
|
2008-06-25 14:06:49 +00:00
|
|
|
Adding a new version of a component |
|
2008-05-02 21:53:09 +00:00
|
|
|
------------------------------------+
|
|
|
|
|
|
|
|
When a new component, such as the Linux kernel, gcc or any other is released,
|
|
|
|
adding the new version to crosstool-NG is quite easy. There is a script that
|
|
|
|
will do all that for you:
|
2008-12-11 18:12:04 +00:00
|
|
|
scripts/addToolVersion.sh
|
2008-05-02 21:53:09 +00:00
|
|
|
|
|
|
|
Run it with no option to get some help.
|
2007-09-14 19:30:56 +00:00
|
|
|
|
2007-07-04 17:37:48 +00:00
|
|
|
Build scripts |
|
2008-05-02 21:53:09 +00:00
|
|
|
--------------+
|
2007-07-04 17:37:48 +00:00
|
|
|
|
|
|
|
To Be Written later...
|