操作系统:虚拟机 uBuntu 10.04.3
交叉编译工具链:arm-linux-4.4.1
内核镜像:Linux-2.6.36 对应的 zImage
文件系统:Linux-2.6.36 对应的 FORLINX_6410_touch.cramfs
源码包:
directFB 源码包 DirectFB-1.4.9.tar.gz http://www.directfb.org/index.php?path=Main%2FDownloads
freetype 源码包 freetype-2.4.8.tar.gz http://freetype.sourceforge.net/index2.html
libjpeg 源码包 jpegsrc.v8d.tar.gz http://www.ijg.org/
libpng 源码包 libpng-1.5.8.tar.gz http://www.libpng.org/pub/png/libpng.html
zlib 源码包 zlib-1.2.5.1.tar.gz http://www.zlib.net/
补丁文件:
DirectFB 1.4.9支持Libpng 1.5.x所需的补丁
DirectFB-1.4.9-libpng-1.5.patch http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/DirectFB/files/
0.准备工作
将所有源代码包都复制到 /home/lean/6410目录中
终端切换到root权限:#sudo su
1.交叉编译工具安装
将arm-linux-4.4.1.tar.gz解压缩到/usr/local/arm目录中
解压缩:#tar zvxf arm-linux-4.4.1.tar.gz -C /usr/local/arm
设置环境变量:#export PATH=/usr/local/arm/4.4.1/bin:$PATH
一、编译和安装依赖包
2.tslib 编译与安装
这里直接采用飞凌编译好的tslib,所以暂无需要编译和安装。如果需要自行编译可参考《OK6410 QT移植百科全书.pdf》
直接拷贝飞凌的/usr/local/tslib到uBuntu的/usr/local目录中
设置环境变量:
#export TSLIB=/usr/local/tslib
#export TSLIB_CFLAGS=$TSLIB/lib
#export TSLIB_LIBS=$TSLIB/lib
3.zlib编译与安装
解压缩: #tar zvxf zlib-1.2.5.1.tar.gz
配置:
#CC=arm-none-linux-gnueabi-gcc ./configure --prefix=/usr/local/zlib
编译及安装:
#make
#make install
设置环境变量:
#export ZLIB=/usr/local/zlib
4.libjpeg编译与安装
解压缩: #tar zvxf jpegsrc.v8d.tar.gz
切换目录:#cd jpeg-8d
执行配置:#./configure --host=arm-linux --prefix=/usr/local/libjpeg --enable-shared
执行编译:#make
执行安装:#make install
设置环境变量:
#export LIBJPEG=/usr/local/libjpeg
4.libpng编译与安装
解压缩:#tar zvxf libpng-1.5.8.tar.gz
切换目录:#cd libpng-1.5.8
配置:#./configure --host=arm-linux --prefix=/usr/local/libpng
编译及安装:
#make
#make install
设置环境变量:
#export LIBPNG=/usr/local/libpng
#export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/libpng/lib/pkgconfig
注意:由于libpng-1.5.8在安装的时候漏拷贝了其根目录下的pnginfo.h和pngstruct.h到安装目录,所以这里要手动
拷贝这两个文件到/usr/local/libpng/include/libpng15目录中,否则在编译directFB时候会出错。
5.freetype编译与安装
解压缩:#tar zvxf freetype-2.4.8.tar.gz
切换目录:#cd freetype-2.4.8
配置:#./configure --host=arm-linux --prefix=/usr/local/freetype
编译及安装:
#make
#make install
设置环境变量:
#export FREETYPE=/usr/local/freetype
#export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/freetype/lib/pkgconfig
至此directFB所需的依赖包都安装完成。注意:在安装libpng前首先得安装zlib否则会出现找不到zlib错误出现。
二、编译和安装directFB
1.设置环境变量
#export LDFLAGS="$LDFLAGS -L$TSLIB/lib -L$LIBJPEG/lib -L$LIBPNG/lib -L$FREETYPE/lib -L$ZLIB/lib -lm"
#export CFLAGS="$CFLAGS -I$TSLIB/include -I$LIBJPEG/include -I$LIBPNG/include -I$FREETYPE/include -I$ZLIB/include"
2.对directFB-1.4.9应用补丁
directFB-1.4.9使用libpng-1.5.x会出现版本不兼容的情况,所以需要对directFB-1.4.9源码打libpng-1.5.x支持补丁。
解压源代码:#tar zvxf DirectFB-1.4.9.tar.gz
切换目录:#cd DirectFB-1.4.9
应用补丁:#patch -p1 < ../DirectFB-1.4.9-libpng-1.5.patch
如果出现patch命令不存在要先安装patch:apt-get install patch
补丁成功以后将会提示应用补丁的文件列表。
3.配置directFB
#./configure --host=arm-linux --prefix=/usr/local/directFB --with-gfxdrivers=none --with-inputdrivers=all --enable-png --enable-jpeg --disable-tiff --enable-zlib --enable-sdl=no --enable-gif=no --disable-x11 --enable-debug --sysconfdir=/etc --enable-fbdev
等待配置完成,并查看所对应的模块是否已经找到,如果出现未找到某个模块,要着重检查环境变量是否设置正确,尤其是下面两个。
#export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/freetype/lib/pkgconfig
#export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/libpng/lib/pkgconfig
4.编译及安装
#make
#make install
三、开发板部署
1.cramfs文件系统制作
将uBuntu /usr/local/目录下的 tslib, libjpeg, libpng, freetype, zlib, directFB 文件夹拷贝到开发板cramfs镜像的/usr/local目录中。
修改cramfs镜像中/usr/local文件权限(不修改貌似也可以)
#chmod 777 -R /usr/local/
修改镜像/etc/init.d/rcS文件,添加如下环境变量:
#export TSLIB=/usr/local/tslib
#export LIBJPEG=/usr/local/libjpeg
#export LIBPNG=/usr/local/libpng
#export FREETYPE=/usr/local/freetype
#export ZLIB=/usr/local/zlib
#export DIRECTFB=/usr/local/directFB
#export TSLIB_CONSOLEDEVICE=none
#export TSLIB_FBDEVICE=/dev/fb0
#export TSLIB_TSDEVICE=/dev/input/event1
#export TSLIB_PLUGINDIR=$TSLIB/lib/ts
#export TSLIB_CONFFILE=$TSLIB/etc/ts.conf
#export TSLIB_CALIBFILE=/etc/pointercal
#export LD_LIBRARY_PATH=$TSLIB/lib:$LIBJPEG/lib:$LIBPNG/lib:$FREETYPE/lib:$ZLIB/lib:$DIRECTFB/lib
修改或新建/etc/directfbrc文件,内容如下:
system=fbdev
fbdev=/dev/fb0
wm=default
重新打包cramfs文件镜像,利用USB或一键烧写到开发板。
重启开发板:
[root@FORLINX6410]# cd /usr/local/directFB/bin
[root@FORLINX6410]# ./dfbinfo
~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.4.9 |~~~~~~~~~~~~~~~~~~~~~~~~~~
(c) 2001-2010 The world wide DirectFB Open Source Community
(c) 2000-2004 Convergence (integrated media) GmbH
----------------------------------------------------------------
(*) DirectFB/Core: Single Application Core. (2012-02-12 10:12) [ DEBUG ]
(*) Direct/Memcpy: Using armasm_memcpy()
(*) Direct/Thread: Started 'VT Switcher' (-1) [CRITICAL OTHER/OTHER 0/0] <8388608>...
(*) Direct/Thread: Started 'VT Flusher' (-1) [DEFAULT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/FBDev: Found 's3cfb' (ID 0) with frame buffer at 0x5e980000, 510k (MMIO 0x00000000, 0k)
(!) Direct/Modules: Unable to dlopen `/usr/local/directFB/lib/directfb-1.4-5/inputdrivers/libdirectfb_tslib.so'!
--> /usr/local/directFB/lib/directfb-1.4-5/inputdrivers/libdirectfb_tslib.so: undefined symbol: ts_close
(*) Direct/Thread: Started 'PS/2 Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: IMPS/2 Mouse 1.0 (directfb.org)
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: gpio-keys (1) 0.1 (directfb.org)
(*) Direct/Thread: Started 'Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: S3C TouchScreen (2) 0.1 (directfb.org)
(*) Direct/Thread: Started 'Hotplug with Linux Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: Hot-plug detection enabled with Linux Input Driver
(*) Direct/Thread: Started 'Keyboard Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: Keyboard 0.9 (directfb.org)
(*) DirectFB/Graphics: Generic Software Rasterizer 0.6 (directfb.org)
(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
Screen (00) FBDev Primary Screen (primary screen)
Caps: VSYNC POWER_MANAGEMENT
Layer (00) FBDev Primary Layer (primary layer)
Type: GRAPHICS
Caps: SURFACE BRIGHTNESS CONTRAST SATURATION
Input (01) IMPS/2 Mouse (primary mouse)
Type: MOUSE
Caps: AXES BUTTONS
Max. Axis: 2
Max. Button: 2
Input (10) gpio-keys
Type:
Caps: KEYS
Min. Keycode: -1
Max. Keycode: -1
Input (11) S3C TouchScreen
Type: MOUSE
Caps: KEYS AXES
Min. Keycode: -1
Max. Keycode: -1
Max. Axis: 1
Input (00) Keyboard (primary keyboard)
Type: KEYBOARD
Caps: KEYS
Min. Keycode: 0
Max. Keycode: 127
[root@FORLINX6410]#
参考文章:
OK6410 QT移植百科全书.pdf
OK6410-B开发板LINUX2.6.36用户手册.pdf
ok6410 移植Directfb详解 http://bbs.witech.com.cn/thread-8082-1-1.html
来源:oschina
链接:https://my.oschina.net/u/133030/blog/41175