配置
boa-0.94.13 # ./configure
修改Makefile
CC = arm-linux-gcc
CPP = arm-linux-gcc -E
编译
boa-0.94.13 # make
出现如下错误出现错误:
yacc -d boa_grammar.y
make: yacc: Command not found
make: *** [y.tab.c] Error 127
解决办法:
# sudo apt-get install bison
出现错误:
lex boa_lexer.l
make: lex: Command not found
make: *** [lex.yy.c] Error 127
解决办法:
# sudo apt-get install flex
出现错误:
arm-none-eabi-gcc -g -O2 -pipe -Wall -I. -c -o alias.o alias.c
In file included from alias.c:26:0:
boa.h:41:19: fatal error: netdb.h: No such file or directory
compilation terminated.
<builtin>: recipe for target 'alias.o' failed
make: *** [alias.o] Error 1
解决办法:
//将交叉编译工具链换成
gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)
出现错误:
arm-linux-gcc -g -O2 -pipe -Wall -I. -c -o util.o util.c
util.c:100:1: error: pasting "t" and "->" does not give a valid preprocessing token
make: *** [util.o] Error 1
解决办法:
# vi compat.h //修改120行
#ifdef HAVE_TM_GMTOFF
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff
#else
制作cgi页面
交叉编译出一个cig脚本,供boa使用。boa默认支持cig格式的网页显示
cgic205 # ls
capture capture.c capture.o cgic.c cgic.h cgic.html cgic.o cgictest.c cgictest.cgi
cgictest.o libcgic.a license.txt Makefile readme.txt support.txt
移植
boa-0.94.13 # cp src/boa /rootfs/sbin
boa-0.94.13 # cp boa.conf /rootfs/etc/boa
boa-0.94.13 # cp cgictest.cgi /rootfs/var/www/cgi-bin/
boa-0.94.13 # cp favicon.ico /rootfs/var/www/
开发板测试
# /sbin/boa
出现如下错误出现错误:
gethostbyname:: No such file or directory
解决办法:
//取消#注释
# vi boa.conf
ServerName www.your.org.here
出现错误:
boa.c:211 - getpwuid: No such file or directory
解决办法:
//注释掉以下代码
# vi boa.c
#if 0
struct passwd *passwdbuf;
passwdbuf = getpwuid(server_uid);
if (passwdbuf == NULL) {
DIE("getpwuid");
}
if (initgroups(passwdbuf->pw_name, passwdbuf->pw_gid) == -1) {
DIE("initgroups");
}
#endif
出现错误:
boa.c:228 - icky Linux kernel bug!: Success
解决办法:
//注释掉以下代码
# vi boa.c
#if 0
if (setuid(0) != -1) {
DIE("icky Linux kernel bug!");
}
#endif
成功启动
[01/Jan/2000:10:09:27 +0000] boa: server version Boa/0.94.13
[01/Jan/2000:10:09:27 +0000] boa: server built Sep 22 2018 at 05:23:16.
[01/Jan/2000:10:09:27 +0000] boa: starting server pid=909, port 80
客户端测试
浏览器输入 http://192.168.1.99/cgi-bin/cgictest.cgi 测试