ARM开源库移植实例

libjpeg移植

源码下载地址: https://sourceforge.net/projects/libjpeg/files/

解压  tar xzf  libjpeg-turbo-1.2.1.tar.gz
配置 ./configure --prefix=$(pwd)/tmp --host=arm-linux CC=arm-none-linux-gnueabi-gcc --enable-shared --enable-static
编译安装 make && make install

安装完成之后,把库文件拷贝到目标板的根文件系统

cd tmp/lib
cp *.so.* ~/omapl138/rootfs/lib -d

由于jpeg解码需要链接jpeg库,使用gcc命令的话比较复杂,建议使用makefile来编译

Makefile
  1 INCLUDE=-I /home/wu/arm-application/jpeg_src/libjpeg-turbo-1.2.1/tmp/include
  2
  3 LIBS=-L /home/wu/arm-application/jpeg_src/libjpeg-turbo-1.2.1/tmp/lib -ljpeg
  4
  5 all:jpeg-test
  6
  7 jpeg-test:
  8     arm-none-linux-gnueabi-gcc -o jpeg-test jpg2rgb.c $(INCLUDE) $(LIBS)
  9
 10 clean:
 11     rm-rfv jpeg-test

tslib移植

tslib下载地址:https://github.com/kergoth/tslib/releases 从上面github链接上下载1.4版本的,并移植到omapl138目标板上

解压 tar xzf tslib-1.4.tar.gz
cd tslib
./autogen.sh

生成configure

./autogen.sh

配置,生成Makefile

  ./configure --host=arm-none-linux-gnueabi- --prefix=$(pwd)/tmp
  --enable-debug=no

生成Makefile后,编译出现fbutils.c:(.text+0x104): undefined reference to `rpl_malloc' 这种错误

解决办法:执行autogen.sh后,修改config.h.in 把里面的#undef malloc,然后就编译通过

安装到源码文件的tmp目录,生成/bin /etc /lib /include文件夹,并放入相应的文件

把tmp目录的文件拷贝到目标系统

cd tmp
cp * -rf ~/omapl138/rootfs

拷贝完成之后,在目标文件系统上有相应的库和测试程序

设置环境变量,把下面的环境变量添加到系统 vi /etc/profile

export TSLIB_TSDEVICE=/dev/input/event0 
export TSLIB_CALIBFILE=/etc/pointercal 
export TSLIB_CONFFILE=/etc/ts.conf 
export TSLIB_PLUGINDIR=/lib/ts 
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0 

使用命令source /etc/profile 使之生效 就可以使用tslib测试程序啦

lighttpd

源码下载地址 http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.30.tar.gz

解压:

tar -zxvf lighttpd-1.4.30.tar.gz

配置:

1, 在当前目录创建一个临时目录  mkdir tmp
2.  配置   ./configure --prefix=$(pwd)/tmp  --host=arm-linux CC=/home/wu/omapl138/cross_compile/arm-2009q1/bin/arm-none-linux-gnueabi-gcc --disable-FEATURE --enable-shared --disable-static --disable-lfs --disable-ipv6 --without-PACKAGE --without-valgrind --without-openssl --without-kerberos5 --without-pcre --without-zlib --without-bzip2 --without-lua  
    配置过程出现以下错误:
    configure: error: zlib headers not found, install them or build without --with-zlib
    重新用以下命令配置:
 ./configure --prefix=$(pwd)/tmp  --host=arm-linux CC=/home/wu/omapl138/cross_compile/arm-2009q1/bin/arm-none-linux-gnueabi-gcc --disable-FEATURE --enable-shared --disable-static --disable-lfs --disable-ipv6 --without-PACKAGE --without-valgrind --without-openssl --without-kerberos5 --without-pcre --without-zlib --without-bzip2 --without-lua
3.  编译 安装
    make && make install

安装完成后将在tmp目录生成lib sbin share 三个目录 然后在这个tmp目录上手动创建如下目录 cache, cgi-bin config log sockets upload vhosts webpages

将源码目录中的doc/config目录下的config.d,lighttpd.conf和modules.conf拷贝到安装目录tmp目录中的config目录下

【1】修改复制过来的lighttpd.conf 1)将16行至20行修改为如下:

 16 var.log_root    = "/home/wu/arm-application/lighttpd_1.4.30_src/lighttpd-1.4.30/tmp/lo    g"
 17 var.server_root = "/home/wu/arm-application/lighttpd_1.4.30_src/lighttpd-1.4.30/tmp"
 18 var.state_dir   = "/home/wu/arm-application/lighttpd_1.4.30_src/lighttpd-1.4.30/tmp"
 19 var.home_dir    = "/home/wu/arm-application/lighttpd_1.4.30_src/lighttpd-1.4.30/tmp"
 20 var.conf_dir    = "/home/wu/arm-application/lighttpd_1.4.30_src/lighttpd-1.4.30/tmp/co    nfig"

2)将61行和93行修改为如下

var.cache_dir   = server_root + "/cache"
server.use-ipv6 = "disable"
  1. 将104和105行注释掉,如下
#server.username  = "lighttpd"
#server.groupname = "lighttpd"

4)将115行修改为如下

server.document-root = server_root + "/webpages"

5)将127行注释掉,如下所示:

#server.pid-file = state_dir + "/lighttpd.pid"

6)将152行、158行、191行注释掉,如下所示:

#include "conf.d/access_log.conf"
#include "conf.d/debug.conf"
#server.network-backend = "linux-sendfile"

7)根据系统资源设置207行和225行的数值,本系统的设置分别如下褐色加粗字体所示:

server.max-fds = 256
server.max-connections = 128

8)注释掉314-316行

343 $HTTP["url"] =~ "\.pdf$" {
344   server.range-requests = "disable"
345 }

9)373行改成

408 server.upload-dirs = ( "/home/wu/arm-application/lighttpd_src/lighttpd-1.4.51/tmp/uplo    ad" )

  1. 336行修改为:
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" ,".cgi")

11)88行修改,默认使用80端口先修改8080端口

server.port = 8080

【2】修改安装目录下config.d/config/cgi.conf

1)将15至19行这一段配置修改如下(原来的):

 15 #cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
 16 #                               ".cgi" => "/usr/bin/perl",
 17 #                               ".rb"  => "/usr/bin/ruby",
 18 #                               ".erb" => "/usr/bin/eruby",
 19 #                               ".py"  => "/usr/bin/python" )

修改后

15 cgi.assgin=(".cgi"=>"")
 16 #cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
 17 #                               ".cgi" => "/usr/bin/perl",
 18 #                               ".rb"  => "/usr/bin/ruby",
 19 #                               ".erb" => "/usr/bin/eruby",
 20 #                               ".py"  => "/usr/bin/python" )

2)将28行的注释符去掉

alias.url += ( "/cgi-bin" => server_root + "/cgi-bin" )

编写一个简单的html页面进行测试 index.html

  1 <html>
  2 <head>
  3 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  4 <title>lighttpd测试</title>
  5 </head>
  6 <body>
  7 <p>轻量级web服务器lighttpd的编译及配置(for arm-linux)</p>
  8 <hr>
  9 <p>测试页面</p>
 10 </body>
 11 </html>

将此目录拷贝到安装目录tmp的webpages子目录中

将安装目录tmp拷贝到目标文件系统中:

目标文件系统中创建目录:
mkdir -p /home/wu/arm-application/lighttpd_1.4.30_src/lighttpd-1.4.30/
主机中拷贝到nfs目录:
cp -rd tmp/ /home/wu/arm-application/lighttpd_1.4.30_src/lighttpd-1.4.30/

打开目标机的控制台,挂载nfs启动,使用如下目录启动web服务器

cd /home/wu/arm-application/lighttpd_1.4.30_src/lighttpd-1.4.30/sbin
启动web服务器
./lighttpd -f ../config/lighttpd.conf

现在web服务器搭建完成,使用cgi的时候出现了问题,发现必须要安装pcre这个库 最新版下载地址:https://sourceforge.net/projects/pcre/files/latest/download

解压

unzip pcre2-10.32.zip

配置

cd pcre2-10.32
./configure --prefix=$(pwd)/tmp  --host=arm-linux CC=/home/wu/omapl138/cross_compile/arm-2009q1/bin/arm-none-linux-gnueabi-gcc

编译,安装

make && make install

猜你喜欢

转载自blog.csdn.net/qq_18737805/article/details/85126968