BOA服务器移植之嵌入式开发板(FS4412)

前言

续前面boa移植链接: boa服务器移植,在这基础之上,更改编译方式,使其boa服务器能够在开发板上运行,然后能够在电脑上访问服务器。

BOA服务器在开发板(fs4412)的移植过程

  1. 查看交叉编译器的类型,并查看选中的工具链,我这里用的是gcc-4.6.4版本
linux@linux:~$ cd /home/linux/fs4412/toolchain/gcc-4.6.4/bin
linux@linux:~/fs4412/toolchain/gcc-4.6.4/bin$ ls

在这里插入图片描述
2. 指定交叉编译工具链

linux@linux:~$ cd boa-0.94.13/src/
linux@linux:~/boa-0.94.13/src$ vi Makefile

将Makefile中的指定编译器改为

# CC = gcc 
CC = arm-none-linux-gnueabi-gcc
  1. 删除原来编译的文件,重新编译
linux@linux:~/boa-0.94.13/src$ make clean
linux@linux:~/boa-0.94.13/src$ make
  1. 将编译生成的文件拷贝到之前的boa文件夹下,查看拷贝文件的属性是支持在ARM平台下运行的文件
linux@linux:~/boa-0.94.13/src$ cp boa /home/linux/boa/
linux@linux:~/boa-0.94.13/src$ cp boa_indexer /home/linux/boa/

linux@linux:~/boa-0.94.13/src$ file boa
boa: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.38, not stripped

linux@linux:~/boa-0.94.13/src$ file boa_indexer
boa_indexer: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.38, not stripped
  1. 将boa/cgi-bin/目录下test.c重新编译
linux@linux:~/boa/cgi-bin$ arm-none-linux-gnueabi-gcc -o test.cgi test.c

linux@linux:~/boa/cgi-bin$ file test.cgi
test.cgi: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.38, not stripped
linux@linux:~/boa/cgi-bin$ 
  1. 将整个/boa目录复制到,nfs共享跟目录下面
linux@linux:~$ sudo cp -rf boa/ /opt/4412/rootfs/
  1. 测试,在电脑(ubuntu)中浏览器进行访问
    在这里插入图片描述
    出现了这样的一个错误,/home/linux/boa这个目录在开发板上找不到,所以我们需要查看这个boa在开发板的目录,更改某个头文件路径和配置文件。
linux@linux:~/boa-0.94.13/src$ vi defines.h +30
将
#define SERVER_ROOT "/home/linux/boa"
改为:
#define SERVER_ROOT "/boa"

将配置文件boa.conf也修改
在这里插入图片描述
然后删除原来编译的文件重新编译,重新拷贝文件过去
linux@linux:~/boa-0.94.13/src$ make clean
linux@linux:~/boa-0.94.13/src$ make
linux@linux:~/boa-0.94.13/src$ sudo cp boa /opt/4412/rootfs/boa/
linux@linux:~/boa-0.94.13/src$ sudo cp boa_indexer /opt/4412/rootfs/boa/

重新执行
在这里插入图片描述
在电脑(ubuntu)上访问开发板的网址
在这里插入图片描述
在点跳转的时候出现了一个错误
在这里插入图片描述
查看log下的日志文件显示以下信息:

[01/Jan/1970:00:00:53 +0000] boa.c:211 - getpwuid: No such file or directory

解决办法:将boa.c中的drop_privs函数以下几行注释掉

#if 0
        if (passwdbuf == NULL) {
            DIE("getpwuid");
        }
        if (initgroups(passwdbuf->pw_name, passwdbuf->pw_gid) == -1) {
            DIE("initgroups");
        }
#endif

然后重新编译拷贝boa文件到nfs共享目录下

太难了,点个赞吧!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值