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)就说这些吧,关键点基本都说明,其余的须要本身花时间去研究,涉及到的方面有些多。