zoukankan      html  css  js  c++  java
  • 在HI3531上移植和运行QT4.8.6

    在HI3531上移植和运行QT4.8.6

    1、            前言:

    近段有点时间,想把QT移植到HI3531上,在网上查找了很多资料,但都不是很全面,有些有问题也没有得到很好的体现。

    2、            环境:

    PC:ubuntu10.04

    HI3531交叉工具链:arm-hisiv100nptl-linux-

    QT版本:qt4.8.6(Qt libraries 4.8.6 for embedded Linux (230 MB) 

    QT-Creator版本:qt-creator-linux-x86-opensource-2.4.1.bin

    3、            交叉编译:

    1)      进入qt-everywhere-opensource-src-4.8.6/mkspecs/qws目录,新建linux-hisi3531nptl-g++目录,复制linux-arm-g++目录下的所有文件到linux-hisi3531nptl-g++

    cp –a linux-arm-g++/* linux-hisi3531nptl-g++

           2)进入linux-hisi3531nptl-g++,修改文件qmake.conf

                 

    # modifications to g++.conf

    QMAKE_CC               = arm-hisiv100nptl-linux-gcc

    QMAKE_CXX             = arm-hisiv100nptl-linux-g++

    QMAKE_LINK            = arm-hisiv100nptl-linux-g++

    QMAKE_LINK_SHLIB      = arm-hisiv100nptl-linux-g++

    # modifications to linux.conf

    QMAKE_AR                = arm-hisiv100nptl-linux-ar cqs

    QMAKE_OBJCOPY          = arm-hisiv100nptl-linux-objcopy

    QMAKE_STRIP             = arm-hisiv100nptl-linux-strip

          

    3)打开文件qplatformdefs.h增加

    #undef O_CLOEXEC

                  此处主要为解决:编译过程中找不到accept4函数问题

          

    4)安装X11库

    sudo apt-get install libX11-dev libXext-dev libXtst-dev

    5)返回源码目录qt-everywhere-opensource-src-4.8.6进行配置

    ./configure --prefix=/opt/qt4.8.6 -opensource -confirm-license -qt-sql-sqlite -qt-gfx-linuxfb -plugin-sql-sqlit -no-qt3support -no-phonon -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-declarative -no-declarative-debug  -qt-zlib -no-gif -qt-libtiff -qt-libpng -no-libmng -qt-libjpeg -no-rpath -no-pch -no-3dnow   -no-avx  -no-neon -no-openssl -no-nis -no-cups -no-dbus -embedded arm -platform linux-g++ -xplatform qws/linux-hisi3531nptl-g++ -little-endian -qt-freetype -no-opengl -no-glib -nomake demos -nomake examples -nomake docs -nomake tools

    其中:  --prefix=/opt/qte4.8.6 为交叉编译目标安装目录

    -xplatform qws/linux-hisi3531nptl-g++指定编译器及平台配置信息

    5)make

    6)make install

    4、            PC编译:

    1)      重新解压qt-everywhere-opensource-src-4.8.6.tar.gz,进行PC编译

    2)      ./ configure

    3)      make

    4)      make install

    5、            安装QT开发环境

    1)sudo ./qt-creator-opensource-linux-x86-2.4.1.run

    2)  下一步直到安装完成

    3)  在应用程序,就可以看到QT Creator

    6、            配置开发环境

    1)从PC的QT安装目录中拷贝如下文件到交叉编译目录

    cp /usr/local/Trolltech/Qt-4.8.6/bin/qml* /opt/qt4.8.6/bin/

    2)打开QT Creator

    3)打开 工具-选项-QT版本

    4)打开添加按键,添加交叉编译的qmake

    5)进入工具链,打开添加按键, 选择GCCE,在编译器路经选择arm-hisiv100nptl-linux-g++的路经

    到些就可以编译QT下自带的例子chip了,但这时在HI3531上还是不能显示的。

    7、            配置海思HI3531

    1) 按照《HIFB开发指南.pdf》 说明加载hifb.ko驱动,这里需要说明的是,如果QT程序运行在fb0上,分辨率为1920*1080,颜色格式为ARGB8888,1buffer模式下,则需要vram0_size = 1920*1080*4=8100K

    如果为2 buffer模式下则需要vram0_size=1920*1080*4*2=16200K

    说明:为什么要使用ARGB8888而不用ARGB1555,是因为我们QT编译使用的是32位framebuffer。不然的话会做不了透明处理。

    2)使能fb0,前提是VO设备已初始化完毕

           static struct fb_bitfield g_r32 = {16,8, 0};

    static struct fb_bitfield g_g32 = {8, 8, 0};

    static struct fb_bitfield g_b32 = {0, 8, 0};

    static struct fb_bitfield g_a32 = {24, 8, 0};

           HI_BOOL show;

           HIFB_ALPHA_S stAlpha;

           struct fb_var_screeninfo stVarInfo;

           fd = open("/dev/fb0", O_RDWR, 0);

          

           show = 0x0;

           ioctl(fd, FBIOPUT_SHOW_HIFB, &show);

           stAlpha.bAlphaEnable = 0x1;

           stAlpha.bAlphaChannel = 0x0;

           stAlpha.u8Alpha0 = 0x0;

           stAlpha.u8Alpha1 = 0xff;

           stAlpha.u8GlobalAlpha = 0xff;

           ioctl(fd, FBIOPUT_ALPHA_HIFB, &stAlpha);

    ioctl(fd, FBIOGET_VSCREENINFO, &stVarInfo);

           stVarInfo.xres = 1920;

           stVarInfo.yres = 1080;

           stVarInfo.xres_virtual = 1920;

           stVarInfo.yres_virtual = 1080;

           stVarInfo.transp= g_a32;

           stVarInfo.red = g_r32;

           stVarInfo.green = g_g32;

           stVarInfo.blue = g_b32;

    stVarInfo.bits_per_pixel = 32;

        stVarInfo.activate = FB_ACTIVATE_NOW;

    ioctl(fd, FBIOPUT_VSCREENINFO, &stVarInfo);

    show = 0x1;

    ioctl(fd, FBIOPUT_SHOW_HIFB, &show);

    while(1)

    {

           Sleep(100);

    }

                  3)配置设备linux环境变量

                         export QT_QWS_FONTDIR=/usr/lib/fonts              //字库的目录

                         export QT_QWS_DISPLAY=“linuxFB:/dev/fb0“   //QT显示在fb0层

    8、            运行CHIP

    OK

    9、            实现背景透明

    只需要调用QWSServer::setBackground(QColor(0,0,0,0));即可关于这个QColor,在设置的时候,是按照ARGB8888来设置的,前三个数值是RGB,最后一个数值是透明度,0x00是全透,0x7f是半透,0xff是不透。

    10、如何显示中文

    从c:windowsfonts 目录下复制*.ttf文件到字库目录,就可以显示了,但字体需要设置大些。

  • 相关阅读:
    让我自闭了两个星期的题 Hello xtCpc
    kmp 回忆训练2 poj3461
    kmp 字符串匹配
    线段树之动态开点  HDU 6183 Color it.
    两个思维
    codeforces 300E Empire Strikes Back
    codeforces1392 E Omkar and Duck
    codeforces1169D
    HDU4335 欧拉函数及降幂
    HDU2588GCD(欧拉函数)
  • 原文地址:https://www.cnblogs.com/subo_peng/p/5457284.html
Copyright © 2011-2022 走看看