forked from andreasgal/B2G
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathINSTALL
213 lines (149 loc) · 6.55 KB
/
INSTALL
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
This document assumes you've already cloned the b2g repo to the path
$B2G.
Dependencies
--------------
Sadly, B2G currently depends on not only the android source, but also
the android SDK and NDK. These dependencies will be removed
eventually, but for now you need to install both. Follow the
instructions at
http://developer.android.com/sdk/installing.html
http://developer.android.com/sdk/ndk/index.html
From here on, this document assumes you installed the SDK to the path
$ANDROID_SDK and the NDK to the path $ANDROID_NDK.
You need to have adb set up to allow your machine to talk to your
phone. Follow the instructions at
http://developer.android.com/guide/developing/device.html
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
Quick start
-------------
This only works if your bootloader is unlocked. If it's not, or
you're not sure, follow the more detailed instructions below. Make
sure to back up your phone before doing this.
$ cd $B2G
$ make sync
$ cat > local.mk << EOF
ANDROID_SDK="$ANDROID_SDK"
ANDROID_NDK="$ANDROID_NDK"
EOF
$ make config-nexuss4g # or, make config-galaxy-s2
$ make flash
# temporary hack you may need
$ adb shell chmod -R 777 /data/system
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|.
== [TEMPORARY] Configure local SDK and NDK paths ==
We're using these currently for reasons not worth knowing.
$ cat > local.mk << EOF
ANDROID_SDK="$ANDROID_SDK"
ANDROID_NDK="$ANDROID_NDK"
EOF
== Configure repo for your device ==
Nexus S 4G:
$ make config-nexuss4g
Galaxy S II:
$ make config-galaxy-s2
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.
In the case of the Nexus S 4G at least, you don't *need* to install
the proprietary blobs if you don't want to; if you don't, the device
will function, only more slowly and without access to some sensors.
== Build the code ==
This part is relatively simple
$ make
This step can take a long time. Subsequent rebuilds will usually be
much faster though.
== Unlock your device's bootloader ==
This is only needed for the Nexus S 4G.
The step above builds host tools as well as the device image. We need
the host tools to unlock the bootloader.
WARNING: This next command deletes *ALL* your user data. Make sure
you back up beforehand.
$ make unlock-bootloader
If this works, you should see your device reboot into a
terminal-looking black screen with a large android logo in the middle
and some small text to the top-left and bottom-left. Follow the
on-screen instructions to confirm unlocking the bootloader. After
that, your device reboot.
== Back up device ==
WARNING: Only tested with the Galaxy S II. Instructions will be
different for other phones. This backup process is absolutely
essential for the Galaxy S II because the B2G image is very unstable
there.
These steps install the "ClockworkMod" recovery image. Among other
things, it lets you make full backups of the phone's partitions to the
sdcard, and restore them. This is extraordinarily useful. To install
ClockworkMod
$ cd /tmp
$ wget http://cmw.22aaf3.com/c1/recovery/recovery-clockwork-4.0.1.4-galaxys2.tar
$ tar xvf recovery-clockwork-*.tar
$ 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 ClockworkMod
$ heimdall flash --kernel zImage
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 "ClockworkMod 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: This next command deletes *ALL* your user data. Make sure
you back up beforehand. If the image is bad, it can also *BRICK* your
phone. Flash at your own risk.
NOTE: For the Galaxy S II, you must first reboot into recovery mode
(adb reboot recovery), then choose "wipe data/factory reset". This
will be fixed. BE SURE you don't reboot your phone before running the
following step. That is, you should run "make flash" while your phone
is still in recovery mode.
$ make flash
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.
After flashing, you may need to run
adb shell chmod -R 777 /data/system
== 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.
== Troubleshooting ==
If you get a message at the end of the install-gecko process that says:
# /sbin/sh pm not found
Then this refers to the android package manager not working properly on the device.
The reason it's not working is that it doesn't have permissions to write to /data/system.
To fix:
1. $ adb push gecko/objdir-prof-android/dist/b2g-9.0a1.en-US.android-arm.apk /data/local/tmp/b2g.apk
2. $ adb shell
3. # chmod -R 777 /data/system
4. # sh /system/bin/pm install -r /data/local/tmp/b2g.apk
5. # reboot
Happy hacking.