返回首页

嵌入式web server boa 在S3C2410上的移植

时间:2010-07-22 15:05来源:技术部 作者:whhq 点击:
作者:武汉华嵌 吴老师 嵌入式 web server boa 在 S3C2410 上的移植 开发平台: ubuntu 8.04 目标平台: S3c2410 开发工具: arm 交叉工具链版本 3.4.5 boa 版本: boa-0.94.13.tar.gz 一、下载源码,生成
  

作者:武汉华嵌  吴老师
 

嵌入式web server boa S3C2410上的移植

 

开发平台:ubuntu 8.04

目标平台:S3c2410

开发工具:arm 交叉工具链版本3.4.5  

boa版本:boa-0.94.13.tar.gz

 

一、下载源码,生成makefile

     1. 下载源码:http://www.boa.org/

     2. 拷贝到 /opt 目录下

     3.解压 tar zxvf boa-0.94.13.tar.tar

     4cd boa-0.94.13/src

     5. ./configure

 

二、编译前,修改文件

1.  修改Makefile文件,找到CC=gccCPP=gcc -E,分别将其改为交叉编译器安装的路径:

CC=  arm-softfloat-linux-gnu-gcc

CPP= arm-softfloat-linux-gnu-g++

保存退出。

 

2. 修改编译方式:

 LDFLAGS = -g –static

: 使用静态编译可以让目标文件自动的包含所需要的

库文件,而动态编译需要手工拷贝库文件。

3.修改/src/defines.h文件:

 

#define SERVER_ROOT "/etc/boa"

 

4 修改boa-0.94/src/ util.c文件

修改char *get_commonlog_time(void)函数。

time_offset = 0;

 

5. 修改src/config.c:加Current_uid=1

 

6. 修改compat.h: 把第120 行的

#define

TIMEZONE_OFFSET(foo)foo##->tm_gmtoff

修改为:

#define

TIMEZONE_OFFSET(foo)foo->tm_gmtoff

 

7.修改/src/boa.c,注释掉下面两行:

 /* if (setuid(0) != -1) {

            DIE("icky Linux kernel bug!");

        } */

 

/*if (passwdbuf == NULL) {

            DIE("getpwuid");

        }*/

 

8 config.c

 /*if (!server_name) {

        struct hostent *he;

        char temp_name[100];

 

        if (gethostname(temp_name, 100) == -1) {

            perror("gethostname:");

            exit(1);

        }

 

        he = gethostbyname(temp_name);

        if (he == NULL) {

            perror("gethostbyname:");

            exit(1);

        }

 

        server_name = strdup(he->h_name);

        if (server_name == NULL) {

            perror("strdup:");

            exit(1);

        }

    }*/

 

9. /src/log.c中的修改:注释掉:

/*     if (dup2(error_log, STDERR_FILENO) == -1) {

            DIE("unable to dup2 the error log");

        } */

                                                          

10. boa.conf中的修改:

1 ServerName的设置

 修改#ServerName www.your.org.here

ServerName www.your.org.here

    注意:该项默认为未打开,执行Boa会异常退出,提示“gethostbyname::No such file or directory,所以必须打开。其它默认设置即可。  

    注意:以下是为改为下面这样的:

2UserGroup的修改:

    User 0

    Group 0

3ErrorLog /var/log/boa/error_log

    AccessLog /var/log/boa/access_log

 4DocumentRoot /var/www

 5DirectoryIndex index.html

 6KeepAliveMax 1000

    KeepAliveTimeout 10

 7MimeTypes /etc/mime.types

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

   

三、编译并移植

  1.编译 boa

      # make

      # arm-softfloat-linux-gnu-strip boa

 

  2,将mime.types文件复制目标板根文件系统/etc目录下

  3。在开发板上

        cd /etc

        mkdir boa

    把开发机上的 (配置文件)boa.conf  (编译结果)boa  defines.h 3个文件拷贝到 开发板/etc/boa/

 

 4.  在开发板上

      cd /var

      mkdir  www  (这个文件夹内可以放网页)

      mkdir /var/log/boa

 

四、 编写CGI脚本测试

1、编写Helloworld.c程序

int main(void)

{

      printf("Content-type:text/html\n\n"); //这句一定要加上

      printf(" Hello,world.");

      exit(0);

}

 

arm-softfloat-linux-gnu-gcc -o helloworld helloworld.c

 

2、浏览

    helloworld拷贝至/var/www/cgi-bin/下,浏览器输入开发板IP地址即可看到web信息。

 

 

------分隔线----------------------------

  • 李老师
  • 李老师
  • 胡老师
  • 胡老师
合作伙伴
  • 武汉工程大学合作培训机构

  • 国家信息技术紧缺人才培养工程(NITE)

  • ARM公司全球授权培训中心

  • 国内首家Symbian授权培训

  • 微软全球嵌入式合作伙伴

  • Altera全球合作培训机构

在线客服
  • 客服热线:
    139-8620-3604
    159-2752-9536



  • 官方微信
  •  咨询微信二维码