Searching the Internet for information on how to build arm toolchain from
scratch I realize that it is very hard to find information about this matter
(and recent one even harder). I will try to fill this lack of information and
try to build toolchain. My main goal is to use a component based on the GNU
public license, and using them in as the newest version as it is possible. What
is toolchain? (according to wikipedia):
In software, a toolchain is the set of programming tools that are used to
create a product (typically another computer program or system of programs).
The tools may be used in a chain, so that the output of each tool becomes the
input for the next, but the term is used widely to refer to any set of linked
development tools.
Requirements
- Cross compiler, I create one using crosstool-ng and describe this process in
previous post. I will use
arm-unknown-linux-gnueabi as entry point
compiler.
$TARGET is defined as my destination directory:
1
|
export TARGET=/home/pietrushnic/sandbox/toolchain
|
Procedure
- Clone linux git repository
1
|
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
|
- Install headers $TARGET is home of our toolchain
1
|
make ARCH=arm INSTALL_HDR_PATH=$TARGET/usr headers_install
|
Libraries (gmp, mpfr, mpc)
1
|
hg clone http://gmplib.org:8000/gmp
|
- create configuration files
1
|
./configure --prefix=$TARGET/arm-x-tools --enable-shared=n --enable-static
|
1
|
make && make check && make install
|
1
|
svn checkout svn://scm.gforge.inria.fr/svn/mpfr/trunk mpfr
|
- create configuration file
1
|
./configure --prefix=$TARGET/arm-x-tools --enable-thread-safe --with-gmp=$TARGET/arm-x-tools --disable-shared --enable-static
|
1
|
svn checkout svn://scm.gforge.inria.fr/svnroot/mpc/trunk mpc
|
- create configuration file
1
|
./configure --prefix=$TARGET/arm-x-tools --with-gmp=$TARGET/arm-x-tools --with-mpfr=$TARGET/arm-x-tools --disable-shared --enable-static
|
1
|
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src
|
- login create directory for checkout
1
|
cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co binutils
|
1
2
3
4
5
6
|
LDFLAGS="-Wl,-rpath -Wl,$TARGET/arm-x-tools/lib" ./configure
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=arm-unknown-linux-gnueabi --prefix=$TARGET/arm-x-tools
--disable-nls --disable-multilib --disable-werror --with-float=soft
--with-gmp=$TARGET/arm-x-tools --with-mpfr=$TARGET/arm-x-tools
--with-mpc=$TARGET/arm-x-tools --with-sysroot=$TARGET
|
1
2
3
|
make configure-host
make
make install
|
To check if everything was made correctly
1
|
ldd $TARGET/arm-x-tools/bin/arm-unknown-linux-gnueabi-ldd
|
It should show that it use library compiled previously by us:
1
|
libz.so.1 => /home/pietrushnic/sandbox/toolchain/arm-x-tools/lib/libz.so.1 (0x00007f0086cc5000)
|
This set gives us a solid base to build the compiler. However, it will be in the
next section.
Piotr Król
I’m into open-source firmware, drawing inspiration from the classic hacker ethos of collaborative innovation and transparency. At 3mdeb, we’re excited about our two main projects: Zarhus OS, an Embedded Linux distribution based on Yocto, and Dasharo, a coreboot downstream. Both are about the value of open development, embedded firmware resilience, platform security transparency, the right to repair, and digital sovereignty.
Community is at the center of our activity. By being involved in the Dasharo Users Group, Dasharo Developers vPub, and events like the Qubes OS Summit, we connect with others who share our passion for open-source.