[Q] Some questions about Android Recovery Mode

Search This thread

Kimi_Jin

New member
Jan 28, 2014
3
0
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://xdaforums.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?
 

jhelp

Member
Nov 21, 2011
15
2
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
 

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,860
3,765
mpls
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
 

Kimi_Jin

New member
Jan 28, 2014
3
0
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

I've got /by-num, but no /by-name, device is Sansumg GT-9288
 

demkantor

Inactive Recognized Contributor
Nov 10, 2011
6,860
3,765
mpls
not sure what a Sansumg GT-9288 is, gsmarena and google dont give me results
what happens with
cat /proc/partitions
or just
mount
?
 

Kimi_Jin

New member
Jan 28, 2014
3
0
not sure what a Sansumg GT-9288 is, gsmarena and google dont give me results
what happens with
cat /proc/partitions
or just
mount
?

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.