Flash image gui? - HTC Amaze 4G

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.

Related

[recovery][ALPHA]CWR-5.0.2.7-cvpcs+DK_RECOV.zip

Notice this could hose,break,trash or brick your phone. You are warned.
Update
Thanks to both CVPCS and Dragonzkiller and the DX2-Dev-Team. And of course thanks to koush. And Tenfar too did he did find the /preinstall hack? Did Dragonzkiller fixed the graphics or what? IDNK, it is fixed(/sbin/recovery in DK, cvpcs is broken). Hence the hybrid zip.
The UL zip works some what from /preinstall see my thread. http://forum.xda-developers.com/showpost.php?p=20634404&postcount=1 It may do the same if flashed via Tenfars,our bootstrap, just flash it as you would any zip and it will take over.
It backs up and will restore, from adv restore, /cache and(if set in recovery.fstab) sd-ext. A full restore bombs:
Checking MD5 sums...
cache.ext3.tar: OK
data.ext3.tar: OK
system.ext3.tar: OK
couldn't find default
Found new backup image: /sdcard/clockworkmod/backup/2012-01-02.05.08.01//system.ext3.tar
Restoring system...
E:format_volume failed to unmount "/system"
Error while formatting /system!
Other features may work. I find that zipping from win7 winrar fails but Root Explorer zipping results work.
/sbin/recovery is distorted (main screen):
https://github.com/cvpcs/DroidX2Bootstrap/tree/master/assets
Distortion fixed;
https://github.com/DX2-Dev-Team/DX2-CWMR/tree/master/assets
Edit What is the "/preinstall cwr hack"?
TO PUT IN PLAIN TERMS : ALL YOU NEED FOR ANY CHARGE ENABLED RECOVERY:
THE FILES: "hijack" AND (THE HACKED) "charge_only_mode" IN /system/bin
AND ".revovery_mode" IS IN /data
YOU DO NOT NEED ANYTHING ELSE BUT TO LOAD /preinstall
WITH YOUR FAV RECOVERY NAMED: "update-recovery.zip", ALONG WITH IT'S BINARY (SAME AS INSIDE THE ZIP/meta-inf....) CALLED: "update-binary" AND "hijack" (SAME AS ABOVE). Thats it! 6 files. With permissions- See above link.
Older post
5.0.2.0 http://download.clockworkmod.com/recoveries/recovery-clockwork-5.0.2.0-olympus.zip
Not everything works: when flashing between recoveries they need to be on internal sd, and, of course, backup and restore may work but its for ul bootloaders only.
DO NOT FLASH FROM ROM MANAGER. IT WILL BE SBF time.
Flash from tenfars and keep a copy of both on int sd (tenfars update-recovery.zip and the DL) to go back and forth. Do not backup and restore with this.
Just checked out the updater script and it looks like it should work, barring no needed changes on the scripts in sbin that it copies. I wonder if ADB works in it on this one. This could be a huge bonus for what were trying to do since BSR is kinda old and crappy
No adb in adv menu.
skwoodwiva said:
No adb in adv menu.
Click to expand...
Click to collapse
ADB shouldnt be in a menu. Should just be enabled by default. Course it only would work if it was plugged into a computer at the time you dropped into CWR. It doesnt support USB state changing.
So if the cwr in charge mode triggered, as is the preinstall hack, then no adb?
Log from cwr
init.svc.battd running
.usbd running
.touch stopped
.atvc stopped
.adb running
Extended commands not found.
See if you can run any adb commands like:
adb devices
adb pull /system/build.prop
etc...
It fails to mount sdcard. When recovering or manual mount.
I'm done messing this one.
I was able to overwrite the one in /data/data/tenfar folder but not in /preinstall folder anything special I need to try? Still went into BSR when I rebooted to recovery.
Sent from my DROID X2 using XDA App
I am learing as I go, but the point I realized is when you go to adv menu,in cwr,and reboot recov the current cwr gets loaded to /preinstall. So paste to data/data...files run sr then do reboot recov. Then paste to preinstall.
Cool ill give that a shot thanks!!!
Sent from my DROID X2 using XDA App
If I had the knowhow I would hack the garphics from 5010atrix to 5025x2!! .
But why would the newest Dx2 be any good and NOT a failure and be so messed for all this time? Unless one failure hides the other.
It probably can't mount SD due to a wrong mountpoint in one of the scripts. Should be easy to fix.
http://download.clockworkmod.com/recoveries/recovery-clockwork-5.0.2.0-olympus.zip
newer atrix 5020 all works but restore fails as boot img, of course, won't load.
skwoodwiva said:
http://download.clockworkmod.com/recoveries/recovery-clockwork-5.0.2.0-olympus.zip
newer atrix 5020 all works but restore fails as boot img, of course, won't load.
Click to expand...
Click to collapse
how hards that going to be to fix?
Ha ha ha ha!
You got me!
But it easy to flash between these cwrs even back to tenfars. Want to find a way to recwr after a wipe or flash.
The skewed graphics problem is from within the recovery (binary) in /sbin of the
zip: http://download.clockworkmod.com/recoveries/recovery-clockwork-5.0.2.5-daytona.zip .
I pasted the file from the above into this http://download.clockworkmod.com/recoveries/recovery-clockwork-5.0.2.0-olympus.zip and got same graphics skewing.
balltongue said:
See if you can run any adb commands like:
adb devices
adb pull /system/build.prop
etc...
Click to expand...
Click to collapse
Is this from android/sdk in win7?
Can you give me a prep? I am just a NooB.
Within your sdk folder look for platform tools, adb is within this folder. Navigate to platform tools directory using cmd then enter the commands.
Sent from my DROID X2 using xda premium
skwoodwiva said:
Is this from android/sdk in win7?
Can you give me a prep? I am just a NooB.
Click to expand...
Click to collapse
I pm'd you with some info about setting up sdk.

[Q] Disable future DNA OTA updates?

I am running stock DNA, rooted, and with CWM touch recovery. For myself, being root is not merely a luxury, it is a need. Most importantly, I cannot stand having a crippled unix terminal without busybox, which of course, requires root.
I know not what the imminent OTA will bring, but root is too precious to risk losing. I would therefore like to engage in a DNA-specifc discussion about disabling the OTA update.
From what I can tell so far, the two methods include:
1) renaming the otacerts.zip file in /etc/security to a .bak file. This will not work in the present case, since /etc is mounted at /system/etc, and /system can only temporarily be mounted rw due to us being stuck with "S-ON" for now.
2) installing "FOTAkill.apk", or, flashing its corresponding zip (attached below) in custom recovery. Again, in the present case, this file was written for the EVO, and will most certainly not work. The updater-script in the zip can be modified to reflect the correct mount points, but there is a corresponding binary which I have no clue contains what, and would certainly need some expert opinion about.
Any ideas ye fine fellers?
You could always do load ota root keeper from the market back your root up temp un root via app update ota and then re root using the app, I have done this on other devices and I never lost root. Worked well. Might be worth a shot.
Sent from my HTC6435LVW using xda app-developers app
manzdagratiano said:
I am running stock DNA, rooted, and with CWM touch recovery. For myself, being root is not merely a luxury, it is a need. Most importantly, I cannot stand having a crippled unix terminal without busybox, which of course, requires root.
I know not what the imminent OTA will bring, but root is too precious to risk losing. I would therefore like to engage in a DNA-specifc discussion about disabling the OTA update.
From what I can tell so far, the two methods include:
1) renaming the otacerts.zip file in /etc/security to a .bak file. This will not work in the present case, since /etc is mounted at /system/etc, and /system can only temporarily be mounted rw due to us being stuck with "S-ON" for now.
2) installing "FOTAkill.apk", or, flashing its corresponding zip (attached below) in custom recovery. Again, in the present case, this file was written for the EVO, and will most certainly not work. The updater-script in the zip can be modified to reflect the correct mount points, but there is a corresponding binary which I have no clue contains what, and would certainly need some expert opinion about.
Any ideas ye fine fellers?
Click to expand...
Click to collapse
There are system writable kernels out there, and you can always rename your files in recovery. S-Off is not an issue in this scenario.
delete checkinprovider.apk, cotaclient.apk, and updater.apk from /system/app
Jaggar345 said:
You could always do load ota root keeper from the market back your root up temp un root via app update ota and then re root using the app, I have done this on other devices and I never lost root. Worked well. Might be worth a shot.
Click to expand...
Click to collapse
I have indeed heard this alternative thrown around but I am not willing to chance it; I have seen an equal amount of horror stories about people having their systems fried with this method (the Droid X for instance, which I had and where the last update broke root).
SolusCado said:
There are system writable kernels out there, and you can always rename your files in recovery. S-Off is not an issue in this scenario.
Click to expand...
Click to collapse
I will look at what's out there and if it is stable enough to be flashed. How does one rename files in recovery though? I rebooted into CWM (touch) and I see no such option - unless you can remount a partition and rename files in it somehow.
nitsuj17 said:
delete checkinprovider.apk, cotaclient.apk, and updater.apk from /system/app
Click to expand...
Click to collapse
This avenue seems promising. Has anyone tried this before? Also, how does one delete these in the S-ON situation? (I'm assuming recovery is the answer). I feel if I remounted rw, deleted and then rebooted, they will be right back where they are.
manzdagratiano said:
This avenue seems promising. Has anyone tried this before? Also, how does one delete these in the S-ON situation? (I'm assuming recovery is the answer). I feel if I remounted rw, deleted and then rebooted, they will be right back where they are.
Click to expand...
Click to collapse
If you install a kernel with /system writing enabled you can just delete them normally.
Sent from my HTC6435LVW using xda app-developers app
Bigandrewgold said:
If you install a kernel with /system writing enabled you can just delete them normally.
Click to expand...
Click to collapse
Great... thanks! I am looking into custom kernels. By the way, if custom kernels that do allow write to /system can be concocted, why is S-ON an issue at all? I was under the impression that this has to do with NAND memory being inaccessible, which seems to be a lower level issue than the kernel.
manzdagratiano said:
Great... thanks! I am looking into custom kernels. By the way, if custom kernels that do allow write to /system can be concocted, why is S-ON an issue at all? I was under the impression that this has to do with NAND memory being inaccessible, which seems to be a lower level issue than the kernel.
Click to expand...
Click to collapse
With s on we can not.
Flash radios
Flash kernels in recovery.
Change the splash screen
Go back to a locked bootloader
And a few other things I'm probably forgetting.
Sent from my HTC6435LVW using xda app-developers app

[SCRIPT/FIX] Internal sdcard permissions (/data/media/)

This should be applicable to any ROM on devices which share internal storage for applications and the internal "sdcard" (Note II, SGS3, probably others). Symptoms may include inability to take screenshots and other failures, and will usually show a "Permission denied" in logcat for files under /data/media/. The underlying problem is that permission is denied to the filesystem, even by the root user when the ROM is booted (this is strange and I still don't understand why). Running "Fix permissions" did not fix this issue for me (that script doesn't change any permissions on the sdcard).
When booted into recovery (ClockworkMod was tested in my case), root has the ability to reset the permissions properly. To fix the problem, connect with adb while booted in recovery and run the following commands to correct the permissions:
Code:
chown -R media_rw:media_rw /data/media/
find /data/media/ -type d -exec chmod 775 {} ';'
find /data/media/ -type f -exec chmod 664 {} ';'
UPDATE (Credit to @Quinny899) If that does not work, you may also want to reset the SELinux contexts for the media partition with this command:
Code:
restorecon -FR /data/media/
Hope this helps! :victory:
I recently restored a Nandroid backup of my old Nexus 7 on a replacement Nexus 7. Most everything worked okay, but screenshots, deleting certain files and directories, and other basic operations weren't really working, and "Fix permissions" didn't help.
Running the commands here worked like a charm! I used TWRP and I have JellyBeer 4 on my Nexus 7. Thanks!
skoshy,
I'm glad this helped you. JellyBeer is a fantastic ROM. Cheers!
xak944 said:
skoshy,
I'm glad this helped you. JellyBeer is a fantastic ROM. Cheers!
Click to expand...
Click to collapse
Well, I created a ZIP of this for people to flash in Recovery, ADB sideload or in an App like Fashify... Only to realize that XDA superstar @osm0sis had already done pretty much the same thing with his sdcard Fix Permissions Script Found here. His script uses pure edify whereas mine uses linux commands.. Both work but his Was First so I will only leave the link for his.
Cheers!
Yeah it's kinda funny. I had that script posted up in the ADBsync thread back in February because I noticed things could start acting funny when I restored an entire sdcard backup to one of my devices. But hey, great minds think alike! Good work all around!
Thanks @TheByteSmasher for bringing another use for the zip to my attention! I didn't know those things had a tendency to go awry on their own as well!
Edit:
Here's the edify script equivalent of the above, plus the proper original perms for /data/media itself, and the special perms that CWM likes its subfolder to have (root + all). TWRP keeps its backups under the primary user subfolder (/data/media/0) and doesn't seem to care as much.
cwm-sdcard.Fix.Permissions.zip/META-INF/com/google/android/updater-script:
Code:
ui_print("");
ui_print("sdcard Fix Permissions Script");
ui_print("by osm0sis @ xda-developers");
show_progress(1.34, 0);
ui_print("");
ui_print("Mounting...");
run_program("/sbin/busybox", "mount", "/data");
set_progress(0.2);
ui_print("");
ui_print("Setting /data/media to media_rw and fixing...");
set_perm_recursive(1023, 1023, 0775, 0664, "/data/media");
set_perm(1023, 1023, 0770, "/data/media");
set_progress(0.8);
ui_print("");
ui_print("Setting /data/media/clockworkmod perms...");
set_perm_recursive(0, 0, 0775, 0777, "/data/media/clockworkmod");
set_progress(1.0);
ui_print("");
ui_print("Unmounting...");
unmount("/data");
set_progress(1.2);
ui_print("");
ui_print("Done!");
set_progress(1.34);
Available over in my Odds and Ends thread as TheByteSmasher mentioned before.
Nice. Good to know this is a well known issue, I thought I was nearly alone (and it drove me up the wall for a while until I figured it out).
Does anyone know what is technically causing even the root user not to be able to write? I'm curious.
Probably because even root apps only run root commands when they need to, so for simple stuff could run into the same issue. Just a guess, but makes sense.
I'm not talking about root apps. When I had the issue I couldn't modify any files with a shell over adb as the root user. Write operations always resulted in 'permission denied' errors. Generally in Linux, the only way this can occur is with filesystem permissions (root user bypasses this), the immutable bit (not set), or if it's a read-only filesystem (didn't appear to be based on the output of 'mount').
xak944 said:
I'm not talking about root apps. When I had the issue I couldn't modify any files with a shell over adb as the root user. Write operations always resulted in 'permission denied' errors. Generally in Linux, the only way this can occur is with filesystem permissions (root user bypasses this), the immutable bit (not set), or if it's a read-only filesystem (didn't appear to be based on the output of 'mount').
Click to expand...
Click to collapse
Osm0sis actually states in the description of his zip, that when you use ADB push to put some stuff on the SD it can mess with the permissions... that's what did it for me.. but I guess a nandroid restore can cause it too depending on how it performs the action.
Sent from my Nexus 4 using Tapatalk 4 Beta
I'm ditching the idea of editing fix_permissions. The way they do all the system files is extremely intelligent and done on-the-fly based on the contents of certain system files to trace through. Adding something specifically for internal sdcards, even with the appropriate checks, would be a hack compared to all the really great work they've done to make the script device-nonspecific.
Deleted
1990mustafa said:
Deleted
Click to expand...
Click to collapse
Could somebody point me in the direction of how to do this for the Note 3 SM-9005 please?
I have an internal SD permissions issue and the flashable zip doesn't work, I presume because the directories are located slightly differently.
Many thanks
i m also stuck in same boat as none of scripts work for note 3... need some help / guidance here ..
You saved me, i was playing with ubuntu touch and i forgot that symbolic links and chown always modify the original directory and twrp could not fix the permissions!
Thank you! Works like a charm! :highfive:
Following using this, I found that the internal SD wouldn't be mounted
Googling the logcat output's lines, I found this, specifically:
[email protected] said:
use for fixing access
su
restorecon -FR /data/media/0
Click to expand...
Click to collapse
Worked a dream, might be useful for anyone else
Quinny899 said:
Following using this, I found that the internal SD wouldn't be mounted
Googling the logcat output's lines, I found this, specifically:
Worked a dream, might be useful for anyone else
Click to expand...
Click to collapse
worked perfectly!
Hey, big THANKS to everyone who contributed to this thread. I restored by SD a different way than I used to do it and had this issue. I figured it was a permissions issue but couldn't get the 'Fix Permissions' function in TWRP or ROM Manager to fix it (now I know why). This saved me, much appreciated!
Quinny899 said:
Code:
su
restorecon -FR /data/media/0
Click to expand...
Click to collapse
Oh man, so it was SELinux causing these issues all along!? I wonder why my original fix worked then since it didn't reset the SELinux context... Oh well, good to know.
Thanks @TheByteSmasher for leading me to the right solution
TheByteSmasher said:
Well, I created a ZIP of this for people to flash in Recovery, ADB sideload or in an App like Fashify... Only to realize that XDA superstar @osm0sis had already done pretty much the same thing with his sdcard Fix Permissions Script Found here. His script uses pure edify whereas mine uses linux commands.. Both work but his Was First so I will only leave the link for his.
Cheers!
Click to expand...
Click to collapse
Thanks again
osm0sis said:
osm0sis' Odds and Ends -- Misc./Batch Tools, Flashable Zips, Scripts, etc.
General Information
In a nutshell, I just wanted a single thread to gather links to some of my other, larger projects, but also serve as a spot I could put some smaller scripts and zips I've created that I don't think merrit their own separate threads. This is partially for my own sanity and will hopefully make it easier for others to find some things as well. A lot of the stuff here was developed with the GN or N7 (my devices) and Windows in mind, but could generally be applicable to most devices either out-of-the-box or with some slight modification. If you see something that inspires you, go ahead and mod it, just let me know and give me some credit somewhere. If anyone would like to know the specifics of what's in a particular script that I haven't already linked to more information on, just let me know and I'll post that in here as well. Thanks!
Misc./Batch Tools
AnyKernel 2.0 (many devices) - link
AnyKernel was a simple template for an update.zip that could apply any kernel to any ROM, regardless of ramdisk to reduce the chance of any issues arising from the custom kernel pairing. The drawback to this is that some kernels require modifications to the ramdisk to enable/set up kernel features, and in the old AnyKernel format there was no way to do this. AnyKernel 2.0 pushes the format even further by allowing kernel developers to modify the underlying ramdisk for kernel feature support easily using a number of included command methods along with properties and variables to customize the install experience.
Android Image Kitchen (many devices) - link
A collection of Windows/Android ports of the necessary Linux utilities for Android image (kernel+recovery) mod work, and my own automation script to unpack, edit and repack the ramdisk. Other guides/scripts exist but none of them are universal for target device, compression and/or developed for Windows/Android. Now also Linux builds to bring my improved featureset back to where it came from. Has been extremely useful for me in my messing around with kernel ramdisks.
ADB Screenshot (all devices) - attached
Take screenshots while in recovery. Useful for development of recovery apps or error reporting. Original method had lots of different threads around with the general method for various devices but I figured out a couple tricks required for getting it working on the Galaxy Nexus and then automated the process. Tested and confirmed working with both pixel formats of CWM and TWRP. More information in this GN Q&A FFmpeg thread. New method uses fb2png and should work on all devices.
ADBsync sdcard Backup (many devices) - attached
Backs up the entire sdcard so that you can have a complete snapshot of your device when you make periodic backups, and be able to restore things exactly as they were. Automates the sync process of Renate NST's great ADBsync utility which makes only newer files get pulled, significantly decreasing backup time for the sdcard compared to "adb pull". Original version posted in the old ADBsync thread. Defaults for devices with /data/media/ internal sdcards (Nexus devices, etc.), but is easily customizable to backup other mountpoints.
Flashable Zips
Nexus BootUnlocker script (GN, N4, N5, N7 '13, N10) - attached
I don't know about everyone else but sometimes I find I've rebooted into the bootloader only to realize I've forgotten to unlock it in segv11's excellent BootUnlocker App beforehand. Well, I decided to make a BootUnlocker Script for my Galaxy Nexus so I could just boot to recovery quickly, unlock, then adb reboot-bootloader (or use my Reboot To Bootloader script below) to get back without having to fully boot the OS to make the change. Also extremely useful in the case you aren't able to boot. As with the app there is no data loss like there would be with fastboot, allowing you to relock for safety. Originally posted in the GN EDIFY Scripting thread. Modified for the newer Nexus devices and combined into a single Nexus BootUnlocker zip with tamperbit reset support added using information from the BootUnlocker App Dev thread.
N7 BootUnlocker script (N7 '12) [creation guide] - link
The Nexus 7 2012 is a special case. Per-device encryption of an entire partition makes it impossible to support the N7 '12 in a simple root app, or flashable zip as above, however using my guide and included script you can now create a working BootUnlocker Script Zip for your specific device. As with the above scripts there is no data loss like there would be with fastboot, allowing you to relock for safety.
Flashify script (many devices) - attached
This script zip makes flashing boot.img (kernel), recovery.img, and radio.img/modem.img (baseband) files via recovery simple. Inspired by cgollner's powerful and visually stunning Flashify App, it aims to save the average user the hassle of repacking their own image zip, or using the command-line or fastboot to flash it. Place an appropriately named file in the same directory as the zip and flash away! Should work on all emmc devices with normal partition naming ("boot", "recovery" and "radio" or "modem") which accept Android standards-compliant images. Extremely handy when used with amarullz' brilliant AROMA Filemanager, and/or my Android Image Kitchen: Mobile Edition (linked above).
Kernel Emergency Reset script (many devices) - link
Basically a go-to cure-all for custom kernel users experiencing issues after an upgrade due to old settings left over in a kernel control app (eg. franco.Kernel updater, Trickster, etc.), or problematic init.d/userinit.d scripts. It's also useful if you just want to make sure you're running clean defaults without conflicts.
Reboot To Bootloader script (all devices) - attached
Those who prefer using CWM may have noticed a couple of things missing that the other popular custom recovery, TWRP, has built-in. One of these is a file explorer/manager, which is answered by amarullz' brilliant AROMA Filemanager. Another thing I found myself wanting is a way to reboot back to the bootloader once I'm in recovery, so I created this very very simple flashable zip script. (No longer required on CWM >=6.0.3.5). Note: Once in the bootloader, "Start" will boot you back to recovery. Not sure why, but it's not a big deal, just reboot normally from recovery at that point.
sdcard Fix Permissions script (many devices) - attached
A little flashable zip script to fix ownership and permissions of files and directories on the sdcard to what they would be if Android OS had put them there itself, since some apps can't access pushed files that have root.root as owner/group. This is useful when restoring to your sdcard backup, as with my ADBsync sdcard Backup batch script above, since generally, pushed files get root.root from adb shell and higher permissions than usual. Also a solution for a bug where sdcard files get lower permissions somehow, resulting in similar access problems. Currently written for devices with /data/media/ internal sdcards (Nexus devices, etc.), but could easily be modified for other mountpoints.
nano Terminal Editor v2.2.6 Installer (all devices) - attached
A simple installer to push bgcngm's great Android port of the nano editor binary to /system/xbin/ along with the required files in /system/etc/terminfo/. It can then be used from Terminal while booted from that point on. Each time you flash it also temporarily enables use in recovery by pushing a script to /sbin/nano with the required environment variables, so you can then trigger it from recovery shell or the console in amarullz' brilliant AROMA Filemanager. Makes it extremely easy and worry-free to tweak and mod on the go, knowing you can edit the faulty build.prop or init.d script if something goes wrong. This script could also be added to recovery to make the functionality permanent.
odex Script Installer (all devices) - attached
Based on the great work and binaries from this thread, a simple installer to push my odex script along with the required dexopt-wrapper and zip binaries to /system/xbin and set the appropriate permissions. Automates the procedure to odex any apk or jar from the commandline to potentially improve performance. Dalvik runtime only. Also uses cut from busybox.
Kernel init.d Support Injector (many devices) - attached
Following from great ideas by Captain_Throwback in my AnyKernel2 thread and using script from my Flashify script above, this AK2 zip will inject basic init.d bootscript support into any kernel ramdisk on any emmc device with normal partition naming and using the Android bootable image standard, without having to bloat a ramdisk using a busybox binary. This zip is also signed, so could potentially be used with stock recovery on a locked bootloader, but that depends on the stock recovery supporting grep, etc. for the zip script to perform the required file changes.
Dev Team init.d Pack Installer (all devices) [see "950iosettings, etc." below] - link
A simple installer I wrote to create the /system/etc/init.d/ directory, extract the latest init.d scripts as published by the "Franco's Dev Team" tuning collective (of which I'm a member), then set correct owner, group and permissions to the entire init.d directory. Link points to my Dev-Host since these may still be subject to change from time to time. If you are a developer and would like to include these tunables/scripts in your kernel or ROM please provide credit. A lot of time and effort has gone into this project and that's all we ask.
Credits & Thanks: All authors of any included binaries and libraries for their amazing work. Anyone who's helped me with these projects along the way.
Disclaimer: Naturally, you take all the responsibility for what happens to your device when you start messing around with things.
XDA:DevDB Information
osm0sis' Odds and Ends -- Misc./Batch Tools, Flashable Zips, Scripts, etc., Tool/Utility for the Android General
Contributors
osm0sis
Version Information
Status: Stable
Created 2013-11-13
Last Updated 2015-03-30
Click to expand...
Click to collapse

[TOOL] LunarTools Menu Initd & CommandLine Parsing scripts

Welcome to LunarTools​
Download standalone: Link
Can find older versions here along with some other rom mods: Link
Download compatibility test script: Link
Link to script source
Link to app source
Q: What is this?
Breif explanation of LunarCmdline & LunarMenu:
LunarCmdLine: It's intended use is for getting rid of the need of a cpu control app. This script allows the end user to change kernel defaults as a boot.img for either immediate flashing or saving for later on a storage option. Can only be implemented if your kernel supports showp1984's command line options.
LunarInitd: Same as Cmdline but more universal to any kernel when paired with init.d supported roms. Be aware, even though this may be safer it may also not be quite as stable as Cmdline.
LunarMenu: This coincides with the boot.img's created from invoking LunarCmdline. It lists the boot.img's created that are found on internal storage in lunar directory. Also has the ability to flash a recovery for you. Also those rom dev's who wish to implement it later you will be able to switch your boot.img using this script.
Think of them as my implementation of TWRP's Dumlock option that works with with every recovery. AS WELL -DO NOT SET A HOTPLUG GOVERNOR WITH CMDLINE! This *might* result in a softbrick only recoverable by reflashing your rom's boot.img.
Q: Oh neat ok, ..... but how do I run them?
Using a terminal emulator app, allow superuser permissions (su then enter), then invoke either script (menu then enter or cmdline then enter).
Q: There was mention earlier about recoveries or switching boot.img's, how do I use that feature?
Place the recovery you wish to flash in the lunar folder on internal storage(Sense)/external (AOSP) in this name format "recovery<name><version of recovery>.img". You will also be prompted if you wish to create a recovery backup if you wish to use the feature. Examples: recovery_CWMTouch6.0.3.1.img or boot_Rage2.5.img
Q: Would I be able to use this with other boot.img's/kernels?
Currently, if your rom dev supports the feature.
Q: Do you plan to support XxYzZ feature?
Post some feedback. I might consider it.
Q: I have a question not listed here, what information would you need if I had an issue?
Filename of the latest boot/recovery you intended to flash & of course your patience while we work on the issue at hand.
Q: I'm a kernel/rom dev, can I use these for HTC xYzzYx device in my android project ?
This is freely distributed for use, all I ask is if you do use it refer back to this thread. If assistance is needed please PM me or post in thread. You may need to modify some values in cmdline.sh for proper implementation and will need abootimg & unzip in system/bin as part of busybox/toolbox.
Known Bugs:
If flashing a recovery, remember to rename your recovery_backup.img to proper format (recovery<name><version>.img). If you don't and attempt to flash it using the same backup filename, you will just be reflashing your current recovery. No longer a bug
Remember to reboot to recovery if it doesn't automatically.
To do or possibly implement:
zImage flashing similar to AnyKernel. Done!
Known Compatible Devices:
HTC Rezound
Credits @d.kozzer - Without your knowledge & assistance the GUI wouldn't exist
PS: REMEMBER THIS IS ALL AT YOUR OWN RISK AND PURE BETA!!!! YOU CAN POTENTIALLY SOFTBRICK BUT CAN ALSO EASILY RESTORE FROM THAT SOFTBRICK!
A quick how-to from a good friend that's been using this since release candidates:
kcirtap420 said:
Here's a quick rundown of what I came up:
LunarTools(menu only currently) Options Explained
NOTE: If you are prompted to reboot or it fails to auto-reboot please do so
and follow instruction.(auto-reboot doesn't work with sense roms)
Option 1 will give you the ability to flash saved boot.img configurations from the cmdline feature or apply those same settings via init.d , eliminating the need for a cpu or kernel modifing app.
Once selected to will be prompted to choose which boot configuration to flash/appl. If command line, reboot to recovery (auto wipes cache and dalvik) for settings to apply. If init.d a simple reboot will do.
Option 2 has the ability to flash a recovery for you, and also backup your current one!
To do this you must first place a recovery image in the lunar folder, rename it to look like this recovery"name""version" enter recovery name and version without quotes.
Once selected it will ask which recovery to flash(if it's not there make sure it's named correctly and in the lunar folder!)
It will then ask you if you would like to backup your current recovery.(this will be in the lunar folder ready to
go!) Enjoy your new recovery once it's completed! No reboot needed.
Option 3 can be used for a couple things, you can update your kernel, or flash a whole new one!
To flash a new one place kernel zip in the lunar folder. If you would like to update your current kernel, place the zimage from a kernel zip in the lunar folder.
Select either file from the list, Once it's done reboot to recovery if not done automatically ( auto wipes cache and dalvik)
Option 4 is the answer for S-on users and boot.img's, REJOICE!! This option will flash a boot.img from a ROM zip!
To do this first place the ROM zip inside the lunar folder and select it, it will continue to flash the boot.img. Once it's done
reboot to recovery and go about usual ROM flashing habits such as perform factory reset and wipe system, then install your ROM and reboot!
Enjoy your new ROM flashed without fastboot commands!
Click to expand...
Click to collapse
Please try to take any questions/bugs to this thread
http://forum.xda-developers.com/showthread.php?p=41634758
or here
http://themikmik.com/showthread.php?16096-LunarTools-ChitChat-amp-Bugs-Thread
For now, the source that's on git is for AOSP roms(place boot.img's on sdcard/lunar). Bare with me while working on getting insecured boots for AOSP to get the scripting to work properly.
Snuzzo said:
For now, the source that's on git is for AOSP roms(place boot.img's on sdcard/lunar). Bare with me while working on getting insecured boots for AOSP to get the scripting to work properly.
Click to expand...
Click to collapse
wow wait for this to be stable. cheers!
Watching
sexy
lookin sexy!
First bug found
Problem
When choosing recovery_backup<DATE>.img and today's date is the same recovery doent seem to flash.
Solution
Rename recovery_backup<DATE>.img to a proper filename. recovery_<name><version>.img and flash the file under the new filename.
Just a small bug found which I will be rectifying very VERY soon.
Nearing release as standalone flashables.
https://github.com/Snuzzo/LunarTools/commit/9bd3b14b2f6a23172da957ae893fea9f5bb0f766
For those who have been following this; do you see anything that you would like implemented?
Standalone flashables posted in the OP for download.
OK so far heroes what i got in a new menu addition...
Pulls boot.img from zip
Flashes it
Creates a recovery script which right now only flashes the zip you chose
Then auto reboots.
May need some assistance with this as it needs to wipe data cache. I probably could do this with a rm command prior to auto reboot.
Thoughts?
Sent from my Nexus 7 using Tapatalk HD
Snuzzo said:
OK so far heroes what i got in a new menu addition...
Pulls boot.img from zip
Flashes it
Creates a recovery script which right now only flashes the zip you chose
Then auto reboots.
May need some assistance with this as it needs to wipe data cache. I probably could do this with a rm command prior to auto reboot.
Thoughts?
Sent from my Nexus 7 using Tapatalk HD
Click to expand...
Click to collapse
I like the idea of it just auto booting into recovery only after flashing boot.img
Edit: or maybe have the script prompt if you want to reboot
Sent from my ADR6425LVW using xda premium
Bug: mismatched boot and rom in a backup
Solution: before using the 4th option to flash a boot.img from zip run your optional nandroid prior.
Sent from my Nexus 7 using Tapatalk HD
Test builds sent out as extensions to busybox placed in /system/bin.
So far that has been working nicely. If those testers find any softbricks today I won't be releasing.
Next to do:
write a how to even though the menus are rather straight forward.
Add implementation of auto reboot to recovery to finish flashing a zImage from a zip.
Further reduce bootsize buffer for compression of output boot.imgs.
Finalize LunarCmdline.
Write a script to test compliance.
Sent from my ADR6425LVW using Tapatalk 2
Updated OP with a v1 release. Still has some work but 99% of it is completed.
Next to do:
write a how to even though the menus are rather straight forward.
Add implementation of auto reboot to recovery to finish flashing a zImage from a zip. Done
Further reduce bootsize buffer for compression of output boot.imgs. Done
Finalize LunarCmdline.
Write a script to test compliance of other devices.
Footnotes:
1st menu option- Not completely implemented yet. Could be used if wishing to restore a backup from Amon RA/CWM, I have further plans for it
3rd menu option- Use zImage from zip if fresh flashing. Use straight zImage if updating/downdating.
DO NOT PUT INVALID CHARACTERS IN ANY REQUESTED INPUTS! This could lead to unwanted results. Please PLEASE ask questions, don't let curiosity get the best of you.
Sent from my ADR6425LVW using Tapatalk 2
Had to re-upload a fixed AOSP/SDCARD zip. It was attempting to source a file from sdcard2.
http://www.androidfilehost.com/?fid=13858035414129967316
Major thanks, this is a really simple way to make use of cmdline features. :thumbup:
Sent from my ADR6425LVW using xda premium
ezpz
Gotta say this is a very handy tool to have around. I've flashed a bunch of different roms/boot.img/zimage and its pretty simple, especially after doing it at least once.
would this finally be an app to make it noob friendly
Sent from my MIUIFIED using xda premium
live2die said:
would this finally be an app to make it noob friendly
Sent from my MIUIFIED using xda premium
Click to expand...
Click to collapse
A walk thru is in the works but its pretty straight forward
Sent from my ADR6425LVW using xda premium
Still got some minor kinks to work. Mainly on the Sense portion. Some of the ported roms are being a pain. The cmdline script runs beatifully. If you're s-off, mainly going to be interested in menu options 1 & 3. Both scripts work brilliantly with s-on and s-off alike without using fastboot.
Next to do:
write a how to even though the menus are rather straight forward.
Clean up some of the script to make it more efficient.
Create a boot.img to command line bootimg.cfg converter.
Add implementation of auto reboot to recovery to finish flashing a zImage from a zip. Done
Further reduce bootsize buffer for compression of output boot.imgs. Done
Finalize LunarCmdline. Done
Write a script to test compliance of other devices. Done

[Q] Some questions about Android Recovery Mode

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.

Categories

Resources