B2G编译要求

Boot to Gecko (B2G) 是Mozilla基金会开发的一个新的移动操作系统. 它使用Linux内核,并且启动一个基于Gecko的运行时引擎,以方便我们运行完全使用HTML, JavaScript, 以及其他开放网页应用程序API开发的移动应用程序.

B2G 目前还处于前期的开发过程中. 我们不断努力尝试各种方法,使你们可以更加简单的使用和开发基于Gaia的移动应用. 但是,为了做某些事情,例如编译整个B2G堆栈,刷机刷成B2G系统,你需要关于系统的知识.

接下来的BLOG 会指导下面这些人:

1.对运行Gaia有兴趣甚至希望修改它的人,

2.希望开发能在B2G设备上运行的移动应用的开发者.

 

 

 

 

 

 

 

介绍 Boot to Gecko

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的电脑终端上实现它.

  1. 确定你已经安装了ffmpeg .
    1. 在Mac上,如果你使用 MacPorts, 你可以用这个命令来安装
      sudo port install ffmpeg
       对于homebrew, 输入以下指令
      brew install ffmpeg
    2. 在Linux (Ubuntu/Debian), 使用

      sudo apt-get install ffmpeg
  2. 通过USB 来连接你的手机.
  3. 导航到你想要截图的手机场景.
  4. 进入你的B2G/gaia目录
    cd into the B2G/gaia directory
  5. make screenshot
  6. 现在你有了名叫 screenshot.png的屏幕截图.

 

 

 

 

B2G 编译要求

下载能编译的 Boot to Gecko的源代码. 你还需要合适配置这个 编译系统. 你现在可以在64位的Linux 发行版或者 Mac OS X上编译.

Have a compatible phone

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.

Samsung Nexus S
The known working model numbers of Nexus S devices are GT-I9020A and GT-I9023. Others may work.
Samsung Galaxy S2
The only model that works is the i9100; no other variants are officially compatible. (i9100P might work, since the only change is a NFC chip added)
Samsung Galaxy Nexus
I'm not currently aware of any variations that are not compatible.
Important: Only devices running Android 4 (aka Ice Cream Sandwich) are supported. If your device is listed above but running an older version of Android, please update it before doing anything.

Requirements for Linux

To build on Linux, you'll need to have a system configured with:

  • An installed Linux distribution (we recommend Ubuntu 11.10, and a 64-distribution is preferable).
  • At least 4 GB of swap space.
  • At least 80 GB of hard disk space.

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:

  • autoconf-2.13
  • git
  • ccache
  • gcc/g++, and you will need g++ multilibs
  • bison
  • flex
  • 32-bit ncurses (libncurses5-dev on Ubuntu/Debian)
  • 32-bit zlib (ia32-libs and lib32z1-dev on Ubuntu/Debian)
  • foo
  • make
  • curl
  • bzip2
  • heimdall (if building for the Samsung Galaxy S2; see Installing heimdall)
Note: When building on 64-bit Ubuntu, you may find that you need to add symlinks for the 32-bit versions of 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.

Requirements for Mac OS X

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.

Note: The B2G emulator requires a Core 2 Duo processor or later; that is, a system that is compatible with Mac OS X 10.7 "Lion." You do not actually have to be running Lion, you just have to be compatible with it. You can, however, build any B2G build on many older Macs.

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
Note: If you have already upgraded to XCode 4.4 and get the message that XCode is outdated, check the XCode path with:
xcode-select -print-path
If it still points to /Developer you can update the path with:
sudo xcode-select -switch /Applications/Xcode.app
Next 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:

  • git
  • gpg
  • ccache
  • yasm
  • autoconf-213
  • gcc-4.6
  • homebrew

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.

Note: If you have installed the Samsung Kies tool, which is used to manage the contents of many Samsung phones, you will have to remove it before you can flash Boot to Gecko onto your device. You can use the standard application removal process on Windows; on Mac, the Kies install disk image has a utility to fully remove Kies from your system. Flashing will not work if you have Kies installed. If you forget to remove Kies, the build system will detect it and remind you to uninstall it. Note also that the uninstall tool does not correctly remove the folder ~/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.

Fix libmpc dependency if broken

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

Optional: Install HAX

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.

Configure Phone

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.

Install adb

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

Install heimdall

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.

Note: Again, it's important to note that this is only required for installing B2G on the Samsung Galaxy S2.

There are two ways to install heimdall:

  • You can download the code GitHub and build it yourself.
  • Use a package manager to install it.
    • On Linux: sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev
    • On Mac, you can download an installer package and use that.

On to the next step

At this point, you should be ready to fetch the B2G code!

你可能感兴趣的:(B2G编译要求)