hi3531移植QT5.9.9

本文详细介绍了如何在Ubuntu18.04上为Hi3531DV100平台交叉编译Qt5.9.9。首先下载并解压源码,然后修改配置文件以适应目标平台,接着设置编译参数,不包含某些模块以减小体积。通过make和make install进行编译和安装。最后,将编译好的库和插件移植到目标板,并配置framebuffer以实现显示。
摘要由CSDN通过智能技术生成

环境:ubuntu18.04 64位

qt版本:qt5.9.9

平台:hi3531dv100

编译工具:arm-hisiv600-linux-g++

1、QT5.9.9安装包下载

下载地址: 点我

选择qt-everywhere-opensource-src-5.9.9.tar.xz

 2、解压

tar -xvf qt-everywhere-opensource-src-5.9.9.tar.xz

 3、hi3531编译配置

cd qt-everywhere-opensource-src-5.9.9/qtbase/mkspecs
# 复制linux-arm-gnueabi-g++为arm-hisiv600-linux-g++
cp -ar linux-arm-gnueabi-g++ arm-hisiv600-linux-g++
修改 qmake.conf,配置如下:
#
# qmake configuration for building with arm-linux-gnueabi-g++
#

MAKEFILE_GENERATOR      = UNIX
CONFIG                 += incremental
QMAKE_INCREMENTAL_STYLE = sublib
#QT_QPA_DEFAULT_PLATFORM = linuxfb 

include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)

# modifications to g++.conf
QMAKE_CC                = arm-hisiv600-linux-gcc
QMAKE_CXX               = arm-hisiv600-linux-g++
QMAKE_LINK              = arm-hisiv600-linux-g++
QMAKE_LINK_SHLIB        = arm-hisiv600-linux-g++

# modifications to linux.conf
QMAKE_AR                = arm-hisiv600-linux-ar cqs
QMAKE_OBJCOPY           = arm-hisiv600-linux-objcopy
QMAKE_NM                = arm-hisiv600-linux-nm -P
QMAKE_STRIP             = arm-hisiv600-linux-strip
load(qt_config)

4、Qt编译参数(不含tslib)

./configure -prefix /opt/Qt-arm-5.9.9 \
-opensource \
-confirm-license \
-release \
-strip \
-no-eglfs -linuxfb \
-qt-zlib \
-no-gif \
-qt-libpng \
-qt-libjpeg \
-qt-freetype \
-no-rpath \
-no-pch \
-no-avx \
-no-openssl \
-no-cups \
-no-dbus \
-no-pkg-config \
-no-glib \
-no-iconv \
-xplatform arm-hisiv600-linux-g++ \
-no-opengl \
-nomake examples \
-nomake tools \
-no-sqlite \
-skip qtgamepad \
-skip qtandroidextras \
-skip qtmacextras \
-skip qtx11extras \
-skip qtsensors \
-skip qtserialbus \
-skip qtserialport \
-skip qtwebengine \
-skip qtwebchannel \
-skip qtwebsockets \
-skip qtlocation \
-skip qtquickcontrols \
-skip qtpurchasing \
-skip qtconnectivity \
-skip qtscxml \
-skip qtxmlpatterns \
-skip qtnetworkauth \
-skip qtspeech \
-skip qtscript \
-skip qtremoteobjects \
-skip qtcharts \
-skip qtdatavis3d \
-skip qtwebview 

说明:
-prefix: 安装目录
-xplatform: 平台选择

5、编译&安装

make -j4 & make install     # -j4: 启用4线程同时编译,提升编译速度

6、移植

在目标板上/lib目录下创建Qt文件夹
将安装文件夹下的lib、plugins、和qml拷贝到目标板的/lib/Qt文件夹下
配置/etc/profile

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Yhi/lib/Qt5.9.9/lib/
export QTDIR=/Yhi/lib/Qt5.9.9
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTDIR/plugins
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=1920x1080
export QT_QPA_FONTDIR=$QTDIR/fonts
export QML_IMPORT_PATH=$QTDIR/qml
export QML2_IMPORT_PATH=$QTDIR/qml

 7、framebuffer配置

static struct fb_bitfield s_a32 = {24,8,0};
static struct fb_bitfield s_r32 = {16,8,0};
static struct fb_bitfield s_g32 = {8,8,0};
static struct fb_bitfield s_b32 = {0,8,0};
HI_S32          hifb_fd = -1;

HI_S32 CMppManager::ConfigFrameBuffer()
{
    HI_S32 s32Ret = HI_SUCCESS;
    struct fb_var_screeninfo stVarInfo;
	HI_CHAR file[12] = "/dev/fb0";
    HI_BOOL bEnable;
    HIFB_DDRZONE_S stDDRZonePara;
    HIFB_LAYER_INFO_S stLayerinfo;
    HI_S32 hifb_fd = -1;
	strcpy(file, "/dev/fb0");
    /* 1. open framebuffer device overlay 0 */
	hifb_fd = open(file, O_RDWR, 0);
	if(hifb_fd < 0)
	{
		SAMPLE_PRT("open %s failed!\n",file);
		return HI_NULL;
	}

    s32Ret = ioctl (hifb_fd, FBIOGET_VSCREENINFO, &stVarInfo);
    if (s32Ret < 0)
    {
        SAMPLE_PRT("FBIOGET_VSCREENINFO failed!\n");
        close(hifb_fd);
        return HI_NULL;
    }

    stVarInfo.red = s_r32;
	stVarInfo.green = s_g32;
	stVarInfo.blue = s_b32;
	stVarInfo.transp = s_a32;
	stVarInfo.bits_per_pixel = 32;
    stVarInfo.xres=HD_WIDTH;
    stVarInfo.yres=HD_HEIGHT;
    stVarInfo.activate=FB_ACTIVATE_NOW;
    stVarInfo.xres_virtual=HD_WIDTH;
    stVarInfo.yres_virtual = HD_HEIGHT;
    stVarInfo.xoffset=0;
    stVarInfo.yoffset=0;

    s32Ret = ioctl (hifb_fd, FBIOPUT_VSCREENINFO, &stVarInfo);
    if (s32Ret < 0)
    {
        SAMPLE_PRT("FBIOPUT_VSCREENINFO failed!\n");
        close(hifb_fd);
        return HI_FAILURE;
    }

    s32Ret = ioctl(hifb_fd, FBIOGET_LAYER_INFO, &stLayerinfo);
    if (s32Ret < 0)
    {
        SAMPLE_PRT("FBIOGET_LAYER_INFO failed!\n");
        close(hifb_fd);
        return HI_FAILURE;
    }

   	stLayerinfo.u32Mask = 0;
    stLayerinfo.BufMode = HIFB_LAYER_BUF_NONE;
    stLayerinfo.u32Mask |= HIFB_LAYERMASK_BUFMODE;
    s32Ret = ioctl(hifb_fd, FBIOPUT_LAYER_INFO, &stLayerinfo);
    if (s32Ret < 0)
    {
        SAMPLE_PRT("FBIOPUT_LAYER_INFO failed!\n");
        close(hifb_fd);
        return HI_FAILURE;
    }
    stDDRZonePara.u32StartSection = 0;
    stDDRZonePara.u32ZoneNums = 15;
    s32Ret = ioctl(hifb_fd, FBIOPUT_MDDRDETECT_HIFB, &stDDRZonePara);
    if (s32Ret < 0)
    {
        SAMPLE_PRT("FBIOPUT_MDDRDETECT_HIFB failed!\n");
        close(hifb_fd);
        return HI_FAILURE;
    }

    /* 2. open compress */
    bEnable = HI_TRUE;
    s32Ret = ioctl(hifb_fd, FBIOPUT_COMPRESSION_HIFB, &bEnable);
    if (s32Ret < 0)
    {
        SAMPLE_PRT("FBIOPUT_COMPRESSION_HIFB failed!\n");
        close(hifb_fd);
        return HI_FAILURE;
    }
	system("/Yhi/NAND/RecordGUI/RecorderGUI &");

    return HI_SUCCESS; 
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值