Project

General

Profile

DeprecatedBuildAndroid » History » Revision 31

Revision 30 (Denis 'GNUtoo' Carikli, 11/04/2010 09:48 PM) → Revision 31/34 (Denis 'GNUtoo' Carikli, 11/04/2010 09:54 PM)

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)'' 

 Open the file {{{~/replicant/vendor/htc/dream-open/htc_dream.mk}}} and at the following text to the beginning of the file: 
 {{{ 
  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 
 make 
 }}} 

 Wait and wait and wait. 

 == Flashing the new firmware == 

 [to be written] 

 == Building individual pieces == 

 === 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 


 === 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 
  mm 
 }}} 

 == 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.c -rf dalvik/libcore/dom/src/test/resources/* 
 rm -rf dalvik/libcore/xml/src/test/resources/* 
 }}} 
 And it will continue to build 
 {{{ 
 rm -rf dalvik/libcore/dom/src/test/resources/* 
 rm -rf dalvik/libcore/xml/src/test/resources/* 
 }}} didn't work 
 

 The workarround came from [http://groups.google.com/group/android-porting/browse_thread/thread/c51d436b2b1edc8d/b320ee78b2ddd0e4 here] and [http://lazyhack.net/tag/emulator/ here]