Port Boa to ARM-Linux
来源:互联网 发布:淘宝网购物皮衣 编辑:程序博客网 时间:2024/05/20 16:42
最近要构建一个小型的webserver,作为熟悉构建embedded webserver的流程,Bean 选择了Boa。
Development:
kernel:2.6.31-14-generic ubuntu9.10
cross-tools:arm-linux-gcc version 4.1.2
Target
kernel: 2.6.28.9 MOZART380 armv5tejl
<1>构建boa的准备
下载Boa
下载地址:http://www.boa.org/
解压Boa
tar xzf boa-0.94.13.tar.gz
Configure
cd boa-0.94.13/src
./configure
修改Makefile
CC =/path/to/arm-linux-gcc
CPP =/path/to/arm-linux-gcc -E
编译
yacc安装
sudo apt-get install bison
Lex安装
sudo apt-get install flex
make
Strip (option)
/path/to/arm-linux-strip boa
<2> 配置Boa
target中需要改动的directory
/etc/ :拷贝boa.conf mime.types至此目录
/bin/ :拷贝boa至此目录
cp boa.conf /path/to/target/etc/boa.conf
cp mime.types /path/to/target/etc/mime.types
cp src/boa /path/to/target/bin/
修改/etc/boa.conf
User root
Group 0
ErrorLog /path/to/boa/log/error_log
AccessLog /path/to/boa/log/access_log
ServerName ByYours
DocumentRoot /path/to/boa/www
DirectoryMaker /path/to/boa/boa_indexer
ScriptAlias /cgi-bin/ /path/to/boa/www/cgi-bin/
gedit /etc/boa.conf
创建相应的目录
boa
boa/log
boa/www
Boa/www/cgi-bin
mkdir -m 777 -p /path/to/target/boa
mkdir -m 777 -p /path/to/target/boa/log
mkdir -m 777 -p /path/to/target/boa/www
mkdir -m 777 -p /path/to/target/boa/www/cgi-bin
<3> 测试Boa
静态页面测试
编写测试程序
index.html
///////////////////////////////////////////////////////////////////////////
<html>
<head>
<title>Welcome to nginx!</title>
</head>
<body bgcolor="white" text="black">
<center><h1>Welcome to Boa!</h1></center>
</body>
</html>
///////////////////////////////////////////////////////////////////////////
拷贝
cp index.html /path/to/boa/www/
测试
http://YOURSIP/
CGI脚本测试
编写测试程序
number.c
///////////////////////////////////////////////////////////////////////////
#include <stdio.h>
int main(void)
{
int i = 10;
printf("Content-type: text/html\n\n");
printf("<html>\n");
printf("<head><title>CGI Output</title></head>\n");
printf("<body>\n");
while(i)
printf("<h1>%d\n</h1>\n",i--);
printf("<body>\n");
printf("</html>\n");
return 0;
}
///////////////////////////////////////////////////////////////////////////
交叉编译
arm-linux-gcc -o number.cgi number.c
拷贝至cgi-bin
cp number.cgi /path/to/boa/www/cgi-bin/
更改属性
chmod 755 number.cgi
测试
http://YOURSIP/cgi-bin/number.cgi
QA-list
1."arm-linux-gcc -g -O2 -pipe -Wall -I. -c -o util.o util.c
util.c:100:1: pasting "t" and "->" does not give a valid preprocessing token" for make
A: 修改 src/compat.h
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff
修改成-->
#define TIMEZONE_OFFSET(foo) (foo)->tm_gmtoff
1.”can't open boa.conf for reading“
A:将boa目录下的boa.conf拷贝至target下的/etc/boa/boa.conf
2.“unable to dup2 the error log bad file descriptor”
A:修改/etc/boa.conf 确保所有定义的有效,特别是ErrorLog和AccessLog
eg: ErrorLog /path/to/boa/log/error_log
AccessLog /path/to/boa/log/access_log
3.“[01/Jan/2031:00:12:25 +0000] boa.c:226 - icky Linux kernel bug!: No such file or directory”
A:修改 src/boa.c
注释掉以下3行
if (setuid(0) != -1) {
DIE("icky Linux kernel bug!");
}
4."gethostbyname:: Resource temporarily unavailable"
A:修改/etc/boa.conf 确保所有定义的有效,特别是ServerName
eg: ServerName ByYours
5."502 Bad Gateway The CGI was not CGI/1.1 compliant." for 测试cgi
A: 更改属性
chmod 755 *.cgi
6.“control reaches end of non-void function” for 测试cgi
A: 修改cgi源码,添加合理的return
7.使用post方法的cgi
A:修改/etc/boa.conf 确保所有定义的有效,特别是User
eg: User root
8.含有system()系统调用的cgi
A:待定
参考
http://hi.baidu.com/whs08/blog/item/3ea48f3e9af62a3a71cf6cd8.html
http://blog.sina.com.cn/s/blog_53013a8c0100do7t.html
Development:
kernel:2.6.31-14-generic ubuntu9.10
cross-tools:arm-linux-gcc version 4.1.2
Target
kernel: 2.6.28.9 MOZART380 armv5tejl
<1>构建boa的准备
下载Boa
下载地址:http://www.boa.org/
解压Boa
tar xzf boa-0.94.13.tar.gz
Configure
cd boa-0.94.13/src
./configure
修改Makefile
CC =/path/to/arm-linux-gcc
CPP =/path/to/arm-linux-gcc -E
编译
yacc安装
sudo apt-get install bison
Lex安装
sudo apt-get install flex
make
Strip (option)
/path/to/arm-linux-strip boa
<2> 配置Boa
target中需要改动的directory
/etc/ :拷贝boa.conf mime.types至此目录
/bin/ :拷贝boa至此目录
cp boa.conf /path/to/target/etc/boa.conf
cp mime.types /path/to/target/etc/mime.types
cp src/boa /path/to/target/bin/
修改/etc/boa.conf
User root
Group 0
ErrorLog /path/to/boa/log/error_log
AccessLog /path/to/boa/log/access_log
ServerName ByYours
DocumentRoot /path/to/boa/www
DirectoryMaker /path/to/boa/boa_indexer
ScriptAlias /cgi-bin/ /path/to/boa/www/cgi-bin/
gedit /etc/boa.conf
创建相应的目录
boa
boa/log
boa/www
Boa/www/cgi-bin
mkdir -m 777 -p /path/to/target/boa
mkdir -m 777 -p /path/to/target/boa/log
mkdir -m 777 -p /path/to/target/boa/www
mkdir -m 777 -p /path/to/target/boa/www/cgi-bin
<3> 测试Boa
静态页面测试
编写测试程序
index.html
///////////////////////////////////////////////////////////////////////////
<html>
<head>
<title>Welcome to nginx!</title>
</head>
<body bgcolor="white" text="black">
<center><h1>Welcome to Boa!</h1></center>
</body>
</html>
///////////////////////////////////////////////////////////////////////////
拷贝
cp index.html /path/to/boa/www/
测试
http://YOURSIP/
CGI脚本测试
编写测试程序
number.c
///////////////////////////////////////////////////////////////////////////
#include <stdio.h>
int main(void)
{
int i = 10;
printf("Content-type: text/html\n\n");
printf("<html>\n");
printf("<head><title>CGI Output</title></head>\n");
printf("<body>\n");
while(i)
printf("<h1>%d\n</h1>\n",i--);
printf("<body>\n");
printf("</html>\n");
return 0;
}
///////////////////////////////////////////////////////////////////////////
交叉编译
arm-linux-gcc -o number.cgi number.c
拷贝至cgi-bin
cp number.cgi /path/to/boa/www/cgi-bin/
更改属性
chmod 755 number.cgi
测试
http://YOURSIP/cgi-bin/number.cgi
QA-list
1."arm-linux-gcc -g -O2 -pipe -Wall -I. -c -o util.o util.c
util.c:100:1: pasting "t" and "->" does not give a valid preprocessing token" for make
A: 修改 src/compat.h
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff
修改成-->
#define TIMEZONE_OFFSET(foo) (foo)->tm_gmtoff
1.”can't open boa.conf for reading“
A:将boa目录下的boa.conf拷贝至target下的/etc/boa/boa.conf
2.“unable to dup2 the error log bad file descriptor”
A:修改/etc/boa.conf 确保所有定义的有效,特别是ErrorLog和AccessLog
eg: ErrorLog /path/to/boa/log/error_log
AccessLog /path/to/boa/log/access_log
3.“[01/Jan/2031:00:12:25 +0000] boa.c:226 - icky Linux kernel bug!: No such file or directory”
A:修改 src/boa.c
注释掉以下3行
if (setuid(0) != -1) {
DIE("icky Linux kernel bug!");
}
4."gethostbyname:: Resource temporarily unavailable"
A:修改/etc/boa.conf 确保所有定义的有效,特别是ServerName
eg: ServerName ByYours
5."502 Bad Gateway The CGI was not CGI/1.1 compliant." for 测试cgi
A: 更改属性
chmod 755 *.cgi
6.“control reaches end of non-void function” for 测试cgi
A: 修改cgi源码,添加合理的return
7.使用post方法的cgi
A:修改/etc/boa.conf 确保所有定义的有效,特别是User
eg: User root
8.含有system()系统调用的cgi
A:待定
参考
http://hi.baidu.com/whs08/blog/item/3ea48f3e9af62a3a71cf6cd8.html
http://blog.sina.com.cn/s/blog_53013a8c0100do7t.html
- Port Boa to ARM-Linux
- port lua to arm platform
- How to Port rt73 driver to ARM
- How to Port rt73 driver to ARM
- ARM-Linux环境下Boa的移植
- [摘抄/记录]GM8180 arm-linux SSH port
- 嵌入式linux web服务器boa的移植方法/arm开发板linux嵌入式web服务器boa
- Linux - How to trace port to pid
- ubuntu下BOA服务器的建立以及arm开发板linux嵌入式web服务器boa
- 移植Boa Web服务器到ARM-Linux系统
- 移植Boa Web服务器到ARM-Linux系统
- 移植Boa Web服务器到ARM-Linux系统
- 移植Boa Web服务器到ARM-Linux系统
- 移植Boa Web服务器到ARM-Linux系统
- Boa服务器在ARM+Linux上的移植
- 移植Boa Web服务器到ARM-Linux系统
- Boa服务器在ARM+Linux上的移植
- Boa服务器在ARM+Linux上的移植
- ubuntu10.10 wine+source insight
- strncasecmp
- Android/Linux 内存监视
- Android Overlay学习 一
- 关于:Android 如何发送/接收DTMF问题
- Port Boa to ARM-Linux
- Linux内核的文件预读详细解析
- js优化按钮
- 生成随机码
- 磁盘结构及在Linux中的命名
- svn update 目录包含中文时出错(svn:Can’t convert string from ‘UTF-8′ to native encoding)
- Porting cgic to arm linux
- AAA服务器
- android Toast 自定义样式