This brief tutorial will describe the steps to build a cross compiler for ARM1136JF-S processor with FPU.
The build environment is an Ubuntu 8.04 but it should work on other distributions as well.
Prerequisites:
The following must be installed.
- build-essentials
- bison
- yacc
- flex
- gawk
- gcc-4.2
- autoconf
- automake
- m4
- makeinfo (or texi2html on Ubuntu)
Other tools might be required. If the build fails due to a missing package(s), please let me know so I can update this list.
Preparations:
Please make sure that you have downloaded all the source codes from the samsung opensource website.
You will need to have the following files in possibly the same folder:
linux.chelsea.tgz
binutils-2.17.50.tgz
gcc-4.2.0-4.0.9.tgz
glibc-2.5.90-9.0.9.tgz
The 32B650.zip package is missing two crucial folders (drivers for RT73 and RT2870) for full kernel build. Luckily these folders are in the LE40B650T2P.zip package. You can simple copy them into the drivers folder.
Untgz all files: (I will assume for the rest of the document that the folder you chose is 'xgcc' in your home folder)
tar xzvf linux.chelsea.tgz
tar xzvf binutils-2.17.50.tgz
tar xzvf glibc-2.5.90-9.0.9.tgz
As GCC is built in two stages I would recommend unpacking gcc twice and renaming them as -stage1 and -stage2 to avoid confusion:
tar xzvf gcc-4.2.0-4.0.9.tgz
mv gcc-4.2.0-4.0.9{,-stage1}
tar xzvf gcc-4.2.0-4.0.9.tgz
mv gcc-4.2.0-4.0.9{,-stage2}
The cross compiler will be installed in /opt/arm-linux-gnueabi folder. Make sure that the user account you are logged on as has write permission on /opt folder.
The cross compiler is built in 4 stages:
Stage 1 - Binutils - The linker and supporting utilities.
On most recent linux distributions the version is makeinfo utility is newer that the samsung provided binutils' configure can handle. Please apply patch configure.in-fix-for-makeinfo.patch for a fix and re-run autoconf to recompile 'configure'.
cd binutils-2.17.50
patch -p0 < configure.in-fix-for-makeinfo.patch
autoconf
Now Binutils is ready to be compiled:
make distclean
export BTARGET=arm-linux-gnueabi
export DDIR=/opt/arm-linux-gnueabi
CC=gcc-4.2 ./configure --target=$BTARGET --prefix=$DDIR --with-lib-path=$DDIR/lib:$DDIR/$BTARGET/lib
make -j2
make install
mkdir $DDIR/$BTARGET/include
cp include/libiberty.h $DDIR/$BTARGET/include
Stage 2 - Compiling GCC without GLIBC
As the cross glibc library has not been built yet, you will need to compile GCC without it.
You will need to edit the gcc-4.2.0-4.0.9-stage1/gcc/config/arm/t-linux-eabi file and change the first line:
TARGET_LIBGCC2_CFLAGS = -fPIC
to look like this:
TARGET_LIBGCC2_CFLAGS = -fPIC -Dinhibit_libc -D__gthr_posix_h -mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp
Then you can compile GCC:
cd gcc-4.2.0-4.0.9-stage1
make distclean
CC=gcc-4.2 ./configure --target=$BTARGET --prefix=$DDIR --enable-languages=c --disable-shared --disable-threads --disable-libmudflap --disable-libssp --disable-nls --disable-libgomp --with-cpu=arm1136jf-s --with-fpu=vfp
make -j2 all-gcc
make install-gcc
Stage 3 - Cross compiling GLIBC with the just-compiled GCC
GLIBC needs to be compiled from a directory other than where the source code is. Also some hacking is required to make configure believe that we do have forced_unwind support in our GCC. Please make sure that SAMKERNHEADERS variable gets set to the correct kernel source's include folder (e.g $HOME/xgcc/linux/linux-r011/include)
There is a folder inside glibc-2.5.90-9.0.9 called glibc-build-localedef which breaks configure. Delete that folder or move it outside the glibc directory.
Glibc must be patched first as it tries to link a file that gcc does not provide yet. For the patch credits go to Joe Ciccone at LinuxFromScratch.org
glibc-2.5-libgcc_eh-2.patch.gz
The patch might reject the 'configure' file as it differs too much from the one patch expects. It's safe to continue as that file will be re-generated by autoconf.
cd glibc-2.5.90-9.0.9
patch -p1 < glibc-2.5-libgcc_eh-2.patch
autoconf
cd ..
mkdir glibc-eabi
cd glibc-eabi
echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
export GSRC=$DDIR/bin/$BTARGET
export SAMKERNHEADERS=$HOME/xgcc/linux/linux-r011/include
BUILD_CC=gcc-4.2 CC=$GSRC-gcc ../glibc-2.5.90-9.0.9/configure --target=$BTARGET --host=$BTARGET --prefix=$DDIR/$BTARGET --with-__thread --cache-file=config.cache --with-headers=$SAMKERNHEADERS --disable-profile --enable-add-ons
make -j2
make install
Now you will need to manually copy the kernel include files into /opt/arm-linux-gnueabi/arm-linux-gnueabi/include
Make sure that the arch-ssdtv symlink points to the real directory! arch-ssdtv in include/asm is a relative symlink which will break if you copy it somewhere else - so make it an absolute one!
Also make sure that in include/asm there is an arch symlink that points to arch-ssdtv!
Stage 4 - Compiling the cross compiler
This last stage will produce the final cross compiler for arm-linux-gnueabi targets
cd gcc-4.2.0-4.0.9-stage2
make distclean
CC=gcc-4.2 ./configure --target=$BTARGET --prefix=$DDIR --enable-languages=c,c++ --enable-threads --enable-shared --disable-nls --enable-__cxa_atexit --enable-long-long --enable-c99 --with-cpu=arm1136jf-s --with-fpu=vfp
make -j2
make install
Now you have a working cross compiler...
To invoke: /opt/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc
I hope this will help you get started! Good luck!
Robbiesz
没有合适的资源?快使用搜索试试~ 我知道了~
gcc_4.2.0_cross_arm.zip_ cross-4.2.0-eabi_arm-linux-gnueabi4.2_c
共1个文件
txt:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 168 浏览量
2022-09-21
06:52:43
上传
评论
收藏 2KB ZIP 举报
温馨提示
This document describes the steps required for creating a cross compiling tool-chain for ARM (EABI) Linux OS. It was made with Samsung LCD TV in mind but has been applied since on other HW (NAS box without FPU) with success.
资源详情
资源评论
资源推荐
收起资源包目录
gcc_4.2.0_cross_arm.zip (1个子文件)
gcc_4.2.0_cross_arm.txt 6KB
共 1 条
- 1
四散
- 粉丝: 52
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0