[Q] Some questions about Android Recovery Mode - Android Q&A, Help & Troubleshooting

Recently I was studying android recovery mode, and I have some questions. Anyone knows the answer? Thanks very much.
1. Can recovery flash bootloader?
From this link====>http://forum.xda-developers.com/showthread.php?t=2321310, I think it can do that. But I'm not sure.
2. Can recovery flash recovery partition itself?
I think it can not do this. Not confirm that.
3. We know in update.zip, boot.img is corresponding boot partition, but why system is a folder, not system.img? There is a system partition also.
4. While OTA upgrade system, why the update package downloaded under /cache path? Can we change it to sdcard?
5. Most important, what exactly update-script do things under recovery mode? How the command executed?
BTW, there are other questions, but not related to Recovery Mode.
1. How can I see the flash partitions? I know to use the command cat /proc/mtd, but as Samsung, it use emmc flash, while I type that command, no results printed. How to see?
2. About userdata partition, we know that when first run android OS, system will copy files from /system to /data, but does it do it every time that we turn on the phone or just do it once after the first booting after we update our system?

Hello,
I can answer some questions, and I hope someone else can fill the blanks.
1. Can recovery flash bootloader?
=> Yes, you have to modify your boot image, but it still possible, just include the modified boot image in the update file, and give good command in update.zip
2. Can recovery flash recovery partition itself?
=> I am not sure, but I think its possible, I saw code of recovery in Android code, so if you modify it, and include the good image in update.zip, I think you will see the modification. Never tried for now.
3. We know in update.zip, boot.img is corresponding boot partition, but why system is a folder, not system.img? There is a system partition also.
=> In fact is depend witch compilation system you use. For Cyanogen, yes in fact its a folder, but for AOSP its System.img
The difference comes from the command file in update, theire not the same. But finally the result in the same. We have a system partition.
4. While OTA upgrade system, why the update package downloaded under /cache path? Can we change it to sdcard?
=> Reasons I can see :
--> In past, sdcard was not mounted by default in recovery mode, so can't see the update.zip file
--> sdcard can be removed at any time, its dangerous, when do the update to loose the file
--> To be sure have right to remove the update.zip when installation done
--> Old phone didn't have all a sdcard, cache is sure to exists
=>Yes we can change it, but we have to be sure the sdcard is mounted on recovery mode. And be sure of the path of sdcard on recovery mode. For exemple in Nexus one it is /sdcard, in Samsung Galaxy S2 is /emmc/, in Samsung S4 mini its /sdcard/0/ ... So it could be a reason why its not in sdcard, because the path is not generic.
5. Most important, what exactly update-script do things under recovery mode? How the command executed?
=>It does lot of stufs, like mount partitions, copy system files, ...
The update-script is in elf script. Generally, an elf interpreter is given just next to the update-script.
I hope it helped you,
JHelp

1 yes, but flashing firmware from recovery can be dangerous and all though unlikely I have seen many brick there phone doing so
2. Yes, rather easily so long as the .zip is put together properly. But like bootloader, it is safest so flash through fastboot or download mode but a very unlikely brick so mostly safe
3. This is how a ROM gets built from source but it needs not be in this setup. At the same note I can't see a better way to flash through recovery than like it is. Using flash_raw_image would work but due to size a system.img shouldn't be flashed in recovery rather through fastboot, bootloader or download mode
4 mostly because you couldn't have an oem ota update without an SD card which isn't a prerequisite for using a phone. Also I believe there is some added safety flashing directly from nand, but in truth this is all speculation. Yes with a rooted phone this could be changed but most often it isn't wise to flash an oem ota on a rooted device
5 lots of things, take a look at my threads for a guide I made explaining this
1 cat /proc/partitions
mount
ls -l /dev/block/
And then keep searching until you get /by-name which many phones have, but this isn't always the same path so if you need further help ask and I'll walk you through it
2 I think this depends on a lot of things, but I don't have a good answer so rather than speculating I'll choose not to answer
Feel free to ask other questions
Sent from my Nexus 4 using XDA Premium 4 mobile app

demkantor said:
1 yes, but flashing firmware from recovery can be dangerous and all though unlikely I have seen many brick there phone doing so
2. Yes, rather easily so long as the .zip is put together properly. But like bootloader, it is safest so flash through fastboot or download mode but a very unlikely brick so mostly safe
3. This is how a ROM gets built from source but it needs not be in this setup. At the same note I can't see a better way to flash through recovery than like it is. Using flash_raw_image would work but due to size a system.img shouldn't be flashed in recovery rather through fastboot, bootloader or download mode
4 mostly because you couldn't have an oem ota update without an SD card which isn't a prerequisite for using a phone. Also I believe there is some added safety flashing directly from nand, but in truth this is all speculation. Yes with a rooted phone this could be changed but most often it isn't wise to flash an oem ota on a rooted device
5 lots of things, take a look at my threads for a guide I made explaining this
1 cat /proc/partitions
mount
ls -l /dev/block/
And then keep searching until you get /by-name which many phones have, but this isn't always the same path so if you need further help ask and I'll walk you through it
2 I think this depends on a lot of things, but I don't have a good answer so rather than speculating I'll choose not to answer
Feel free to ask other questions
Sent from my Nexus 4 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
I've got /by-num, but no /by-name, device is Sansumg GT-9288

not sure what a Sansumg GT-9288 is, gsmarena and google dont give me results
what happens with
cat /proc/partitions
or just
mount
?

demkantor said:
not sure what a Sansumg GT-9288 is, gsmarena and google dont give me results
what happens with
cat /proc/partitions
or just
mount
?
Click to expand...
Click to collapse
Sorry, type wrong, should be GT-9228, it's a customer made smartphone only for CMCC.
I can get the partition info by GT-9220, so I think it's because of the customer made that I can not get the by-name folder.
Thanks again.

Related

[Solved] Flash ROM without SD Card? Using Fastboot Help

A few weeks ago my SD card went bad on me. I have been using Gingershedbread as my ROM and see there are some updates, however, since I don't have an SD card, the "normal" method of loading the zip onto the SD card obviously won't work for me.
My question is: Is there a way to flash a ROM zip from a pc (windows) to my phone without an SD card? I know you can put the zip on the data partition, then use "recovery --update_package=DATA:rom.zip" (through adb), however, when trying to copy the rom I get a message saying that there is no space left.
As of now, the only thing I know of is to do a full wipe and factory reset, then push the ROM zip to my phone, but I don't necessarily want to do this every time.
I have also tried fastboot and using mkyaffs2image to create a system.img from the ROM's system folder in the zip file, but I am not doing something right.
I run "mkyaffs2image c:\rom\system\ c:\system.img"
then with my phone in fastboot, I "fastboot flash system c:\system.img"
and "fastboot flash boot c:\rom\boot.img".
I restart the phone in recovery mode, load gapps and xtrCache, but then it reboots, sits on black screen for a few seconds, then reboots into recovery.
I have tried erasing system and boot first, but that didn't seem to help.
I first tried just flashing system.img, but that didn't work.
Not sure what I am doing wrong. Is there a way to take a ROM zip and create a system.img and boot.img that can be flashed through fastboot without an SD card? OR, is it possible to flash a ROM zip without transferring the file to my phone first? Any help would be appreciated.
I don't think that there is an answer to your question which is both complete and also short.
So, here goes with the long answer.
First, a yaffs2 image file (e.g. system.img) is not compressed, so it is quite large - for things like the HTC factory/stock ROMs, it can be bigger than the cache partition. I don't know if the cache partition is actually used when you push things with fastboot, but experimentally, I have run into the problem that when attempting to do a
Code:
fastboot flash system my-yaffs2-system.img
fastboot gives you get an error about being out of room.
Second, and more importantly, the file modes (permissions) and user:group ownership of files in the /system mount point are extremely critical to proper operation of Android. If you have files sitting on a Windoze machine filesystem (either FAT32 or NTFS), all this information will be lost even before you create your "yaffs2" image file. (Not only that, but all symbolic links will be missing, too). This is why you observe that ROM files have instructions in their "update-script" (or "updater-script") command files for setting file & directory ownership, file permission modes, creating symlinks, et cetera.
Third - even if you use a linux OS to unpack yaffs2 images, and run as root when you are doing so, a lot of the "unyaffs" programs that are lying around do not even bother to extract things like user:group ownership or file modes - so you are basically screwed as soon as you unpack a yaffs2 image file on a PC, no matter whether it is Windows or Linux/Unix/OS-X.
Fourth, I am not sure that it is even a good idea in the first place to be "flashing" yaffs2 images. The "fastboot flash" command merely writes whatever you pass to it as a long linear blob of bytes, and there is no evidence to suggest that the yaffs formatting used in the archive is the same formatting used by the kernel. When "Nandroid" runs to restore a system.img or data.img file onto the phone, it does not write the image as a linear blob of bytes: it actually mounts the filesystem in question, cleans it up with a "rm -rf *" command, and then manually unpacks the yaffs2 image file into the mounted file system, one file at a time. (Fortunately in this case, it actually restores things like symlinks, file permissions, and file/directory user:group ownership information). This insures that the low-level yaffs2 formatting is *identical* to what the kernel expects, because it is the kernel that creates it.
There is a solution, but it is tedious enough that you really ought to ask the question, "Why don't I go out and buy a replacement SD card for 10 bucks instead of wasting a huge amount of time?"
Here's the solution:
You mount /system, clean it up manually, use adb to push the files recursively from wherever you have them stored on your PC, and then afterwards you run a custom (signed) installer .zip file which has been modified so that it only contains the "symlink" and permission-setting commands - you delete the "format" and "extract" commands from that command file, since you have manually put all the files into /system. Either that or you manually adjust the permissions and user:group ownership information by hand.
Obviously, since you don't have an /sdcard any longer, you will need to put this flashable, custom .zip file in /cache, and then create a one-line command file at /cache/recovery/command that points at the flashable .zip file in /cache. (This is the way the the OTAs work, and also how ROM Manager is able to customize the recovery when it boots).
Is this a lot of work? Yeah, you betcha.
It seems like running down to wally world to get a cheap SD card might be a little more fun.
Thanks for the info. I figured getting a new SD would be the best solution.
I knew about the symlink and file permission stuff and was trying to flash a system img then run a zip to ser that info., but couldn't get it to work. Sounds like using fastboot might be a bad idea.
For now I think I will just have to find a rom and stick with it for a while.
I am nearing an upgrade for a new phone and looking at the Thunderbolt, which comes with an SD so I don't want to buy one just yet.
Thanks for your help.
Sent from my ERIS GSBv2.1 using XDA App
kgunnIT said:
then run a zip to ser that info., but couldn't get it to work.
Click to expand...
Click to collapse
If you know how to sign ROMs, it's really not a hard hack to launch an installer of the type you mention.
And, now that I've just said that, I think I have another, simpler, idea.
But first:
[SIZE=+2]How To Launch a (smallish) .zip-based Flash That's Not On the SD Card.[/SIZE]
All of the recoveries - both the stock and custom recoveries - look for a "command" file when they first start up.
It literally is named "command", i.e.: /cache/recovery/command
... and it is a simple text file with as few as one line(s) in it.
Here is an example from the most recent OTA of the contents of /cache/recovery/command:
Code:
--update_package=CACHE:8e3b63f96149.OTA_Desire_C_Verizon_WWE_2.37.605.4_2.36.605.1_release.zip
basically, it's just a single line with the following format:
--update_package=CACHE:filename.zip
So, if you are trying to get an installer to run without an SD card, you would:
1) Boot to Amon_RA
2) Wipe the cache if necessary (wipe -> wipe data/factory reset also clears /cache)
3) Push your zip file to cache:
Code:
adb push mycustominstall.zip /cache/
4) Create a command file (say, named "command.txt") with the contents:
Code:
--update_package=CACHE:mycustominstall.zip
5) Push it to the phone:
Code:
adb push command.txt /cache/recovery/command
6) reboot directly back into recovery with
Code:
adb shell reboot recovery
When the recovery boots up again, it will immediately start unpacking your "mycustominstall.zip" file.
After I thought this all the way through, I realized, though: a lot of the ROM files are only about 100 MB, and cache is about 128 Mb, so
.... wait for it .....
... wait for it ....
it might be a worthwhile experiment to just push an untouched ROM file right to cache and then use that ROM file's name in your "command" file.
So long as /sbin/recovery does not unpack files to /cache (I can't remember if it does this or not!), you could use original ROM files -- just what you wanted originally. If it unpacks things to cache, though, it will only get part way through the install and fail.
It's worth a shot; if it fails, you'll have a mess that is no worse to clean up than what you've presently got. (If it fails, to be on the safe side it might be wise to go in using adb and clean things up in /cache a little bit so that the next recovery boot has some wiggle room in /cache - e.g. "adb shell rm -rf /cache/*" )
bftb0
bftb0 said:
If you know how to sign ROMs, it's really not a hard hack to launch an installer of the type you mention.
And, now that I've just said that, I think I have another, simpler, idea.
But first:
[SIZE=+2]How To Launch a (smallish) .zip-based Flash That's Not On the SD Card.[/SIZE]
All of the recoveries - both the stock and custom recoveries - look for a "command" file when they first start up.
It literally is named "command", i.e.: /cache/recovery/command
... and it is a simple text file with as few as one line(s) in it.
Here is an example from the most recent OTA of the contents of /cache/recovery/command:
Code:
--update_package=CACHE:8e3b63f96149.OTA_Desire_C_Verizon_WWE_2.37.605.4_2.36.605.1_release.zip
basically, it's just a single line with the following format:
--update_package=CACHE:filename.zip
So, if you are trying to get an installer to run without an SD card, you would:
1) Boot to Amon_RA
2) Wipe the cache if necessary (wipe -> wipe data/factory reset also clears /cache)
3) Push your zip file to cache:
Code:
adb push mycustominstall.zip /cache/
4) Create a command file (say, named "command.txt") with the contents:
Code:
--update_package=CACHE:mycustominstall.zip
5) Push it to the phone:
Code:
adb push command.txt /cache/recovery/command
6) reboot directly back into recovery with
Code:
adb shell reboot recovery
When the recovery boots up again, it will immediately start unpacking your "mycustominstall.zip" file.
After I thought this all the way through, I realized, though: a lot of the ROM files are only about 100 MB, and cache is about 128 Mb, so
.... wait for it .....
... wait for it ....
it might be a worthwhile experiment to just push an untouched ROM file right to cache and then use that ROM file's name in your "command" file.
So long as /sbin/recovery does not unpack files to /cache (I can't remember if it does this or not!), you could use original ROM files -- just what you wanted originally. If it unpacks things to cache, though, it will only get part way through the install and fail.
It's worth a shot; if it fails, you'll have a mess that is no worse to clean up than what you've presently got. (If it fails, to be on the safe side it might be wise to go in using adb and clean things up in /cache a little bit so that the next recovery boot has some wiggle room in /cache - e.g. "adb shell rm -rf /cache/*" )
bftb0
Click to expand...
Click to collapse
You always find the one thousand and ONETH way to skin a cat. Hehehehe...
Thankyou so much for this this alowed me to flash a rom on my phone which can't detect any sd cards and i stupidly wiped it before relising the sd card wasnt being detected!
sum_guy55 said:
Thankyou so much for this this alowed me to flash a rom on my phone which can't detect any sd cards and i stupidly wiped it before relising the sd card wasnt being detected!
Click to expand...
Click to collapse
very good, sum_guy55!
At least all that typing wasn' t in vain.
Out of curiosity, how big was the ROM file you used?
bftb0
Been meaning to post this:
Thanks for your posts roirraW "edor" ehT and bftb0 for posting this. I also was able to clear the cache and push the ROM and update.
However, I have xtrCMCache2cache on my phone, so the dalvik-cache was moved from /data/ to /cache/. After doing a wipe of dalvik-cache from Amon recovery, the folder in /cache/ was not emptied out. I went ahead and cleaned it manually, which freed up enough space to push the ROM.
Is this behavior expected using cache2cache and wiping dalvik-cache from recovery? I guess it would be since the dalvik-cache was moved.
Anyway, after clearing the dalvik folder, I was able to push GSBv2.4 to my phone, as well as gapps and xtrCMCache2cache, a total of almost 80 MB. Rebooted and all was well.
Thanks again for your help.
kgunnIT said:
Been meaning to post this:
Thanks for your posts roirraW "edor" ehT and bftb0 for posting this. I also was able to clear the cache and push the ROM and update.
However, I have xtrCMCache2cache on my phone, so the dalvik-cache was moved from /data/ to /cache/. After doing a wipe of dalvik-cache from Amon recovery, the folder in /cache/ was not emptied out. I went ahead and cleaned it manually, which freed up enough space to push the ROM.
Is this behavior expected using cache2cache and wiping dalvik-cache from recovery? I guess it would be since the dalvik-cache was moved.
Anyway, after clearing the dalvik folder, I was able to push GSBv2.4 to my phone, as well as gapps and xtrCMCache2cache, a total of almost 80 MB. Rebooted and all was well.
Thanks again for your help.
Click to expand...
Click to collapse
It was all bftb0. Interesting, I had once asked if cache was definitely wiped from Amon after it was moved. The consensus was that it should. I shall be anticipating some light shed on this.
Sent from my Gingerbread Eris via Tapatalk
Well, Amon_RA has no idea whether you are using cache2cache; I suppose we would need to look at the code to figure out how it behaves.
If it mounts /data and then does something like
rm -rf /data/dalvik-cache
there is a chance that the symbolic link is not followed, which would explain what kgunnIT observed.
Normally, if you are flashing a new ROM in a full-wipe fashion, the " wipe data/factory reset" menu option clears both /data and /cache, so in that case it is irrelevant that the "wipe dalvik-cache" is a no-op.
If you are overflashing, it's not obvious that you need to wipe the dalvik-cache... at least for the market apps normally stored in /data/app, although it seems like it would be a good idea to do so, as the system apps could be changing.
Note that even when cache2cache is not in use, the Amon_RA menu item "wipe dalvik-cache" never works as intended for froyo & gingerbread ROMs - the system apps have their dalvik-cache stored in /cache, and this never gets touched by Amon_RA with that menu operation.
BTW... for what it's worth, the ClockworkMod recoveryhas a menu entry for wiping only the cache.
bftb0
bftb0 said:
BTW... for what it's worth, the ClockworkMod recoveryhas a menu entry for wiping only the cache.
bftb0
Click to expand...
Click to collapse
Does ClockworkMod recovery work ok on the Droid Eris? I was going to load it on, but saw some people posting that it bricked their phones, so now I am skeptical. I will do more research and see if this is something I want to do. Thanks for your insight.
kgunnIT said:
Does ClockworkMod recovery work ok on the Droid Eris? I was going to load it on, but saw some people posting that it bricked their phones, so now I am skeptical. I will do more research and see if this is something I want to do. Thanks for your insight.
Click to expand...
Click to collapse
There is a version of Amon_RA (the trackball-optional version) that also allows you to format cache. You can find out more about it here: http://androidforums.com/eris-all-t...2-custom-recovery-trackball-not-required.html
That said, if you have ROM Manager, you can have Clockwork Recovery start as a stub within Amon_RA just from ROM Manager (the first option copies a file called update.zip to the root of your SD card, and the second, "Reboot into Recovery", starts Amon_RA with a script to flash update.zip, which starts Clockwork.) In fact, once update.zip is on the SD card, you can start Amon_RA as you always do, go to the Flash a zip from SD card menu, choose update .zip, and it will start Clockwork, if you want to do it that way. However, the drawback to this is that you can't go back to Amon_RA without shutting down the phone and then restarting in Recovery again, so I just find it easier to use the trackball-optional version of Amon_RA.
I think every person who has bricked their Eris while running Clockwork was running Clockwork Recovery as their main recovery image, and not in the way that I described in the last paragraph. (Though don't hold me to that ...)
kgunnIT said:
Does ClockworkMod recovery work ok on the Droid Eris? I was going to load it on, but saw some people posting that it bricked their phones, so now I am skeptical. I will do more research and see if this is something I want to do. Thanks for your insight.
Click to expand...
Click to collapse
I've been using it through ROM Manager since last August or so, I use it all the time.

Flash image gui?

Would this be a possible solution to our kernel flashing problems, I know it works for the evo
Sent from my HTC Amaze 4G using XDA App
DEFINITIONOFREAL said:
Would this be a possible solution to our kernel flashing problems, I know it works for the evo
Sent from my HTC Amaze 4G using XDA App
Click to expand...
Click to collapse
It's possible. In fact I mentioned this about a month ago to a developer.
I would like to see one that has a couple of options such as flashing recovery and flashing boot.img files.
You can easy push the flash_image binary to /system/bin and set the permission to 755. In fact my CWMFaux kernel does just that. Faux stopped using it because it doesn't always work.
In fact I made it so easy that all you need to do is push the boot.img to /system and reboot. Yet... no one uses it. In fact I suggested to a couple of rom developers to simply add the binary file to /system/bin so that you can at least run the command from terminal but they don't even want to do that. I like being able to update my recovery at anytime by entering "flash_image recovery /sdcard/recovery.img" and then just rebooting to recovery. You can easily do that for kernels too. But I suppose it's so much easier to carry a computer around.
Binary100100 said:
It's possible. In fact I mentioned this about a month ago to a developer.
I would like to see one that has a couple of options such as flashing recovery and flashing boot.img files.
You can easy push the flash_image binary to /system/bin and set the permission to 755. In fact my CWMFaux kernel does just that. Faux stopped using it because it doesn't always work.
In fact I made it so easy that all you need to do is push the boot.img to /system and reboot. Yet... no one uses it. In fact I suggested to a couple of rom developers to simply add the binary file to /system/bin so that you can at least run the command from terminal but they don't even want to do that. I like being able to update my recovery at anytime by entering "flash_image recovery /sdcard/recovery.img" and then just rebooting to recovery. You can easily do that for kernels too. But I suppose it's so much easier to carry a computer around.
Click to expand...
Click to collapse
Im going to contact joeykrim and see if I can get him to add support in his app, and Ive been using your method since I got the phone (2 days ago) and started reading, but still a little hassle, and a big htc fail
Sent from my HTC Amaze 4G using XDA App
DEFINITIONOFREAL said:
Im going to contact joeykrim and see if I can get him to add support in his app, and Ive been using your method since I got the phone (2 days ago) and started reading, but still a little hassle, and a big htc fail
Sent from my HTC Amaze 4G using XDA App
Click to expand...
Click to collapse
Keep me posted will ya?
I believe that Faux and other developers would have to use the zImage kernel flashing technique to get it to work with his existing app but I'm sure he can simplify it to accept .img files and the .ko files in the /system/lib directory of a zip file. It actually should be very easy. It took me about ten mintues with testing included to create the script for my method. I just can't code for apps else it would be done by now.
DEFINITIONOFREAL said:
Im going to contact joeykrim and see if I can get him to add support in his app, and Ive been using your method since I got the phone (2 days ago) and started reading, but still a little hassle, and a big htc fail
Sent from my HTC Amaze 4G using XDA App
Click to expand...
Click to collapse
I contacted pershoot, no answer lol!!!
Joeykrim is willing to support the Amaze, he just needs testers, this would be a great backup incase the new script failed to push the kernel. I'll keep everyone posted with updates
Sent from my HTC Amaze 4G using XDA App
I've been working with joeykrim getting his app setup for our device, it looks like it should work, hopefully, within the next couple of days we can get this working and released
Sent from my HTC Amaze 4G using XDA App
DEFINITIONOFREAL said:
I've been working with joeykrim getting his app setup for our device, it looks like it should work, hopefully, within the next couple of days we can get this working and released
Sent from my HTC Amaze 4G using XDA App
Click to expand...
Click to collapse
That would be wonderful!
I'm tired of having to repeat myself.
flash_image boot /sdcard/boot.img
flash_image recovery /sdcard/recovery.img
Binary100100 said:
That would be wonderful!
I'm tired of having to repeat myself.
flash_image boot /sdcard/boot.img
flash_image recovery /sdcard/recovery.img
Click to expand...
Click to collapse
I just wish the devs would use your script, it would make things so much easier
Sent from my HTC Amaze 4G using XDA App
DEFINITIONOFREAL said:
I just wish the devs would use your script, it would make things so much easier
Sent from my HTC Amaze 4G using XDA App
Click to expand...
Click to collapse
Once I see that they do I can work out something else like:
kernelupdate
recoveryupdate
kernelupdate would be
flash_image boot /sdcard/kernel/*boot*.img
recoveryupdate would be
flash_image recovery /sdcard/recovery/*recovery*.img
So that if you place ANY of the appropriate img file in the perspective folders on the sdcard partition it would flash the .img by just entering either of the two commands from adb shell or terminal.
But I'm not going to waste my time if the devs don't want to use it.
Binary100100 said:
Once I see that they do I can work out something else like:
kernelupdate
recoveryupdate
kernelupdate would be
flash_image boot /sdcard/kernel/*boot*.img
recoveryupdate would be
flash_image recovery /sdcard/recovery/*recovery*.img
So that if you place ANY of the appropriate img file in the perspective folders on the sdcard partition it would flash the .img by just entering either of the two commands from adb shell or terminal.
But I'm not going to waste my time if the devs don't want to use it.
Click to expand...
Click to collapse
could a script be written to automatically flash these while installing/flashing the custom rom? This would cut down atleast the step for flashing kernels for a lot of noobs!!
seansk said:
could a script be written to automatically flash these while installing/flashing the custom rom? This would cut down atleast the step for flashing kernels for a lot of noobs!!
Click to expand...
Click to collapse
Actually, yes! I did add it to the init.d script but since xboarder had removed the init.d scripts from his rom it doesn't work anymore. But you sure could. It was basically how I was setting up my CWMFaux kernels. However it didn't seem to work 100% of the time. Couldn't figure out why.
It basically worked like this...
Flashing the CWM custom kernel .zip via recovery.
copies boot.img to /system
copies init.d 06tweaks script to init.d folder.
copies and set permissions for flash_image binary and kernelupdate script to /system/bin directory.
You then boot your phone up which triggers the init.d script which commands the kernelupdate script to initiate. The kernel update script is simply using the flash_image binary command "flash_image boot /system/boot.img" and it automatically updates the kernel. Then the init.d script removes the boot.img file from the /system directory to keep it from flashing upon every boot.
I would like to change it to /sdcard directory but there's the problem that the sdcard doesn't get mounted until the very end. WAY after the system. Which is why I stored it there. The system gets mounted even before the data partition so I couldn't even store the file in data because the script would run even before the data partition could mount. Basically the script is initiated while your still looking at the boot animation. Pretty much when your softkey backlights and led light comes on it flashes the new kernel. It's a pretty neat workaround if I must say but unfortunately nowhere near perfect and not even close to having an s-off workaround.
Now if you don't mind the fact that it won't be initiated upon boot I could make it so that it will flash any file in a perspective folder on the sdcard.
example:
kernelupdate would update the kernel with any *boot*.img file located in a certain directory... say /sdcard/kernel
recoveryupdate would update the recovery with any *recovery*.img file located in a certain directory... say /sdcard/recovery
The problem:
Some people would want to collect their kernels and recoveries and store them in those directories. That would NOT be possible since using the command "flash_image recovery /sdcard/*recovery*.img would flash any img file with the word "recovery" in it. So if there's more than one it would error out and not flash anything because of the conflict. Same principal with the kernel only MOST kernels are simply named "boot.img" where-as almost all recovery files have a unique name since they are all already custom.
Binary100100 said:
Actually, yes! I did add it to the init.d script but since xboarder had removed the init.d scripts from his rom it doesn't work anymore. But you sure could. It was basically how I was setting up my CWMFaux kernels. However it didn't seem to work 100% of the time. Couldn't figure out why.
It basically worked like this...
Flashing the CWM custom kernel .zip via recovery.
copies boot.img to /system
copies init.d 06tweaks script to init.d folder.
copies and set permissions for flash_image binary and kernelupdate script to /system/bin directory.
You then boot your phone up which triggers the init.d script which commands the kernelupdate script to initiate. The kernel update script is simply using the flash_image binary command "flash_image boot /system/boot.img" and it automatically updates the kernel. Then the init.d script removes the boot.img file from the /system directory to keep it from flashing upon every boot.
I would like to change it to /sdcard directory but there's the problem that the sdcard doesn't get mounted until the very end. WAY after the system. Which is why I stored it there. The system gets mounted even before the data partition so I couldn't even store the file in data because the script would run even before the data partition could mount. Basically the script is initiated while your still looking at the boot animation. Pretty much when your softkey backlights and led light comes on it flashes the new kernel. It's a pretty neat workaround if I must say but unfortunately nowhere near perfect and not even close to having an s-off workaround.
Now if you don't mind the fact that it won't be initiated upon boot I could make it so that it will flash any file in a perspective folder on the sdcard.
example:
kernelupdate would update the kernel with any *boot*.img file located in a certain directory... say /sdcard/kernel
recoveryupdate would update the recovery with any *recovery*.img file located in a certain directory... say /sdcard/recovery
The problem:
Some people would want to collect their kernels and recoveries and store them in those directories. That would NOT be possible since using the command "flash_image recovery /sdcard/*recovery*.img would flash any img file with the word "recovery" in it. So if there's more than one it would error out and not flash anything because of the conflict. Same principal with the kernel only MOST kernels are simply named "boot.img" where-as almost all recovery files have a unique name since they are all already custom.
Click to expand...
Click to collapse
quite a dilemma, I wonder if we could add pause to the script until everything is loaded on the first boot then after the pause the script flahes the recovery and more importantly the kernel!!! if this was possible we could keep the files in a separate place on the SD card.
Still nothing like S-off!!! Thanks HTC for being so dev friendly
seansk said:
quite a dilemma, I wonder if we could add pause to the script until everything is loaded on the first boot then after the pause the script flahes the recovery and more importantly the kernel!!! if this was possible we could keep the files in a separate place on the SD card.
Still nothing like S-off!!! Thanks HTC for being so dev friendly
Click to expand...
Click to collapse
I'm sure there's a way to add a delay timer of some sort. I'm just not that savvy. Easiest way would be through an app like Tasker.
DEFINITIONOFREAL said:
Would this be a possible solution to our kernel flashing problems, I know it works for the evo
Sent from my HTC Amaze 4G using XDA App
Click to expand...
Click to collapse
The short answer is yes!
I've setup the application to support the HTC Amaze 4G, but before I release it publically and officially, I want to have a few testers confirm everything is working properly for them.
Posted all the information in a new thread as this one seems to be covering a few different topics so I didn't want to "hijack".
http://forum.xda-developers.com/showthread.php?p=21574722
Thanks for the request and for reaching out to me DEFINITIONOFREAL.
Binary100100 said:
Once I see that they do I can work out something else like:
kernelupdate
recoveryupdate
kernelupdate would be
flash_image boot /sdcard/kernel/*boot*.img
recoveryupdate would be
flash_image recovery /sdcard/recovery/*recovery*.img
So that if you place ANY of the appropriate img file in the perspective folders on the sdcard partition it would flash the .img by just entering either of the two commands from adb shell or terminal.
But I'm not going to waste my time if the devs don't want to use it.
Click to expand...
Click to collapse
I think my application, Flash Image GUI, will be the best alternative, but of course I have a biased opinion!
Regarding alternatives, I think a simple sh script which takes an argument would make a nice wrapper. The argument would be location to the image file to flash. The script could either bundle the flash_image binary or take the location of it as another argument.
All depends on how the developers want to create some type of standard. Which is another great reason Flash Image GUI will work well as it contains everything required and doesn't rely on developers providing support in their ROM, only relys on developers following the standards for ROMs and kernel .zip files.
Also, in looking through some of the custom ROMs and kernel .zip files for this device, I notice one of the custom kernels does something similar to the suggestions above, it executes a file located in /system/etc/init.d on every boot which automatically flashes /system/boot.img file.
At first glance I was horrified to see this as this is a *major* security issue. If anybody were to place any type of file in /system/boot.img, either a rogue kernel or just a blank file, the script automatically flashed it on boot w/o any type of file verification or user notification!
Wanted to get that off my chest and discourage the use of *automatic* loading of any type of major file, such as kernel or recovery image, especially without at least file verification or user approval/notification.
I'll try and keep up with the thread and help contribute ideas to alternatives for anybody who wants to develop/implement! Great ideas in the thread and always enjoy reading community collaboration efforts, especially in resolution to manufacturer "adjustments" of standards.
ugh, sorry about the double post (too excited for being too early in the morning). if a moderator wants to combine my last two posts, please do. i dont have access to delete a post.
joeykrim said:
I think my application, Flash Image GUI, will be the best alternative, but of course I have a biased opinion!
Regarding alternatives, I think a simple sh script which takes an argument would make a nice wrapper. The argument would be location to the image file to flash. The script could either bundle the flash_image binary or take the location of it as another argument.
All depends on how the developers want to create some type of standard. Which is another great reason Flash Image GUI will work well as it contains everything required and doesn't rely on developers providing support in their ROM, only relys on developers following the standards for ROMs and kernel .zip files.
Also, in looking through some of the custom ROMs and kernel .zip files for this device, I notice one of the custom kernels does something similar to the suggestions above, it executes a file located in /system/etc/init.d on every boot which automatically flashes /system/boot.img file.
At first glance I was horrified to see this as this is a *major* security issue. If anybody were to place any type of file in /system/boot.img, either a rogue kernel or just a blank file, the script automatically flashed it on boot w/o any type of file verification or user notification!
Wanted to get that off my chest and discourage the use of *automatic* loading of any type of major file, such as kernel or recovery image, especially without at least file verification or user approval/notification.
I'll try and keep up with the thread and help contribute ideas to alternatives for anybody who wants to develop/implement! Great ideas in the thread and always enjoy reading community collaboration efforts, especially in resolution to manufacturer "adjustments" of standards.
ugh, sorry about the double post (too excited for being too early in the morning). if a moderator wants to combine my last two posts, please do. i dont have access to delete a post.
Click to expand...
Click to collapse
I look forward to tryin out your app.
It was basically what this thread was all about in the first place.
The clockwork method that you mentioned is the only workaround that I was able to come up with for custom kernels (like Faux123) because a kernel cannot be flashed through recovery without s-off. Really stupid. So I started thinking "How can we flash a boot.img file from recovery without the typical means?" Then came up with the solution to flash_image the boot.img file automatically IF the file is detected. But how to start a script automatically upon boot? init.d is the only way I could think of. Okay... so where to put the boot? I tried the sdcard but it failed to mount until it was way too late. So... data. Nope... still didn't mount in time. Cache? Well... how many developers will include a cache file into their roms? So the only other option was /system and it seemed convenient since /system mounts BEFORE the script can run (obviously) so that's why it is as it is. I also figured "If someone wants to flash a new kernel all they need to do is push the boot.img to /system and reboot." Must easier than using the EKF method (requiring PC access) and I don't know about you but I'm not around a computer 24/7.

[Q] Anyone Know A Way To Mount SD While In Recovery?

Basically i went to flash a Rom in my phone, one of the requirements for the Rom was to format system. Not looking I, formatted SD card instead. Erasing my backup i had just made, and whipping the Rom that I was about to flash. So, what I need help with is seeing if anyone know a way to flash a Rom to my phone while in recovery, or is there a way to mount my SD Card memory while in Fastboot or recovery? I'm just looking to be able to flash any Rom in my phone to at least get it able to be used again.
CWR had an option to mount the sd card under mounts and storage. I say had because that was on my dinc2. I'm not rooted on my DNA so I don't have a custom recovery to check for you but this is how I did it in the past.
Sent from my HTC6435LVW using xda app-developers app
charlrober6 said:
Basically i went to flash a Rom in my phone, one of the requirements for the Rom was to format system. Not looking I, formatted SD card instead. Erasing my backup i had just made, and whipping the Rom that I was about to flash. So, what I need help with is seeing if anyone know a way to flash a Rom to my phone while in recovery, or is there a way to mount my SD Card memory while in Fastboot or recovery? I'm just looking to be able to flash any Rom in my phone to at least get it able to be used again.
Click to expand...
Click to collapse
Not to fret, ran into this problem last night. Both of our recoveries allow for adb sideload but ithasn't worked for me (maybe it will for you)
If it doesn't work, you can drop whatever ROM you want into your ADB folder. To make things simple, just change the name of the ROM to DNA. Go into your recovery and then cd to your adb tools from a command window. type in adb push dna.zip /sdcard/ and it'll move it to your internal storage. It takes awhile so be patient :good:
Chyrux said:
Not to fret, ran into this problem last night. Both of our recoveries allow for adb sideload but ithasn't worked for me (maybe it will for you)
If it doesn't work, you can drop whatever ROM you want into your ADB folder. To make things simple, just change the name of the ROM to DNA. Go into your recovery and then cd to your adb tools from a command window. type in adb push dna.zip /sdcard/ and it'll move it to your internal storage. It takes awhile so be patient :good:
Click to expand...
Click to collapse
Okay quick question, well questions. When typing in my adb commands, do my phone need to be in fastboot, if not when you say it needs to be in recovery do it need to be in recovery with it mounted some how or just in recovery in general. Sorry if i'm being a complete noob, but being phone less is killing me
charlrober6 said:
Okay quick question, well questions. When typing in my adb commands, do my phone need to be in fastboot, if not when you say it needs to be in recovery do it need to be in recovery with it mounted some how or just in recovery in general. Sorry if i'm being a complete noob, but being phone less is killing me
Click to expand...
Click to collapse
No problem, we all have to start somewhere. I'll give a bit of clarification.
Fastboot is a way of accessing the Android system from the bootloader, such as flashing system and boot.img's or recovery files, meaning you can't be booted into the system when you want to use Fastboot.
ADB is the android debugging bridge and can be used at just about any time your phone is booted. For the average user, it's mainly a tool to push and pull files. So, in this case since you need to push the ROM to your phone.
I'm not sure if this can be done from the bootloader since it's going to your internal storage, so you need to boot into your recovery. Once there, you don't need to do anything. just make sure that the .zip is in your ADB directory. Open up a command prompt, cd to your adb tools, then use adb push insertfilename.zip (Like I said, rename it to dna to make it easy) so the command looks like adb push dna.zip /sdcard/ This takes awhile depending on the file size (UKB took about 5 minutes, I think. Maybe longer.) so just be patient. If it gives you any type of error, just try again. Hope this helps

[Q] ADB sideload how to install/update a specific file in a specific directory

Hello guys,
so i have messed up my ZenFone 5's booting configuration. good thing is, i know where i have messed up, unlike other noobs like myself. i have been modifying the adbon.sh file, where i added a conditional to check if a file(/dev/keycheck) exists and if it exists(will always return 'true'), to extract the contents of a recovery.tar(custom recovery). problem is, now i cannot boot normally into my device. if anyone can help me with three things, i'd be grateful.
1. How to modify the adbon.sh file using:
(a) preferred choice: using adb sideload <filename> ( i need to update THAT SPECIFIC FILE ONLY) ->(the file is in /system/bin/)
(b) secondary choice: using fastboot flash command. is it possible to update a single file using fastboot flash? (probably not, i think) should i have to flash the entire system partition with a stock/custom ROM? (i already know most about this, but a clear good guide can help me)(i know it will overwrite the total /system partition)
2. Give me a link to the original(stock) adbon.sh file if method 1(a) is possible.
3. Give me a compatible link to a CWM recovery for my device, ASUS_T00J (the recovery in my recovery.tar is a stock recovery, i got f**** fooled into downloading a stock one where i thought it was a custom CWM recovery)

WI502Q, how i unbricked my watch! (TWRP Backup included)

Alright, so I screwed up my watch a few days ago and it ended up not getting past the splash screen and going straight to recovery. Thanks to @z0mghii, I was able to get a TWRP backup of the system, boot, and data. I replaced this backup with my own so none of his data (if possible) could be taken advantage of. However, after flashing it, I was still unable to boot up. Here are the steps I took in order to get everything back to working order. Keep in mind this is for WREN, the small version. Some steps may be unnecessary.
1. Boot to TWRP
2. Go to advanced wipe
3. Wipe everything
4. Go to the link below and download the TWRP Backup
5. Create a backup of a small partition (like boot) on your watch to create the folder.
6. Plug watch into PC while in TWRP
7. Go to the watch's internal storage
8. Go to the TWRP folder
9. Go to the subfolder
10. Paste the downloaded backup folder into this folder, this should be with the one you created earlier
11. Restore this backup on your watch, be sure to check all the boxes
12. Reboot to the bootloader
13. Install ADB if you haven't already, I recommend the 15 second one
14. While the watch is in the bootloader and it is plugged in, type the following commands
fastboot erase cache
fastboot erase misc
fastboot reboot
https://drive.google.com/drive/folders/0B_HUnwYIrFskUW10UDZ0dXdHQzg (You might have to download each item and put them in a folder instead, unless I'm oblivious to something, sorry )
After this, your watch should boot up, then power back down, then boot back up again. This will be followed up by the boot animation and go to the welcome screen.
If any of you guys could provide me with the latest stock rom version TWRP backup or a stock recovery.img, it would be greatly appreciated. (Unless June patch is the latest). The recovery would be great no matter what. Getting the stock recovery can be done by typing the following commands into the command prompt on a PC. Hopefully they work. It should be copied onto the /sdcard.
Via adb shell (make sure ADB debugging is on in developer options, then type adb shell in CMD on PC) type: cat/proc/mtd and press enter
You will see which is recovery partition and then type: dd if=/dev/mtd/mtd1 of=/sdcard/recovery.img (note that mtd1 you must replace with number which is recovery partition)
I hope I helped somebody with this. Again, huge thanks to @z0mghii for making this possible. I'm sorry for bad formatting.
I'm really new to this. I'm also by no means a developer/hardcore android person. These commands were all taken from google. I take 0 responsibility for your device being ruined. This is just what worked for me.
Reserved
HOLY CRAP IT WORKED!! You just don't know how much this means to me, words can't express!
cland216 said:
HOLY CRAP IT WORKED!! You just don't know how much this means to me, words can't express!
Click to expand...
Click to collapse
Hell yeah. Glad I could help somebody! I've been wanting to give back to the wonderful XDA community for a while as a long time lurker. Also, I'm hoping to get a newer version of the stock rom and a stock recovery.img so you can go back to 100% factory stock for an OTA. I'm pretty proud of myself (being noobish) figuring this out.
Thanks a lot!! My watch was kept in a drawer because it was useless and it has now returned to life, I just have a problem restoring the recovery, the command to locate the recovery folder do not work me, have any idea how located the recovery folder?
klaudio_tv said:
Thanks a lot!! My watch was kept in a drawer because it was useless and it has now returned to life, I just have a problem restoring the recovery, the command to locate the recovery folder do not work me, have any idea how located the recovery folder?
Click to expand...
Click to collapse
Are you referring to "extracting" the recovery img? You only need to do it if you're running the stock recovery.
If so, I think I have screwed the command. Make sure you're in adb shell (in recovery on the watch) and then type "cat /proc/mtd" (with the space in front of cat) without the quotes in order to locate the recovery partition.
You will see which is recovery partition and then type: dd if=/dev/mtd/mtd1 of=/sdcard/recovery.img (note that mtd1 you must replace with number which is recovery partition)
Hopefully this works
Hi, my watch now works well, but I was not able to install updates, when I try to install updates from the watch, watch reboots and go to TWRP recovery. Anyone knows how install the updates?
klaudio_tv said:
Hi, my watch now works well, but I was not able to install updates, when I try to install updates from the watch, watch reboots and go to TWRP recovery. Anyone knows how install the updates?
Click to expand...
Click to collapse
Since the OP helped me, here's my chance to give back..
By no means do I know what hell I'm doing, but I know enough to be dangerous. If you're ready to live dangerously, follow these steps (which worked for me):
1. Go into TWRP on the watch and connect it usb to your computer. Using TWRP file manager, copy the update.zip from CACHE to sdcard\Download.
2. On the computer, browse to Zenwatch internal memory Downloads folder and copy the update.zip file to your computer.
3. Unzip the file on your computer using 7zip.
4. Navigate to \META-INF\com\google\android\ and look for updater-script.
5. Edit updater-script in Notepad++.
6. Delete the lines starting with getprop. This turned out to be lines 2 thru 5.
7. Delete the lines starting with apply_patch_check. This turned out to be lines 10 thru 176
8. Save changes to updater-script then in Windows Explorer highlight all of the files and folders that you unzipped, right-click them and click on 7zip --> Add to update.zip
9. Copy the new update.zip to the Zenwatch internal memory, Downloads folder, overwriting the original update.zip
10. Flash the update.zip file with TWRP.
11. Reboot TWRP to Bootloader.
12. On your computer, goto adb folder where you have fastboot files, and using command prompt type:
fastboot erase cache
fastboot erase misc
fastboot reboot
These steps worked as I was stuck on the June 1, 2016 Android security patch on my Wren Zenwatch. These steps helped me get to the September 1, 2016 security patch.
I managed to update my watch to the September 1 security patch using Cland216's method. But I am unable to update further using the method above. Does anyone have any info on how to update further? Or has any zip files to flash?
If we could get someone to upload the watches stock recovery that would solve all issues.....Why has noone done this for this model yet?
Sent from my OnePlus X using XDA Labs
I'm unable to create a backup file
5. Create a backup of a small partition (like boot) on your watch to create the folder.
6. Plug watch into PC while in TWRP
TWRP :
Could not mount /data
When I try to mount /data , I unable to /data
HOLY ****
Dude.. Let me just say...
YOU ARE THE ****ING ABSOLUTE BEST.
I am now going to make a backup, and save it to my computer, google drive, dropbox, icloud, and every other ****in place I can to make sure this never happens again. Thank you!!!!
Nicholas6706 said:
Alright, so I screwed up my watch a few days ago and it ended up not getting past the splash screen and going straight to recovery. Thanks to @z0mghii, I was able to get a TWRP backup of the system, boot, and data. I replaced this backup with my own so none of his data (if possible) could be taken advantage of. However, after flashing it, I was still unable to boot up. Here are the steps I took in order to get everything back to working order. Keep in mind this is for WREN, the small version. Some steps may be unnecessary.
1. Boot to TWRP
2. Go to advanced wipe
3. Wipe everything
4. Go to the link below and download the TWRP Backup
5. Create a backup of a small partition (like boot) on your watch to create the folder.
6. Plug watch into PC while in TWRP
7. Go to the watch's internal storage
8. Go to the TWRP folder
9. Go to the subfolder
10. Paste the downloaded backup folder into this folder, this should be with the one you created earlier
11. Restore this backup on your watch, be sure to check all the boxes
12. Reboot to the bootloader
13. Install ADB if you haven't already, I recommend the 15 second one
14. While the watch is in the bootloader and it is plugged in, type the following commands
fastboot erase cache
fastboot erase misc
fastboot reboot
https://drive.google.com/drive/folders/0B_HUnwYIrFskUW10UDZ0dXdHQzg (You might have to download each item and put them in a folder instead, unless I'm oblivious to something, sorry )
After this, your watch should boot up, then power back down, then boot back up again. This will be followed up by the boot animation and go to the welcome screen.
If any of you guys could provide me with the latest stock rom version TWRP backup or a stock recovery.img, it would be greatly appreciated. (Unless June patch is the latest). The recovery would be great no matter what. Getting the stock recovery can be done by typing the following commands into the command prompt on a PC. Hopefully they work. It should be copied onto the /sdcard.
Via adb shell (make sure ADB debugging is on in developer options, then type adb shell in CMD on PC) type: cat/proc/mtd and press enter
You will see which is recovery partition and then type: dd if=/dev/mtd/mtd1 of=/sdcard/recovery.img (note that mtd1 you must replace with number which is recovery partition)
I hope I helped somebody with this. Again, huge thanks to @z0mghii for making this possible. I'm sorry for bad formatting.
I'm really new to this. I'm also by no means a developer/hardcore android person. These commands were all taken from google. I take 0 responsibility for your device being ruined. This is just what worked for me.
Click to expand...
Click to collapse
I spoke just a bit too soon, now it is hanging on that animation with the 4 dots. Any suggestions?
NEVERMIND, I AM UP AND RUNNING!! WOOHOOOO

Categories

Resources