boa-0.94.13 移植到 ARM

boa-0.94.13 porting to ARM

                                 Table of Contents

 

       1. 程序移植

      2. 配置

      3. 测试

 

1. 程序移植

 

  <1> 解压源码,配置

furtherchan@further:~/work/boa_porting/boa-0.94.13$ src/configure

furtherchan@further:~/work/boa_porting/boa-0.94.13$ vim Makefile

CC = arm-linux-gcc

CPP = arm-linux-gcc -E

 

<2> 编译

furtherchan@further:~/work/boa_porting/boa-0.94.13$ make

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o y.tab.o y.tab.c

src/boa_grammar.y:30:19: error: parse.h: No such file or directory

  # 出错,修改头文件包含路径。

y.tab.c: In function 'yyparse':

furtherchan@further:~/work/boa_porting/boa-0.94.13$ vim src/boa_grammar.y

 

flex  src/boa_lexer.l

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o lex.yy.o lex.yy.c

src/boa_lexer.l:28:19: error: parse.h: No such file or directory

  # 出错,修改头文件包含路径。

furtherchan@further:~/work/boa_porting/boa-0.94.13$ vim src/boa_lexer.l

 

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o util.o src/util.c

src/util.c:100:1: error: pasting "t" and "->" does not give a valid preprocessing token

  # 去掉其中的 ”##”

make: *** [util.o] Error 1

furtherchan@further:~/work/boa_porting/boa-0.94.13$ vim src/compat.h

furtherchan@further:~/work/boa_porting/boa-0.94.13$ make

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o util.o src/util.c

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o sublog.o src/sublog.c

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o timestamp.o src/timestamp.c

arm-linux-gcc  -o boa y.tab.o lex.yy.o alias.o boa.o buffer.o cgi.o cgi_header.o config.o escape.o get.o hash.o ip.o log.o mmap_cache.o pipe.o queue.o read.o request.o response.o select.o signals.o util.o sublog.o timestamp.o -g

arm-linux-gcc  -g -O2 -pipe -Wall -I.   -c -o index_dir.o src/index_dir.c

arm-linux-gcc  -o boa_indexer index_dir.o escape.o -g

  # 编译成功

 

furtherchan@further:~/work/boa_porting/boa-0.94.13$ file boa

boa: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped

furtherchan@further:~/work/boa_porting/boa-0.94.13$ arm-linux-strip boa

furtherchan@further:~/work/boa_porting/boa-0.94.13$ file boa

boa: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, stripped

 

2. 配置

 

<1> 配置 boa.conf ,如下

Port 80

User 0

Group 0

ErrorLog /var/boa_error_log

DocumentRoot / var/ www

UserDir public_html

DirectoryIndex index.html

DirectoryMaker /usr/lib/boa/boa_indexer

KeepAliveMax 1000

KeepAliveTimeout 10

MimeTypes /etc/mime.types

DefaultType text/plain

CGIPath /bin:/usr/bin:/usr/local/bin

Alias /doc /usr/doc

ScriptAlias /cgi-bin/ / var/ www/cgi-bin/

ServerName www.your.org.here

 

<2> 配置开发板环境

创建目录

furtherchan@further:~/rootfs$ mkdir etc/boa

furtherchan@further:~/rootfs$ mkdir /var/ www

furtherchan@further:~/rootfs$ mkdir /var/ www/cgi-bin

拷贝文件

furtherchan@further:~/rootfs$ cp /home/furtherchan/work/boa_porting/boa-0.94.13/boa.conf ./etc

furtherchan@further:~/rootfs$ cp -v /home/furtherchan/work/boa_porting/boa-0.94.13/boa ./bin

furtherchan@further:~/rootfs$ cp /etc/mime.types ./etc

 

3. 测试

<1> 程序

 

# include < stdio . h >
# include < stdlib . h >
int main ( void )
{
  
printf ( "Content-type: text/html/n/n" );
  
printf ( "/n" );
  
printf ( "CGI </span> </span> <span class="SourceText"><span style="font-size:11pt;font-family:'新宋体';color:#FF00FF;">test</span> </span> <span class="SourceText"><span style="font-size:11pt;font-family:'新宋体';color:#FF00FF;">/n" );
  
printf ( "/n" );
  
printf ( "

Hello,world.

/n" );
  
printf ( "/n" );
  
printf ( "/n" );
  
exit ( 0 );
}

furtherchan@further:~/rootfs/www/cgi-bin$ arm-linux-gcc -o hello hello.c

 

<2> 打开网页

http:// 板子 IP/cgi_bin/hello

 

你可能感兴趣的:(〖Embedded〗)