Chinaunix首页 | 论坛 | 博客
  • 博客访问: 32460
  • 博文数量: 2
  • 博客积分: 312
  • 博客等级: 一等列兵
  • 技术积分: 75
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-21 09:14
文章分类
文章存档

2008年(2)

分类: LINUX

2008-04-02 14:05:59

理清思路其实交互编译就是把x.86下程序用arm版本的编译器重新编译。存在兼容问题所以之需要在原来x.86下可以通过的
代码重新使用arm gcc make 即可下面是大概的步骤


How to Apache Cross Compile

OS : CentOS
Kernel : 2.6
Machine : x.86

Target arm
OS : linux
Kernel : 2.4.18
Machine : arm (TS-7250)


#1. Download apache file at
version apache_1.3


#2. unzip software
[root@wc02 utils]# tar xvfz apache_1.3.33.tar.gz


#3. change to two version GCC files
[root@wc02 utils]# cp apache_1.3.33 host_apache_1.3.33 -a


#4.start 2 tty prepare compile

[root@wc02 utils]# cd host_apache_1.3.33/

[root@wc02 host_apache_1.3.33]# mkdir /usr/local/apache/

[root@wc02 host_apache_1.3.33]# ./configure --prefix=/usr/local/apache/

Configuring for Apache, Version 1.3.33
+ using installation path layout: Apache (config.layout)
Creating Makefile
Creating Configuration.apaci in src
Creating Makefile in src
+ configured for Linux platform
+ setting C compiler to gcc
+ setting C pre-processor to gcc -E
+ using "tr [a-z] [A-Z]" to uppercase
+ checking for system header files
+ adding selected modules
+ using system Expat
+ checking sizeof various data types
+ doing sanity check on compiler and options
Creating Makefile in src/support
Creating Makefile in src/regex
Creating Makefile in src/os/unix
Creating Makefile in src/ap
Creating Makefile in src/main
Creating Makefile in src/modules/standard
[root@wc02 host_apache_1.3.33]#
[root@wc02 host_apache_1.3.33]# make

这里是我们编译x.86版本的编译。肯定可以通过。注意我们不是要安装所以不需要
make install。把代码放到这里准备


#5. arm GCC configure

[root@wc02 src]# export CC=arm-linux-gcc
[root@wc02 src]# export CPP=arm-linux-gcc
[root@wc02 src]# export LD=arm-linux-ld
[root@wc02 src]# export STRIP=arm-linux-strip
[root@wc02 src]# export OBJCOPY=arm-linux-objcopy

[root@wc02 apache_1.3.33]# vi configure
##
## determine platform id
##
## PLATFORM="`$aux/GuessOS`" <----------- OS版本这里没有我们支持的只能写死否则出错.
PLATFORM=arm-whatever-riscix


#6. 开始编译
[root@wc02 apache_1.3.33]# ./configure --prefix=/usr/local/apache
Configuring for Apache, Version 1.3.33
+ using installation path layout: Apache (config.layout)
Creating Makefile
Creating Configuration.apaci in src
./helpers/TestCompile: /home/hi78s/utils/apache_1.3.33/src/helpers/testfunc:
cannot execute binary file
./helpers/TestCompile: /home/hi78s/utils/apache_1.3.33/src/helpers/testfunc:
cannot execute binary file
./helpers/TestCompile: /home/hi78s/utils/apache_1.3.33/src/helpers/testfunc:
cannot execute binary file
./helpers/TestCompile: /home/hi78s/utils/apache_1.3.33/src/helpers/testfunc:
cannot execute binary file
./helpers/TestCompile: /home/hi78s/utils/apache_1.3.33/src/helpers/testfunc:
cannot execute binary file
Creating Makefile in src
+ configured for Linux platform
+ setting C pre-processor to NOT-AVAILABLE
+ using "tr [a-z] [A-Z]" to uppercase
+ checking for system header files
+ adding selected modules
+ using builtin Expat
+ checking sizeof various data types
+ doing sanity check on compiler and options
Creating Makefile in src/support
Creating Makefile in src/regex
Creating Makefile in src/os/unix
Creating Makefile in src/ap
Creating Makefile in src/main
Creating Makefile in src/lib/expat-lite
Creating Makefile in src/modules/standard
[root@wc02 apache_1.3.33]#


arm-linux-gcc 在这里出错。不要紧我们现编的步骤就是准备解决这些x.86不识别我们arm 软件的编译错误



#7. (Root_dir)/src/main

[root@wc02 main]# make ../../../host_apache_1.3.33/src/main/gen_test_char

[root@wc02 main]# make ../../../host_apache_1.3.33/src/main/gen_test_char




#8. Change compiled file at host pc

[root@wc02 main]# cp ../../../host_apache_1.3.33/src/main/gen_test_char ./
[root@wc02 main]# cp ../../../host_apache_1.3.33/src/main/gen_uri_delims ./


#9. make install
好了程序正常建立我们可以开始安装

[root@wc02 apache_1.3.33]# make install

Install message ................................

+--------------------------------------------------------+
| You now have successfully built and installed the |
| Apache 1.3 HTTP server. To verify that Apache actually |
| works correctly you now should first check the |
| (initially created or preserved) configuration files |
| |
| /usr/local/apache/conf/httpd.conf
| |
| and then you should be able to immediately fire up |
| Apache the first time by running: |
| |
| /usr/local/apache/bin/apachectl start
| |
| Thanks for using Apache. The Apache Group |
|  이 링크를 새창으로 엽니다. |
+--------------------------------------------------------+


#10. Install check

/usr/local/apache/
.
|-- bin
|-- cgi-bin
|-- conf
|-- htdocs
| `-- manual
| |-- howto
| |-- images
| |-- misc
| |-- mod
| |-- programs
| `-- vhosts
|-- icons
| `-- small
|-- include
| `-- xml
|-- libexec
|-- logs
|-- man
| |-- man1
| `-- man8
`-- proxy

[root@wc02 bin]# file httpd
httpd: ELF 32-bit LSB executable, no machine, version 1, dynamically linked
(uses shared libs), stripped

[root@wc02 src]# file httpd
httpd: ELF 32-bit LSB executable, Advanced RISC Machines ARM, version 1,
dynamically linked (uses shared libs), not stripped

[root@wc02 src]# cp httpd /usr/local/apache/bin/
cp: overwrite `/usr/local/apache/bin/httpd'? y


#11. Copy to Ramdisk, Make Ramdisk Image
/* ./htdocs
[root@wc02 apache]# du -h
889k ./bin
21k ./man/man1
41k ./man/man8
62k ./man
153k ./conf
512 ./logs
262k ./icons/small
899k ./icons
512 ./proxy
512 ./libexec
8.5k ./htdocs
73k ./include/xml
370k ./include
8.5k ./cgi-bin
2.4M .

阅读(2298) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:测试基础理论

给主人留下些什么吧!~~