交叉編譯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)

運行截圖:

 

 完。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM