summaryrefslogtreecommitdiff
path: root/README
blob: b55be32889508043209a09bfb7cbc9b98d02e611 (plain)
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
This git repository contains specifications used by the anagrman tool to
create local_manifest.xml files with the specified modules (project bundles
or feature packages).

The following instructions will guide you in downloading a complete Android
OS source tree, extract the firmware blobs, build, and install. If you need
to restore a factory image, see:
https://developers.google.com/android/nexus/images


			1. Preparations:

anagrman
	Get git://git.collabora.co.uk/git/android/anagrman.git
	From there you get the command 'anagrman' which is a python
	script. It will be needed later for creating a local_manifest.xml.

Set up udev rules for Galaxy Nexus, as described in
http://source.android.com/source/initializing.html

Install the repo tool as described here:
http://source.android.com/source/downloading.html
so that you have the 'repo' command in your PATH.


			2. Downloading:

Get the Android tree used for Samsung Galaxy Nexus:
$ mkdir galaxy-nexus && cd galaxy-nexus
$ repo init -u git://git.collabora.co.uk/git/android/manifest.git

Select the modules you want with anagrman, a local_manifest.xml file is
written in the current directory. This example selects wayland:
$ cd .repo
$ anagrman -m wayland
$ cd ..

Fetch it all, this will take a while:
$ cd galaxy-nexus && repo sync -j2
$ cd ..

You may need to run 'repo sync' multiple times, if some git repositories
fail to download. This will take quite a while, depending on your internet
speed.


			3. Environment setup

The following is a summary from
http://source.android.com/source/building.html

$ cd galaxy-nexus
$ source build/envsetup.sh
$ lunch
and select full_maguro-userdebug.

You need to do this every time you launch a new shell to work in.


			4. Build device tools

We follow http://source.android.com/source/building-devices.html like this:
$ make fastboot adb

On your Galaxy Nexus device, go to Settings -> Developer options, and enable
USB debugging. After that, plug the device to your computer via USB.


			5. Unlocking the device

Reboot the device into the bootloader:
$ adb reboot-bootloader

Unlock the device:
$ fastboot oem unlock
and follow the intructions appearing on the device, and finally reboot the
device.

Booting may take a while, and when it is ready, enable USB debugging again,
see Section 4.


			6. Extracting the firmware blobs

First, download all the packages for you particular device from
http://code.google.com/android/nexus/drivers.html and get the shell scripts
from the packages.

Go to your android root directory (galaxy-nexus), and run the scripts you
got from the packages.

Then, we download more firmware directly from the device:
$ cd device/samsung/maguro
$ ./extract-files.sh

Now you have all the firmware blobs in your Android tree. It is nice to save
those for later, in case you need them:
$ cd galaxy-nexus
$ tar zcf vendor-backups.tar.gz vendor

The blobs can also be extracted again, if you first flash the factory image
into your device.


			7. Building

We assume you have executed Section 3, Environment setup.

To build everything:
$ m

That will take several hours. The build process will configure all
projects that use autotools, and generate their Android makefiles. Due to
this process, GNU Make will automatically reload all makefiles 2-3 times
during the first build.


			8. Installing

First, make sure your build completed successfully:
$ m

It should not build anything more at this point, and it should exit
successfully.

The device needs to be set into fastboot mode again:
$ adb reboot-bootloader

You install everything into your device by:
$ fastboot -w flashall

The device will reboot automatically, and afterwards you should
have the new Android OS running in your device. Don't worry if the
device "spontaneously" reboots once more. That is just Android
finalising the installation.

If nothing appears on screen in few minutes, something could be wrong.
See Appendix A, Troubleshooting.


		Appendix A. Troubleshooting:

If after building 'repo sync' fails with a dirty source tree, try
$ make contrib-reset

If the command 'adb root' fails with "adbd cannot run as root in production
builds", verify that you chose a userdebug variant for 'lunch'.

If any 'adb' command says "device not found", make sure you have the udev
rules in place and the device plugged in and turned on.

If after installation, the device does not show anything on screen, try to
see what it is doing:
$ adb logcat '*:V'


		Appendix B. Special make targets:

contrib-reset
	For every autotools project, run the equivalent of
	'git reset --hard HEAD' and 'git clean -dxf'.
	Does not remove any build products, that are outside the source
	trees (all Android build system products). Usually used with
	contrib-clean as: 'make contrib-clean contrib-reset'

contrib-clean
	Runs the clean-<module> targets for all non-AOSP modules.
	Note, that is not a special clean-up rule like 'clean' is.
	If there are makefiles to generate, they will be generated,
	before contrib-clean runs. Removes Android build system
	products with the benefit of not wiping the whole out/.

contrib-debug
	Prints some info, like configure variables
	and found pkg-config packages.