Arm Linux 系統如何實現java程序的運行


     Android現在因為工作關系沒得玩了,這些日子涉及到了嵌入式Linux環境java運行環境的搭建,有點意思,分享一下:

   

      1)java常被說成跨平台語言,可以要在要讓一套java程序能夠既能在x86 windos上運行,有能在arm linux上運行 道不像說的那么容易;

      2)Oracle 發布了Java Embedded版本,其在ubuntu上還是很容易運行起來,環境搭建也很簡單(自己上官網看看就明白),但是ubuntu arm版本穩定性太差,除非對ubuntu進行裁剪,這個工作量太大,結果未知,從項目角度看不可取;

      3)那就在裸linux上進行開發咯,運行java Embedded 需要Gnome 2.16以上,移植Gnome?,目前決定放低Gnome中的窗體管理器,只移植X windows(xserver或者xorg),經過實現證明這種方法是可行的

      4)現在的問題就變成了怎么移植arm 版本xorg了,下面中提供的連接,別想着分分鍾就搞定了,還是進下心來,慢慢看,慢慢移植吧(有智能編譯工具,需要修改調試才能通過);

編譯主要用到了xorg官網提供的jhbuild工具進行編譯,因為相關的庫實在是太多了,超過60個
參看連接(比較多,看看會懂的):
http://www.x.org/wiki/CrossCompilingXorg
http://www.x.org/releases/X11R7.6/
http://www.x.org/releases/X11R7.6/doc/
http://www.x.org/wiki/JhBuildInstructions/
http://www.x.org/wiki/CrossCompilingXorgJhbuild/
http://www.x.org/wiki/
http://www.x.org/releases/X11R7.6/doc/man/man4/evdev.4.xhtml
http://cgit.freedesktop.org/xorg/util/modular/plain/xorg-7.6.modules
ftp://ftp.freedesktop.org/pub/mesa/older-versions/7.x/7.9/

6)嵌入式當然要用到鼠標,觸摸屏等一些human咯,這里記得移植編譯Xorg的時候,要把xf86-video-fbdev xf86-input-mouse xf86-input-void xf86-input-keyboard xf86-input-evdev這些組件給帶上,要不到時可能光有組件沒發操作

7)這里說說中文字庫支持的問題,必須要編譯xorg 的mode fontconfig才能支持中文字庫,未在xorg config指定的情況下,字庫的默認路徑是/usr/shera/font下面放ttf、ttc字庫,會在Xorg server啟動時加載這些字庫

8)編譯的東西只要靜下心來,總會搞定的,這里假設將編譯好的xorg放在/opt/xorg-arm目錄下,那么需要提示在/etc/profile中配置一下參數(我這里是基於freescal Imx6 自定制linux系統 用的fb0)

         export DISPLAY=:0.0
         export LD_LIBRARY_PATH=/opt/xorg-arm/lib

         然后在運行/opt/xorg-arm/bin/X&即可,x window 算是運行起來了

      9)觸摸屏怎么辦能,修改xorg.conf,不會那就看看這個吧http://www.x.org/releases/X11R7.6/doc/man/man5/xorg.conf.5.xhtml#heading8

           把我的配置xorg.conf貼出來,支持觸摸屏,鼠標

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
EndSection

Section "InputDevice"
Identifier "touchscreen"
Driver "evdev"
Option "Device" "/dev/input/event0"
Option "Calibration" "38 1941 78 1939"
Option "Mode" "Absolute"
EndSection

Section "Device"
Identifier "builtin Default fbdev Device 0"
Driver "fbdev"
EndSection

Section "ServerFlags"
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
EndSection

Section "Monitor"
Identifier "Configured Monitor"
Option "DPMS" "false"
EndSection

Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "i.MX Accelerated Framebuffer Device"
EndSection

Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "touchscreen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
EndSection

10)就說這些吧,關鍵點基本都說明,其他的需要自己花時間去研究,涉及到的方面有些多。

 

       

 

 


免責聲明!

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



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