Contenu connexe Similaire à Firefox OS Overview (20) Firefox OS Overview3. Overview
Firefox OS 是一個由 Mozilla 所主導的新移
動作業系統,專案代號是 Boot to Gecko
(B2G) 。和 Android 一樣,它也是用 Linux
的核心,然後開機到以 Gecko 引擎為基礎
的環境裡,使用者可以在這個平台上執行完
全以 HTML 、 JavaScript 和其他的開放網
路應用程式介面所開發的應用程式。
7. How to build - Requirements
An installed 64 bit GNU/Linux
distribution (we recommend Ubuntu
12.04).
At least 4 GB of RAM/swap space.
At least 20 GB of available hard disk
space.
8. How to build - Requirements
需要預先安裝的套件基本上跟 Android 非常相似
autoconf 2.13
bison
bzip2
ccache
curl
flex
gawk
git
gcc / g++ / g++-multilib (4.6.3 or older)
make
OpenGL headers
X11 headers
32-bit ncurses
32-bit zlib
yasm
…
9. How to build – Supported
devices
目前支援的裝置分為 3 個 Tier , Tier 1 是主力
開發的部分, Tier 2 是比較多人使用,而 Tier 3
是不保證能順利運作的
Tier 1: Unagi, Otoro, Pandaboard, Emulator
(ARM/x86), Desktop (Firefox + addon )
Tier 2: Samsung Nexus S, Samsung Nexus S
4G
Tier 3: Samsung Galaxy S2, Samsung Galaxy
Nexus
10. How to build - Emulator
下載 Build system
git clone git://github.com/mozilla-
b2g/B2G.git
列出可支援的裝置: ./config.sh
要編譯 Emulator ,所以輸入 ./config.sh
emulator-x86
漫長的等待…
11. How to build - Emulator
sudo ln –s /usr/lib/i386-linux-gnu/mesa/libGL.so.1
/usr/lib/i386-linux-gnu/libGL.so
sudo ln –s /usr/lib/i386-linux-gnu/libX11.so.6
/usr/lib/i386-linux-gnu/libX11.so
編輯 gecko/nsprpub/pr/src/Makefile.in 將 133 行的
OS_LIBS += -lrt 註解掉。
build system 基本上是採用 Android 的機制,輸入
./build.sh ,這個 script 會載入必要的環境變數,並用
lunch 設置要編譯的 product ,然後開始編譯。
又是一段漫長的過程。
12. How to build - Emulator
編譯完成以後,就可以輸入 ./run-
emulator.sh
模擬器跟 Android 一樣是使用 QEMU
13. 開發 – build system
Build system 基本上與 Android 一致,使用
lunch 來決定要編譯出哪個產品,這部分可以參
考 config.sh 與 setup.sh 。
主要的差異在於 gecko , gecko 是 Mozilla
browser 的引擎,原來是用 C++ 開發,以
autoconf/automake 來編譯。因此這邊並不是
以 Android.mk 來編譯,事實上這個檔案也是空
的。應該要看的是 client.mk ,編譯時是在同層
的 objdir-gecko 進行編譯。
14. 開發 – boot process
從 bootloader 到 kernel 到
init/init.rc ,這部分都跟 Android 相同。
在 Android 的 init.rc 裡,原來是執行
zygote 的, Firefox OS 則是改為
b2g.sh
service b2g /system/bin/b2g.sh
class main
onrestart restart media
15. 開發 – user space 架構
圖片取自 Mozilla developer 網站
16. 開發 – Hardware module
Graphics: Gecko -> GLES 2.0 + EGL -> screen
Audio: 使用 Android 的 mediaserver
像 sensor/ 陀螺儀…等走的路子是沿用 Android
的機制,也就是在 hardware 目錄下去修改。
這裡有一份追蹤手機振動的文章,從 gaia 層
navigator.vibrate() 到 gecko/HAL ,寫的很
清楚。 http://j.mp/UVG92M
很大一部分都沿用自 Android