[SOLVED] Flash custom ROM with ADB

Search This thread

jmhecker

Senior Member
Mar 25, 2009
249
11
Racine, WI
Is there any way to flash a custom rom with ADB? I would assume there is, as ADB can do everything else, heh.

I have read up on the ADB tutorials and such that are on here, as well as the stuff that is supplied with a quick google search, and have not been able to find anything significant to this specific question.

Any advice would be great. Thanks :)


EDIT:
So, digging around in the DroidExplorer source code, I came across this:

Code:
public void ApplyUpdate ( string device ) {
	/*
		mkdir -p /cache/recovery/
		echo 'boot-recovery' >/cache/recovery/command
		echo '--nandroid' >> /cache/recovery/command
		echo '--update_package=SDCARD:update.zip' >> /cache/recovery/command
	*/
	ShellRun ( device, "mkdir -p /cache/recovery/" );
	ShellRun ( device, "echo 'boot-recovery ' > /cache/recovery/command" );
	//ShellRun ( device, "echo '--nandroid ' >> /cache/recovery/command" );
	ShellRun ( device, "echo '--update_package=SDCARD:update.zip' >> /cache/recovery/command" );
	RebootRecovery ( device );
}

So I opened up ADB, and began plunking around.

I started from the recovery menu, in console mode.

Code:
C:\Users\Jason>adb shell
/ # recovery --update_package=/sdcard/update.zip
recovery --update_package=/sdcard/update.zip

C:\Users\Jason>

That restarted recovery mode, and attempted to mount/load/verify/flash update.zip. I did not have an update.zip on the SDCard, so naturally it errored out (yay).

Next, I decided to try a few things with the phone booted up:


Code:
C:\Users\Jason>adb remount
remount succeeded

C:\Users\Jason>adb shell "echo 'boot-recovery ' > /cache/recovery/command"

C:\Users\Jason>adb shell "echo '--update_package=SDCARD:update.zip' >> /cache/recovery/command"

C:\Users\Jason>adb shell "reboot recovery"

C:\Users\Jason>

That in turn rebooted the G1, and again, attempted to install the update.zip.

Complete output of the RA-Dream-v1.5.2 is as follows:

Code:
Build : RA-dream-v1.5.2
Finding update package...
Opening update pacakge...
E:Can't open /sdcard/update.zip
(No such file or directory)
Installation aborted.

That leads me to believe that this process should work flawlessly, as long as I point to the correct .zip file (update.zip, or SuperD-AOSP...zip).

Now, another thing that I need to do is to figure out how to perform the wipe actions that the recovery menu has. Does anyone know what is ran when I choose any of the 3 wipe options? (I assume they are just rm -rf on the appropriate directories, but I would like to be sure first)

EDIT2:

Gotta love open source :) After quite a bit more googling, this is what I found (located in the source code for ra-dream-v1.5.2):

Code:
 * The arguments which may be supplied in the recovery.command file:
 *   --send_intent=anystring - write the text out to recovery.intent
 *   --update_package=root:path - verify install an OTA package file
 *   --wipe_data - erase user data (and cache), then reboot
 *   --wipe_cache - wipe cache (but not user data), then reboot

As well as:
Code:
recovery.c(849): "/sbin/wipe dalvik",
recovery.c(859): "/sbin/wipe ext",
recovery.c(869): "/sbin/wipe battery",
recovery.c(879): "/sbin/wipe rotate",

Using that information, I think I can finally start my lil applicatoin, heh. Thanks for letting me answer my own questions :) (I wont argue with a good learning experience)
 
Last edited:

jj972

Senior Member
May 8, 2009
132
3
Dallas, Tx
Thanks dude been tryna figure this out for a week and stumbled on ur thread...played around with the commands and got data wipe cache wipe to work but couldnt figure out dalvik or ext wipe...flashed cyan rc3 and gapps. thanks again, my home button doesnt work and couldnt get anything done in the recovery menu. props!
 

shayind4

Senior Member
Mar 24, 2008
540
97
London
Did you manage to write the application for ADB ROM flash? My home button and trackball do not work. ADB ROM install/flash is my only hope.

Shayind4
 

androidkid88

New member
Oct 17, 2010
4
2
Grand Rapids.mi
AWESOME!

I just ran the few lines as follows with all my info there, and it was the ONLY way to load a new rom. My cliq has a broken home key, making it impossible to use any recovery. Props for these lines, helped teach a newb something.

C:\Users\Jason>adb remount
remount succeeded

C:\Users\Jason>adb shell "echo 'boot-recovery ' > /cache/recovery/command"

C:\Users\Jason>adb shell "echo '--update_package=SDCARD:update.zip' >> /cache/recovery/command"

C:\Users\Jason>adb shell "reboot recovery"
 

Cnug726

Member
May 12, 2011
6
0
I was just thinking of giving this a try because i thought using adb might go faster than just going the cwm or watever route using just rom mgr or what have you, so does it go by as fast as it does using cwm? or does adb do it faster?

I assume its the same but I'm just wondering what your experience says
 

Kikkoman_56

Member
Aug 25, 2011
9
1
Thank you!

You have no idea how much help you were to me.
I just bought this unbranded chinese tablet and i tried to set a pattern unlock to it, then to find out that it didn't accept my pattern afterwards.. I was essentially locked out of the thing that i just bought.. I eventually figured out the key combination to access recovery mode but for some reason it seemed to auto select update via sdcard... But the first thing it would check for is a file called "factory_update_param.aml", googled it and it was a simple text file with
--update_package=/sdcard/update.zip
within it. Searching for it i came across it your post, linking the two together i had realised the manufacturer had locked out the recovery mode and replaced it with a simple script that would run whatever stated in the file.
I just replaced it with the
--wipe_data
as you stated and it worked wonders! Factory reset and back to the way i first opened it out of the box!
You saved me 50$ for the shipping back to hong kong! Thank you!
 

Jarreth29

Member
Jul 26, 2009
7
0
London
This post is just what I'm looking for.
I have bricked my tablet: Storage Options Scroll 7". I've been looking for a solution and I think the only way is to flash the original Firmware with adb commands.
My only problem is when I write "adb shell" the computer says that can't find the device. I tried diferent drivers with no luck. On the device manager the Android is in yellow and doesn't recognize the device. I tried with the google drivers from SDK and the VTC drivers without any luck.
What drivers did you use?
If I can get the right drivers this method will save my scroll tablet.
Thanks
 
Last edited:

clozi

New member
Oct 6, 2010
1
0
Częstochowa
You saved my tab.
My tab sdcard not read, so I had to change little for adb commands.
adb shell "echo 'boot-recovery ' > /cache/recovery/command"
adb shell "echo '--update_package=/nand/update.zip' >> /cache/recovery/command"
adb shell "reboot recovery"
)
( this didn't work for me: adb shell "echo '--update_package=nand:update.zip' >> /cache/recovery/command"
Thanks to you everything is ok
 

BGDonLINE

Senior Member
Oct 26, 2011
142
125
Hello i was trying to flash update.zip this way but i bumped into wall -.-

In my /cache/recovery/last_log i saw this lines

Finding update package...
I:Update location: SDCARD:/update.zip
E:unknown volume for path [SDCARD:/update.zip]
E:Can't mount SDCARD:/update.zip
Installation aborted.

i tryed with

--update_package=SDCARD:update.zip

and

--update_package=/sdcard/update.zip


Phone boot into recovery but end's with (dead xD) green android with opened chest
and big ugly red triangle with !

At that point adb is still working i write adb reboot and phone boot normally and then i take a look in last_log...

Any help with this one?


Edit: strange thing that in last_log before those error lines recovery seems to read my new build info

Code:
Starting recovery on Thu Jul  5 13:49:00 2012
recovery filesystem table
=========================
  0 /tmp ramdisk (null) (null) 0
  1 /boot emmc /dev/block/mmcblk0p9 (null) 0
  2 /cache ext4 /dev/block/mmcblk0p16 (null) 0
  3 /data ext4 /dev/block/mmcblk0p20 (null) 0
  4 /misc emmc /dev/block/mmcblk0p8 (null) 0
  5 /recovery emmc /dev/block/mmcblk0p17 (null) 0
  6 /system ext4 /dev/block/mmcblk0p14 (null) 0

call get_bootloader_message
get_args: 
I:Got arguments from /cache/recovery/command
I:fopen_path 1 /data/fota/ipth-muc.prop
I:fopen_path 2 /data/fota/ipth-muc.prop
I:fopen_path 3 /data/fota/ipth-muc.prop
I:Failed to open /data/fota/ipth-muc.prop, use default pkg location:/cache/fota
I:Delta package does not exist /cache/fota/ipth_package.bin
recovery.c : import_kernel_cmdline lge.frst = flag3
framebuffer: fd 4 (480 x 800)
Command: "/sbin/recovery" "--update_package=SDCARD:/update.zip"

ro.secure=1
ro.allow.mock.location=0
ro.debuggable=0
ro.build.id=Optimus_L7_Revolution
ro.build.display.id=Optimus_L7_Revolution
ro.build.version.incremental=lgp700-V10g.rooted
ro.build.version.sdk=15
ro.build.version.codename=REL
ro.build.version.release=4.0.3
ro.build.date=2012. 06. 23. (토) 08:17:57 KST
ro.build.date.utc=1340407077
ro.build.type=user
ro.build.user=bgdonline
ro.build.host=anemone
ro.build.tags=test-keys
ro.product.model=LG-P700
ro.product.brand=lge
ro.product.name=u0_open_eu
ro.product.device=u0
ro.product.board=7x27
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.manufacturer=LGE
ro.product.locale.language=en
ro.product.locale.region=GB,en
ro.wifi.channels=
ro.board.platform=msm7627a
ro.build.product=u0
ro.build.description=u0_open_eu-user 4.0.3 Optimus_L7_Revolution lgp700-V10g.rooted test-keys
ro.build.fingerprint=lge/u0_open_eu/u0:4.0.3/Optimus_L7_Revolution/lgp700-V10g.rooted:user/test-keys
ro.build.characteristics=default
rild.libpath=/system/lib/libril-qc-1.so
rild.libargs=-d /dev/smd0
persist.rild.nitz_plmn=
persist.rild.nitz_long_ons_0=
persist.rild.nitz_long_ons_1=
persist.rild.nitz_long_ons_2=
persist.rild.nitz_long_ons_3=
persist.rild.nitz_short_ons_0=
persist.rild.nitz_short_ons_1=
persist.rild.nitz_short_ons_2=
persist.rild.nitz_short_ons_3=
ril.subscription.types=NV,RUIM
DEVICE_PROVISIONED=1
debug.sf.hw=1
debug.enabletr=false
debug.composition.7x27A.type=mdp
debug.composition.7x25A.type=mdp
persist.gsm.sms.forcegsm7=1
persist.cne.UseCne=none
persist.cne.bat.range.low.med=30
persist.cne.bat.range.med.high=60
persist.cne.loc.policy.op=/system/etc/OperatorPolicy.xml
persist.cne.loc.policy.user=/system/etc/UserPolicy.xml
persist.cne.bwbased.rat.sel=false
persist.cne.snsr.based.rat.mgt=false
persist.cne.bat.based.rat.mgt=false
persist.cne.rat.acq.time.out=30000
persist.cne.rat.acq.retry.tout=0
persist.cne.fmc.mode=false
persist.cne.fmc.init.time.out=30
persist.cne.fmc.comm.time.out=130
persist.cne.fmc.retry=false
media.stagefright.enable-player=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=true
media.stagefright.enable-fma2dp=true
media.stagefright.enable-aac=true
media.stagefright.enable-qcp=true
ro.opengles.version=131072
ro.use_data_netmgrd=true
persist.data.ds_fmc_app.mode=0
persist.ims.regmanager.mode=0
ro.bluetooth.request.master=false
ro.qualcomm.bluetooth.ftp=true
ro.qualcomm.bluetooth.sap=false
ro.qualcomm.bluetooth.hfp.wbs=false
ro.bluetooth.remote.autoconnect=true
persist.omh.enabled=1
ro.config.ehrpd=true
ro.qualcomm.cabl=1
ro.fm.analogpath.supported=true
ro.fm.transmitter=false
ro.fm.mulinst.recording.support=false
ro.hw_plat=7x27a
ro.emmc.sdcard.partition=20
debug.camcorder.disablemeta=0
ro.hiddenreset=0
ro.device.hapticfeedback=0
ro.lge.swversion=V10g-JUN-23-2012
ro.lge.hwversion=
ro.lge.factoryswversion=
ro.lge.basebandversion=MSM7227A-1-AA
hwui.render_dirty_regions=false
ro.max.fling_velocity=5000
ro.hwui.text_cache_width=1536
ro.hwui.text_cache_height=384
ro.build.target_operator=OPEN
ro.build.target_country=EU
ro.build.target_region=EU
ro.build.factory_operator=EUR
ro.build.factory_country=XX
ro.com.google.clientidbase=android-lge
ro.com.google.clientidbase.gmm=android-lge
ro.com.google.clientidbase.yt=android-lge
ro.com.google.clientidbase.am=android-lge
ro.com.google.clientidbase.ms=android-lge
ro.camera.sound.forced=1
keyguard.no_require_sim=true
ro.com.android.dataroaming=false
ro.com.android.dateformat=MM-dd-yyyy
ro.config.ringtone=Beyond_the_Dream.ogg
ro.config.notification_sound=Pebble.ogg
ro.config.alarm_alert=Alarm1.ogg
ro.vendor.extension_library=/system/lib/libqc-opt.so
persist.radio.cdg2_flag=false
wifi.supplicant_scan_interval=20
wlan.chip.vendor=qcom
ro.lge.touchkey=BACK|HOME|MENU
ro.device.networkmode=WCDMA
ro.telephony.default_network=3
ro.radio.ratdisplay=true
ro.config.bt.amp=no
ro.sf.lcd_density=240
media.video.max-width=854
media.video.max-height=480
media.divx-video.max-width=854
media.divx-video.max-height=480
ro.emmc=0
ro.sf.hwrotation=180
ro.lge.audio_scenario=SOUNDEXCEPTION
ro.lge.audio_soundexception=true
ro.lge.audio_soundprofile=true
lge.signed_image=true
dalvik.vm.heapstartsize=10m
dalvik.vm.heapgrowthlimit=48m
dalvik.vm.heapsize=128m
drm.service.enabled=true
ro.lge.capp_core=true
ro.lge.capp_drm=true
ro.lge.capp_divx_drm=true
ro.lge.capp_almond=true
ro.lge.capp_optimusui=true
ro.lge.capp_resource=true
ro.lge.capp_wapservice=true
ro.lge.lazy_service_bringup=true
ro.lge.capp_touch_scroller=true
ro.lge.capp_touch_ldi=true
ro.lge.capp_key_light_off=true
ro.lge.capp_key_exception=true
ro.lge.capp_keyled_timeout=true
ro.lge.capp_lockscreen=true
ro.com.google.gmsversion=4.0_r2
ro.setupwizard.mode=DISABLED
ro.livewallpaper.map=DISABLED
ro.nfc.port=I2C
lge.nfc.fwpatchv13=yes
lge.nfc.indicator=yes
lge.nfc.setype=uicc
dalvik.vm.dexopt-flags=m=y
net.bt.name=Android
net.change=net.bt.name
dalvik.vm.stack-trace-file=/data/anr/traces.txt
ro.factorytest=0
ro.serialno=bd28a52
ro.bootmode=recovery
ro.baseband=msm
ro.carrier=unknown
ro.bootloader=unknown
ro.hardware=u0
ro.revision=0
ro.crypto.fs_type=ext4
ro.crypto.fs_real_blkdev=/dev/block/mmcblk0p20
ro.crypto.fs_mnt_point=/data
ro.crypto.fs_options=barrier=1,data=ordered,noauto_da_alloc,errors=panic
ro.crypto.fs_flags=0x00000406
ro.crypto.state=unencrypted
ro.encrypt_state=0
persist.sys.usb.config=charge_only,adb
persist.radio.adb_log_on=0
persist.radio.mem_leak_debug=0
persist.radio.voip_enabled=0
persist.radio.sma_voice_3gpp=0
persist.radio.net_pref_0=2
persist.radio.net_pref_1=3
persist.radio.tuneaway=1
persist.radio.paging_priority=0
persist.radio.mcc-list=FFF
persist.radio.first_no_sim=
persist.radio.iccid-changed=0
persist.radio.iccid=8938105210033115009
persist.radio.prev-mcc=220
persist.radio.same-mcc=1
persist.radio.tmp-mcc=220
persist.radio.first-mcc=220
persist.radio.first-boot=11
persist.service.bt.bdaddr=c0:cc:e5:c6:a0:00
persist.sys.profiler_ms=0
persist.service.system.dirty=1
persist.lge.first_boot=0
persist.sys.timezone=Europe
persist.sys.language=en
persist.sys.country=GB
persist.sys.localevar=
persist.gsm.mms.enabled=true
persist.sys.system_volume=4
persist.sys.sound_enable=1
init.svc.brd=running
init.svc.recovery=running
init.svc.adbd=running
init.svc.rmt_storage=running
init.svc.atd=restarting

Finding update package...
I:Update location: SDCARD:/update.zip
E:unknown volume for path [SDCARD:/update.zip]
E:Can't mount SDCARD:/update.zip
Installation aborted.
 
Last edited:

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,862
3,762
mpls
the android with the open chest is showing it is trying to apply update. the triangle with ! is the defult recovery screen.
so I take it you don't have a custom recovery, are you rooted?

Sent from my HTC Vision using xda premium
 

BGDonLINE

Senior Member
Oct 26, 2011
142
125
the android with the open chest is showing it is trying to apply update. the triangle with ! is the defult recovery screen.
so I take it you don't have a custom recovery, are you rooted?

Sent from my HTC Vision using xda premium

Rooted yes, custom recovery i still can't use untill Secure booting is off.... This lg model (optimus l7) have Secure boot and custom recovery can't work on stock rom, that is why i try this way....
 
Last edited:

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,862
3,762
mpls
got ya, don't know much about lgs - maybe ask in that forum

Sent from my HTC Vision using xda premium
 

BGDonLINE

Senior Member
Oct 26, 2011
142
125
This solution works generally in android im just curious why recovery can't mount sdcard and is it possible to flash it from internal memory? Because when im in root explorer and when im in / i have /sdcard < internal memory and /sdcard/external_sd < external memory


btw we still don't have our sub forum im only one currently working on this model :(
 

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,862
3,762
mpls
dont know what teamwin recovery is (assume its for the evo 4g) but it should work fine as a few other posters got it workinig with other recoveries.
but even if it doest an unlocked bootloader should allow you to do all the commands via fastboot, wipe flash etc.
 

z1on

Member
Apr 10, 2012
44
37
Wien
Code:
C:\Users\Jason>adb remount
remount succeeded

C:\Users\Jason>adb shell "echo 'boot-recovery ' > /cache/recovery/command"

C:\Users\Jason>adb shell "echo '--update_package=SDCARD:update.zip' >> /cache/recovery/command"

C:\Users\Jason>adb shell "reboot recovery"

C:\Users\Jason>

I just tried to do that with my custom ROM but I got this error:
Code:
Finding update package...
I:Update location: /sdcard/my_custom_rom.zip
Opening update package...
I:1 key(s) loaded from /res/keys
Verifying update package...
I:verify_file returned 1
E:signature verification failed
Installation aborted.

My ROM is signed with test-key same as the one in /res/keys, I can't understand why the error..
 

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,862
3,762
mpls
does your recovery support turning off sig check? if not you may need to find a new method of signing

Sent from my HTC Vision using xda premium
 
  • Like
Reactions: z1on

z1on

Member
Apr 10, 2012
44
37
Wien
does your recovery support turning off sig check? if not you may need to find a new method of signing

Sent from my HTC Vision using xda premium
I'm using CWM 5.0.2.8; from the menu I can disable the signature verification but can't do it via cmd line.

I'm wondering why I can't flash my ROM even if /res/keys and CERT.RSA using the same key?! I'm missing something?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    Is there any way to flash a custom rom with ADB? I would assume there is, as ADB can do everything else, heh.

    I have read up on the ADB tutorials and such that are on here, as well as the stuff that is supplied with a quick google search, and have not been able to find anything significant to this specific question.

    Any advice would be great. Thanks :)


    EDIT:
    So, digging around in the DroidExplorer source code, I came across this:

    Code:
    public void ApplyUpdate ( string device ) {
    	/*
    		mkdir -p /cache/recovery/
    		echo 'boot-recovery' >/cache/recovery/command
    		echo '--nandroid' >> /cache/recovery/command
    		echo '--update_package=SDCARD:update.zip' >> /cache/recovery/command
    	*/
    	ShellRun ( device, "mkdir -p /cache/recovery/" );
    	ShellRun ( device, "echo 'boot-recovery ' > /cache/recovery/command" );
    	//ShellRun ( device, "echo '--nandroid ' >> /cache/recovery/command" );
    	ShellRun ( device, "echo '--update_package=SDCARD:update.zip' >> /cache/recovery/command" );
    	RebootRecovery ( device );
    }

    So I opened up ADB, and began plunking around.

    I started from the recovery menu, in console mode.

    Code:
    C:\Users\Jason>adb shell
    / # recovery --update_package=/sdcard/update.zip
    recovery --update_package=/sdcard/update.zip
    
    C:\Users\Jason>

    That restarted recovery mode, and attempted to mount/load/verify/flash update.zip. I did not have an update.zip on the SDCard, so naturally it errored out (yay).

    Next, I decided to try a few things with the phone booted up:


    Code:
    C:\Users\Jason>adb remount
    remount succeeded
    
    C:\Users\Jason>adb shell "echo 'boot-recovery ' > /cache/recovery/command"
    
    C:\Users\Jason>adb shell "echo '--update_package=SDCARD:update.zip' >> /cache/recovery/command"
    
    C:\Users\Jason>adb shell "reboot recovery"
    
    C:\Users\Jason>

    That in turn rebooted the G1, and again, attempted to install the update.zip.

    Complete output of the RA-Dream-v1.5.2 is as follows:

    Code:
    Build : RA-dream-v1.5.2
    Finding update package...
    Opening update pacakge...
    E:Can't open /sdcard/update.zip
    (No such file or directory)
    Installation aborted.

    That leads me to believe that this process should work flawlessly, as long as I point to the correct .zip file (update.zip, or SuperD-AOSP...zip).

    Now, another thing that I need to do is to figure out how to perform the wipe actions that the recovery menu has. Does anyone know what is ran when I choose any of the 3 wipe options? (I assume they are just rm -rf on the appropriate directories, but I would like to be sure first)

    EDIT2:

    Gotta love open source :) After quite a bit more googling, this is what I found (located in the source code for ra-dream-v1.5.2):

    Code:
     * The arguments which may be supplied in the recovery.command file:
     *   --send_intent=anystring - write the text out to recovery.intent
     *   --update_package=root:path - verify install an OTA package file
     *   --wipe_data - erase user data (and cache), then reboot
     *   --wipe_cache - wipe cache (but not user data), then reboot

    As well as:
    Code:
    recovery.c(849): "/sbin/wipe dalvik",
    recovery.c(859): "/sbin/wipe ext",
    recovery.c(869): "/sbin/wipe battery",
    recovery.c(879): "/sbin/wipe rotate",

    Using that information, I think I can finally start my lil applicatoin, heh. Thanks for letting me answer my own questions :) (I wont argue with a good learning experience)
    2
    AWESOME!

    I just ran the few lines as follows with all my info there, and it was the ONLY way to load a new rom. My cliq has a broken home key, making it impossible to use any recovery. Props for these lines, helped teach a newb something.

    C:\Users\Jason>adb remount
    remount succeeded

    C:\Users\Jason>adb shell "echo 'boot-recovery ' > /cache/recovery/command"

    C:\Users\Jason>adb shell "echo '--update_package=SDCARD:update.zip' >> /cache/recovery/command"

    C:\Users\Jason>adb shell "reboot recovery"
    1
    does your recovery support turning off sig check? if not you may need to find a new method of signing

    Sent from my HTC Vision using xda premium