当前位置: 首页 > 工具软件 > Tiny httpd > 使用案例 >

Tiny6410——BOA移植

赵志
2023-12-01

 boa-0.94.13移植到Tiny6410开发板

(先在X86平台上编译成功后,再从原有的基础上进行ARM移植)

1.进入src目录下修改Makefile

CC = arm-linux-gcc

CPP = arm-linux-gcc -E

2.执行make

3.查看boa格式

root@wxq:src# file boa
boa: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux2.6.27, not stripped

4.下载到Tiny6410开发板,并修改权限,chmod 775 boa

5. mkdir /etc/boa

6. vim /etc/boa/boa.conf

Port 80
User root
Group root
ErrorLog /dev/console
AccessLog /dev/null
ServerName Boa-arm
DocumentRoot /www
DirectoryIndex index.html
KeepAliveMax 1000
KeepAliveTimeout 10
MimeTypes /etc/mime.types
DefaultType text/plain
CGIPath /www
AddType application/x-httpd-cgi cgi

7.mkdir /www

8.拷贝源码/etc/mime.types文件到开发板的/etc下

9.运行boa 

./boa会报错(boa.c的226行有问题,回到源码注析掉有问题的代码)

/*

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

DIE("icky Linux kernel bug!");

}

*/


10.再重新编译一次,再重新把boa下载到开发板,修改权限

11.在/www目录中建立index.html

12.在/www下建立cgi-bin目录,里面存放cgi程序

mkdir /www/cgi-bin

13.编写CGI程序,vim hello.c 编译时gcc -o hello.cgi hello.c,生产hello.cgi文件放到/www/cgi-bin目录下

 #include <stdio.h>
 #include <stdlib.h>
  
 int main(void)
 {
          printf("Conten-type: text/html\n\n");
          printf("<html>\n");
          printf("<head><title>CGI Output</title></head>\n");
          printf("<body>\n");
          printf("<h1>Hello, World.</h1>\n");
          printf("</body>\n");
          printf("</html>\n");
  
          return(0);
  }

14.访问http://ip/cgi-bin/hello.cgi


 类似资料: