Tina linux
环境配置与编译
- 安装中文输入法
sudo apt-get install fcitx-googlepinyin - https://www.cnblogs.com/g2thend/p/14016227.html
- CTRL+SPACE切换输入法
- 编译报错,提示依赖ncurses库
解决方案: sudo apt-get install libncurses5-dev
sudo apt-get install libncurses5
- 编译报错,提示环境变量异常:
解决方案: 在tina源码根目录执行 date +%s > version.date ,然后重新执行make继续编译 - tina linux编译环境依赖库安装脚本install_tools.sh
# /bin/sh
sudo apt-get install texinfo -y
sudo apt-get install pkg-config -y
sudo apt-get install nfs-kernel-server -y
sudo apt-get install samba -y
sudo apt-get install ssh -y
sudo apt-get install gcc -y
sudo apt-get install autoconf -y
sudo apt-get install patch -y
sudo apt-get install wget -y
sudo apt-get install texinfo -y
sudo apt-get install zlib1g-dev -y
sudo apt-get install dos2unix -y
sudo apt-get install git -y
sudo apt-get install gnupg -y
sudo apt-get install flex -y
sudo apt-get install bison -y
sudo apt-get install gperf -y
sudo apt-get install build-essential -y
sudo apt-get install zip -y
sudo apt-get install curl -y
sudo apt-get install libc6-dev -y
sudo apt-get install libncurses5-dev:i386 -y
sudo apt-get install x11proto-core-dev -y
sudo apt-get install libx11-dev:i386 -y
sudo apt-get install libreadline6-dev:i386 -y
sudo apt-get install libgl1-mesa-glx:i386 -y
sudo apt-get install libgl1-mesa-dev -y
sudo apt-get install g++-multilib -y
sudo apt-get install tofrodos -y
sudo apt-get install python-markdown -y
sudo apt-get install libxml2-utils -y
sudo apt-get install xsltproc -y
sudo apt-get install zlib1g-dev:i386 -y
sudo apt-get install gawk -y
sudo apt-get install libssl-dev -y
sudo apt-get install u-boot-tools:i386 -y
echo "deb http://us.archive.ubuntu.com/ubuntu trusty main universe" | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt-get install mingw32 -y
sudo dpkg-reconfigure dash
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
5.tina linux编译
. build/envsetup.sh
lunch
选择项目
make
6.build error:
export FORCE_UNSAFE_CONFIGURE=1
openwrt 源码里配置程序为开机启动
在 OpenWrt 中,配置程序为开机启动通常涉及到几个步骤,包括编写启动脚本、确保脚本在正确的位置、以及设置适当的权限和链接,以便系统能够在启动时自动执行该脚本。以下是一个基本的指南,帮助你完成这个过程:
1. 编写启动脚本
2. 将脚本放置在正确的位置
将你的脚本文件放置在 /etc/init.d/ 目录下。确保文件是可执行的:
#!/bin/sh /etc/rc.common
# 提供 START 和 STOP 命令
START=99
STOP=15
start() {
# 启动你的应用程序的命令
/usr/bin/myapp &
}
stop() {
# 停止你的应用程序的命令,如果有的话
killall myapp
}
# 如果你的脚本支持重启,也可以添加 restart() 函数
# 调用 run-parts 服务以管理此脚本
ENABLE_SVC=yes
3. 使脚本在系统启动时自动运行
要使脚本在系统启动时自动运行,你需要通过 /etc/rc.local 文件(对于较旧版本的 OpenWrt)或通过更新 /etc/config/system 文件(对于较新版本的 OpenWrt,使用 UCI 系统)来启用它。
对于较新版本的 OpenWrt(使用 UCI):
你可以通过 UCI 命令来启用服务,或者手动编辑 /etc/config/system 文件,添加或更新对服务的引用。但是,对于 /etc/init.d/ 下的脚本,通常不需要直接修改 /etc/config/system,因为 OpenWrt 的启动过程会自动查找并运行 /etc/init.d/ 目录下的启动脚本。
确保你的脚本文件名以 S 开头,并且有一个适当的启动顺序号(如上例中的 99),这样它就可以在系统启动的适当时间被调用了。
4. 重启系统以测试
最后,重启你的 OpenWrt 设备以测试你的脚本是否按预期工作:
reboot
在设备重启后,你可以通过查看系统日志(如使用 logread 命令)来确认你的应用程序是否已成功启动。
注意
- 确保你的应用程序和脚本路径正确无误。
- 如果你的应用程序需要特定的环境变量或配置文件,确保这些也被正确设置。
- 如果你在 OpenWrt 的构建环境中工作(即你正在编译自己的固件),你可能还需要在 Makefile 或其他配置文件中添加额外的依赖项或配置。
源码中打包出来的实例 /etc/init.d/S99swupdate_autorun
#!/bin/sh /etc/rc.common
#Copyright (c) 2018-2020 Allwinner Technology Co. Ltd.
START=99
DEPEND=done
PROG=/sbin/swupdate_cmd.sh
PROG_PROGRESS=/sbin/swupdate-progress
start(){
$PROG_PROGRESS -w > /dev/console 2>&1 &
$PROG
}
搜索结果:
wmd@wmd-pc:/opt/share_win/Tina-Linux-20231212$ grep -nriE S99swupdate_autorun
package/allwinner/swupdate/Makefile:117: $(INSTALL_BIN) ./swupdate_autorun.init $(1)/etc/init.d/S99swupdate_autorun
out/t113-bingpi_m2/compile_dir/target/rootfs-tmp/usr/lib/opkg/info/swupdate.list:3:/etc/init.d/S99swupdate_autorun
out/t113-bingpi_m2/compile_dir/target/rootfs/usr/lib/opkg/info/swupdate.list:3:/etc/init.d/S99swupdate_autorun
package/allwinner/swupdate/Makefile 是其配置文件,如下内容为install部分内容:
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/swupdate $(1)/sbin
ifeq ($(CONFIG_SWUPDATE_CONFIG_REMOVE_PROGRESS),)
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/swupdate-progress $(1)/sbin
endif
ifeq ($(CONFIG_SWUPDATE_CONFIG_REMOVE_CLIENT),)
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/swupdate-client $(1)/sbin
endif
ifneq ($(CONFIG_SWUPDATE_CONFIG_SURICATTA_HAWKBIT),)
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/swupdate-hawkbitcfg $(1)/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/swupdate-sendtohawkbit $(1)/sbin
endif
ifeq ($(CONFIG_SWUPDATE_CONFIG_REMOVE_AUTORUN),)
$(INSTALL_BIN) ./swupdate_autorun.init $(1)/etc/init.d/S99swupdate_autorun
$(INSTALL_BIN) ./swupdate_cmd.sh $(1)/sbin
endif
endef
QT
package/gui/qt/qt5/Makefile
PKG_NAME:=qt5
PKG_VERSION:=5.12.9
PKG_RELEASE:=1
gui:
package/gui$ ls
directfb efl flutter gtk libs littlevgl-6 littlevgl-8 minigui qt waylan
qt demo
cd /usr/lib/arm-qt/examples
chmod 777 animatedtiles
./animatedtiles
package/busybox-init-base-files/usr/lib/arm-qt/qml/QT*
SDK说明
file:///opt/share_win/00_%E5%BF%85%E7%9C%8B%EF%BC%81_%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B%E6%96%87%E6%A1%A3/BingPi-M2%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B_V1.0.pdf

wangmingdong
接usb线
装USB驱动
按住KEY-FEL再插入USB线
打开烧录工具,tinalinux\0_驱动和工具\SPI_NAND镜像烧录工具\PhoenixSuitLSB,选择烧录的文件tina_t113-bingpi_m2_uart3
插入USB线后提示是否格式化烧录,确认即可
wangmingdong
root@TinaLinux:/# cat /var/log/messages | grep woshi
Jan 1 00:00:06 TinaLinux user.notice root: woshi_start
Jan 1 00:00:06 TinaLinux user.notice root: woshi_run
Jan 1 00:00:06 TinaLinux user.notice root: woshi_finished
root@TinaLinux:/# cat /etc/init.d/Swoshi.sh
#!/bin/sh
logger “woshi_start”
logger “woshi_run”
logger “woshi_finished”
wangmingdong
集成应用并设置开机自启:
前置条件,打开日志
make menuconfig -> Base system -> busybox-init-base-files :
* Use the rc.log
* Auto load the script in /etc/rc.d
* Use the rc.modules
在package/busybox-init-base-files/files/etc/init.d目录下添加脚本,如:名称Swoshi.sh 内容为:
#!/bin/sh
logger “woshi_start”
logger “woshi_run”
logger “woshi_finished”
make & mboot & pack 编译打包之后,烧录验证,日志有脚本打印的日志
# cat /var/log/messages | grep woshi
Jan 1 00:00:06 TinaLinux user.notice root: woshi_start
Jan 1 00:00:06 TinaLinux user.notice root: woshi_run
Jan 1 00:00:06 TinaLinux user.notice root: woshi_finished
wangmingdong
rc.final:
mkdir -p /var/run
mkdir -p /var/lock
/sbin/ubusd &
then test as below:
ubus monitor 2>&1 > /var/log/1.log
ubus call network.interface lan status
wangmingdong
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include “logger.h”
//server start
#include
#include
#include
#include
static struct ubus_context *ctx;
static struct ubus_request_data req_data;
static struct blob_buf bb;
static int ering_handler( struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg );
/* Enum for EGI policy order */
enum {
ERING_ID,
ERING_DATA,
ERING_MSG,
__ERING_MAX,
};
/* Ubus Policy */
static const struct blobmsg_policy ering_policy[] =
{
[ERING_ID] = { .name=”id”, .type=BLOBMSG_TYPE_INT32},
[ERING_DATA] = { .name=”data”, .type=BLOBMSG_TYPE_INT32 },
[ERING_MSG] = { .name=”msg”, .type=BLOBMSG_TYPE_STRING },
};
/* Ubus Methods */
static const struct ubus_method ering_methods[] =
{
UBUS_METHOD(“ering_method”, ering_handler, ering_policy),
};
/* Ubus object type */
static struct ubus_object_type ering_obj_type =
UBUS_OBJECT_TYPE(“ering_uobj”, ering_methods);
/* Ubus object */
static struct ubus_object server_ering_obj=
{
.name = “ering.host”, /* with APP name */
.type = &ering_obj_type,
.methods = ering_methods,
.n_methods = ARRAY_SIZE(ering_methods),
//.path= /* useless */
};
void start_server(void)
{
int ret;
const char *ubus_socket=NULL; /* use default UNIX sock path: /var/run/ubus.sock */
log_debug(“zmw_server”, “uloop_init\n”);
/* 1. create an epoll instatnce descriptor poll_fd */
uloop_init();
/* 2. connect to ubusd and get ctx */
log_debug(“zmw_server”, “ubus_connect\n”);
ctx=ubus_connect(ubus_socket);
if(ctx==NULL) {
log_debug(“zmw_server”, “Fail to connect to ubusd!\n”);
return;
}
/* 3. registger epoll events to uloop, start sock listening */
log_debug(“zmw_server”, “ubus_add_uloop\n”);
ubus_add_uloop(ctx);
/* 4. register a usb_object to ubusd */
log_debug(“zmw_server”, “ubus_add_object\n”);
ret=ubus_add_object(ctx, &server_ering_obj);
if(ret!=0) {
log_debug(“zmw_server”, “Fail to register an object to ubus.\n”);
goto UBUS_FAIL;
} else {
log_debug(“zmw_server”, “Add ‘%s’ to ubus @%u successfully.\n”, server_ering_obj.name, server_ering_obj.id);
}
/* 5. uloop routine: events monitoring and callback provoking */
log_debug(“zmw_server”, “uloop_run\n”);
uloop_run();
log_debug(“zmw_server”, “uloop_done\n”);
uloop_done();
UBUS_FAIL:
ubus_free(ctx);
}
/*———————————————
A callback function for ubus methods handling
———————————————-*/
static int ering_handler( struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg )
{
struct blob_attr *tb[__ERING_MAX]; /* for parsed attr */
/* Parse blob_msg from the caller to request policy */
blobmsg_parse(ering_policy, ARRAY_SIZE(ering_policy), tb, blob_data(msg), blob_len(msg));
/* print request msg */
log_debug(“zmw_server”, “Receive msg from caller: “);
if(tb[ERING_ID])
log_debug(“zmw_server”, “UBUS_ID=%u “, blobmsg_get_u32(tb[ERING_ID]));
if(tb[ERING_DATA])
log_debug(“zmw_server”, “DATA=%u “, blobmsg_get_u32(tb[ERING_DATA]));
if(tb[ERING_MSG])
log_debug(“zmw_server”, “MSG=’%s’ \n”, blobmsg_data(tb[ERING_MSG]));
/* Do some job here according to caller’s request */
/* send a reply msg to the caller for information */
blob_buf_init(&bb, 0);
blobmsg_add_string(&bb,”Ering reply”, “Request is being proceeded!”);
ubus_send_reply(ctx, req, bb.head);
/* —– reply results to the caller —–
* NOTE: we may put proceeding job in a timeout task, just to speed up service response.
*/
ubus_defer_request(ctx, req, &req_data);
ubus_complete_deferred_request(ctx, req, UBUS_STATUS_OK);
}
//server end
//client start
#include
#include
#include
static struct ubus_context *ctx;
static struct blob_buf bb;
static void result_handler(struct ubus_request *req, int type, struct blob_attr *msg);
/* ubus object assignment */
static struct ubus_object ering_obj=
{
.name = “ering_caller”,
#if 0
.type = &ering_obj_type,
.methods = ering_methods,
.n_methods = ARRAY_SIZE(ering_methods),
.path= /* useless */
#endif
};
void start_client(void)
{
int ret;
uint32_t host_id; /* ering host id */
const char *ubus_socket=NULL; /* use default UNIX sock path: /var/run/ubus.sock */
/* 1. create an epoll instatnce descriptor poll_fd */
uloop_init();
/* 2. connect to ubusd and get ctx */
ctx=ubus_connect(ubus_socket);
if(ctx==NULL) {
log_debug(“zmw_client”, “Fail to connect to ubusd!\n”);
return;
}
/* 3. registger epoll events to uloop, start sock listening */
ubus_add_uloop(ctx);
/* 4. register a usb_object to ubusd */
ret=ubus_add_object(ctx, &ering_obj);
if(ret!=0) {
log_debug(“zmw_client”, “Fail to register an object to ubus.\n”);
goto UBUS_FAIL;
} else {
log_debug(“zmw_client”, “Add ‘%s’ to ubus @%u successfully.\n”,ering_obj.name, ering_obj.id);
}
/* 5. search a registered object with a given name */
if( ubus_lookup_id(ctx, “ering.host”, &host_id) ) {
log_debug(“zmw_client”, “ering.host is NOT found in ubus!\n”);
goto UBUS_FAIL;
}
log_debug(“zmw_client”, “ering.host is found in ubus @%u.\n”,host_id);
/* 6. prepare request method policy and data */
blob_buf_init(&bb,0);
blobmsg_add_u32(&bb,”id”, ering_obj.id); /* ERING_ID */
blobmsg_add_u32(&bb,”data”, 123456); /* ERING_DATA */
blobmsg_add_string(&bb,”msg”, “Hello, ERING!”); /* ERING_DATA */
/* 7. call the ubus host object */
ret=ubus_invoke(ctx, host_id, “ering_method”, bb.head, result_handler, 0, 3000);
log_debug(“zmw_client”, “Call result: %s\n”, ubus_strerror(ret));
/* 8. uloop routine: events monitoring and callback provoking
However, we just ignore uloop in this example.
*/
//uloop_run();
uloop_done();
UBUS_FAIL:
ubus_free(ctx);
}
/* callback function for ubus_invoke to process result from the host
* Here we just print out the message.
*/
static void result_handler(struct ubus_request *req, int type, struct blob_attr *msg)
{
char *strmsg;
if(!msg)
return;
strmsg=blobmsg_format_json_indent(msg,true, 0); /* 0 type of format */
log_debug(“zmw_client”, “Response from the host: %s\n”, strmsg);
free(strmsg); /* need to free strmsg */
}
//client end
/* Signal handler */
static void terminate(int sig_no)
{
log_debug(“zmw”, “zmw Got signal %d, exiting …\n”, sig_no);
// release resources
log_debug(“zmw”, “zmw terminate”);
exit(1);
}
int actor_type = 0; // 0=server, 1=client
int parse_cmdline(int argc, char **argv)
{
int i = 0;
int type = 0;
i = 0;
while(i i+1) {
i++;
type = atoi(argv[i]);
}
}
i++;
}
actor_type = type;
log_debug(“zmw”, “zmw parse_cmdline type:%d\n”, actor_type);
return 0;
}
static void install_sig_handler(void)
{
signal(SIGBUS, terminate);
signal(SIGFPE, terminate);
signal(SIGHUP, terminate);
signal(SIGILL, terminate);
signal(SIGINT, terminate);
signal(SIGIOT, terminate);
signal(SIGPIPE, terminate);
signal(SIGQUIT, terminate);
signal(SIGSEGV, terminate);
signal(SIGSYS, terminate);
signal(SIGTERM, terminate);
signal(SIGTRAP, terminate);
signal(SIGUSR1, terminate);
signal(SIGUSR2, terminate);
}
int main(int argc, char **argv)
{
log_debug(“zmw”, “zmw main start\n”);
install_sig_handler();
(void)parse_cmdline(argc,argv);
if(1 == actor_type)
{
log_debug(“zmw”, “start_client\n”);
start_client();
}
else
{
log_debug(“zmw”, “start_server\n”);
start_server();
}
log_debug(“zmw”, “zmw main exit\n”);
return 0;
}
wangmingdong
Dock安装
sudo apt install docker.io
sudo usermod -aG docker $USER #添加当前用户到docker用户组,否则没有权限
newgrp docker #登录docker用户组
Dock加载
docker load -i mss-docker-ubuntu1804-v1.0-20240416.tar
Dock登录
#!/bin/bash
# 确保当前工作目录是 /opt/mss
cd /opt/mss || { echo “Failed to change directory”; exit 1; }
# 设置宿主机上的 SDK 目录
export SDK_DIR=$(pwd)
# 确保 SDK 目录存在
if [ ! -d “$SDK_DIR” ]; then
echo “Creating SDK directory: $SDK_DIR”
mkdir -p “$SDK_DIR” || { echo “Failed to create SDK directory”; exit 1; }
fi
echo “SDK directory exists: $SDK_DIR”
# 设置容器内的 SDK 目录
export DOCKER_DIR=/home/mss/sdk_dir
# 获取当前用户的 UID 和 GID
export DOCKER_UID=$(id -u)
export DOCKER_GID=$(id -g)
echo “Current user UID: $DOCKER_UID, GID: $DOCKER_GID”
# 设置 Docker 镜像名称和版本
export DOCKER_IMAGE_NAME=mss-docker-ubuntu1804
export DOCKER_IMAGE_VERSION=v1.01
# 检查 Docker 镜像是否存在
docker image inspect “${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_VERSION}” &>/dev/null || {
echo “Docker image ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_VERSION} does not exist.”
exit 1;
}
# 启动容器
docker run \
–rm -it \
–entrypoint /bin/bash \
–mount type=bind,source=”$SDK_DIR”,target=”$DOCKER_DIR” \
–net host \
–user “${DOCKER_UID}:${DOCKER_GID}” \
–workdir “$DOCKER_DIR” \
${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_VERSION}
wangmingdong
#### make completed successfully (56:08 (mm:ss)) ####
wangmingdong
Livesuit (Ubuntu烧录工具)
https://thoughts.teambition.com/share/5ff5aa2068c1c000466f61f3
https://www.codenong.com/cs105573875/
sudo apt-get install libtool
sudo apt-get install zlib1g-dev
wangmingdong
wangmingdong
pack failed:
mbr size = 16384
mbr magic softw411
disk name=boot-resource
ERROR: dl file boot-resource.fex size too large
ERROR: filename = boot-resource.fex
ERROR: dl_file_size = 12650 sector
ERROR: part_size = 1850 sector
update_for_part_info -1
ERROR: update mbr file fail
ERROR: update_mbr failed
解决:
编辑device/config/chips/t113/configs/bingpi_m2/sys_partition.fex
修改size大小
wangmingdong
adb — no permissions (user in plugdev group; are your udev rules wrong?)解决方案
https://blog.csdn.net/cccc_strive/article/details/128440644
wangmingdong
Mangopi MQ-R:T113-s3编译Tina Linux系统(三)独立编译Qt5
https://blog.csdn.net/qq_28877125/article/details/127098767
t113-s3的tina linux如何配置及编译sdk自带的qt?
https://whycan.com/p_89265.html
基于D1s的QT5移植
https://bbs.aw-ol.com/topic/944/%E5%9F%BA%E4%BA%8Ed1s%E7%9A%84qt5%E7%A7%BB%E6%A4%8D?lang=zh-CN
wangmingdong
HELL= flock /home/mss/sdk_dir/tinasdk/tmp/.qt-everywhere-opensource-src-5.12.9.tar.xz.flock -c ‘ /home/mss/sdk_dir/tinasdk/scripts/download.pl “/home/mss/sdk_dir/tinasdk/dl” “qt-everywhere-opensource-src-5.12.9.tar.xz” “f177284b4d3d572aa46a34ac8f5a7f00” “” “http://download.qt.io/archive/qt/5.12/5.12.9/single”‘
URL transformed to HTTPS due to an HSTS policy
–2024-11-19 15:50:33– https://download.qt.io/archive/qt/5.12/5.12.9/single/qt-everywhere-opensource-src-5.12.9.tar.xz
Resolving download.qt.io (download.qt.io)… 77.86.162.2
Connecting to download.qt.io (download.qt.io)|77.86.162.2|:443… connected.
HTTP request sent, awaiting response… 403 Forbidden
2024-11-19 15:50:35 ERROR 403: Forbidden.
Download failed.
–2024-11-19 15:50:35– http://mirror2.openwrt.org/sources/qt-everywhere-opensource-src-5.12.9.tar.xz
Resolving mirror2.openwrt.org (mirror2.openwrt.org)… 2a01:4f8:221:3d45::2, 46.4.11.11
Connecting to mirror2.openwrt.org (mirror2.openwrt.org)|2a01:4f8:221:3d45::2|:80… connected.
HTTP request sent, awaiting response… 404 Not Found
2024-11-19 15:50:41 ERROR 404: Not Found.
Download failed.
–2024-11-19 15:50:41– http://downloads.openwrt.org/sources/qt-everywhere-opensource-src-5.12.9.tar.xz
Resolving downloads.openwrt.org (downloads.openwrt.org)… 2a04:4e42:1a::644, 151.101.110.132
Connecting to downloads.openwrt.org (downloads.openwrt.org)|2a04:4e42:1a::644|:80… connected.
HTTP request sent, awaiting response… 301 Moved Permanently
Location: https://sources.openwrt.org/qt-everywhere-opensource-src-5.12.9.tar.xz [following]
–2024-11-19 15:50:48– https://sources.openwrt.org/qt-everywhere-opensource-src-5.12.9.tar.xz
Resolving sources.openwrt.org (sources.openwrt.org)… 2a03:4000:3b:221::1, 185.163.119.85
Connecting to sources.openwrt.org (sources.openwrt.org)|2a03:4000:3b:221::1|:443… connected.
HTTP request sent, awaiting response… 404 Not Found
2024-11-19 15:50:49 ERROR 404: Not Found.
Download failed.
No more mirrors to try – giving up.
Makefile:1433: recipe for target ‘/home/mss/sdk_dir/tinasdk/dl/qt-everywhere-opensource-src-5.12.9.tar.xz’ failed
make[3]: *** [/home/mss/sdk_dir/tinasdk/dl/qt-everywhere-opensource-src-5.12.9.tar.xz] Error 2
make[3]: Leaving directory ‘/home/mss/sdk_dir/tinasdk/package/gui/qt/qt5’
package/Makefile:192: recipe for target ‘package/gui/qt/qt5/compile’ failed
make[2]: *** [package/gui/qt/qt5/compile] Error 2
make[2]: Leaving directory ‘/home/mss/sdk_dir/tinasdk’
package/Makefile:189: recipe for target ‘/home/mss/sdk_dir/tinasdk/out/t113-bingpi_m2/staging_dir/target/stamp/.package_compile’ failed
make[1]: *** [/home/mss/sdk_dir/tinasdk/out/t113-bingpi_m2/staging_dir/target/stamp/.package_compile] Error 2
make[1]: Leaving directory ‘/home/mss/sdk_dir/tinasdk’
/home/mss/sdk_dir/tinasdk/build/toplevel.mk:304: recipe for target ‘world’ failed
make: *** [world] Error 2
[1]+ Done $T/tools/build/buildserver –path $T 2> /dev/null 1>&2
wangmingdong
QT国内镜像源:(注意下载linux(.tar.xz)/Windows(.zip)下不同的源码包)
https://mirrors.tuna.tsinghua.edu.cn/qt/archive/qt/5.15/
QT官网:(无法下载,点击版本的网络提示所在IP无法访问)
https://download.qt.io/archive/qt/
wangmingdong
交叉编译QT
配置环境变量
export PATH=$PATH:/opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/
export STAGING_DIR=/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir
qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf
#
# qmake configuration for building with arm-linux-gnueabi-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
include(../common/linux.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
# modifications to g++.conf
QMAKE_CC = /opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-gcc
QMAKE_CXX = /opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-g++
QMAKE_LINK = /opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-g++
QMAKE_LINK_SHLIB = /opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-g++
# modifications to linux.conf
QMAKE_AR = /opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-ar cqs
QMAKE_OBJCOPY = /opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-objcopy
QMAKE_NM = /opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-nm -P
QMAKE_STRIP = /opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-strip
load(qt_config)
autoconfigure.sh
#!/bin/sh
./configure \
-prefix /opt/mss/tools/qt5.15.9-arm \
-opensource \
-confirm-license \
-release \
-strip \
-shared \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-c++std c++11 \
--rpath=no \
-pch \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdoc \
-skip qtgamepad \
-skip qtlocation \
-skip qtmacextras \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtwayland \
-skip qtwebengine \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-make libs \
-make examples \
-nomake tools -nomake tests \
-gui \
-widgets \
-dbus-runtime \
--glib=no \
--iconv=no \
--pcre=qt \
--zlib=qt \
-no-openssl \
--freetype=qt \
--harfbuzz=qt \
-no-opengl \
-linuxfb \
--xcb=no \
-tslib \
--libpng=qt \
--libjpeg=qt \
--sqlite=qt \
-plugin-sql-sqlite \
-plugin-sql-sqlite \
-I/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/include/ \
-I/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/include/allwinner/ \
-I/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/include/allwinner/include/ \
-L/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/lib/ \
-recheck-all
编译安装
sudo ./autoconfigure.sh
time make
sudo make install
wangmingdong
编译报错:
qlogging.cpp:(.text+0x455c): undefined reference to `backtrace’
qlogging.cpp:(.text+0x461c): undefined reference to `backtrace_symbols’
解决:
修改qtbase/src/corelib/global/qlogging.cpp, 注释掉backtrace调用的地方
wangmingdong
编译报错:
/opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/../lib/gcc/arm-openwrt-linux-muslgnueabi/6.4.1/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: warning: libudev.so.1, needed by /opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so, not found (try using -rpath or -rpath-link)
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_list_entry_get_next@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_unref@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_list_entry_get_name@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_enumerate_unref@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_new@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_get_devnode@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_enumerate_new@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_get_parent@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_unref@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_get_property_value@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_get_driver@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_enumerate_get_list_entry@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_enumerate_scan_devices@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_enumerate_add_match_subsystem@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_get_sysname@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_new_from_syspath@LIBUDEV_183′
collect2: error: ld returned 1 exit status
wangmingdong
make menuconfig
close libgpu
open udev
wangmingdong
/opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/arm-openwrt-linux-g++ -Wl,-O1 -Wl,–enable-new-dtags -o cenumerator .obj/main.o -L/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/lib/ /opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so /opt/mss/tools/qt-everywhere-src-5.15.9/qtbase/lib/libQt5Core.so -lpthread
arm-openwrt-linux-muslgnueabi-g++.bin: warning: environment variable ‘STAGING_DIR’ not defined
arm-openwrt-linux-muslgnueabi-g++.bin: warning: environment variable ‘STAGING_DIR’ not defined
/opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/../lib/gcc/arm-openwrt-linux-muslgnueabi/6.4.1/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: warning: libudev.so.1, needed by /opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so, not found (try using -rpath or -rpath-link)
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_list_entry_get_next@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_unref@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_list_entry_get_name@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_enumerate_unref@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_new@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_get_devnode@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_enumerate_new@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_get_parent@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_unref@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_get_property_value@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_get_driver@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_enumerate_get_list_entry@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_enumerate_scan_devices@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_enumerate_add_match_subsystem@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_get_sysname@LIBUDEV_183′
/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/lib/libQt5SerialPort.so: undefined reference to `udev_device_new_from_syspath@LIBUDEV_183′
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:71:cenumerator] 错误 1
make[4]: 离开目录“/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/examples/serialport/cenumerator”
make[3]: *** [Makefile:57:sub-cenumerator-make_first] 错误 2
make[3]: 离开目录“/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/examples/serialport”
make[2]: *** [Makefile:47:sub-serialport-make_first] 错误 2
make[2]: 离开目录“/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport/examples”
make[1]: *** [Makefile:74:sub-examples-make_first] 错误 2
make[1]: 离开目录“/opt/mss/tools/qt-everywhere-src-5.15.9/qtserialport”
make: *** [Makefile:87:module-qtserialport-make_first] 错误 2
Command exited with non-zero status 2
1864.20user 158.13system 33:38.13elapsed 100%CPU (0avgtext+0avgdata 487504maxresident)k
4792inputs+2626016outputs (22major+102821640minor)pagefaults 0swaps
wangmingdong
#!/bin/sh
export STAGING_DIR=/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir
./configure \
-prefix /opt/mss/tools/qt5.15.9-arm \
-opensource \
-confirm-license \
-release \
-strip \
-shared \
-xplatform linux-arm-gnueabi-g++ \
-optimized-qmake \
-c++std c++14 \
–rpath=no \
-pch \
-skip qt3d \
-skip qtactiveqt \
-skip qtandroidextras \
-skip qtcanvas3d \
-skip qtconnectivity \
-skip qtdatavis3d \
-skip qtdoc \
-skip qtgamepad \
-skip qtlocation \
-skip qtmacextras \
-skip qtnetworkauth \
-skip qtpurchasing \
-skip qtremoteobjects \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtspeech \
-skip qtsvg \
-skip qttools \
-skip qttranslations \
-skip qtwayland \
-skip qtwebengine \
-skip qtwebview \
-skip qtwinextras \
-skip qtx11extras \
-skip qtxmlpatterns \
-make libs \
-nomake examples \
-nomake tools -nomake tests \
-gui \
-widgets \
-dbus-runtime \
–glib=no \
–iconv=no \
–pcre=qt \
–zlib=qt \
-no-openssl \
–freetype=qt \
–harfbuzz=qt \
-no-opengl \
-linuxfb \
–xcb=no \
-tslib \
–libpng=qt \
–libjpeg=qt \
–sqlite=qt \
-plugin-sql-sqlite \
-plugin-sql-sqlite \
-I/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/include/ \
-I/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/include/allwinner/ \
-I/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/include/allwinner/include/ \
-L/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/lib/ \
-recheck-all \
wangmingdong
export PATH=$PATH:/opt/mss/tinasdk/prebuilt/gcc/linux-x86/arm/toolchain-sunxi-musl/toolchain/bin/
export STAGING_DIR=/opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir
git config –global –add safe.directory /home/mss/sdk_dir/tinasdk
编译报错:
qlogging.cpp:(.text+0x455c): undefined reference to `backtrace’
qlogging.cpp:(.text+0x461c): undefined reference to `backtrace_symbols’
解决:
修改qtbase/src/corelib/global/qlogging.cpp, 注释掉backtrace调用的地方
-ludev /opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/lib/libudev.so.1
wangmingdong
sudo ‘/home/wmd/Downloads/qt-unified-linux-x64-online.run’ –mirror https://mirrors.tuna.tsinghua.edu.cn/qt
wangmingdong
https://mirrors.tuna.tsinghua.edu.cn/qt/online/qtsdkrepository/windows_x86/desktop/qt5_5152/
wangmingdong
qt app build:
qmake -project //to generate *.pro
qmake *.pro //to generate Makefile
make //to build app bin
交叉编译出来的Lib, plugins目录拷贝到目录
how to run in remote device:
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event1
export QT_ROOT=/mnt/UDISK
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts
export QT_QPA_GENERIC_PLUGINS=tslib:$TSLIB_TSDEVICE
export QT_QPA_FB_TSLIB=1
export QML2_IMPORT_PATH=$QT_ROOT/qml
export QT_DEBUG_PLUGINS=1
#export QT_QPA_EGLFS_TSLIB=1
#export QT_QPA_FB_TSLIB=1
#export QT_DEBUG_PLUGINS=1
qml相关的加载失败,需要export QT_DEBUG_PLUGINS=1,然后看具体报错
提示找不到的库,是Push到设备的.so.5文件是链接,但是没有链接好,直接拷贝文件到.so.5之后,可以解决库加载失败的问题
洗衣机的界面是横屏的
wangmingdong
分辨率,界面旋转
main.cpp: //添加Quickview所需的头文件 //添加QQuickTransform所需的头文件
#include
#include
// #include
#include
#include
#include
//这个结构体是来自那位博主的代码
//作用按照我拙劣的理解应该是一个转置+平移的功能
//具体可以看那位博主的博客,里面有图片可以对照理解。
struct MyTransform : public QQuickTransform {
MyTransform(QSizeF size) {
// tr_.rotate(270);
// tr_ *= QTransform::fromTranslate(0, size.width());
tr_.rotate(90);
tr_ *= QTransform::fromTranslate(size.height(), 0);
}
virtual void applyTo(QMatrix4x4 *matrix) const
{
*matrix = *matrix * tr_;
}
QTransform tr_;
};
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QRect mRect;width();
mRect = QGuiApplication::primaryScreen()->geometry();
qDebug()<<"@@@@@@@@@@@@@b width:"<
} else {
qDebug() << "Failed to get root object."; } //这部分代码也是来自那位博主,用于实现旋转和平移。 QQuickItem * root = view.rootObject(); QSizeF size{root->width(), root->height()};
view.resize(size.height(), size.width());
(new MyTransform(size))->appendToItem(root);
#endif
return app.exec();
}
qml:
import QtQuick 2.10
import QtQuick.Window 2.10
Item {
visible: true
width: 384
height: 216
Image {
source: “images/neiyi.png”
}
wangmingdong
目前获取的分辨率:216×384
wangmingdong
11/23总结:
1. 通过qc编译失败
2. 通过指令编译OK
3. 运行需要拷贝依赖的文件,配置环境变量
4. 需要熟悉界面开发
5. 需要确认触摸是否OK,已经是否需要旋转
wangmingdong
SDK: 补充下libgpu关闭了,udev打开了。QT的因为编译失败,都关闭了。
wangmingdong
触摸的依赖,还有屏幕旋转确认是否要看下,屏幕和触摸同步解决;
下一步:接入文件监控模拟事件注入;软件编译使用-g,-O带调试信息,以及打印堆栈;
wangmingdong
git config –global –add safe.directory /home/mss/sdk_dir/tinasdk_1124_origin
FORCE_UNSAFE_CONFIGURE=1
wangmingdong
新sdk手顺:
合入驱动patch
make kernel_menuconfig
meke menuconfig
git config –global –add safe.directory /xxxxxxxxxx/sdk路径
FORCE_UNSAFE_CONFIGURE=1
make
mboot
pack
在ubuntu使用livesuit来烧录
wangmingdong
交叉编译QT 5.12.9 经验谈 (二番战)
1. 交叉编译错误,链接不到backtrace的接口
解决:qtlogger.cpp中删除调用backtrace的地方
2. 交叉编译错误,链接不到Udev的接口
解决:修改qtbase/mkspecs/linux-arm-gnueabi-g++/qmake.conf,添加如下:
QMAKE_LIBS = /opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/lib/libudev.so.1
3. 检查编译之后,make install安装失败,提示如下:
Python not found.
Building QtQml requires Python.
意味着缺失或找不到python资源包
解决办法:
1.未装Python资源包;
sudo apt install python3.8
2.资源包未获取到;
找到资源包并放置在/usr/bin/python
目录下
which python3
sudo cp -r /usr/bin/python3 /usr/bin/python
4. 安装到设备运行时报错,提示缺少Udev的库,将Udev的库拷贝到/lib目录下
5. 安装到设备运行时报错,提示qml无法加载
解决:
5.1 修改*.qml中import接口的版本,如下:
import QtQuick 2.0
import QtQuick.Window 2.0
5.2 配置环境变量
export QML2_IMPORT_PATH=/usr/lib/arm-qt/qml
wangmingdong
LIBS = $(SUBLIBS) /opt/mss/tools/opt_backup/opt/Qt5.12.9/5.12.9/Output/lib/libQt5Gui.so /opt/mss/tools/opt_backup/opt/Qt5.12.9/5.12.9/Output/lib/libQt5Core.so -lpthread /opt/mss/tinasdk/out/t113-bingpi_m2/staging_dir/target/usr/lib/libudev.so.1 /opt/mss/tools/opt_backup/opt/Qt5.12.9/5.12.9/Output/lib/libQt5Widgets.so
wangmingdong
开机自启动: /etc/init.d/rc.moduels:
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event2
export QT_ROOT=/usr/lib/arm-qt
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0
export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts
export QT_QPA_GENERIC_PLUGINS=tslib:$TSLIB_TSDEVICE
export QML2_IMPORT_PATH=$QT_ROOT/qml
/mnt/UDISK/qt-washing-machine &
wangmingdong
uic xxx.ui -o ui_xxx.h
wangmingdong
QT的界面切换显示加速
https://blog.csdn.net/qq_35570735/article/details/85008257
在嵌入式板子上显示图像经常感到卡顿,尤其是在加载背景图像时。那么我们来理一下加速的方法吧。
1.不使用setBackgroundRole这个函数而是后面放一个QLabel等显示控件来显示图片当做背景。
2.不要使用QImage等函数去加载图像,而是使用QPixmap去加载图像。
3.自己裁剪好图像大小,以免使用程序自适应大小
4.提前加载进内存(在图像数据少时一口气加载进内存),使用qrc(图片多时用rcc)还是不够的,还需要自己手动加载。
5.界面和功能实现在不同的线程中
我这里有一个例子大家可以看看。
链接:https://pan.baidu.com/s/1O2k0CViQW619Zwjf_fdEmQ 密码:dqry
wangmingdong
QT5.9移植ARM实现界面UI旋转90°–linuxfb显示
https://blog.csdn.net/qq_15725099/article/details/102717970
wangmingdong
export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event2:rotate=270
wangmingdong
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include “qlinuxfbscreen.h”
#include
#include
#include
#include
#include
#include // overrides QT_OPEN
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
QT_BEGIN_NAMESPACE
static int openFramebufferDevice(const QString &dev)
{
int fd = -1;
if (access(dev.toLatin1().constData(), R_OK|W_OK) == 0)
fd = QT_OPEN(dev.toLatin1().constData(), O_RDWR);
if (fd == -1) {
if (access(dev.toLatin1().constData(), R_OK) == 0)
fd = QT_OPEN(dev.toLatin1().constData(), O_RDONLY);
}
return fd;
}
static int determineDepth(const fb_var_screeninfo &vinfo)
{
int depth = vinfo.bits_per_pixel;
if (depth== 24) {
depth = vinfo.red.length + vinfo.green.length + vinfo.blue.length;
if (depth <= 0) depth = 24; // reset if color component lengths are not reported } else if (depth == 16) { depth = vinfo.red.length + vinfo.green.length + vinfo.blue.length; if (depth <= 0) depth = 16; } return depth; } static QRect determineGeometry(const fb_var_screeninfo &vinfo, const QRect &userGeometry) { int xoff = vinfo.xoffset; int yoff = vinfo.yoffset; int w, h; if (userGeometry.isValid()) { w = userGeometry.width(); h = userGeometry.height(); if ((uint)w > vinfo.xres)
w = vinfo.xres;
if ((uint)h > vinfo.yres)
h = vinfo.yres;
int xxoff = userGeometry.x(), yyoff = userGeometry.y();
if (xxoff != 0 || yyoff != 0) {
if (xxoff < 0 || xxoff + w > (int)(vinfo.xres))
xxoff = vinfo.xres – w;
if (yyoff < 0 || yyoff + h > (int)(vinfo.yres))
yyoff = vinfo.yres – h;
xoff += xxoff;
yoff += yyoff;
} else {
xoff += (vinfo.xres – w)/2;
yoff += (vinfo.yres – h)/2;
}
} else {
w = vinfo.xres;
h = vinfo.yres;
}
if (w == 0 || h == 0) {
qWarning(“Unable to find screen geometry, using 320×240”);
w = 320;
h = 240;
}
return QRect(xoff, yoff, w, h);
}
static QSizeF determinePhysicalSize(const fb_var_screeninfo &vinfo, const QSize &mmSize, const QSize &res)
{
int mmWidth = mmSize.width(), mmHeight = mmSize.height();
if (mmWidth <= 0 && mmHeight <= 0) { if (vinfo.width != 0 && vinfo.height != 0 && vinfo.width != UINT_MAX && vinfo.height != UINT_MAX) { mmWidth = vinfo.width; mmHeight = vinfo.height; } else { const int dpi = 100; mmWidth = qRound(res.width() * 25.4 / dpi); mmHeight = qRound(res.height() * 25.4 / dpi); } } else if (mmWidth > 0 && mmHeight <= 0) { mmHeight = res.height() * mmWidth/res.width(); } else if (mmHeight > 0 && mmWidth <= 0) { mmWidth = res.width() * mmHeight/res.height(); } return QSize(mmWidth, mmHeight); } static QImage::Format determineFormat(const fb_var_screeninfo &info, int depth) { const fb_bitfield rgba[4] = { info.red, info.green, info.blue, info.transp }; QImage::Format format = QImage::Format_Invalid; switch (depth) { case 32: { const fb_bitfield argb8888[4] = {{16, 8, 0}, {8, 8, 0}, {0, 8, 0}, {24, 8, 0}}; const fb_bitfield abgr8888[4] = {{0, 8, 0}, {8, 8, 0}, {16, 8, 0}, {24, 8, 0}}; if (memcmp(rgba, argb8888, 4 * sizeof(fb_bitfield)) == 0) { format = QImage::Format_ARGB32; } else if (memcmp(rgba, argb8888, 3 * sizeof(fb_bitfield)) == 0) { format = QImage::Format_RGB32; } else if (memcmp(rgba, abgr8888, 3 * sizeof(fb_bitfield)) == 0) { format = QImage::Format_RGB32; // pixeltype = BGRPixel; } break; } case 24: { const fb_bitfield rgb888[4] = {{16, 8, 0}, {8, 8, 0}, {0, 8, 0}, {0, 0, 0}}; const fb_bitfield bgr888[4] = {{0, 8, 0}, {8, 8, 0}, {16, 8, 0}, {0, 0, 0}}; if (memcmp(rgba, rgb888, 3 * sizeof(fb_bitfield)) == 0) { format = QImage::Format_RGB888; } else if (memcmp(rgba, bgr888, 3 * sizeof(fb_bitfield)) == 0) { format = QImage::Format_RGB888; // pixeltype = BGRPixel; } break; } case 18: { const fb_bitfield rgb666[4] = {{12, 6, 0}, {6, 6, 0}, {0, 6, 0}, {0, 0, 0}}; if (memcmp(rgba, rgb666, 3 * sizeof(fb_bitfield)) == 0) format = QImage::Format_RGB666; break; } case 16: { const fb_bitfield rgb565[4] = {{11, 5, 0}, {5, 6, 0}, {0, 5, 0}, {0, 0, 0}}; const fb_bitfield bgr565[4] = {{0, 5, 0}, {5, 6, 0}, {11, 5, 0}, {0, 0, 0}}; if (memcmp(rgba, rgb565, 3 * sizeof(fb_bitfield)) == 0) { format = QImage::Format_RGB16; } else if (memcmp(rgba, bgr565, 3 * sizeof(fb_bitfield)) == 0) { format = QImage::Format_RGB16; // pixeltype = BGRPixel; } break; } case 15: { const fb_bitfield rgb1555[4] = {{10, 5, 0}, {5, 5, 0}, {0, 5, 0}, {15, 1, 0}}; const fb_bitfield bgr1555[4] = {{0, 5, 0}, {5, 5, 0}, {10, 5, 0}, {15, 1, 0}}; if (memcmp(rgba, rgb1555, 3 * sizeof(fb_bitfield)) == 0) { format = QImage::Format_RGB555; } else if (memcmp(rgba, bgr1555, 3 * sizeof(fb_bitfield)) == 0) { format = QImage::Format_RGB555; // pixeltype = BGRPixel; } break; } case 12: { const fb_bitfield rgb444[4] = {{8, 4, 0}, {4, 4, 0}, {0, 4, 0}, {0, 0, 0}}; if (memcmp(rgba, rgb444, 3 * sizeof(fb_bitfield)) == 0) format = QImage::Format_RGB444; break; } case 8: break; case 1: format = QImage::Format_Mono; //###: LSB??? break; default: break; } return format; } static int openTtyDevice(const QString &device) { const char *const devs[] = { "/dev/tty0", "/dev/tty", "/dev/console", 0 }; int fd = -1; if (device.isEmpty()) { for (const char * const *dev = devs; *dev; ++dev) { fd = QT_OPEN(*dev, O_RDWR); if (fd != -1) break; } } else { fd = QT_OPEN(QFile::encodeName(device).constData(), O_RDWR); } return fd; } static void switchToGraphicsMode(int ttyfd, bool doSwitch, int *oldMode) { // Do not warn if the switch fails: the ioctl fails when launching from a // remote console and there is nothing we can do about it. The matching // call in resetTty should at least fail then, too, so we do no harm. if (ioctl(ttyfd, KDGETMODE, oldMode) == 0) { if (doSwitch && *oldMode != KD_GRAPHICS) ioctl(ttyfd, KDSETMODE, KD_GRAPHICS); } } static void resetTty(int ttyfd, int oldMode) { ioctl(ttyfd, KDSETMODE, oldMode); QT_CLOSE(ttyfd); } static void blankScreen(int fd, bool on) { ioctl(fd, FBIOBLANK, on ? VESA_POWERDOWN : VESA_NO_BLANKING); } QLinuxFbScreen::QLinuxFbScreen(const QStringList &args) : mArgs(args), mFbFd(-1), mTtyFd(-1), mBlitter(0), mRotation(90) { mMmap.data = 0; } QLinuxFbScreen::~QLinuxFbScreen() { if (mFbFd != -1) { if (mMmap.data) munmap(mMmap.data - mMmap.offset, mMmap.size); close(mFbFd); } if (mTtyFd != -1) resetTty(mTtyFd, mOldTtyMode); delete mBlitter; } bool QLinuxFbScreen::initialize() { QRegularExpression ttyRx(QLatin1String("tty=(.*)")); QRegularExpression fbRx(QLatin1String("fb=(.*)")); QRegularExpression mmSizeRx(QLatin1String("mmsize=(\\d+)x(\\d+)")); QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)")); QRegularExpression offsetRx(QLatin1String("offset=(\\d+)x(\\d+)")); QRegularExpression rotationRx(QLatin1String("rotation=(0|90|180|270)")); QString fbDevice, ttyDevice; QSize userMmSize; QRect userGeometry; bool doSwitchToGraphicsMode = true; // Parse arguments for (const QString &arg : qAsConst(mArgs)) { QRegularExpressionMatch match; if (arg == QLatin1String("nographicsmodeswitch")) doSwitchToGraphicsMode = false; else if (arg.contains(mmSizeRx, &match)) userMmSize = QSize(match.captured(1).toInt(), match.captured(2).toInt()); else if (arg.contains(sizeRx, &match)) userGeometry.setSize(QSize(match.captured(1).toInt(), match.captured(2).toInt())); else if (arg.contains(offsetRx, &match)) userGeometry.setTopLeft(QPoint(match.captured(1).toInt(), match.captured(2).toInt())); else if (arg.contains(ttyRx, &match)) ttyDevice = match.captured(1); else if (arg.contains(fbRx, &match)) fbDevice = match.captured(1); else if (arg.contains(rotationRx, &match)) mRotation = match.captured(1).toInt(); } if (fbDevice.isEmpty()) { fbDevice = QLatin1String("/dev/fb0"); if (!QFile::exists(fbDevice)) fbDevice = QLatin1String("/dev/graphics/fb0"); if (!QFile::exists(fbDevice)) { qWarning("Unable to figure out framebuffer device. Specify it manually."); return false; } } // Open the device mFbFd = openFramebufferDevice(fbDevice); if (mFbFd == -1) { qErrnoWarning(errno, "Failed to open framebuffer %s", qPrintable(fbDevice)); return false; } // Read the fixed and variable screen information fb_fix_screeninfo finfo; fb_var_screeninfo vinfo; memset(&vinfo, 0, sizeof(vinfo)); memset(&finfo, 0, sizeof(finfo)); if (ioctl(mFbFd, FBIOGET_FSCREENINFO, &finfo) != 0) { qErrnoWarning(errno, "Error reading fixed information"); return false; } if (ioctl(mFbFd, FBIOGET_VSCREENINFO, &vinfo)) { qErrnoWarning(errno, "Error reading variable information"); return false; } mDepth = determineDepth(vinfo); mBytesPerLine = finfo.line_length; QRect geometry = determineGeometry(vinfo, userGeometry); QRect originalGeometry = geometry; if( mRotation == 90 || mRotation == 270 ) { int tmp = geometry.width(); geometry.setWidth(geometry.height()); geometry.setHeight(tmp); } mGeometry = QRect(QPoint(0, 0), geometry.size()); mFormat = determineFormat(vinfo, mDepth); //mPhysicalSize = determinePhysicalSize(vinfo, userMmSize, geometry.size()); mPhysicalSize = determinePhysicalSize(vinfo, userMmSize, originalGeometry.size()); // mmap the framebuffer mMmap.size = finfo.smem_len; uchar *data = (unsigned char *)mmap(0, mMmap.size, PROT_READ | PROT_WRITE, MAP_SHARED, mFbFd, 0); if ((long)data == -1) { qErrnoWarning(errno, "Failed to mmap framebuffer"); return false; } //mMmap.offset = geometry.y() * mBytesPerLine + geometry.x() * mDepth / 8; mMmap.offset = originalGeometry.y() * mBytesPerLine + originalGeometry.x() * mDepth / 8; mMmap.data = data + mMmap.offset; QFbScreen::initializeCompositor(); //mFbScreenImage = QImage(mMmap.data, geometry.width(), geometry.height(), mBytesPerLine, mFormat); mFbScreenImage = QImage(mMmap.data, originalGeometry.width(), originalGeometry.height(), mBytesPerLine, mFormat); mCursor = new QFbCursor(this); mTtyFd = openTtyDevice(ttyDevice); if (mTtyFd == -1) qErrnoWarning(errno, "Failed to open tty"); switchToGraphicsMode(mTtyFd, doSwitchToGraphicsMode, &mOldTtyMode); blankScreen(mFbFd, false); return true; } QRegion QLinuxFbScreen::doRedraw() { QRegion touched = QFbScreen::doRedraw(); if (touched.isEmpty()) return touched; if (!mBlitter) mBlitter = new QPainter(&mFbScreenImage); mBlitter->setCompositionMode(QPainter::CompositionMode_Source);
for (const QRect &rect : touched)
{
if( mRotation == 90 || mRotation == 270 )
{
mBlitter->translate(mGeometry.height()/2, mGeometry.width()/2);
}
else if( mRotation == 180 )
{
mBlitter->translate(mGeometry.width()/2, mGeometry.height()/2);
}
if( mRotation != 0 )
{
mBlitter->rotate(mRotation);
mBlitter->translate(-mGeometry.width()/2, -mGeometry.height()/2);
}
mBlitter->drawImage(rect, mScreenImage, rect);
mBlitter->resetTransform();
}
return touched;
}
// grabWindow() grabs “from the screen” not from the backingstores.
// In linuxfb’s case it will also include the mouse cursor.
QPixmap QLinuxFbScreen::grabWindow(WId wid, int x, int y, int width, int height) const
{
if (!wid) {
if (width < 0) width = mFbScreenImage.width() - x; if (height < 0) height = mFbScreenImage.height() - y; return QPixmap::fromImage(mFbScreenImage).copy(x, y, width, height); } QFbWindow *window = windowForId(wid); if (window) { const QRect geom = window->geometry();
if (width < 0) width = geom.width() - x; if (height < 0) height = geom.height() - y; QRect rect(geom.topLeft() + QPoint(x, y), QSize(width, height)); rect &= window->geometry();
return QPixmap::fromImage(mFbScreenImage).copy(rect);
}
return QPixmap();
}
QT_END_NAMESPACE
wangmingdong
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QLINUXFBSCREEN_H
#define QLINUXFBSCREEN_H
#include
QT_BEGIN_NAMESPACE
class QPainter;
class QFbCursor;
class QLinuxFbScreen : public QFbScreen
{
Q_OBJECT
public:
QLinuxFbScreen(const QStringList &args);
~QLinuxFbScreen();
bool initialize() override;
QPixmap grabWindow(WId wid, int x, int y, int width, int height) const override;
QRegion doRedraw() override;
private:
QStringList mArgs;
int mFbFd;
int mTtyFd;
int mRotation;
QImage mFbScreenImage;
int mBytesPerLine;
int mOldTtyMode;
struct {
uchar *data;
int offset, size;
} mMmap;
QPainter *mBlitter;
};
QT_END_NAMESPACE
#endif // QLINUXFBSCREEN_H
wangmingdong
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event2
export QT_ROOT=/mnt/SDCARD/Output
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms:$QT_ROOT/../
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0:rotation=90
export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts
export QT_QPA_GENERIC_PLUGINS=tslib:$TSLIB_TSDEVICE
export QML2_IMPORT_PATH=$QT_ROOT/qml
export QT_DEBUG_PLUGINS=1
wangmingdong
export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event2:rotate=270
wangmingdong
*.pro
TEMPLATE = app
QT += quick core gui widgets
CONFIG += c++11 release
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp
RESOURCES += qml.qrc \
images/images.qrc
# Additional import path used to resolve QML modules in Qt Creator’s code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
wangmingdong
qtbase/src/plugins/platforms
wangmingdong
Linux显示(五):QT显示插件(LinuxFB)及其依赖的驱动(DRM/Framebuffer)记录
https://www.cnblogs.com/arnoldlu/p/17267914.html
wangmingdong
A33 Linux ARM QT移植,支持GPU(EGLFS)插件
https://blog.csdn.net/guanchen8022/article/details/133038942
wangmingdong
全志 g2g 加速旋转 –正确姿势
wangmingdong
cp libQt5Quick.so.5.12.9 libQt5Quick.so.5
cp libQt5Widgets.so.5.12.9 libQt5Widgets.so.5
cp libQt5Gui.so.5.12.9 libQt5Gui.so.5
cp libQt5Qml.so.5.12.9 libQt5Qml.so.5
cp libQt5Network.so.5.12.9 libQt5Network.so.5
cp libQt5Core.so.5.12.9 libQt5Core.so.5
cp libQt5DBus.so.5.12.9 libQt5DBus.so.5
cp libQt5QuickTemplates2.so.5.12.9 libQt5QuickTemplates2.so.5
cp libQt5QuickControls2.so.5.12.9 libQt5QuickControls2.so.5
cp libQt5SerialPort.so.5.12.9 libQt5SerialPort.so.5
wangmingdong
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_TSDEVICE=/dev/input/event2
export QT_ROOT=/mnt/SDCARD/Output
export LD_LIBRARY_PATH=$QT_ROOT/lib:$QT_ROOT/plugins/platforms:$QT_ROOT/../
export QT_QPA_PLATFORM_PLUGIN_PATH=$QT_ROOT/plugins
export QT_PLUGIN_PATH=$QT_ROOT/plugins
export QT_QPA_PLATFORM=linuxfb:tty=/dev/fb0:rotation=0
export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts
export QT_QPA_GENERIC_PLUGINS=tslib:$TSLIB_TSDEVICE
export QML2_IMPORT_PATH=$QT_ROOT/qml
export QT_DEBUG_PLUGINS=1
wangmingdong
Linux 上 Qt 一些常见报错解决办法~
https://blog.csdn.net/AntiHips/article/details/138910795
wangmingdong
sudo apt-get install libqt5serialport5
sudo apt-get install libqt5serialport5-dev
wangmingdong
https://github.com/zhuzichu520/FluentUI
wangmingdong
https://gitcode.com/open-source-toolkit/99401/overview
QT主界面滑动窗口框架
wangmingdong
import QtQuick 2.11
import QtQuick.Window 2.11
import QtQuick.Controls 2.11
//import QtQuick.Layouts 2.0
import QtQuick.Controls.Material 2.11
Item {
visible: true
width: 1920
height: 1080
Image {
source: “images/a_main_bg.png”
}
Button {
id: clickButton
anchors.centerIn: parent
x: 100
y: 200
width: 160
height: 160
property var normalImage: “qrc:/images/hg_lianggan.png”
property var pressedImage: “qrc:/images/hg_tegan.png”
background: Image {
source: clickButton.pressed ? clickButton.pressedImage : clickButton.normalImage
}
onClicked: loader.source = “a_washing_config.qml”
}
Loader {
id: loader
anchors.fill: parent
}
}
wangmingdong
汉字显示:
export QT_QPA_FONTDIR=$QT_ROOT/lib/fonts
中文ttf推送到$QT_ROOT/lib/fonts目录下
代码:
#include
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setFont(QFont(“fzcircle”, 10));
QTextCodec *codec = QTextCodec::codecForName(“utf-8”);
QTextCodec::setCodecForLocale(codec);
。。。。。。
setText(QStringLiteral(“这是汉字”));
。。。。。。
wangmingdong
qt widget reference
https://www.linux-apps.com/p/1132110