Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 217 lines (145 sloc) 5.721 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
This document assumes you've already cloned the b2g repo to the path
$B2G.


 Dependencies
--------------
* Linux is required to build. In addition to Linux, 4GB RAM and
  at least 30GB free disk space is recommended.

* adb/fastboot/heimdall need to access your phone. On Linux, this
  requires setting up udev.

  Put this in /etc/udev/rules.d/android.rules :

  SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
  SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"

* When building B2G for the first time, don't forget to run 'make gonk' first.

* If you're building for the Galaxy S II, you need to install
  "Heimdall" to be able to flash your phone with B2G. Follow the
  instructions at

    http://www.glassechidna.com.au/products/heimdall/

  (Even if you're not building for the Galaxy S II, it's not a bad
  idea to install Heimdall anyway.)

* There are a few other dependencies you may find necessary to
  install. These were found to be necessary when building on a ubuntu
  64bit system.

    # sudo apt-get install ia32-libs gcc-multilib g++-multilib bison \
      flex gperf lib32z1-dev lib32ncurses5-dev lib32ncursesw5-dev \
      libidl-dev lib32gomp1 autoconf2.13 ccache libx11-dev \
      lib32readline-gplv2-dev

  lib32readline-gplv2-dev is available for Ubuntu 11.10. For Ubuntu 10.10
  lib32readline5-dev seems to work fine.


 Quick start
-------------

 == Samsung Galaxy SII ==

Getting a download-mode jig is recommended before attempting this.

$ cd $B2G
$ make sync
$ make config-galaxy-s2
$ make kernel
$ adb reboot download
$ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImage
$ adb reboot recovery

This will reboot your phone into CWM-based recovery.
Use the volume up and down keys and home key to navigate the menus
and back up your device.

$ make gonk
$ make flash

 == Fastboot Phones ==

This includes the Nexus S, maguro, akami, and Galaxy Nexus.

Flashing a recovery image and backing up your phone is recommended
before trying flashing B2G.

$ cd $B2G
$ make sync

Pick an appropriate configure command for your phone:
--
# Nexus S. Flash your phone to ICS first
$ make config-nexuss-ics

# Maguro
$ make config-maguro

# Akami
$ make config-akami

# Galaxy Nexus
$ make config-galaxy-nexus
--

# Build
$ make gonk
$ make

# Unlock your bootloader if you haven't already
$ make unlock-bootloader

# Make sure your phone is booted up normally before flashing
$ make flash-only

 == Android Emulator ==

$ cd $B2G
$ make sync
$ make config-qemu
$ make gonk
$ make
$ ./emu.sh

 Detailed instructions
-----------------------

These instructions assume you have followed the directions in the
"Dependencies" section.

 == Initialize repository ==

The repository is organized as a top-level B2G module with many
submodules for the kernel, gecko, and other userspace libraries.
Before doing anything else, you need to synchronize all these
submodules

$ cd $B2G
$ make sync

This takes a *long* time, so be patient. Whenever you want to pull
from upstream again, just re-run |make sync|.

 == Configure repo for your device ==

 Galaxy S II:
$ make config-galaxy-s2

 Android Emulator:
$ make config-qemu

This configures submodules appropriately for the given device, and for
devices with proprietary libraries, will attempt to download and
install the blobs. The blobs may ask you to agree to an EULA before
they will install.

 == Build the code ==

When building for the first time, first run:

$ make gonk

Then simply run:

$ make

This step can take a long time. Subsequent rebuilds will usually be
much faster, though.

 == Running on the Android Emulator ==

At this stage, if you're building for the Android emulator, you just
need to run the provided script and you're done.

$ ./emu.sh

 == Kernel Flashing / Device Backup [Galaxy S II] ==

The kernel should be flashed when using the gonk backend on a SII.
It should only be done once or when the kernel is updated.
This kernel comes with a clockwork mod variant.

GET A DOWNLOAD MODE JIG BEFORE ATTEMPTING THIS!
The flashing process is known to fail.

$ make kernel
$ adb reboot download

This puts your phone into "download mode", in which it's ready to be
flashed using the "Odin" protocol. Your phone should boot into a
screen that says something like, "Downloading, Do not turn off!". If
not, something went wrong. To actually flash the kernel:

$ heimdall flash --kernel boot/kernel-android-galaxy-s2/arch/arm/boot/zImage

Note: If during "make kernel" the process seems to stop and shows a colon for user input, it's probably asking you a question. Try hitting enter to continue.

When this finishes, your phone should reboot normally. If not,
something went wrong, get help. Finally, let's back up your phone's
current image

$ adb reboot recovery

This boots your phone into a screen that says "CWM-based Recovery"
at the top-left. Follow the on-screen instructions to make a backup
image.

 == Flash device ==

The "image" to be flashed comprises the custom-built kernel and all
the userspace programs and libraries.

WARNING: Make sure you back up before the next command. If the image
is bad, it can also *BRICK* your phone. Flash at your own risk.

$ make flash-only

If all goes well, you'll see the phone reboot into the bootloader,
then your host machine will report the progress of files it uploads
and installs on the device. After finishing, the device will reboot.

 == Install Gaia ==

Gaia is the phone experience prototype being developed by Mozilla. It
is built into the system image by default. To update gaia on a flashed
device, run

$ make install-gaia

If you press the "Home" button on device, the Gaia homescreen will
reload.


Happy hacking.
Something went wrong with that request. Please try again.