boa-0.94.13 移植到 ARM

<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:新宋体; panose-1:2 1 6 9 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"DejaVu Sans Mono"; mso-font-alt:"MS Gothic"; mso-font-charset:128; mso-generic-font-family:modern; mso-font-pitch:auto; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@新宋体"; panose-1:2 1 6 9 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:modern; mso-font-pitch:fixed; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"DejaVu Sans"; mso-font-alt:"MS Gothic"; mso-font-charset:128; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:"/@DejaVu Sans"; mso-font-charset:128; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:"/@DejaVu Sans Mono"; mso-font-charset:128; mso-generic-font-family:modern; mso-font-pitch:auto; mso-font-signature:0 0 0 0 0 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:none; mso-hyphenate:none; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"DejaVu Sans"; mso-font-kerning:.5pt; mso-fareast-language:#00FF;} p.MsoHeader, li.MsoHeader, div.MsoHeader {margin:0cm; margin-bottom:.0001pt; mso-pagination:no-line-numbers; mso-hyphenate:none; tab-stops:center 249.3pt right 498.6pt; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"DejaVu Sans"; mso-font-kerning:.5pt; mso-fareast-language:#00FF;} p.MsoBodyText, li.MsoBodyText, div.MsoBodyText {margin-top:0cm; margin-right:0cm; margin-bottom:6.0pt; margin-left:0cm; mso-pagination:none; mso-hyphenate:none; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"DejaVu Sans"; mso-font-kerning:.5pt; mso-fareast-language:#00FF;} a:link, span.MsoHyperlink {mso-style-parent:""; color:navy; mso-ansi-language:#00FF; mso-fareast-language:#00FF; mso-bidi-language:#00FF; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} span.SourceText {mso-style-name:"Source Text"; mso-style-parent:""; font-family:"DejaVu Sans Mono"; mso-ascii-font-family:"DejaVu Sans Mono"; mso-fareast-font-family:"DejaVu Sans Mono"; mso-hansi-font-family:"DejaVu Sans Mono"; mso-bidi-font-family:"DejaVu Sans Mono";} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:2.0cm 2.0cm 2.0cm 2.0cm; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->

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 ( "<html>/n" );
  
printf ( "<head><title>CGI test </title></head>/n" );
  
printf ( "<body>/n" );
  
printf ( "<h1>Hello,world.</h1>/n" );
  
printf ( "<body>/n" );
  
printf ( "</html>/n" );
  
exit ( 0 );
}

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

 

<2> 打开网页

http:// 板子 IP/cgi_bin/hello

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值