Edit:
We have now a temporary git repository at gitorious:
http://gitorious.org/replicant
Before starting¶
- Root your phone
- Backup your current system!!!
- Install git
Setting up the build environment and getting source code¶
These instructions assume that you are building replicant in your home directory (~). If you are building it in another directory, modify path names accordingly.
Get the repo tool¶
repo is a front-end to git which is used to manage several git repositories.
mkdir bin cd bin wget http://android.git.kernel.org/repo chmod a+x repo cd ..
Check out the Replicant repository¶
This step will download the Android source (minus the kernel) and the Replicant patches.
mkdir replicant cd replicant ../bin/repo init -u git://gitorious.org/replicant/manifest.git -b replicant ../bin/repo sync
Optional: building the kernel and wireless LAN driver¶
By default, the Android build system uses a pre-compiled kernel and wireless driver rather than compiling these components from scratch. If you want to compile your own copy of either of these components, you have to compile both: the wireless driver sources included with Android are incompatible with the pre-compiled kernel.
Get the kernel source¶
To download the kernel sources, create a file in your replicant/.repo directory called "local_manifest.xml" containing the following:
<?xml version="1.0" encoding="UTF-8"?> <manifest> <project path="kernel" name="kernel/msm" revision="refs/heads/android-msm-2.6.27"/> </manifest>
Then from the ~/replicant/ directory, run:
../bin/repo sync
This will create a directory called replicant/kernel and download the kernel sources to it.
Build the kernel¶
To build the kernel:
cd ~/replicant/kernel export ARCH=arm export CROSS_COMPILE=arm-eabi- export PATH=$PATH:~/replicant/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin cp arch/arm/configs/msm_defconfig .config make oldconfig && make
Wait several hours.
Point the build system to your kernel¶
Create a file called ~/replicant/buildspec.mk containing the following:
TARGET_PRODUCT:=htc_dream TARGET_PREBUILT_KERNEL:=kernel/arch/arm/boot/zImage
This will instruct the build process to use your kernel rather than the pre-compiled kernel.
Build the wifi module¶
To build the wifi module:
cd ~/replicant/system/wlan/ti/sta_dk_4_0_4_32 export KERNEL_DIR=~/replicant/kernel/ make
(If make can't find your compiler, re-run same PATH export command you ran before compiling the kernel.)
Replace the pre-built wifi module with the one you just built:
cp wlan.ko ~/replicant/vendor/htc/dream-open
Build the firmware¶
Change the build scripts to include some important missing packages¶
(This section will be removed once these changes are committed to the replicant repository)
<pre>
PRODUCT_PACKAGES := \
Calculator \
Email \
[[ImProvider]] \
[[SdkSetup]] \
[[VoiceDialer]]
</pre>
This will include packages in the build which would otherwise be missing (including the [[SdkSetup]] package, which will enable incoming calls).
<pre>
cd ~/replicant
make
</pre>
Wait and wait and wait.
h2. Flashing the new firmware
[to be written]
h2. Building individual pieces
h3. Each time you want to build something
* open a new console
* Then type:
<pre>
cd ~/replicant
source build/envsetup.sh
export ANDROID_JAVA_HOME=$JAVA_HOME
lunch htc_dream-eng
make
</pre>
* The files to flash are in ~/replicant/out/target/product/dream,flash them and then clear the cache
* boot and push the wifi firmware if you want it
h3. If you want to build a particular project
* open a new console
* build everything if it was not done before
* Then type:
<pre>
cd ~/replicant
source build/envsetup.sh
export ANDROID_JAVA_HOME=$JAVA_HOME
lunch htc_dream-eng
#go into the directory containing an Android.mk
mm
</pre>
h2. error workarrounds ==
hyts_Foo.c ===
if you have:
<pre>
target Java: [[SettingsProvider]] (out/target/common/obj/APPS/SettingsProvider_intermediates/classes)
target Java: Settings (out/target/common/obj/APPS/Settings_intermediates/classes)
java.util.zip.ZipException: duplicate entry: hyts_Foo.c
at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:192)
at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
at sun.tools.jar.Main.addFile(Main.java:731)
at sun.tools.jar.Main.update(Main.java:585)
at sun.tools.jar.Main.run(Main.java:220)
at sun.tools.jar.Main.main(Main.java:1167)
make: *** [out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar] Error 1
make: *** Deleting file @out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar'
make: *** Waiting for unfinished jobs....
Note: frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
</pre>
do that:
<pre>
rm -f dalvik/libcore/luni/src/test/resources/hyts_Foo.c
</pre>
And it will continue to build
Note that that:
<pre>
rm -rf dalvik/libcore/dom/src/test/resources/*
rm -rf dalvik/libcore/xml/src/test/resources/*
</pre>
didn't work
The workarrounds came from "here":http://groups.google.com/group/android-porting/browse_thread/thread/c51d436b2b1edc8d/b320ee78b2ddd0e4 and "here":http://lazyhack.net/tag/emulator/
h3. No rule to make target @development/data/etc/apns-conf_sdk.xml'
if you have:
<pre>
make: *** No rule to make target @development/data/etc/apns-conf_sdk.xml', needed by @out/target/product/dream-open/system/etc/apns-conf.xml'. Stop.
make: *** Waiting for unfinished jobs....
</pre>
simply re-type make and it should continue
Updated by Denis 'GNUtoo' Carikli almost 15 years ago ยท 34 revisions