接下来,将跟各位小伙伴详细先容一下基于ELF 1开拓板移植Boa的方法。
1、Boa官网下载源码
官网网址:Boa download | SourceForge.net

下载好的Boa源码为:boa-0.94.13.tar.gz
2、将源码拷贝到虚拟机并解压
elf@ubuntu:~/work/a/boa$ tar xvf boa-0.94.13.tar.gz
3、进行交叉编译
elf@ubuntu:~/work/a/boa$ cd boa-0.94.13/src/elf@ubuntu:~/work/a/boa/boa-0.94.13/src$ . /opt/fsl-imx-x11/4.1.15-2.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabielf@ubuntu:~/work/a/boa/boa-0.94.13/src$ ./configure --host=arm elf@ubuntu:~/work/a/boa/boa-0.94.13/src$ make
这时会涌现报错,如下图显示:
修正src/compat.h文件中的如下位置:
elf@ubuntu:~/work/a/boa/boa-0.94.13/src$ vi compat.h
将 #define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff
修正为 #define TIMEZONE_OFFSET(foo) (foo)->tm_gmtoff
修正完成,保存退出,连续make,之后就不会报错了。
至此交叉编译Boa已经完成,接下来在开拓板上进行测试。
1、开拓板中建立Boa和cgi-bin目录
root@ELF1:~# cd /etc/root@ELF1:/etc# mkdir boaroot@ELF1:/etc# mkdir -p /www/cgi-bin/root@ELF1:/etc# mkdir group
2、将可实行运用和一些配置文件通过Scp命令拷贝到开拓板中
elf@ubuntu:~/work/a/boa/boa-0.94.13/src$ scp boa root@192.168.2.98:/etc/boa/elf@ubuntu:~/work/a/boa/boa-0.94.13/src$ scp ../boa.conf root@192.168.2.98:/etc/boa/elf@ubuntu:~/work/a/boa/boa-0.94.13/src$ scp /etc/mime.types root@192.168.2.98:/etc/
3、修正boa.conf文件
root@ELF1:~# vi /etc/boa/boa.conf
须要做如下修正:
1、将Group nogroup改为Group 0
2、指定 log 文件的路径,把log保存到/etc/boa目录下
将ErrorLog /var/log/boa/error_log 改为
ErrorLog/etc/boa/error_log
将AccessLog /var/log/boa/access_log 改为
AccessLog/etc/boa/access_log
3、将#ServerName www.your.org.here改为
ServerName www.your.org.here
4、将DocumentRoot /var/www改为
DocumentRoot /www
5、将ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/改为
ScriptAlias /cgi-bin/ /www/cgi-bin/
4、在/www/下创建index.html
root@ELF1:/etc# vi /www/index.html
并编写加入以下内容:
<!DOCTYPE html><html xmlns="http://www/w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html;charset-gb2312"> <title>Isaigu_gateway</title><style type="text/css"><!-- .STYLE1{font-size:45px} body{ background-color: #ADD8E6; } --></style> </head> <body> <table width="613" height="424" border="0" align="center"> <tr> <td colspan="2" align="center" valign="middle"><h2 class="STYLE1">Hello ElfBoard </h2></td> </tr> </tr> <td> </td> <td> </td> <tr> </table> </body></html>
5、在开拓板实行运用
root@ELF1:~# /etc/boa/boa
6、在浏览器输入开拓板IP,效果如下
至此Boa的移植就完成了,希望各位小伙伴不仅能节制这项技能,还能享受在嵌入式技能海洋中不断探索的乐趣,并期待你们在接下来的学习道路上越走越远,能够在嵌入式技能领域独当一壁!