ROM Android: Penggunaan adb

From OnnoWiki
Jump to navigation Jump to search

Instalasi

sudo apt-get install android-tools-adb


devices

adb devices -l
List of devices attached 
5H9TFYCYSGQ8Y9MZ       device usb:2-5 product:a80a model:A80A device:a80a


shell

adb shell

Ini akan masuk ke shell

shell@a80a:/ $

Untuk menjadi superuser ketik

su

Perlu di allow oleh kingroot yang sudah di instalasi sebelumnya

shell@a80a:/ #


mount -o remount, rw /system


install dan uninstall

The most commonly used "adb" command is the "adb install" command that allows you to install an application stored in the specified APK file to the connect Android emulator or device:

adb install <path_to_apk>

You can also uninstall a package from the connected emulator or device by using the "adb uninstall" command:

adb uninstall <apk_name>


Push dan Pull

he "adb" tool also offers you commands to copy files into and from the connected Android emulator or devices.

The "adb push <local> <remote>" copies a file or folder from the local system to the remote emulator or device.

The "adb pull <remote> <local>" copies a file or folder from the remote emulator or device to the local system.


adb shell

adb shell
su
more /proc/mtd

Instalasi fastboot

apt-get install android-tools-fastboot



Cara masuk ke fastboot

adb devices -l
adb reboot-bootloader
fastboot devices

akan keluar

5H9TFYCYSGQ8Y9MZ	fastboot


fastboot flash recovery recovery.img

Here's a quick explanation of the above command:

fastboot: that's the executable tool
flash: that's the function we want the fastboot tool to perform
recovery: this is the name of the partition we want to flash into. since we are flashing  a recovery image, it needs to go to the recovery partition.
recovery.img: this is the name of the actual file to flash. Your filename may be different. Just make sure it matches the actual filename.


The fastboot command line usage is:

$ fastboot -h usage: fastboot [ <option> ] <command>

commands:

 update <filename>                        reflash device from update.zip
 flashall                                 flash boot + recovery + system
 flash <partition> [ <filename> ]         write a file to a flash partition
 erase <partition>                        erase a flash partition
 getvar <variable>                        display a bootloader variable
 boot <kernel> [ <ramdisk> ]              download and boot kernel
 flash:raw boot <kernel> [ <ramdisk> ]    create bootimage and flash it
 devices                                  list all connected devices
 reboot                                   reboot device normally
 reboot-bootloader                        reboot device into bootloader

options:

 -w                                       erase userdata and cache
 -s <serial number>                       specify device serial number
 -p <product>                             specify product name
 -c <cmdline>                             override kernel commandline
 -i <vendor id>                           specify a custom USB vendor id

Erase an individual partition

To erase an individual partition, use:

   fastboot erase <partition>

Ex: fastboot erase cache

Write to an individual partition

To write an image file to an individual partition, use:

   fastboot flash <partition> [ <filename> ] 

If writing to the 'splash1' partition, the file needs to be an image file in a special format. See G1 Splash Image for details.

If writing to the 'recovery' or 'boot' partitions, the file consists of a Linux kernel and initrd file system image. This can be created with the 'mkbootimg' program.

If writing to the 'system', 'cache', or 'userdata' partitions, the file is a file system image formatted in yaffs2 format.

FIXTHIS - document how to create one of these. To boot with a host-side kernel image (and rootfs image)

This command allows you to download a kernel image (and optional root filesystem image) and boot the phone with those, instead of using the kernel and rootfs in the boot flash partition. It is very useful while developing a kernel or modifying the rootfs.

   fastboot boot <kernel> [ <ramdisk> ]

Ex: fastboot boot linux-2.6/arch/arm/boot/zImage root-image/recovery.img-ramdisk.cpio.gz


fastboot boot boot.img


Reboot the phone

To reboot the phone, using the kernel and rootfs in the 'boot' partition:

   fastboot reboot


fastboot: cek partisi

fastboot getvar all
(bootloader) 	partition-size:fat: 1a4500000
(bootloader) 	partition-type:fat: fat
(bootloader) 	partition-size:userdata: 32000000
(bootloader) 	partition-type:userdata: ext4
(bootloader) 	partition-size:cache: 8000000
(bootloader) 	partition-type:cache: ext4
(bootloader) 	partition-size:system: 32000000
(bootloader) 	partition-type:system: ext4
(bootloader) 	partition-size:expdb: f60000
(bootloader) 	partition-type:expdb: raw data
(bootloader) 	partition-size:ebr2: 80000
(bootloader) 	partition-type:ebr2: raw data
(bootloader) 	partition-size:logo: 800000
(bootloader) 	partition-type:logo: raw data
(bootloader) 	partition-size:misc: 80000
(bootloader) 	partition-type:misc: raw data
(bootloader) 	partition-size:sec_ro: 600000
(bootloader) 	partition-type:sec_ro: ext4
(bootloader) 	partition-size:recovery: a00000
(bootloader) 	partition-type:recovery: raw data
(bootloader) 	partition-size:boot: a00000
(bootloader) 	partition-type:boot: raw data
(bootloader) 	partition-size:uboot: 60000
(bootloader) 	partition-type:uboot: raw data
(bootloader) 	partition-size:seccfg: 40000
(bootloader) 	partition-type:seccfg: raw data
(bootloader) 	partition-size:protect_s: a00000
(bootloader) 	partition-type:protect_s: ext4
(bootloader) 	partition-size:protect_f: a00000
(bootloader) 	partition-type:protect_f: ext4
(bootloader) 	partition-size:nvram: 500000
(bootloader) 	partition-type:nvram: raw data
(bootloader) 	partition-size:pro_info: 300000
(bootloader) 	partition-type:pro_info: raw data
(bootloader) 	partition-size:ebr1: 80000
(bootloader) 	partition-type:ebr1: raw data
(bootloader) 	partition-size:mbr: 80000
(bootloader) 	partition-type:mbr: raw data
(bootloader) 	partition-size:preloader: 40000
(bootloader) 	partition-type:preloader: raw data
(bootloader) 	kernel: lk
(bootloader) 	product: WT99601
(bootloader) 	version: 0.5
all: Done!!
finished. total time: 0.008s



fastboot flashing

$ fastboot -i 0x04c5 devices
mt8389_tablet_s3    fastboot

$ fastboot -i 0x04c5 flash uboot lk.bin 
sending 'uboot' (243 KB)...
OKAY [  0.021s]
writing 'uboot'...
OKAY [  0.028s]
finished. total time: 0.050s

fastboot -i 0x04c5 devices
fastboot -i 0x04c5 flash uboot lk.bin 
fastboot -i 0x04c5 flash boot boot2.img 
fastboot -i 0x04c5 flash android system2.img 
fastboot reboot
fastboot -i 0x04c5 reboot

Referensi