[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Patches] updates to cross-build instructions
- To: <patches@xxxxxxxxxx>
- Subject: [Patches] updates to cross-build instructions
- From: Steve Longerbeam <steve_longerbeam@xxxxxxxxxx>
- Date: Mon, 28 Nov 2011 16:05:15 -0800
As part of the menuconfig development, I encountered some outdated
information in the cross-build instructions, libc/EGLIBC.cross-building.
This patch updates the file with new (and tested) instructions. It is
unrelated to the menuconfig support, but applies after.
My testing was done with an ARM target, and an x86_64 Linux host, so I
converted the instructions to use those host/target types from the
original i686/powerpc. Hope that's ok.
Thanks,
--
Steve Longerbeam | Senior Embedded Engineer, ESD Services
Mentor Embedded(tm) | 46871 Bayside Parkway, Fremont, CA 94538
P 510.354.5838 | M 408.410.2735
Nucleus(r) | Linux(r) | Android(tm) | Services | UI | Multi-OS
EGLIBC.cross-building | 59 +++++++++++++++++++++++++++++---------------------
1 file changed, 35 insertions(+), 24 deletions(-)
diff -Nupbar -X /home/stevel/dontdiff eglibc.orig/libc/EGLIBC.cross-building eglibc/libc/EGLIBC.cross-building
--- eglibc.orig/libc/EGLIBC.cross-building 2011-11-22 18:09:21.863350687 -0800
+++ eglibc/libc/EGLIBC.cross-building 2011-11-22 18:00:01.233663186 -0800
@@ -47,31 +47,34 @@ Preparation
EGLIBC requires recent versions of the GNU binutils, GCC, and the
Linux kernel. The web page <http://www.eglibc.org/prerequisites>
documents the current requirements, and lists patches needed for
-certain target architectures. As of this writing, EGLIBC required
-binutils 2.17, GCC 4.1, and Linux 2.6.19.1.
+certain target architectures. As of this writing, these build
+instructions have been tested with binutils 2.22.51, GCC 4.6.2,
+and Linux 3.1.
First, let's set some variables, to simplify later commands. We'll
-build EGLIBC and GCC for a PowerPC target, known to the Linux kernel
-as 'powerpc', and we'll do the build on an Intel Linux box:
+build EGLIBC and GCC for an ARM target, known to the Linux kernel
+as 'arm', and we'll do the build on an Intel x86_64 Linux box:
- $ build=i686-pc-linux-gnu
+ $ build=x86_64-pc-linux-gnu
$ host=$build
- $ target=powerpc-none-linux-gnu
- $ linux_arch=powerpc
+ $ target=arm-none-linux-gnueabi
+ $ linux_arch=arm
We're using the aforementioned versions of Binutils, GCC, and Linux:
- $ binutilsv=binutils-2.17
- $ gccv=gcc-4.1.1
- $ linuxv=linux-2.6.20
+ $ binutilsv=binutils-2.22.51
+ $ gccv=gcc-4.6.2
+ $ linuxv=linux-3.1
We're carrying out the entire process under '~/cross-build', which
-contains unpacked source trees:
+contains unpacked source trees for binutils, gcc, and linux kernel,
+along with EGLIBC svn trunk (which can be checked-out with
+'svn co http://www.eglibc.org/svn/trunk eglibc'):
- $ top=$HOME/cross-build/ppc
+ $ top=$HOME/cross-build/$target
$ src=$HOME/cross-build/src
$ ls $src
- binutils-2.17 gcc-4.1.1 libc linux-2.6.20
+ binutils-2.22.51 eglibc gcc-4.6.2 linux-3.1
We're going to place our build directories in a subdirectory 'obj',
we'll install the cross-development toolchain in 'tools', and we'll
@@ -99,7 +102,7 @@ Configuring and building binutils for th
The First GCC
-For our work, we need a cross-compiler targeting a PowerPC Linux
+For our work, we need a cross-compiler targeting an ARM Linux
system. However, that configuration includes the shared library
'libgcc_s.so', which is compiled against the EGLIBC headers (which we
haven't installed yet) and linked against 'libc.so' (which we haven't
@@ -125,7 +128,8 @@ So, we create a build directory, configu
> --prefix=$tools \
> --without-headers --with-newlib \
> --disable-shared --disable-threads --disable-libssp \
- > --disable-libgomp --disable-libmudflap \
+ > --disable-libgomp --disable-libmudflap --disable-libquadmath \
+ > --disable-decimal-float --disable-libffi \
> --enable-languages=c
$ PATH=$tools/bin:$PATH make
$ PATH=$tools/bin:$PATH make install
@@ -162,12 +166,13 @@ full cross-compiler will need:
> CXX=$tools/bin/$target-g++ \
> AR=$tools/bin/$target-ar \
> RANLIB=$tools/bin/$target-ranlib \
- > $src/libc/configure \
+ > $src/eglibc/libc/configure \
> --prefix=/usr \
> --with-headers=$sysroot/usr/include \
> --build=$build \
> --host=$target \
- > --disable-profile --without-gd --without-cvs --enable-add-ons
+ > --disable-profile --without-gd --without-cvs \
+ > --enable-add-ons=nptl,libidn,../ports
The option '--prefix=/usr' may look strange, but you should never
configure EGLIBC with a prefix other than '/usr': in various places,
@@ -181,6 +186,11 @@ installations.
The '--with-headers' option tells EGLIBC where the Linux headers have
been installed.
+The '--enable-add-ons=nptl,libidn,../ports' option tells EGLIBC to look
+for the listed glibc add-ons. Most notably the ports add-on (located
+just above the libc sources in the EGLIBC svn tree) is required to
+support ARM targets.
+
We can now use the 'install-headers' makefile target to install the
headers:
@@ -223,6 +233,7 @@ and avoiding libraries we won't use:
> --prefix=$tools \
> --with-sysroot=$sysroot \
> --disable-libssp --disable-libgomp --disable-libmudflap \
+ > --disable-libffi --disable-libquadmath \
> --enable-languages=c
$ PATH=$tools/bin:$PATH make
$ PATH=$tools/bin:$PATH make install
@@ -240,13 +251,14 @@ full EGLIBC build:
> CXX=$tools/bin/$target-g++ \
> AR=$tools/bin/$target-ar \
> RANLIB=$tools/bin/$target-ranlib \
- > $src/libc/configure \
+ > $src/eglibc/libc/configure \
> --prefix=/usr \
> --with-headers=$sysroot/usr/include \
> --with-kconfig=$obj/linux/scripts/kconfig \
> --build=$build \
> --host=$target \
- > --disable-profile --without-gd --without-cvs --enable-add-ons
+ > --disable-profile --without-gd --without-cvs \
+ > --enable-add-ons=nptl,libidn,../ports
Note the additional '--with-kconfig' option. This tells EGLIBC where to
find the host config tools used by the kernel 'make config' and 'make
@@ -337,15 +349,15 @@ our target, using our dynamic linker:
ELF Header:
...
Type: EXEC (Executable file)
- Machine: PowerPC
+ Machine: ARM
...
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4
- INTERP 0x000134 0x10000134 0x10000134 0x0000d 0x0000d R 0x1
- [Requesting program interpreter: /lib/ld.so.1]
- LOAD 0x000000 0x10000000 0x10000000 0x008f0 0x008f0 R E 0x10000
+ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1
+ [Requesting program interpreter: /lib/ld-linux.so.3]
+ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000
...
Looking at the dynamic section of the installed 'libgcc_s.so', we see
@@ -357,7 +369,6 @@ not our dummy 'libc.so':
Dynamic section at offset 0x1083c contains 24 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libc.so.6]
- 0x00000001 (NEEDED) Shared library: [ld.so.1]
0x0000000e (SONAME) Library soname: [libgcc_s.so.1]
...
_______________________________________________
Patches mailing list
Patches@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/patches