Difference between revisions of "OS: Android - Flash Device"

From OnnoWiki
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 161: Line 161:
 
  fastboot reboot-bootloader
 
  fastboot reboot-bootloader
 
  fastboot -w update namaimage.zip
 
  fastboot -w update namaimage.zip
 +
 +
 +
 +
==Sideload==
 +
 +
* Masukan device dalam mode recovery (CWM atau TWRP)
 +
 +
Cek dulu
 +
 +
adb devices
 +
 +
Hasilnya kira-kira
 +
 +
* daemon not running. starting it now on port 5037 *
 +
* daemon started successfully *
 +
List of devices attached
 +
55cef322 recovery
 +
 +
* pindah ke folder lokasi file zip image
 +
* Pilih di CWM
 +
 +
wipe data/factory reset
 +
wipe cache partition
 +
install zip > install zip from sideload
 +
 +
* Lakukan di laptop
 +
 +
adb sideload <fileimageandroid>.zip
 +
 +
Lakukan beberapa kali untuk file.zip yang ingin kita instalasi
 +
 +
adb sideload cm-12.1-20160410-NIGHTLY-e980.zip
 +
adb sideload open_gapps-arm-5.1-nano-20160416.zip
 +
 +
 +
 +
==adb reboot==
 +
 +
Enable USB debugging on your android device.
 +
Install adb and USB driver for your device model Samsung, HTC, Sony, LG, Motorola, Google.
 +
Connect your device to PC by USB cable
 +
 +
To boot into download mode for Samsung devices type in cmd window :
 +
 +
adb reboot downloadreboot download
 +
 +
To boot into bootloader mode for most Android devices type in cmd window :
 +
 +
adb reboot-bootloaderreboot-bootloader
 +
 +
To boot into recovery mode for all Android devices type in cmd window :
 +
 +
adb reboot recovery
  
 
==Emulate sebuah Android Device==
 
==Emulate sebuah Android Device==

Latest revision as of 08:03, 18 April 2016

Tulisan ini akan membahas cara mem-flash zip dari ROM / kernel menggunakan cara Recovery dan OEM tools.

Asumsinya, kita sudah mempunyai / memdownload file yang di butuhkan.


ROM Flashing

   Copy the ZIP to your phone
   Power off your phone.
   Boot into recovery.
       Note: must be a custom recovery like CWM (Clockwork Mod recovery) or TeamWin recovery
   Wipe data/factory reset (If your ROM is no-wipe, then no need. But it is recommended)
       Note: Factory reset will clear/wipe all your user data
   Wipe cache.
   Choose Install Zip from sd card.
   Browse to the ZIP you put in your phone.
   Wait while it installs.
   Install Gapps if needed.
   Reboot.

Congratulations, you have flashed your first zip Kernel Flashing

   Copy the kernel ZIP to your phone.
   Power off your phone.
   Boot into recovery.
   Wipe cache.
   Wipe Dalvik cache.
   Choose Install Zip from sd card.
   Browse to the ZIP you copied.
   Wait while it installs.
   Reboot.



Congratulations, you have flashed a kernel OEM Tools Motorola RSD Lite

   Download RSD Lite : ( http://goo.gl/JXJQa )
   Download SBF files for your device from here: ( http://goo.gl/CdZKm )
   Reduce number of letters in archive name to 5
   Go to bootmenu on your device
   Connect device
   Make sure you have installed required device drivers
   Launch RSD Lite
   Click on 3 dot icon
   Choose Uncompress And Start Flashing
   Wait for the process to finish
   All done. SBF successfully flashed.

Troubleshooting

If you experience: “ Please manually power up this phone! “ do as following:

   Leave device connected for 5 minutes with PC and RSD Lite running at current condition
   If nothing happens..unplug your device
   Go to stock recovery
   Wipe data/factory reset
   Wipe cache
   Reboot

Samsung ODIN If you would like to flash ROMs in the .tar format on your Samsung phone, you have to do it with Samsung’s own leaked factory software called “ODIN”. You can also make use of the open source Heimdall application, which works similarly, and is available on Mac and Linux as well.

   Samsung Kies should be installed for the drivers to get installed, if you don’t have Kies, don’t worry. Get the drivers from (SamFirmware Link). Go to the page, select your device, and select “Download” next to “Drivers”.
   Download Odin : (Dev Host Link)
   Download Samsung ROM file for your device. Official ones can be found here : (SamFirmware Link)
   Power off your device.
   Now while pressing volume down and home button simultaneously, keep the power button pressed
   This will bring you to the download mode custom binary warning screen
   Press volume up to confirm
   Phone will enter download mode. Connect to the computer.
   Drivers will be installed.
   Fire up Odin.
   Odin should show a blue text such as “0:[COM3]” written in the ID:COM box. [Note: The COM port will vary from system to system, so do not assume it to be always 3]
   Select the ROM you downloaded. (If its a single file, it should generally be PDA). Confirm that the files are selected in their respective boxes.
   Make sure “Auto Reboot” and “F. Reset Time” is checked and that “Phone EFS Clear” and/or “Flash Lock” is NOT checked.
   Take a deep breath and click “Start”.
   After the flashing process is complete there will be a green “PASS” displayed and the phone will reboot.
   Done! ROM succesfully flashed!


Troubleshooting If you experience a bootloop (phone constantly reboots and reboots on the boot screen) or a soft brick (powering on the phone shows an orange triangle with a phone and computer), don’t be afraid. XDA to the rescue! For a bootloop:

   Take out the battery.
   Wait for 3 min.
   Put the battery in. Do NOT power on the phone.
   Keep pressing Volume Up + Home simultaneously and press the power button to turn on the device.
   Once the phone shows the model number screen, leave the buttons.
   Your phone will boot into recovery.
   Select “Wipe data/ Factory reset”. (Volume Up for going up and Volume down to go down)
   After the reset is done, select “Reboot system now”.
   The phone will reboot and you should be all fine.

For a soft brick:

   You probably flashed some faulty firmware or firmware not meant for your device.
   If instead of “PASS” it shows “FAIL”, step 3 is the way out.
   Download the correct firmware and flash again.



Run It!

Kita dapat menjalankan image yang kita buat menggunakan emulator atau flash ke device. Perlu kita ketahui bahwa kita harus menentukan target build menggunakan lunch, biasanya akan sangat sukar di jalankan kalau image tersebut di jalankan ke target yang tidak di tujukan sebelumnya.


Cek Device

Gunakan

adb devices

Hasilnya

List of devices attached 
LG-F240S-55cef322	device

Flash ke Device

Untuk flash ke device, kita butuh menggunakan fastboot yang biasanya sudah termasuk dalam path setelah kita telah sukses build. Buat device agar masuk dalam fastboot mode baik secara manual dengan cara menekan tombol yang benar saat booting, atau melalui shell menggunakan perintah

adb reboot bootloader


Tampaknya untuk mem-flash device harus dilakukan dari folder .zip dari product yang kita buat

cd ~/android-cyanogenmod/out/target/product/e980/

Cek fastboot mengenali device

fastboot devices

Jika device sudah dalam mode fastboot, jalankan

fastboot flashall -w

opsi -w akan menghapus partisi /data di device. Ini berguna jika kita melakukan flashing untuk pertama kali ke sebuah device, jika tidak maka cara ini tidak berguna.


Beberapa perintah fastboot lainnya

fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot erase userdata
fastboot flash bootloader bootloader.img
fastboot reboot-bootloader
fastboot -w update namaimage.zip


Sideload

  • Masukan device dalam mode recovery (CWM atau TWRP)

Cek dulu

adb devices

Hasilnya kira-kira

* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached 
55cef322	recovery
  • pindah ke folder lokasi file zip image
  • Pilih di CWM
wipe data/factory reset
wipe cache partition
install zip > install zip from sideload
  • Lakukan di laptop
adb sideload <fileimageandroid>.zip

Lakukan beberapa kali untuk file.zip yang ingin kita instalasi

adb sideload cm-12.1-20160410-NIGHTLY-e980.zip 
adb sideload open_gapps-arm-5.1-nano-20160416.zip


adb reboot

Enable USB debugging on your android device. Install adb and USB driver for your device model Samsung, HTC, Sony, LG, Motorola, Google. Connect your device to PC by USB cable

To boot into download mode for Samsung devices type in cmd window :

adb reboot downloadreboot download

To boot into bootloader mode for most Android devices type in cmd window :

adb reboot-bootloaderreboot-bootloader

To boot into recovery mode for all Android devices type in cmd window :

adb reboot recovery

Emulate sebuah Android Device

emulator di tambahkan ke path kita secara automatis saat proses build. Untuk menjalankan emulator, ketik,

$ emulator


Fastboot is a command line tool used to directly flash the filesystem in Android devices from a host via USB. It allows flashing of unsigned partition images. It is disabled in production devices since USB support has been disabled in the bootloader. You must have an Engineering SPL, or an SPL that is S-OFF.

After installing the Android SDK or ADB Standalone you can use 'fastboot' in addition to the more common ADB.

Verify SPL S-OFF

With the exception of the Google Nexus One (which has an OEM unlock), when you boot the device into the bootloader, you should see S-OFF (security off) on the top line. If you see S-ON, or you see a four-color rainbow background, the SPL does not support fastboot. You will need to install a fastboot compatable SPL, such as HardSPL or any of the Engineering SPLs for various devices. See the device specific page for further instructions.

Access bootloader

  1. Make sure you have ADB or the SDK installed.
  2. Download fastboot for the appropriate operating system for your computer.
  3. Place the executable in the proper place, usually:
    • Linux: ~/android_sdk/tools/ or ~/bin/
    • OS X: ~/android-sdk-macosx/platform-tools/
    • Windows: C:\android-sdk-windows\tools
  4. Turn off the device.
  5. Boot device into bootloader
  6. Make sure the device is in FASTBOOT and not HBOOT
  7. Connect the device to the computer via USB.
  8. On your computer, open terminal and run (you may need elevated privileges for this):
    fastboot devices
You should see something similar to:
List of devices attached 
HTXXXXXXXXXX	device

fastboot --help

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
  setserial <serial>                       set the device serial number
  setrev <rev>                             set the device hardware revision

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
  -b <base_addr>                           specify a custom kernel base address
  -n <page size>                           specify the nand page size. default: 2048

Typical Partition Layout

For Reference when flashing partitions

Name Nandroid .img Information Contained Mount Point Notes
splash1 N/A Boot image ("T-mobile G1" image) mtdblock0? size: 320x480x2. Different from bootanimation.zip.
recovery N/A A 'backup' kernel, initrd, and OS
for system recovery / maintenance
mtdblock1 Can flash custom recovery.img (Amon_Ra, ClockworkMod, etc).
Accessed by holding [home] while booting.
boot boot.img The main kernel and initrd mtdblock2 Can flash custom boot.img
system system.img The main OS mtdblock3 This is the /system partition
cache cache.img Temp storage mtdblock4 Unused. Can be re-partitioned.
userdata data.img User data and settings mtdblock5 This is the /data partition

Examples

Manual Nandroid restore

Make a Nandroid backup, and copy the folder off your SD card to your desktop.

cd ~/Desktop/path/to/backup/
fastboot flash userdata data.img
fastboot flash system system.img
fastboot flash boot boot.img
fastboot reboot

Flash Custom Recovery.img

fastboot flash recovery /path/to/<recovery>.img
fastboot reboot

Flash Custom boot.img

You should make a Nandroid backup first, in case you need to recover your boot.img

fastboot flash boot /path/to/<boot>.img
fastboot reboot

Development

If you are developing a kernel, you may find it helpful to delete your boot.img and recovery.img to force booting into fastboot:

fastboot erase boot
fastboot erase recovery

You can then manually boot from your custom kernel and a ramdisk:

fastboot boot <kernel> <ramdisk>

Once you have a working kernel and ramdisk, you can automagically combine them within fastboot:

fastboot flash:raw boot <kernel> <ramdisk>


Referensi