参考http://www.cnitblog.com/suyiwei/articles/41387.html
(1)开发版: TQ2440 ,
(2)编译linux主机: 虚拟机上的RHEL 5.4
(3)交叉 工具链: 是前段时间自己编译出来的arm-sdutyl-linux-gnueabi-gcc
(4)环境变量:
[yanglu@localhost build_boa]$ cat ~/bashEnv
#!/bin/sh
export PRJROOT=/home/yanglu/arm
export TARGET=arm-sdutyl-linux-gnueabi
export PREFIX=${PRJROOT}/tools
export TARGET_PREFIX=${PREFIX}/${TARGET}
export PATH=$PREFIX/bin:$PATH
交叉编译boa服务器。
到boa web 官网http://www.boa.org/上下载boa-0.94.13.tar.gz
一、boa 服务器编译
1、修改boa.conf的路径
boa-0.94.13/src/defines.h
#ifndef SERVER_ROOT
#define SERVER_ROOT "/var/boa"
#endif
2、[yanglu@localhost build_boa]$../boa-0.94.13/src/configure --host={$TARGET}
3、[yanglu@localhost build_boa]$ vi Makefile
注:修改Makefile的CC和GCC
CC = gcc
CPP = gcc –E
成交叉编译gcc
CC = ${TARGET}-gcc
CPP =${TARGET}-gcc –E
4、[yanglu@localhost build_boa]$ make
二、boa 服务器配置:
1、需要的文件。
(1)、文件 mime.types 从编译主机/etc/mime.types 取得
(2)、文件boa.conf 从src/boa.conf 取得
(3)、编译出来的boa文件。
2、修改boa.conf 成自己想要的配置。
将boa.conf 拷贝到开发版的/var/boa目录, 其他按照boa.conf中的配置来放置文件。
我的配置目录是:
/var/boa/boa
/var/boa/boa.conf
/var/boa/mime.types
/var/boa/www
/var/boa/www/index.html
/var/boa/log
/var/boa/www/cgi-bin/
三、goa 运行
[root@EmbedSky boa]#./goa &
错误:
1、如果出现parse.h
可以修改成parse.h 的绝对路径。
#include "../boa-0.94.13/src/parse.h"
2、 util.c:100:1: error: pasting "t" and "->"
解决办法: 修改 src/compat.h
找到
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff
修改成
#define TIMEZONE_OFFSET(foo) foo->tm_gmtoff
3、: gethostbyname:: No such file or directory
解决办法: 修改boa.conf 去掉 ServerName www.your.org.here 前的注释符号(#)
4、: boa.c:228 - icky Linux kernel No such file or directory
解决办法: 修改src/boa.c
注释掉下面语句:
if (setuid(0) != -1) {
DIE(”icky Linux kernel bug!”);
}
即修改为:
#if 0
if (setuid(0) != -1) {
DIE(”icky Linux kernel bug!”);
}
#endif
5、"./boa: 1: syntax error: "(" unexpected"
解决:没有修改Makefile,是用gcc编译的,应该改成是${TARGET}-gcc 编译。
附:boa.conf 配置
[root@EmbedSky /]# cat /var/boa/boa.conf | grep -v "^#" | grep -v "^$"
Port 8080
User root
Group root
ErrorLog /var/boa/log/error_log
AccessLog /var/boa/log/access_log
ServerName sdutyl
DocumentRoot /var/boa/www
UserDir public_html
DirectoryIndex index.html
KeepAliveMax 1000
KeepAliveTimeout 10
MimeTypes /var/boa/mime.types
DefaultType text/plain
CGIPath /bin:/usr/bin:/usr/local/bin
Alias /doc /usr/doc
ScriptAlias /cgi-bin/ /var/boa/www/cgi-bin/