[Q] (Stock Deodexing) -- boot.img failure on update.zip flash? Fix, Replace? Re-Zip? - Android Software/Hacking General [Developers Only]

I have a ZTE990 avail.
Currently I'm rooted with no other roms installed, simply stock, and odexed.
I've tried to manually de-odex using baksmali, Xultimate, etc. All were a pain, all wouldn't work properly.
I found someone and downloaded someone who just simply uploaded a Stock_Deodex.zip rom. Sounded perfect.
So I boot into CWM, try to update and...
assert failed: write_raw_image("/tmp/boot.img","boot" android
Click to expand...
Click to collapse
Since I have stock.. and am just trying to De-Odex.
Can I just unzip the Stock_Deodex.zip, delete the current (apparently faulty) boot.img, and replace it with one of the ones created with the cwm recovery, re-zip and attempt to update as usual?
Or since (if my understanding is correct), the only thing necessary for a system to become deodex is the files in /system/app and /system/restore.
Obviously when I un-zip stock_deodex.zip I have access to them. Could I possibly just replace the two folders (somehow?) and be properly de-odexed?
Any other options that I could use that'd be best?
Much appreciated to anyone who helps, thanks!

Related

[Q] problem installing a modded rom

I am having hard time to install a ROM after I modded it a bit.
The ROM itself had been installed already and works perfectly.
I was trying to change a few things like icons, bootanimation, default launcher and other stuff but the phone keep giving me an error and fail to install the file.
my phone is HTC HD2 t-mobile version, the ROM is android 2.3.4 with CM7, I am installing ROMs using MAGLDR 1.13 + clk 3.1.0.1.
I modified the zip file using 2 methods - both led to the error
1. unpack the zip file, replace the files, repack the folders back together into zip
2. swapping the files without extracting the folders out of the zip file
in both cases I used winrar (my computer runs 64bit win7).
am I missing something?
any help will be much appreciated
This is strange... I basically use the same method to mod minor stuff (like icons)... And it works for me without problems.
Are you sure your repackaged file has the same structure? Maybe unpack both original package and your modified one and compare folders and files using WinDiff or something?
I ran a check with "Beyond Compare 3" and it appeared to be the same except the files I've replaced.
What archiving software are you using?
There is no need to sign the zip or anything like it, right?
I'm using Total Commander which has zip functionality built-in.
No, I don't need to sign anything either (although I don't know, maybe it requires setting development options in android's settings).

[Q] Editing zip before flashing a ROM

I know I have done this before and this is a noob question, but lately I've been having trouble with this.
If I make changes to the zip file of a ROM (eg replace a few existing files, and remove some unwanted system APKs, but not add anything new), do I need to sign the zip before flashing or just flash straight after editing? Also what's the best tool to use to replace the files within the zip? I trust WinRAR will do the trick...
djsubtronic said:
I know I have done this before and this is a noob question, but lately I've been having trouble with this.
If I make changes to the zip file of a ROM (eg replace a few existing files, and remove some unwanted system APKs, but not add anything new), do I need to sign the zip before flashing or just flash straight after editing? Also what's the best tool to use to replace the files within the zip? I trust WinRAR will do the trick...
Click to expand...
Click to collapse
I've never added anything (yet!), just deleted un-wanted APK's and altered some system files (ie build,prop etc). I've never signed anything and I used IZArc although only as that's what's installed on my XP system.
This is something that I too would like to do more so that I can further personalize and tweak some of these already great ROMS, so I'm also curious for some pointers from more the experienced.
Check the portal, there's an app to create flashable zips there.
PS - POST QUESTIONS IN THE GENERAL SECTION !!!!!!!!
You can set a flag in recovery to check for signatures or not. When it is not set you can flash any zip file
Sent from my HTC Desire S using XDA App
jorgen2009 said:
You can set a flag in recovery to check for signatures or not. When it is not set you can flash any zip file
Sent from my HTC Desire S using XDA App
Click to expand...
Click to collapse
I tried this once, and then I flashed the zip. It was a CM7 zip which would normally take at least 20-30 seconds to complete, but this modified zip flashed in less than ten seconds. It said successfully flashed but when I rebooted nothing had actually happened. Hence I was wondering what went wrong?

How to re-odex?

Normally to decompile my dex files I use smali and baksmali, how can I re-odex them?
Id like to get my service.jar re-odexed so I can try and push it to my phone via a zip update.
Sent from my MB865 using xda premium
[mini HOW-TO] Re-Odex (or create a new .odex file)
Fall of Enosis said:
Normally to decompile my dex files I use smali and baksmali, how can I re-odex them?
Id like to get my service.jar re-odexed so I can try and push it to my phone via a zip update.
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
It all needs to be done on your phone, live.. with adb.
Here's how I accomplished it - I will use the services.jar in this example. Just change the file name and path to existing .odex accordingly for other files (not sure if all steps are required exactly, but it has worked for me multiple times with different jars and SysUI apk):
Requirements:
Odexed system
adb
dexopt-wrapper
Put this dexopt-wrapper file (unzip first) in /system/bin with 775 permissions:
X X X
X....X
X....X
Probably a good idea to reboot after pushing that file, if you use root explorer (like I did).
Put the deodexed services.jar (or other jar/apk file you want to make an new odex of) on your sd card.
Go to /system folder (with root explorer or equal) and mount it R/W (not sure if this is necessary - but won't hurt)
Put your USB connection to "Charge only" mode.
Go here (big props and credit to jhotmann for this) and follow steps 8-12 (I've recreated the steps with the A2's bootclasspath below).
The bootclass path is located in the /init.rc file at the root of your phone.
Connect with adb (do a adb devices check to make sure you're all good).
To create the new odex:
Code:
adb shell
su
cd /sdcard/
dexopt-wrapper services.jar new.odex /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar:/system/framework/com.motorola.android.frameworks.jar:/system/framework/com.motorola.android.widget.jar
I know it's a long entry for those who don't work with command lines often (like me), but double check your entry before hitting enter.
To copy the signature from the existing odex (change path to /system/app/.. if necessary):
Code:
busybox dd if=/system/framework/services.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc
Done! Rename new.odex (created on your /sdcard) to services.odex since that is your new signed odex file...
You can then get that on your odexed system by your choice of method (adb push, update.zip, root explorer push, etc.. - note: please know what you are doing before trying to push files with root explorer! - you cannot simply copy and paste!)
Or, if you want to deodex it right away again for some odd reason like I did (personal issues )... Take the services.jar and the new services.odex from your sdcard and put them on your computer - and open the services.jar with 7-zip (maybe winzip) and delete the classes.dex file from the 7-zip window. Now you have a fresh new set of .jar/.odex files ready for deodexing (I did this all with the SystemUI.apk last night, that's why I elaborated and re-typed this whole thing today..).
Frigging brilliant man.
Much appreciated. I'm super sick and my USB cable is at work.
Once i get it back on Wednesday, I'll work all this out. If I could thank you twice I would.
Thanks man!
Sent from my MB865 using xda premium
Fall of Enosis said:
Frigging brilliant man.
Much appreciated. I'm super sick and my USB cable is at work.
Once i get it back on Wednesday, I'll work all this out. If I could thank you twice I would.
Thanks man!
Sent from my MB865 using xda premium
Click to expand...
Click to collapse
Not a prob.
And, I updated the dexopt-wrapper link so it's easier to download - just unzip it first..
Good luck on your quest.. let me know if you catch any snags along the way - and i'll try and help you out.
Sent from my mind using XDA
Ok sooo, I think we (or most likely me) are confused on what I wanted to do. I don't want to make a NEW odex file. I need to recombine my modded classes.dex BACK with the service.jar.
Since I needed to modify some script in the services.jar I had to de-odex it so I had a classes.dex file to use baksmali with so I could modify it. Once I modded it I used smali to create the NEW MODDED classes.dex. And now I need to re-odex(bad terminology?) them to re-combine the services.jar with the classes.dex so the modded services.jar could be used on a odexed ROM.
I'm working on a de-odexed version also, but I'd like to be able to offer both
Fall of Enosis said:
Ok sooo, I think we (or most likely me) are confused on what I wanted to do. I don't want to make a NEW odex file. I need to recombine my modded classes.dex BACK with the service.jar.
Since I needed to modify some script in the services.jar I had to de-odex it so I had a classes.dex file to use baksmali with so I could modify it. Once I modded it I used smali to create the NEW MODDED classes.dex. And now I need to re-odex(bad terminology?) them to re-combine the services.jar with the classes.dex so the modded services.jar could be used on a odexed ROM.
I'm working on a de-odexed version also, but I'd like to be able to offer both
Click to expand...
Click to collapse
So, you have a deodexed services.jar (with an unedited classes.dex inside)? And, you also have an edited classes.dex (the new modded one). Just drag and drop the new modded classes.dex into the services.jar file with 7-zip to overwrite the old one.
Then I would check out the mods on a deodexed system, and provided they work, then go through the re-odexing process (separating that classes.dex from the apk and creating a new odex file) as described above to get it working on odexed systems.
Hope that helps.. Good luck!
Yes sir, you are correct. That was the first thing I tried to do was just drag and drop the modded classes.dex with 7zip, save it, however when i tried to flash the "modded" ROM it can't install the system folder because (according to Jim), when I modded copied the new classes.dex, I changed the size, and so the signature needed to be changed as well. They mismatched.
Fall of Enosis said:
Yes sir, you are correct. That was the first thing I tried to do was just drag and drop the modded classes.dex with 7zip, save it, however when i tried to flash the "modded" ROM it can't install the system folder because (according to Jim), when I modded copied the new classes.dex, I changed the size, and so the signature needed to be changed as well. They mismatched.
Click to expand...
Click to collapse
Not sure about the details of that.. I know the signatures can be tricky, but I've modded a few apks/jars similarly with no problems... when you say "can't install.." is that it wouldn't flash in recovery, or you bootlooped?
Just wouldn't flash at all.
And thanks for all your help man.
Sent from my MB865 using xda premium
I've updated the 2nd post with more detail on creating a new odex file...
Not to be a "rooster" (replace with your word of choice) or anything, but maybe this info has a place somewhere besides the general threads..?:angel: (and what is up with these new Smilies and posting reply layout?) - it just seems so hard to come by good literature on this process (which, I suppose, is a process so rarely needed though...)
So I need to perform the processes above while running in an odexed environment correct? Does this process change the deodexed APK we are running the script on to an odexed one as well as create a new .odex file for that APK? I am just confused about what the result is after running the script. For my situation I want to take 2 deodexed files (systemui and sec settings.apk) and odex them. Then push them into an odexed rom. Once I run the script above what am I left with?
Didact74 said:
So I need to perform the processes above while running in an odexed environment correct?
YES.
Does this process change the deodexed APK we are running the script on to an odexed one as well as create a new .odex file for that APK?
(Yes, it will create a new odex file that you will need to rename, but..)NO. You will need to take the classes.dex out of the deodexed apk/jar - use something like 7-zip. Unless you only edited smali, then you really only need the new odex file.
I am just confused about what the result is after running the script. For my situation I want to take 2 deodexed files (systemui and sec settings.apk) and odex them. Then push them into an odexed rom. Once I run the script above what am I left with?
Click to expand...
Click to collapse
I broke up your quote with my best answers...
As for what your're left with is a new.odex file, properly signed, if all goes well. You are going to need to do it for each of your deodexed files.
Rename them, remove the classes.dex from the deodexed files you used, and get them on your phone however you choose (I prefer zip packages and a restore.zip in case something goes wrong).
Also note that the bootclass path is different from GB to ICS.. and among different devices of course. Check init.rc file if need be. I posted the one to use for A2 ICS (think it may be the same for razr too) here: http://forum.xda-developers.com/showthread.php?t=1753659
I can't garuntee you won't have problems, but good luck... if you do you could try the dexopt-wrapper from here: http://forum.xda-developers.com/showthread.php?t=1645950 - just unzip it first obviously (but I think it's the exact same file though..)
Btw, it's all done with adb, one line at a time.. not really a script, but thank you for the idea - maybe a batch file?
Sent from my phone's mind
Great, thank you for the detailed response. Last question.
What if I have the original SystenUI.odex and SecSettings.odex files that used to be attributed to them before i deodexed them? Can I simply reuse those without having to run through the adb process?
Thanks,
Didact74 said:
Great, thank you for the detailed response. Last question.
What if I have the original SystenUI.odex and SecSettings.odex files that used to be attributed to them before i deodexed them? Can I simply reuse those without having to run through the adb process?
Thanks,
Click to expand...
Click to collapse
But, you deodexed them to edit the smali files in the classes.dex right? So, no, you will need to use the new odex files that are created from the modded deodexed files you used..
If you never edited any of the smali files, then you didn't need to deodex in the first place... you only need to deodex in order to mod the smali files - everything else in the apk can be modded as is on odexed systems.
Sent from my phone's mind
Thank you very much. Can you repost the wrapper file? Its not downloading correctly.
Didact74 said:
Thank you very much. Can you repost the wrapper file? Its not downloading correctly.
Click to expand...
Click to collapse
Updated the link in Post #2 with a zip file - you need to unzip it first then move it.
Thank you.
So I am getting an error trying to re-odex. See the attached image of the error.
Weird thing is that even though I get an error it still creates the new.odex file. I triedto go through the entire process even though I was getting errors and it just got stuck on the boot screen and never loaded. Anything in my error attached raise any flags?
Thanks,
Didact74 said:
Thank you.
So I am getting an error trying to re-odex. See the attached image of the error.
Weird thing is that even though I get an error it still creates the new.odex file. I triedto go through the entire process even though I was getting errors and it just got stuck on the boot screen and never loaded. Anything in my error attached raise any flags?
Thanks,
Click to expand...
Click to collapse
Hmmm... First thing I can think of is: are all of those framework files in the bootclass path that you used actually in your /framework folder? With our A2, in ICS there are a few extra .jar files listed that were not actually on our phone, so I had to remove those from the path...
I will try to make a new odex myself and make sure that's not a standard error message... @Fall of Enosis, you recall what it spits out?
EDIT: Shoot - forgot I'm deodexed right now... will attempt later or hear back from Fall by then..
alteredlikeness said:
Hmmm... First thing I can think of is: are all of those framework files in the bootclass path that you used actually in your /framework folder? With our A2, in ICS there are a few extra .jar files listed that were not actually on our phone, so I had to remove those from the path...
I will try to make a new odex myself and make sure that's not a standard error message... @Fall of Enosis, you recall what it spits out?
EDIT: Shoot - forgot I'm deodexed right now... will attempt later or hear back from Fall by then..
Click to expand...
Click to collapse
Yes, all .jar files listed in my bootclass were located in the framework directory.
Nevermind...my mistake. I had an issue with my files not being deodexed correctly from the start. I went back and deodexed, made the edits to res and smali then odexed using the method above again and all went well!
Thanks!

Modyfying existing ROM

Hi,
I decided to try to make a modification of an existing ROM which would suit me better right after flashing. Nothing large, only adding some apps and stuff. But Ive got a couple of questions:
1) Ive read some apps cant run from /system partition. Looks like that (at least) one of mine is one of them - it FCs when in /system/apps or /system/priv-apps. Is there any workaround to make this work? I dont want to lose it when doing factory reset (or to flash the ROM again after every factory reset).
2) I wanted to add langunages (http://forum.xda-developers.com/showthread.php?t=2602704) but according to forums those files are odexed. How could I deodex them to make them run on an deodexed ROM?
3) I want to include the faux kernel but Im not sure if simply copying those files into the ROM would do ... in the other cases it went ok but Im not sure about the kernel - Im afraid I could break something.
4) Can I also use the ROM file to store other files? I mean - if I put files into the ROM in /data/media/0/ would it simply appear in my home directory or could this break anything - by which I mean to destroy my existing files?
Thanks for any leads!
michalurban said:
Hi,
I decided to try to make a modification of an existing ROM which would suit me better right after flashing. Nothing large, only adding some apps and stuff. But Ive got a couple of questions:
1) Ive read some apps cant run from /system partition. Looks like that (at least) one of mine is one of them - it FCs when in /system/apps or /system/priv-apps. Is there any workaround to make this work? I dont want to lose it when doing factory reset (or to flash the ROM again after every factory reset).
2) I wanted to add langunages (http://forum.xda-developers.com/showthread.php?t=2602704) but according to forums those files are odexed. How could I deodex them to make them run on an deodexed ROM?
3) I want to include the faux kernel but Im not sure if simply copying those files into the ROM would do ... in the other cases it went ok but Im not sure about the kernel - Im afraid I could break something.
4) Can I also use the ROM file to store other files? I mean - if I put files into the ROM in /data/media/0/ would it simply appear in my home directory or could this break anything - by which I mean to destroy my existing files?
Thanks for any leads!
Click to expand...
Click to collapse
1) What is the app? on system/app they should work fine since kitkat update, i think
2) To deodex i used a kitchen i got out of foro nexus (cant get the link atm) that only worked on linux. If you want to translate things in your rom, i think it can be done without deodexing, im not sure.
3) Copy paste should work fine but if you take a look at faux's meta inf, see what's there, merge it with your rom's meta inf. But it should work with cp
4) You can use the meta inf to link files to storage like your sdcard, yes. However, if you try to put a wallpaper somewhere inside the rom it wont show up
anerik said:
1) What is the app? on system/app they should work fine since kitkat update, i think
2) To deodex i used a kitchen i got out of foro nexus (cant get the link atm) that only worked on linux. If you want to translate things in your rom, i think it can be done without deodexing, im not sure.
3) Copy paste should work fine but if you take a look at faux's meta inf, see what's there, merge it with your rom's meta inf. But it should work with cp
4) You can use the meta inf to link files to storage like your sdcard, yes. However, if you try to put a wallpaper somewhere inside the rom it wont show up
Click to expand...
Click to collapse
Thanks very much for your reply! Now:
1) The app is a game, Traffic Racer. When I flash a ROM where this app has been put in /data/app it runs fine. In /system/app or /system/priv-app it FCs. As you say it should work Ill try to do it again - but I tried it twice in /system/priv-app and once in /system/app already so I dont believe it would work. BTW I use APKs from update.zip created by TiBa if it could be relevant.
2) Linux is not a problem so Ill try to find the link here.
3) Ill try only to copy the files first before messing with meta files.
4) I only want to store some apps config backup files (for Apex launcher and Agenda widget mainly).
michalurban said:
Thanks very much for your reply! Now:
1) The app is a game, Traffic Racer. When I flash a ROM where this app has been put in /data/app it runs fine. In /system/app or /system/priv-app it FCs. As you say it should work Ill try to do it again - but I tried it twice in /system/priv-app and once in /system/app already so I dont believe it would work. BTW I use APKs from update.zip created by TiBa if it could be relevant.
2) Linux is not a problem so Ill try to find the link here.
3) Ill try only to copy the files first before messing with meta files.
4) I only want to store some apps config backup files (for Apex launcher and Agenda widget mainly).
Click to expand...
Click to collapse
Oh, games could cause issues, yes. Better leave it on data app. Messing with meta inf is totally easier than it sounds anyways and could help fixing any possible bugs, you gotta try it. Backup files i dont think they'll work on the rom but you can store them into storage/emulated/legacy which is the storage, though you could do this any other easier way
anerik said:
Oh, games could cause issues, yes. Better leave it on data app. Messing with meta inf is totally easier than it sounds anyways and could help fixing any possible bugs, you gotta try it. Backup files i dont think they'll work on the rom but you can store them into storage/emulated/legacy which is the storage, though you could do this any other easier way
Click to expand...
Click to collapse
Thanks again! Ive got one more question about including the faux kernel. The updater-script is supposed to run this command during the installation in CWM:
Code:
package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/boot");
... which I dont know how to implement. If I would only copy all files it would overwrite the original boot.img (Kitkat+ 1.1 original anyway) - which im not sure is the same. So Im not sure if it wont screw something up ...
Or is this extraction the same as copying it? Does the "/dev/block/platform/msm_sdcc.1/by-name/boot" just mean - "its a block device on first SD, partition name boot"?
michalurban said:
Thanks again! Ive got one more question about including the faux kernel. The updater-script is supposed to run this command during the installation in CWM:
Code:
package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/boot");
... which I dont know how to implement. If I would only copy all files it would overwrite the original boot.img (Kitkat+ 1.1 original anyway) - which im not sure is the same. So Im not sure if it wont screw something up ...
Or is this extraction the same as copying it? Does the "/dev/block/platform/msm_sdcc.1/by-name/boot" just mean - "its a block device on first SD, partition name boot"?
Click to expand...
Click to collapse
Put faux's boot.img on the rom first, then on updater script go to the line that refers to extracting boot.img (should be like the last one) and replace that with the command on faux's updater script. That means it will extract it in that directory, nothing else. Be sure to copy modules aswell and set the perms
Q&A threads should be created in the Q&A forum... not the Development forum.
Thread moved.
One more question - is there a special way how to pack the ZIP file? Cause I unpacked a ROM, added some apks, packed it but it didnt work (no error, just ended at "opening rom" or what the CWM message is) ... but when I modified existing ZIP it went fine ...

[Q] How to create a Google Apps flashable zip from the stock ROM ?

From CM Gapps page it says
It is possible to perform a "backup" of the Google Apps on your device and then "restore" them, but this does take additional steps which are not covered here.
Click to expand...
Click to collapse
I'd like to know how can I do this.
I've searched all across the forum but had no luck. It looks like some kind of trade secret.
I know that it's not just a matter of pulling the apk files. Because I can see that the zip has .apk, .jars, .so, configuration and certificate files.
I'm guessing this is done by extracting the files from a system.img.
But how is this done?
Is there some script available to build a gapps zip from a system.img file?
Another thing is that my OnePlus phone doesn't has an official LP update yet (although CM12 and their gapps work fine) so I suspect this would have to be done using the stock ROM of another device, maybe a Nexus. Is this correct?
Any help is appreciated.
Thanks

Categories

Resources