Android如今由於工做關係沒得玩了,這些日子涉及到了嵌入式Linux環境java運行環境的搭建,有點意思,分享一下:html
1)java常被說成跨平臺語言,能夠要在要讓一套java程序可以既能在x86 windos上運行,有能在arm linux上運行 道不像說的那麼容易;java
2)Oracle 發佈了Java Embedded版本,其在ubuntu上仍是很容易運行起來,環境搭建也很簡單(本身上官網看看就明白),可是ubuntu arm版本穩定性太差,除非對ubuntu進行裁剪,這個工做量太大,結果未知,從項目角度看不可取;linux
3)那就在裸linux上進行開發咯,運行java Embedded 須要Gnome 2.16以上,移植Gnome?,目前決定放低Gnome中的窗體管理器,只移植X windows(xserver或者xorg),通過實現證實這種方法是可行的git
4)如今的問題就變成了怎麼移植arm 版本xorg了,下面中提供的鏈接,別想着分分鐘就搞定了,仍是進下心來,慢慢看,慢慢移植吧(有智能編譯工具,須要修改調試才能經過);ubuntu
編譯主要用到了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/windows
6)嵌入式固然要用到鼠標,觸摸屏等一些human咯,這裏記得移植編譯Xorg的時候,要把xf86-video-fbdev xf86-input-mouse xf86-input-void xf86-input-keyboard xf86-input-evdev這些組件給帶上,要不到時可能光有組件沒發操做ide
7)這裏說說中文字庫支持的問題,必需要編譯xorg 的mode fontconfig才能支持中文字庫,未在xorg config指定的狀況下,字庫的默認路徑是/usr/shera/font下面放ttf、ttc字庫,會在Xorg server啓動時加載這些字庫工具
8)編譯的東西只要靜下心來,總會搞定的,這裏假設將編譯好的xorg放在/opt/xorg-arm目錄下,那麼須要提示在/etc/profile中配置一下參數(我這裏是基於freescal Imx6 自定製linux系統 用的fb0)ui
export DISPLAY=:0.0
export LD_LIBRARY_PATH=/opt/xorg-arm/libspa
而後在運行/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)就說這些吧,關鍵點基本都說明,其餘的須要本身花時間去研究,涉及到的方面有些多。