交叉编译MiniGUI

在MiniGUI官网提供了编译方法:http://www.minigui.com/blog/quick-start

编译5.0和4.0的方法类似,这两个版本的下载链接分别是https://github.com/VincentWei/build-minigui-5.0https://github.com/VincentWei/build-minigui-4.0,下面以编译4.0为例。

 

交叉编译工具链:arm-linux-gnueabihf-gcc 7.3

 

下载:

 $ git clone https://github.com/VincentWei/build-minigui-4.0.git
 $ cd build-minigui-4.0

执行 ./fetch-all.sh,下载软件包

编译两个会用到的工具bin2c和upf2c:

$ cd mg-tools/tools
$ gcc bin2c.c -o bin2c
$ sudo cp bin2c /usr/local/bin

$ cd mg-tools/font-tools
$ gcc upf2c.c -o upf2c
$ sudo cp upf2c /usr/local/bin

 

然后进入cross-build/arm-r16-linux/,这里提供了一个交叉编译MiniGUI的参考,不过编译的是时候会有一些问题。

  • 修改modify-this-config.sh:
diff --git a/cross-build/arm-r16-linux/modify-this-config.sh b/cross-build/arm-r16-linux/modify-this-config.sh
index 698bc6f..c5e0a08 100644
--- a/cross-build/arm-r16-linux/modify-this-config.sh
+++ b/cross-build/arm-r16-linux/modify-this-config.sh
@@ -3,7 +3,7 @@
 
 # You must set TINA_DIR for r16 tina dirctory.
 # It is the ONLY line you have to modify in the whole compiling process. 
-TINA_DIR=/home/projects/r16/tinav2.5
+TINA_DIR=${PWD}/build
  • 下载软件包,./fetch-all.sh
  • 修改libinput.txt,替换交叉编译工具链
  • 修改build-all.sh,替换交叉编译工具链

下面开始编译:

  • 在交叉编译libharfbuzz的时候遇到一些问题,然后我用qemu static +ubuntu arm文件系统的办法直接编译一个arm版本的harfbuzz库,编译时的configure参数使用build-all.sh中的。编译完成后,将得到的库和头文件拷贝到rootfs/usr/local下。

然后为rootfs/usr/local/lib/libharfbuzzex.so.0.20501.0建立一个软连接,因为在编译minigui时会检测libharfbuzz.so

ln -sf libharfbuzzex.so.0.20501.0 libharfbuzz.so
  • udev编译错误:
3rd-party/udev-182/src/sd-daemon.c:394: undefined reference to `mq_getattr'

  修改build-all.sh,编译udev时为LDFLAGS增加参数"-lrt"

  • minigui编译错误
freetype2.h:65:10: fatal error: ft2build.h: No such file or directory
 #include <ft2build.h>

  修改build-all.sh,编译minigui时增加-I$WORK_DIR/rootfs/usr/local/include/freetype2

harzbuff-minigui-funcs.c:66:10: fatal error: hb.h: No such file or directory
 #include <hb.h>

  修改build-all.sh,编译minigui时增加-I$WORK_DIR/rootfs/usr/local/include/harfbuzz

 

  • libmgncs4touch编译错误
grep: /usr/lib/arm-linux-gnueabihf/libfreetype.la: No such file or directory
sed: can't read /usr/lib/arm-linux-gnueabihf/libfreetype.la: No such file or directory

  删除rm rootfs/usr/local/lib/libharfbuzzex.la

 

  • mg-tests编译错误
/lib/libminigui_ths.so: undefined reference to `dlsym'
/lib/libminigui_ths.so: undefined reference to `dlerror'
/lib/libminigui_ths.so: undefined reference to `dlopen'
/lib/libminigui_ths.so: undefined reference to `dlclose'

  重新编译minigui,增加编译参数"-ldl",然后make clean,重新执行build-all.sh

 


 

上面默认编译的MiniGUI是线程模式,下面编译process模式,修改build-all.sh,修改minigui的编译参数“--with-runmode=procs”,然后将“-lminigui_ths”改为“-lminigui_procs”。编译:

  • minigui编译错误
drmvideo.c:2054:18: error: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'size_t {aka unsigned int}' [-Werror=format=]

  修改minigui的编译参数,增加:-Wno-error=format=

 

下面是交叉编译minigui的压缩包的下载链接:

链接: https://pan.baidu.com/s/1JjN3QEr0njw-UWmXdeHF6Q 提取码: 215s

 


 

将procs模式的minigui拷贝到跟文件系统中,然后再把编译好的mg-samples目录拷贝到板子上。

修改/usr/local/etc.MiniGUI.cfg:

[system]
# GAL engine and default options
# The equivalent environment variable: MG_GAL_ENGINE
gal_engine=fbcon
# The equivalent environment variable: MG_DEFAULTMODE
defaultmode=800x600-16bpp

# IAL engine
# The equivalent environment variable: MG_IAL_ENGINE
ial_engine=console
mdev=/dev/input/mice
mtype=IMPS2

kernel配置上需要配置:

Device Drivers  ---> Input device support  ---><*>   Mouse interface

 

在运行测试程序时会遇到如下问题:

[root@vexpress-a9 mginit]# ./mginit
KERNEL>LoadSharedResource: No such file or directory
KERNEL>InitGUI (step 9): Can not load shared resource!
Aborted

原因是mginit在运行时,在kernel_LoadSharedResource中其中会创建一个lock文件:/var/tmp/mginit,但是在目前的板子上不存在/var/tmp目录,所以需要手动在板子上创建一个目录。

[root@vexpress-a9 mginit]# mkdir /var/tmp

然后重新运行:

root@vexpress-a9 mg-samples]# cd mginit/
[root@vexpress-a9 mginit]# ./mginit
IAL: use 'tty' native keyboard engine, with the device file ''
IAL Native Engine: keyboard device has been connected.
IAL Native Engine: mouse device has been connected.
libpng warning: iCCP: known incorrect sRGB profile
new child, pid: 870.
New comming in client: 
do_client_join_layer: SERVER: Join a client (graphics) to layer mginit
New client joined layer: (mginit, graphics)

运行截图:

 

 完。

posted @ 2020-06-07 00:12  摩斯电码  阅读(1649)  评论(1编辑  收藏  举报