본문 바로가기
3. 개발 관련/정리 :: issue 와 resovle

Hacked your Android mobile : Nexus5

by kyuho.choi 2014. 6. 23.
728x90
반응형

-. Course Outline

 : Purporse : SQLite/FileSystem/BlockDriver to LDD/Storage

 : Benchmark Tools

 

0. Android Custom Kernel

 : Environment


Host : Ubuntu 12.04

Kernel : 3.2.0.23-generic

H/W : Nexus5


1. Install Source for msm kernel

#] git clone http:s//android.googlesource.com/kernel/msm.git

#] cd msm

#] git checkout 3.4.0-generic


2. Install Toolchain

#] cd workspace

#] git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6 . 

#] export CROSS_COMPILE=/home/android/workspace/bin/arm-eabi-


3. Build Kernel

#] cd nexus5/kernel

#] make ARCH=arm hammerhead_defconfig

#] make -j2


4. Install ADB and Fastboot via PPA(http://www.webupd8.org/2012/08/install-adb-and-fastboot-android-tools.html)

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb android-tools-fastboot

: if PPA tools not working, remove packages :(

#] sudo apt-get remove android-tools-adb android-tools-fastboot


4. Install Android Tools with dev site(http://developer.android.com/sdk/index.html#download)

#] tar xzf /home/android/Downloads/android-sdk-linux.tgz  -C /home/android/bin

#] cd /home/android/bin/android-sdk-linux

#] ./tools/android update --no-ui


* Add PATH for JAVA_HOME & platform-tools


5. USB debugging setup in Nexus5

 `Menu` => `About Phone` => "Many time" touched `build number`!. => back => `Developer option` => USB debugging enabled.


6. ADB command testing

#] adb  devices

#] adb  shell ; exit

#] adb  push aa /sdcard/.

#] adb pull /sdcard/aa .


7. FASTBOOT command testing

: reboot nexus5

#] adb reboot-bootloader

or 

- Manual power-off/Boot key with Vol-up/Vol-down keys.


#] fastboot devices


 android@ubuntu:~/bin/android-sdk-linux/platform-tools$ fastboot devices

???????????? fastboot

android@ubuntu:~/bin/android-sdk-linux/platform-tools$ fastboot oem unlock

...

FAILED (remote: Already Unlocked)

finished. total time: 0.004s

android@ubuntu:~/bin/android-sdk-linux/platform-tools$ fastboot oem lock

...

OKAY [  0.093s]

finished. total time: 0.093s

android@ubuntu:~/bin/android-sdk-linux/platform-tools$ fastboot oem unlock

...

OKAY [ 19.151s]

finished. total time: 19.151s

android@ubuntu:~/bin/android-sdk-linux/platform-tools$ 



8. Download recovery image for Nexus5


http://techerrata.com/file/twrp2/hammerhead/openrecovery-twrp-2.6.3.4-hammerhead.img

download : openrecovery-twrp-2.6.3.4-hammerhead.img


-. Recovery image flash with Fastboot 

android@ubuntu:~/Downloads$ adb reboot bootloader

android@ubuntu:~/Downloads$ fastboot flash recovery ./openrecovery-twrp-2.6.3.4-hammerhead.img  


-. for elegant reboot. :)

#] fastboot reboot


9. Rooting via SUperSU

-. Click `SUperSU installer`

   => Check TWRP => COntinue

#] adb shell;su


10. Bootimage dump from Nexus5 device

-. Dump boot image

#] adb  shell

#] su

#] cd /dev/block/platform/msm_sdcc.1/by-name

#] dd if=boot of=sdcard/boot.img 

#] exit; exit

#] adb pull /sdcard/boot.img ./workspace/.


-.Split Boot image to developer readable file list

#] wget http://dmclab.hanyang.ac.kr/wikidata/androidcamp/mkboot_tools.zip

#] unzip mkboot_tools.zip

#] chmod a+x *


: Split boot image to `Boot image files`

#] unmkbootimg -i boot.img

: Replace custom kernel (user built to device kernel)

#] android@ubuntu:~/resource$ cp -a ~/src/nexus5/kernel/arch/arm/boot/zImage-dtb ./kernel


android@ubuntu:~/resource$ mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x00008000 --ramdisk_offset 0x02900000 --second_offset 0x00f00000 --tags_offset 0x02700000 --cmdline 'console=ttyHSL0,115200,n8 androidboot.hardware=hammerhead user_debug=31 maxcpus=2 msm_watchdog_v2.enable=1' --kernel kernel --ramdisk ramdisk.cpio.gz -o ./boot.img


: Device reboot to Bootloader 

#] adb  reboot bootloader


:check device attach in host

#] fastboot devices


: Custom boot image flash to device boot partition

#] fastboot flash boot ./boot.img


: for elegeant reboot  :)

#] fastboot reboot

728x90
반응형

댓글