Boot to Gecko (B2G) 是Mozilla基金会开发的一个新的移动操作系统. 它使用Linux内核,并且启动一个基于Gecko的运行时引擎,以方便我们运行完全使用HTML, JavaScript, 以及其他开放网页应用程序API开发的移动应用程序.
B2G 目前还处于前期的开发过程中. 我们不断努力尝试各种方法,使你们可以更加简单的使用和开发基于Gaia的移动应用. 但是,为了做某些事情,例如编译整个B2G堆栈,刷机刷成B2G系统,你需要关于系统的知识.
接下来的BLOG 会指导下面这些人:
1.对运行Gaia有兴趣甚至希望修改它的人,
2.希望开发能在B2G设备上运行的移动应用的开发者.
Boot to Gecko (也叫 "B2G") 是 Mozilla的开源移动操作系统.它基于Linux内核和Mozilla的Gecko技术. 这个想法基本上是说使用高级的HTML5 技术和设备API开发网页应用程序,它们可以通过JavaScript来直接访问手机硬件.
对网页开发者来说, 最需要理解的部分就是整个系统用户界面就是一个网页app,它可以展示并且启动其他的网页apps. 你们修改的用户界面以及你们在B2G上创建的任何程序都只是网页而已,并且可以直接访问硬件.
你能学会如何编译和安装Boot to Gecko在我这个blog里.
这个章节会提供许多技巧来帮助你使用B2G. 直到我们有一个真的使用文档之前这里会是一个简单的占位符.
如果你启动了你编译的B2G系统,会提示你输入密码,密码默认都是0000.大部分版本都会有这个功能,我们仅仅是为了测试锁屏代码.
目前没有办法在手机上截图,但是你看可以在安装了B2G编译系统的linux和Mac OS X的电脑终端上实现它.
你可以用这个命令来安装
sudo port install ffmpeg对于homebrew, 输入以下指令
brew install ffmpeg
在Linux (Ubuntu/Debian), 使用
sudo apt-get install ffmpeg
进入你的
B2G/gaia目录
cd into the B2G/gaia directory
make screenshot
screenshot.png
的屏幕截图.
下载能编译的 Boot to Gecko的源代码. 你还需要合适配置这个 编译系统. 你现在可以在64位的Linux 发行版或者 Mac OS X上编译.
This is important. Even though we support several phones, some of them are available in multiple variations, and only select variations of them may be supported.
You can, of course, build the desktop client or one of the emulators without a phone.
To build on Linux, you'll need to have a system configured with:
This is more than the bare minimum, but you'll find after a while that you'll need the resources.
It's possible to use other distributions, but we recommend this one just to ensure everything works as expected.
You will also need the following tools installed:
libX11.so
and
libGL.so
; to do so, go into
/usr/lib/i386-linux-gnu
and create symlinks from
libX11.so
to
libX11.so.6
and from
libGL.so
to
mesa/libGL.so
.
To build B2G on Mac OS X, you need to install Xcode, which is available through the Mac App Store; on Xcode 4 or later, be sure to go into Preferences, then the Downloads panel, and install the Command Line Utilities. In addition, make sure you have at least 20 GB of free disk space.
Then you need to open a terminal and run this command in the terminal; this will pull and run a bootstrap script that makes sure you have all prerequisites met.
curl -fsSL https://raw.github.com/mozilla-b2g/B2G/master/scripts/bootstrap-mac.sh | bash
xcode-select -print-pathIf it still points to /Developer you can update the path with:
sudo xcode-select -switch /Applications/Xcode.appNext to that be sure that you have the OS X 10.6 SDK available at:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/If it cannot be found there you will need to extract and copy it from the XCode 4.3 DMG file which is available at the Apple Developer portal.
This will check to see if you have all the things you need to be able to build the emulator, and will prompt you for permission to install anything you're missing. The items this script will check for and install for you are:
If you plan to build for the Samsung Galaxy S2, you will also need to install heimdall. See Installing heimdall for details. This is not done for you by the bootstrap script!
Similarly, you will also need a Java runtime installed; this, too, is not done for you.
~/Library/Application Support/.FUS
, and leaves a reference to a utility there in your user startup items list. You will want to remove these manually.
gcc 4.6 was built with libmpc 0.9; if you then use homebrew to update packages, libmpc gets updated to version 1.0, but homebrew doesn't rebuild gcc 4.6 after the library version changes. So you need to create a symlink to make things work again, like this:
cd /usr/local/lib/ ln -s libmpc.3.dylib libmpc.2.dylib
Intel provides a special driver that lets the B2G emulator run its code natively on your Mac instead of being emulated, when you're using the x86 emulator. If you wish to use this, you can download and install it. It's not required, but it can improve emulation performance and stability.
Before you plug your phone into your USB port, put it USB developer mode. This lets us access the phone for debugging and flashing. To do this, go to the Settings application and navigate to Applications > Development, and turn on the "USB debugging" checkbox.
The build process needs to pull binary blobs from the Android installation on the phone before building B2G (unless you're building the emulator, of course). For this, you will need adb
, the Android Debug Bridge.
To get this, you'll need to install the Android SDK starter package for your platform. Then run their package manager, $SDK_HOME/tools/android
, and use the GUI to install "Android SDK Platform-tools".
adb
will be installed to $SDK_HOME/platform_tools
. Be sure to add directory is in your PATH
. Also, you may wish to run:
adb pull /system <backup target dir>/system
to back up the entire Android system partition on your phone. This will give you a copy of all the binary blobs for Android in case you later delete your B2G tree. Depending on the phone, you may also need to pull the /data and/or /vendor directories:
adb pull /data <backup target dir>/data adb pull /vendor <backup target dir>/vendor
Heimdall is a utility for flashing the Samsung Galaxy S2. It's used by the Boot to Gecko flash utility to replace the contents of the phone with B2G, as well as to flash updated versions of B2G and Gaia onto the device. You'll need it if you want to install B2G on a Galaxy S2; it is not needed for any other device. For other devices, we build and use the fastboot utility instead.
There are two ways to install heimdall:
sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev
At this point, you should be ready to fetch the B2G code!