DirectFB 1.4.3 在ARM-linux上移植

时间:2022-06-01 16:37:10

1.下载源码DirectFB-1.4.3.tar.gz

2.解压缩 tar xzvf DirectFB-1.4.3.tar.gz

3.进入目录cd DirectFB-1.4.3

4.automake工具配置,需要系统中包含有automake相关工具

配置./autogen.sh 

5.参数配置

./configure -prefix /usr/local/dFB-1.4.3 -host=armv-linux -with-gfxdrivers=none -with-inputdrivers=tslib --with-tests -enable-shared -enable-png -enable-zlib -enable-devmem -enable-fbdev -enable-x11 -enable-x11vdpau 

如果出现下面的提示:

PNG support is missing - many applications won't work correctly!

JPEG support is missing - many applications won't workcorrectly!

FreeType2 support is missing - many applications won't workcorrectly!

参考解决方法:

$sudo apt-get install libpng12-dev

$sudo apt-get install libjpeg62-dev

$sudo apt-get install libfreetype6-dev


如果libpng安装后不好用,编译不通过,则可以单独安装,如下:

libpng编译与安装
解压缩:#tar zvxf libpng-1.6.18.tar.gz
切换目录:#cd libpng-1.6.18
配置:#./configure --host=arm-linux --prefix=/home/light/libpng
编译及安装:
#make
#make install
设置环境变量:
#export LIBPNG=/home/light/libpng
#export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/light/libpng/lib/pkgconfig
设置环境变量
#export LDFLAGS="$LDFLAGS -L$LIBPNG/lib -lm"
#export CFLAGS="$CFLAGS -I$LIBPNG/include"
手动拷贝这两个文件到/home/light/libpng/include/libpng16目录中,否则在编译directFB时候可能会出错。


如果还是不行的话,就换一个版本。换成 libpng-1.2.52.tar.gz 这个版本。


6.编译

#make

7.安装
#make install

需要注意root权限问题

需要注意路径问题。-prefix配置的路径,板子和PC上需要保持一致。

8.将install生成后的文件夹拷贝至板子上

9.将路径,lib等信息导入到环境变量/etc/profile中

export DFB_ROOT=/usr/local/dFB-1.4.3

export PKG_CONFIG_PATH=$DFB_ROOT/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DFB_ROOT/lib

10.编写directfbrc配置文件在/etc目录下

vi /etc/directfbrc

添加如下内容

system=fbdev
fbdev=/dev/fb0
wm=default
mode=320x240
depth=32
pixelformat=RGB32

11.运行测试程序

目录/usr/local/dFB-1.4.3/bin中


# ./dfbtest_window
 [[ main                           ]]  Starting up...


   ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 1.4.3 |~~~~~~~~~~~~~~~~~~~~~~~~~~
        (c) 2001-2009  The world wide DirectFB Open Source Community
        (c) 2000-2004  Convergence (integrated media) GmbH
      ----------------------------------------------------------------


(*) DirectFB/Core: Single Application Core. (2015-09-14 06:03) 
(!) Direct/Modules: Unable to dlopen `/usr/local/dFB-1.4.3/lib/directfb-1.4-0/systems/libdirectfb_x11.so'!
    --> libX11.so.6: cannot open shared object file: No such file or directory
(*) Direct/Memcpy: Using libc 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 'Layer0' (ID 0) with frame buffer at 0x86200000, 382k (MMIO 0x00000000, 0k)
(*) Direct/Thread: Started 'tslib Input' (-1) [INPUT OTHER/OTHER 0/0] <8388608>...
(*) DirectFB/Input: tslib touchscreen 0 0.1 (tslib)
(*) DirectFB/Graphics: Generic Software Rasterizer 0.6 (directfb.org)
(*) DirectFB/Core/WM: Default 0.3 (directfb.org)
===============================================================


 [[ Test_CreateWindow              ]]  CreateWindow( 100,100 - 200x200 UNKNOWN, options 0x00000000 )...
 [[ Test_CreateWindow              ]]    - GetSurface()...
 [[ Test_CreateWindow              ]]    - Clear( 0x20, 0x50, 0xC0, 0xFF )...
 [[ Test_CreateWindow              ]]    - SetOpacity( 255 )...
 [[ Test_CreateWindow              ]]    - GetID()...
 [[ Test_CreateWindow              ]]  ...CreateWindow( 100,100 - 200x200 UNKNOWN ) done. => Top Window ID 1
===============================================================


 [[ Test_CreateSubWindow           ]]  CreateWindow( 40,40 - 120x120 UNKNOWN + toplevel ID 1, options 0x00000000 )...
 [[ Test_CreateSubWindow           ]]    - GetSurface()...
 [[ Test_CreateSubWindow           ]]    - Clear( 0xC0, 0xC0, 0xC0, 0xFF )...
 [[ Test_CreateSubWindow           ]]    - SetOpacity( 255 )...
 [[ Test_CreateSubWindow           ]]    - GetID()...
 [[ Test_CreateSubWindow           ]]  ...CreateWindow( 40,40 - 120x120 UNKNOWN + toplevel ID 1 ) done. => Sub Window ID 2
 [[ main                           ]]  Shutting down...


移植完成。