Chinaunix首页 | 论坛 | 博客
  • 博客访问: 631076
  • 博文数量: 37
  • 博客积分: 106
  • 博客等级: 民兵
  • 技术积分: 993
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-30 18:26
个人简介

来自汉江北邻的IT男一枚,专注于PHP和C#开发... 最常更新的技术Blog → https://enjoy233.cnblogs.com/

文章分类

全部博文(37)

文章存档

2013年(36)

2012年(1)

我的朋友

分类: 系统运维

2013-04-21 21:00:04

   

                                  编译Firefox OS的系统需求 - Mozilla




在获取用于编译Firefox OS的代码之前,你需要设置好所需的编译环境。目前可在64位Linux或Mac OS X下编译Firefox OS。

使用兼容的硬件或使用仿真器

Even though we support several phones, some of them are available in multiple variations. We currently support specific variations and some devices will have better support than others:

Tier 1

Tier 1 devices represent a primary target for development and will typically be the first to receive bug fixes and feature updates.

Unagi Unagi is a phone being used as a test and development platform as a low-to-midrange smartphone. Many core Firefox OS developers are working on Unagi. Otoro Otoro is a phone being used as a test and development platform as a low-to-midrange smartphone. Many core Firefox OS developers are working on Otoro. Pandaboard The Pandaboard is a development board based on the OMAP 4 architecture, used to do development work on mobile platforms. Emulator (ARM and x86) There are two emulators available: one emulates ARM code and the other runs everything in x86 code. Desktop You can also build a desktop version of Firefox OS; this runs Gecko in a XULRunner application, and you then use the Gaia user experience inside it.

You can, of course, build the desktop client or one of the emulators without a phone.

Tier 2

Tier 2 devices are generally functional and many developers (especially app developers) are using them, so they tend to pick up changes secondarily.

Samsung Nexus S The known working model numbers of Nexus S devices are GT-I9020A and GT-I9023. Others may work. Samsung Nexus S 4G The SPH-D720 is supported as a tier 2 device.

Tier 3

Firefox OS can be built for these devices, but they are not being actively worked on a regular basis by core developers. Their reliability and feature set may lag noticeably behind tier 1 and even tier 2 devices.

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 We are not currently aware of any variations that are not compatible.

Important: Only devices running at least 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.

Linux系统需求

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

  • 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.

This is more than the bare minimum, but sometimes building fails just because it's missing resources.

It's possible to use other distributions, but we recommend Ubuntu 12.04 since it's the most common system people use successfully. Distributions that might not work: 32 bit distros and recent distros ( Ubuntu 12.10, Fedora 17/18, Arch Linux because of gcc 4.7).

You will also need the following tools installed:

  • 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

64 bit install examples:

Ubuntu 12.04 / Linux Mint 13 / Debian 6

$ sudo apt-get install autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev make zip

When building on 64-bit Ubuntu, you may find that you need to add symlinks for the 32-bit versions of libX11.soand libGL.so:

$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

Ubuntu 12.10

$ sudo apt-get install autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib gcc-4.6 g++-4.6 g++-4.6-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev make zip

In addition to the steps above needed to fix issues with the 32-bit versions of the libX11.so and libGL.so libraries, you will need to specify GCC 4.6 as the default host compiler before building. After having retrieved the sources, see here how to do it.

In a fresh Ubuntu 12.10 install, you'll get an error about unmet dependenceis for ia32-libs. The following steps fix it.

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install ia32-libs

Fedora 16:

$ sudo yum install autoconf213 bison bzip2 ccache curl flex gawk gcc-c++ git glibc-devel glibc-static libstdc++-static libX11-devel make mesa-libGL-devel ncurses-devel patch zlib-devel ncurses-devel.i686 readline-devel.i686 zlib-devel.i686 libX11-devel.i686 mesa-libGL-devel.i686 glibc-devel.i686 libstdc++.i686 libXrandr.i686 zip

Fedora 17/18:

$ sudo yum install autoconf213 bison bzip2 ccache curl flex gawk gcc-c++ git glibc-devel glibc-static libstdc++-static libX11-devel make mesa-libGL-devel ncurses-devel patch zlib-devel ncurses-devel.i686 readline-devel.i686 zlib-devel.i686 libX11-devel.i686 mesa-libGL-devel.i686 glibc-devel.i686 libstdc++.i686 libXrandr.i686 zip perl-Digest-SHA

In addition to the above you will need GCC 4.4 in order to compile the project. You can find a pre-compiled version . Download it and install it to /opt with the following command:

$ wget ~gsvelto/gcc-4.4.7-bin.tar.xz
$ sudo tar -x -a -C /opt -f gcc-4.4.7-bin.tar.xz

You will need to specify this compiler as the default host compiler before building. After having retrieved the sources, see here how to do it.

Arch Linux (not functional yet):

$ sudo pacman -S --needed alsa-lib autoconf2.13 bison ccache curl firefox flex gcc-multilib git gperf libnotify libxt libx11 mesa multilib-devel wireless_tools yasm lib32-mesa lib32-ncurses lib32-readline lib32-zlib

By default, Arch Linux uses Python3. You'll have to force it to use the old python2:

$ cd /usr/bin $ sudo ln -fs python2 python

Mac OS X系统需求

To build Firefox OS on Mac OS X, you need to install Xcode's Command Line Utilities.

You can download just the Command Line Utilities from Apple's developer downloads page for your particular version of OS X.

However, if you would like the entire Xcode suite of applications, you can  through the Mac App Store. 

Install Command Line Utilities via XCode 4.3.1 and newer

Xcode 4.3.1 (OS X 10.7 "Lion") and other newer versions such as 4.4.1+ (that is, Mac OS X10.8 "Mountain Lion"), won't necessarily include the required Command Line Utilities. When you install Xcode, make 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 Firefox OS 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 Firefox OS build on many older Macs.

Firefox OS Mac Bootstrap

Open a terminal and run the following command:

curl -fsSL  | bash

It will pull and run a bootstrap script that makes sure you have all the prerequisites met to build the emulator. It will also prompt you for permission to install anything you're missing. The script will check for and install the following items:

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

Xcode

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 Mac 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. You can use the utility Pacifist to extract the 10.6 SDK. Be sure to add a symlink to it to the /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ directory. (We can drop the 10.6 SDK requirement after  has been fixed, and our version of .)

Mountain Lion

If you are building on OS X 10.8 "Mountain Lion" (Xcode 4.4.1 or later) and encounter the following error:

external/qemu/android/skin/trackball.c:130:25: error: 'M_PI' undeclared (first use in this function)
Edit the file: B2G/external/qemu/Makefile.android and add in line 78:
MY_CFLAGS += -DM_PI=3.14159265358979323846264338327950288   #/* B2G_fix: not finding M_PI constant */

If you are on Mountain Lion and you receive an error during the installation of the dependencies via homebrew, such as:

clang: error: unable to execute command: Segmentation fault: 11
... try reinstalling the dependency manually adding the --use-gcc flag, for example:
brew install mpfr --use-gcc

Samsung Galaxy S2

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!

Note: If you have installed the  tool, which is used to manage the contents of many Samsung phones, you will have to remove it before you can flash Firefox OS 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.

Note: Mac OS X uses a case insensitive filesystem by default, which will prevent you from building Firefox OS down the road (EDITOR'S NOTE: I have never had a problem with this).  You should create a case sensitive sparse disk image work from within that directory.  To buld the case sensitive disk image:

hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/firefoxos.dmg

Mount the drive with:

open ~/firefoxos.dmg

Change into the mouted drive with:

cd /Volumes/untitled/

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.

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 (you'll want the ADT Bundle, not the SDK Tools Only option). 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 this directory to your PATH. This can be done by adding the line

PATH=$SDK_HOME/platform-tools:$PATH

replacing $SDK_HOME with the location of the andoird sdk, to your ~/.bashrc or equivalent.  Also, you may wish to run:

adb pull /system /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 /data
adb pull /vendor /vendor

If the pull commands fail with "insufficient permission" message, try either stopping and restarting the adb server, or if that fails, double-check that you have granted root permissions to the 'adb' tool within your custom ROM (eg. under CyanogenMod, change 'Settings > System > Developer Options > Root Access' to 'Apps and ADB' or 'ADB only').

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 Firefox OS, as well as to flash updated versions of B2G and Gaia onto the device. You'll need it if you want to install Firefox OS 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 Firefox OS on the Samsung Galaxy S2.

There are two ways to install heimdall:

  • You can  GitHub and build it yourself.
  • Use a package manager to install it.

Configure ccache

The default cache size for ccache is 1GB; the B2G build easily saturates this. You can configure your cache size as follows:

$ ccache --max-size 3GB

Configure the udev rule for your phone

You can get the USB vendor ID by running lsusb now, but typically it's Google's 18d1, Samsung's 04e8 or ZTE's19d2 so adding this line in your /etc/udev/rules.d/51-android.rules (create the file if it doesn't exist, replace XXXXwith the ID) would work:

SUBSYSTEM=="usb", ATTR{idVendor}=="XXXX", MODE="0666", GROUP="plugdev"

Take ZTE for example, the content in 51-android.rules will be

SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0666", GROUP="plugdev"

Once you've saved the file, and closed it,  make the file readable:

$ sudo chmod a+r /etc/udev/rules.d/51-android.rules

Then you can check if you can list device via adb command:

$adb devices
List of devices attached
123456          device

If the device did not list as expect. Check the file name and the script are all correct, then restart the computer and retype the command again.

Set the phone to developer mode

Before you plug your phone into your USB port, put it USB developer mode. This allows to debug and flash the phone. To enable developer mode: Settings app -> Device information -> Mode Information -> Developer -> (enable) Developer mode

On to the next step

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


阅读(4682) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~