OS: Android - Build Untuk Motorola

From OnnoWiki
Jump to navigation Jump to search

HOWTO: Build and Flash Motorola's kernel from source

   DISCLAIMER:
   I'm not responsible for any damages done to your phone. Please read carefully, and also please, please do a nandroid backup.
   If any of the following fails, don't continue. And post your errors on this thread.


   Prepare your system
   Code:
   $ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev
   Get the Kernel sources for your device from https://opensource.motorola.com/sf/g...s.cliqdext/frs
   Be sure to download the one for your CLIQ/DEXT, if you compile other than the one intended for your device you will be left in 1969!! (DISCO!).
   Note: The latest for TMO, is split in 3 files, download all of them.
   Once you have downloaded all your files
   Code:
   $ mkdir ~/motorola-source
   $ gunzip morrison-customer-tmo-1_4-release-1_4_8-framework.tar.gz
   $ tar xvf morrison-customer-tmo-1_4-release-1_4_8-framework.tar -C ~/motorola-source
   $ gunzip morrison-customer-tmo-1_4-release-1_4_8-external.tar.gz
   $ tar xvf morrison-customer-tmo-1_4-release-1_4_8-external.tar -C ~/motorola-source
   $ gunzip morrison-customer-tmo-1_4-release-1_4_8-kernel.tar.gz
   $ tar xvf morrison-customer-tmo-1_4-release-1_4_8-kernel.tar -C ~/motorola-source
   This should leave a directory structure like this under ~/motorola-source
   Code:
   $ ls ~/motorola-source
   base  bionic  bootable  build  dalvik  external  frameworks  kernel  libhardware  libhardware_legacy  Makefile  msm7k  out  prebuilt  README.txt  system  unpack.pl  vendor
   Now lets get the prerequisites stated at ~/motorola-source/README.txt


   Once you have downloaded all of previous requirements you will need to download several things from android to do this:
   Code:
   $ mkdir ~/moto-prerquisites
   $ cd ~/moto-prerquisites
   $ git clone git://android.git.kernel.org/platform/frameworks/base.git
   $ git clone git://android.git.kernel.org/platform/hardware/libhardware.git
   $ git clone git://android.git.kernel.org/platform/hardware/libhardware_legacy.git
   $ git clone git://android.git.kernel.org/platform/hardware/msm7k.git
   $ git clone git://android.git.kernel.org/platform/prebuilt.git
   Get ready to wait a while because de prebuilt repository is quite big
   Once all of the above have finished lets set the prerequisites to the TAGS specified in the README.txt
   Code:
   $ cd ~/moto-prerquisites/base 
   $ git checkout android-1.5r3
   $ cd ~/moto-prerquisites/libhardware
   $ git checkout android-1.5r3
   $ cd ~/moto-prerquisites/libhardware_legacy
   $ git checkout android-1.5r3
   $ cd ~/moto-prerquisites/msm7k
   $ git checkout android-1.6_r1
   $ cd ~/moto-prerquisites/prebuilt
   $ git checkout android-1.5r3
   Once you've done this copy all the directories to ~/motorola-source
   Code:
   $ cp -r base libhardware libhardware_legacy msm7k prebuilt ~/motorola-source
   Now we have to unpack what comes in the sources from motorola
   Code:
   $ cd ~/motorola-source
   $ chmod +x unpack.pl
   $ ./unpack.pl
   Now you have everything that's needed to compile your kernel
   You have to set some variables first
   Code:
   $ export PLATFORM_DIR=~/motorola/source
   $ export ARCH=arm
   $ export CROSS_COMPILE=arm-eabi-
   $ export PATH=/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin:
   Now lets build
   Code:
   cd /kernel 
   $ make msm_mot_defconfig
   This line will build the kernel and output a zImage
   Code:
   $ make ANDROID_BUILD_TOP=
   This will build the wireless driver module dhd.ko
   Code:
   $ make -C /system/wlan/bcm/osrc/open-src/src/dhd/linux ANDROID_BUILD_TOP=
   Now you have build your kernel!
   results should be
   Code:
   ~/motorola-source/kernel/arch/arm/boot/zImage
   ~/motorola-source/system/wlan/bcm/osrc/open-src/src/dhd/linux/dhd.ko
   In order to flash this to your system you will need
   A nandroid backup and unpack-bootimg.pl and repack-bootimg.pl get them from here http://android-dls.com/wiki/index.ph...ck_Boot_Images
   Code:
   $ mkdir ~/bin
   $ unzip unpack-bootimg.zip -d ~/bin
   $ unzip repack-bootimg.zip -d ~/bin
   $ export PATH=:~/bin
   With your nandroid backup search for your boot.img and copy it somewhere easy to find
   Code:
   $ mkdir ~/mymoto
   $ cd ~/mymoto
   $ cp /path/to/my/nandroid/boot.img .
   Extract the boot image
   Code:
   $ unpack-bootimg.pl boot.img
   this will leave you with
   Code:
   $ ls ~/mymoto
   boot.img  boot.img-kernel.gz  boot.img-ramdisk  boot.img-ramdisk.cpio.gz
   Now lets repack that boot image with our new kernel
   Code:
   $ cd ~/mymoto
   $ repack-bootimg.pl ~/motorola-source/kernel/arch/arm/boot/zImage boot.img-ramdisk my-boot.img


   //You'll need android-sdk installed to use adb search the forums on how to install android-sdk
   Now push your image and wireless driver to your phone
   Code:
   $ adb push my-boot.img /sdcard/
   $ adb push ~/motorola-source/system/wlan/bcm/osrc/open-src/src/dhd/linux/dhd.ko /system/lib/
   $ adb shell


   Now let's see where we should flash our image
   Code:
   # cat /proc/mtd
   dev:    size   erasesize  name
   mtd0: 00300000 00020000 "boot"
   mtd1: 08ac0000 00020000 "system"
   mtd2: 0df80000 00020000 "userdata"
   mtd3: 00040000 00020000 "misc"
   mtd4: 00500000 00020000 "recovery"
   mtd5: 06000000 00020000 "cache"
   mtd6: 00080000 00020000 "splash"
   As we can see mtd0 is where our boot image is stored, be sure to checkout wich one corresponds to your phone but it should be the same for all
   now erase /dev/mtd/mtd0
   Code:
   # cat /dev/zero > /dev/mtd/mtd0
   write: No space left on device [this is ok, you can ignore]
   # flash_image boot /sdcard/my-boot.img
   # reboot
   That's it now you have built and flashed your newly built kernel! 

- See more at: http://modmymobile.com/forums/403-motorola-cliq-development/531359-howto-build-flash-motorolas-kernel-source.html#sthash.tKEZTUpR.dpuf


Referensi