亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 3166 | 回復(fù): 1
打印 上一主題 下一主題

自己實(shí)驗(yàn)建立交叉編譯工具鏈(ARM EABI based) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2010-01-27 16:17 |只看該作者 |倒序?yàn)g覽
一、host準(zhǔn)備工作
$ sudo apt-get install build-essential
$ sudo apt-get install automake
$ sudo apt-get install bison flex
$ sudo apt-get install texinfo
$ sudo apt-get install gwak
二、下載源碼包
在gcc+glibc+bintuils+kernel的組合中,binuitls和kernel是相對(duì)獨(dú)立的,或者說(shuō)允許較大版本變化的,而gcc是最繁瑣的,不同版本需要經(jīng)過(guò)一定的微調(diào)(hack)才能通過(guò)整個(gè)編譯。
here is the tar package of the source code:
binutils-2.19.1.tar.bz2  
gcc-4.3.3.tar.bz2
glibc-2.11.tar.bz2   
glibc-ports-2.11.tar.bz2     
linux-2.6.21.tar.bz2
mpfr-2.4.1.tar.gz
gmp-4.2.4.tar.bz2   
There is the patch:
-rw-r--r-- 1 rambo rambo 570641 2010-01-25 10:15 binutils-2.19.1-branch_update-5.patch
-rw-r--r-- 1 rambo rambo   3649 2010-01-25 10:16 binutils-2.19.1-posix-1.patch
-rw-r--r-- 1 rambo rambo 367968 2010-01-18 14:10 gcc-4.3.3-branch_update-5.patch
-rw-r--r-- 1 rambo rambo  14268 2010-01-18 14:10 gcc-4.3.3-posix-1.patch
-rw-r--r-- 1 rambo rambo   1446 2010-01-25 10:08 gcc_eh.patch.cross
-rw-r--r-- 1 rambo rambo  11058 2010-01-26 17:49 gmp-4.2.4-branch_update-1.patch
-rw-r--r-- 1 rambo rambo   6770 2010-01-26 17:57 mpfr-2.4.1-branch_update-2.patch
三 源代碼準(zhǔn)備:
Create the proper directory.
untar all tar packages, apply these patches.
四 運(yùn)行腳本
Shell file:
#!/bin/sh
export proot=/home/rambo/embedded
export prefix=/home/rambo/embedded/cross-tools
export target=arm-none-linux-gnueabi
export PATH=$prefix/tools/bin:$PATH
export host=i686-cross-linux-gnu
#上面i486和i686對(duì)編譯沒(méi)什么影響
export linux_tar=linux-2.6.21
export binutils_tar=binutils-2.19.1
export gcc_tar=gcc-4.3.3
export glibc_tar=glibc-2.11
#assume something:all source&patch have been ready.
#build bintuils
cd $proot/tar/build
mkdir binutils
cd binutils
AR=ar AS=as ../../src/$binutils_tar/configure --build=$host --host=$host --target=$target --prefix=$prefix/tools --with-sysroot=$prefix  --disable-nls --enable-shared --disable-multilib  --disable-werror
make all
make install
#install the linux kernel headers
cd $proot/tar/src
cd $linux_tar
mkdir -p $prefix/usr/include
make mrproper
make ARCH=arm zylonitep_alp_eabi_defconfig
make ARCH=arm headers_check
make ARCH=arm INSTALL_HDR_PATH=dest headers_install
cp -rv dest/include/* ${prefix}/usr/include
find ${prefix}/usr/include -name .install -or -name ..install.cmd | xargs rm -fv
#Build gcc the first time
cd $proot/tar/build
mkdir gcc
cd gcc
AR=ar LDFLAGS="-Wl,-rpath,${prefix}/lib" \
../../src/$gcc_tar/configure \
--build=$host \
--host=$host \
--target=$target \
--prefix=$prefix/tools \
--enable-languages=c \
--disable-nls \
--disable-shared \
--disable-threads \
--disable-libmudflap \
--disable-libssp \
--disable-libgomp \
--disable-decimal-float \
--without-headers --with-newlib \
--with-sysroot=$prefix
make
make install
#Build glibc
cd $proot/tar/build
rm -Rf glibc
mkdir glibc
cd glibc
echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
echo "libc_cv_arm_tls=yes" >> config.cache
BUILD_CC="gcc" CC=${target}-gcc AR=${target}-ar RANLIB=${target}-ranlib \
../../src/${glibc_tar}/configure \
--build=${host} \
--host=${target} \
--target=${target} \
--prefix=/usr \
--with-tls \
--disable-profile --enable-add-ons=ports,nptl \
--enable-kernel=2.6.0 --with-__thread \
--with-binutils=${prefix}/bin \
--with-headers=$prefix/usr/include \
--cache-file=config.cache
make all
make install install_root=$prefix
#Build gcc the second time
cd $proot/tar/build
rm -Rf gcc
mkdir gcc
cd gcc
../../src/$gcc_tar/configure \
--build=$host \
--host=$host \
--target=$target \
--prefix=$prefix/tools \
--enable-languages=c,c++ --enable-c99 \
--enable-threads=posix \
--enable-long-long \
--enable-shared \
--enable-__cxa_atexit \
--disable-multilib \
--disable-nls \
--with-sysroot=$prefix
make
make install
五 驗(yàn)證工具鏈
After cross-compile, the directory is here:
embedded/
|-- cross-tools
|   |-- etc
|   |-- lib
|   |-- sbin
|   |-- tools
|   |   |-- arm-none-linux-gnueabi
|   |   |-- bin
|   |   |-- i686-cross-linux-gnu
|   |   |-- include
|   |   |-- info
|   |   |-- lib
|   |   |-- libexec
|   |   |-- man
|   |   `-- share
|   `-- usr
|       |-- bin
|       |-- include
|       |-- lib
|       |-- libexec
|       |-- sbin
|       `-- share
|-- tar
|   |-- build
|   |   |-- binutils
|   |   |-- gcc
|   |   `-- glibc
|   |-- patch
|   `-- src
|       |-- binutils-2.19.1
|       |-- gcc-4.3.3
|       |-- glibc-2.11
|       `-- linux-2.6.21
`-- test
Using the cross gcc to compile a test app.
arm-none-linux-gnueabi-gcc -static main.c
下載到板子上驗(yàn)證無(wú)誤。
后記
從開(kāi)始搞這個(gè)交叉工具鏈到目前完成,整整用了15個(gè)工作日。這里面有個(gè)主要的問(wèn)題是EABI,我開(kāi)始的時(shí)候并不知道怎么指定gcc的EABI,還以為4.1以上的gcc自動(dòng)都是EABI,結(jié)果就是生成的內(nèi)核能跑,而init進(jìn)程(根文件系統(tǒng)的第一個(gè)進(jìn)程)卻運(yùn)行不了。而最讓我啼笑皆非的是 readelf,這絕對(duì)對(duì)我是誤導(dǎo)的,例如:
一個(gè)ABI的文件
#readelf -h aa
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            ARM
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x80f0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          2361284 (bytes into file)
  Flags:                             0x2, has entry point, GNU EABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         4
  Size of section headers:           40 (bytes)
  Number of section headers:         35
  Section header string table index: 32
看見(jiàn)Flags那行了嗎?清清楚楚寫(xiě)的是GNU EABI,其實(shí)它是ABI(想起來(lái)臺(tái)詞:它看起來(lái)是一個(gè)電吹風(fēng),其實(shí)還是刮胡刀)
真正的EABI是這樣的
#readelf -h a.out
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           ARM
  Version:                           0x1
  Entry point address:               0x8130
  Start of program headers:          52 (bytes into file)
  Start of section headers:          2460164 (bytes into file)
  Flags:                             0x4000002, has entry point, Version4 EABI
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         6
  Size of section headers:           40 (bytes)
  Number of section headers:         36
  Section header string table index: 33

       
        文件:tool_build.sh.zip
        大小:1KB
        下載:
下載
       
腳本文件
               
               
               

本文來(lái)自ChinaUnix博客,如果查看原文請(qǐng)點(diǎn):http://blog.chinaunix.net/u2/60303/showart_2162288.html

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2013-08-22 00:27 |只看該作者
本帖最后由 paomu52 于 2013-09-03 00:22 編輯

兄弟 我現(xiàn)在也在制作交叉編譯器(gcc 3.4.3 binutils-2.16.1 glibc-2.3.3)按照網(wǎng)上的做法編譯成功了 也能用  但死活不能指定為
Flags:                             0x4000002, has entry point, Version4 EABI。
看了一下你的過(guò)程 不知道你制作glibc頭文件的時(shí)候這一步make ARCH=arm zylonitep_alp_eabi_defconfig,是怎么來(lái)的?我的那個(gè)configs 目錄下沒(méi)有這個(gè)文件所以報(bào)錯(cuò)了,請(qǐng)明示謝謝!
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP