Project

General

Profile

DeprecatedBuildAndroid » History » Revision 27

Revision 26 (Aaron Williamson -, 09/30/2009 09:55 PM) → Revision 27/34 (Denis 'GNUtoo' Carikli, 10/10/2009 04:57 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 
  ../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 
  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 
 }}} 

 == Status == 
  * ril works more or less: 
  * * calls should work(in/out) 
  * * sms should work(in/out) 
  * * headphones not supported 
 
  * sound works even with headphones(beware calls's sound don't work with headphones)