Edit: We have now a temporary git repository at gitorious: http://gitorious.org/replicant h2. Before starting * Root your phone * Backup your current system!!! * Install git h2. 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. h3. 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 ..h3. 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 synch2. 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. h3. Get the kernel source To download the kernel sources, create a file in your replicant/.repo directory called "local_manifest.xml" containing the following:
Then from the ~/replicant/ directory, run:
../bin/repo syncThis will create a directory called replicant/kernel and download the kernel sources to it. h3. 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 && makeWait several hours. h3. 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/zImageThis will instruct the build process to use your kernel rather than the pre-compiled kernel. h3. 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-openh2. Build the firmware h3. Change the build scripts to include some important missing packages _(This section will be removed once these changes are committed to the replicant repository)_
PRODUCT_PACKAGES := \ Calculator \ Email \ [[ImProvider]] \ [[SdkSetup]] \ [[VoiceDialer]]This will include packages in the build which would otherwise be missing (including the [[SdkSetup]] package, which will enable incoming calls).cd ~/replicant makeWait 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:cd ~/replicant source build/envsetup.sh export ANDROID_JAVA_HOME=$JAVA_HOME lunch htc_dream-eng make* 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:cd ~/replicant source build/envsetup.sh export ANDROID_JAVA_HOME=$JAVA_HOME lunch htc_dream-eng #go into the directory containing an Android.mk mmh2. error workarrounds == hyts_Foo.c === if you have: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.do that:rm -f dalvik/libcore/luni/src/test/resources/hyts_Foo.cAnd it will continue to build Note that that:rm -rf dalvik/libcore/dom/src/test/resources/* rm -rf dalvik/libcore/xml/src/test/resources/*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: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....simply re-type make and it should continue