yashsingh1/xdaforums huggingface dataset:
[Samsung Galaxy R i9103] Itzik68:
Great guide man awesome, thanks!

I've got some questions which I believe you can answer:

1. I come from another device's forum [SAMSUNG Galaxy S II I9100] so I'm not sure, will this method work with any device, or at least with mine?

2. What I'm trying to do is to take the nandroid backup I made for the ROM my device is currently running (whole ROM, along with all the MODs, themes & changes I have on it) and convert it into a CWM flashable .zip file, so:

A. Is this even possible with this method?

B. If it is, just to verify that I got it all right up until now: I decompress the 'system.ext4.tar' file from the nandroid' backup folder and then I push the decompressed system folder into the 'sample.zip' file that I've downloaded from this thread, right?

3. I know for a fact (correct me, if I'm wrong) that a nandroid backup doesn't include a backup of the modem (at least not in my device), so how do I add my currently installed modem to the .zip file?

4. What about the recovery and bootloader, how do I add them?

5. What about "cache.ext4.tar" & "data.ext4.tar", are they necessary in any way?
[Samsung Galaxy R i9103] pankaj88:
(1) This method will work with any device as long as the device has custom recovery (CWM).

(2) a. yes, it is possible

b. decompress system.ext4.tar and push all the files/folders in the system folder to the system folder in the sample.zip

You must add the line in BOLD/italic to the META-INF/com/google/android/updater-script file

run_program("/sbin/busybox", "mount", "/system");
[B][I]delete_recursive("/system");[/I][/B]
package_extract_dir("system", "/system");

This line has to be added only when you want to replace all the system files/folders

otherwise no need to add.

drag updater-script from sample.zip (open via 7zip, do not extract) to the desktop, make modifications, save & then push it back to the same locations in sample.zip

(3) To include modem.bin :

first drag modem.bin & this file to sample.zip

now the directory structure of sample.zip is as follows

FOLDERS - system, META-INF

FILES - modem.bin, flash_image

add following lines to the META-INF/com/google/android/updater-script file

package_extract_file("flash_image", "/tmp/flash_image");
set_perm(0, 0, 0777, "/tmp/flash_image");
ui_print("Installing modem...");
assert(package_extract_file("modem.bin", "/tmp/modem.bin"),
run_program("/tmp/flash_image", "/dev/block/mmcblk0p7", "/tmp/modem.bin"),
delete("/tmp/modem.bin"));
delete("/tmp/flash_image");

(4) Don't know about bootloader, but for recovery, similar step as above:

drag recovery.img to sample.zip

add these lines to updater-script

package_extract_file("recovery.img", "/tmp/recovery.img");
run_program("/sbin/busybox", "dd", "if=/dev/zero", "of=/dev/block/mmcblk0p8");
run_program("/sbin/busybox", "dd", "if=/tmp/recovery.img", "of=/dev/block/mmcblk0p8");
run_program("/sbin/busybox", "sync");
run_program("/sbin/busybox", "rm", "-f", "/tmp/recovery.img");

(5) No these files are not needed.
[Samsung Galaxy R i9103] Itzik68:
Thanks man, you're awesome!!!

I still have several questions though:

OK, puling / pushing files / folders from / to the .zip / .tar files is no problem, but I don't really get the part with this: "updater-script" file...

1. Let's say I've pulled it:

A. What is this file?

B. How can I open and edit it?

C. You say to add those code lines, but I'm guessing there are already several other code lines in it, where do I add those line? Above something else? Below it? Where?

2. Except for this: "updater-script" file, there are also:

META-INF\CERT.RSA

META-INF\CERT.SF

META-INF\MANIFEST.MF

META-INF\com\google\android\update-binary

A. What about those, what are they?

B. Don't they need to be changed as well?

I have more questions about the other parts of your answer, but for now let's live it at that.

I'm really sorry I'm bugging you, but I really like to understand what I'm doing before doing it...
[Samsung Galaxy R i9103] pankaj88:
(1) It is updater-script file.

CWM flashes the zip file according to the steps mentioned in this file.

lets say

updater-script contains following lines:

ui_print("| Writing System |");
run_program("/sbin/busybox", "mount", "/system");
delete_recursive("/system");
package_extract_dir("system", "/system");

Explanation of all the lines:

first line just print "Writing System"

next, mounts system partition so that files can be copied to it

deletes system folder

extract the system folder in the sample.zip to the device system partition

I hope now you have understand what updater-script is all about

You can use notepad++ to edit this file

(2) All the other files should be left as they are. No need to edit those files.

But their presence is necessary in the sample.zip

(these files serve as signature of the zip file)

Download this updater-script file to study more code.
[Samsung Galaxy R i9103] Itzik68:
OK, so now my "updater-script" file is looking like that:

ui_print("SAMPLE CWM FLASHABLE PACKAGE");
run_program("/sbin/busybox", "mount", "/system");
delete_recursive("/system");
package_extract_dir("system", "/system");
run_program("/sbin/busybox", "umount", "/system");
package_extract_file("flash_image", "/tmp/flash_image");
set_perm(0, 0, 0777, "/tmp/flash_image");
ui_print("Installing modem...");
assert(package_extract_file("modem.bin", "/tmp/modem.bin"),
run_program("/tmp/flash_image", "/dev/block/mmcblk0p7", "/tmp/modem.bin"),
delete("/tmp/modem.bin"));
delete("/tmp/flash_image");

Is that right so far?
[Samsung Galaxy R i9103] pankaj88:
you should study the updater-script file, the link for which I provided in the last reply.

run_program("/sbin/busybox", "umount", "/system");

this line should come at the last when all the copying & flashing has been done.

It unmount the system partition.

Also you need to set permissions & create symbolic links.

I suggest you to study the updater script file first.

If you found any problem, post here.
[Samsung Galaxy R i9103] draiyan:
what are symbolic links for? i have studied the updater script you posted.. and did some on my custom rom, both have many symbolic links, what it is for? is it necessary? or just for custom roms?
[Samsung Galaxy R i9103] pankaj88:
for understanding what symbolic links are:

http://en.m.wikipedia.org/wiki/Symbolic_link

it is necessary to have symbolic links for every ROM that you are going to flash via CWM.
[Samsung Galaxy R i9103] baldypal:
So i followed these steps with Phone.apk. Made an "app" folder inside the already existing "system" folder. moved my modified "Phone.apk" inside that folder. put on SD card, reboot recovery, choose to install from zip, choose correct zip, and get...

Error: in /sample.zip

(Status 0)

Installation aborted

Any idea. those are my exact steps, i left nothing out.
[Samsung Galaxy R i9103] selva.simple:
Try do Mount/System and then flash it. Still if u get some prob, please attach ur cwm zip. Will try to help u buddy.:)
[Samsung Galaxy R i9103] pankaj88:
Do not extract the zip file.

Use "7zip" to open it & make a new folder named as "app" inside the system directory.

Also mount /system in CWM recovery.
[Samsung Galaxy R i9103] The-Droidster:
Has anyone succeeded in making an update.zip for our device that can be flashed through stock recovery? If yes how to make one?
[Samsung Galaxy R i9103] baldypal:
OK the "mount /system in CWM recovery" is did not do. I did not extract the files. I did use 7zip.

Sent from my Galaxy Nexus
[Samsung Galaxy R i9103] baldypal:
Had the chance to try this last night. Mount /system in CWM didn't allow it either. Same error.
[Samsung Galaxy R i9103] pankaj88:
I will upload a cwm zip with modified updater script soon.
[Samsung Galaxy R i9103] pankaj88:
OP updated with modified "sample.zip".

Thanks !! :)
[Samsung Galaxy R i9103] arcsuser:
somehow i got "installatin aborted"
[Samsung Galaxy R i9103] taiber2000:
i want to push via cwm zip file to other folders in root except system - like the /efs folder - do i need to add lines in the updater file?

and how do i restore file permissions after pushing files to it? can i use busybox or there is a method via the updater or CMW?
[Samsung Galaxy R i9103] baldypal:
This one worked perfectly!

Sent from my Galaxy Nexus
[Samsung Galaxy R i9103] fone_fanatic:
Thanks for writing this up. Simplest guide to follow yet I'm still having issues :(

I'm trying to make a flashable zip of Apex Launcher (so I don't have to manually move it to /system/app every time I update or flash a rom).

I've downloaded the sample.zip, used 7zip to open archive. I've made a folder on my desktop called "app" with apexlauncher.apk in that folder. Copied that "app" folder into the "system" folder from the downloaded zip. Then I just hit the X on 7zip. So now in the sample.zip I have a META-INF folder and system folder ("system/app/apexlauncher.apk").

Now when I flash the zip (which I've renamed to Apex_1.3.2.zip) in CWM v6.0.1.5 it says:

-- Installing: /emmc/aokp.ota/after-rom/Apex_1.3.2.zip
Finding update package. . .
Opening update package. . .
Installing update. . .
Enjoy!

Install from sdcard complete.

Now when I reboot, I get a pop up asking which launcher I want to use and apex launcher isn't an option to choose from. So I open up root explorer to navigate to /system/app and "apexlauncher.apk" is not there :(

What am I doing wrong?

Also this is on my At&t S2 (sgh-i777) running Task650's AOKP if that makes a difference.
[Samsung Galaxy R i9103] D™:
I think additional app stores in Data/app. have you check there also..??
[Samsung Galaxy R i9103] selva.simple:
May be a mount issue. Open the updater-script using Notepad++ and replace the lines with the below

run_program("/sbin/busybox", "mount", "/system");
package_extract_dir("system", "/system");
run_program("/sbin/busybox", "umount", "/system");
ui_print("Enjoy!");
[Samsung Galaxy R i9103] fone_fanatic:
Looks like Data/app contains apk's for the apps downloaded from the market. I want Apex to be a system app. Usually what I do after I update my rom (which wipes the /system/app folder) I open up root explorer, copy apexlauncher.apk to /system/app, set the proper permissions and reboot.

I want to create a .zip that will do that for me (add apexlauncher.apk into /system/app).
[Samsung Galaxy R i9103] jayjojayson:
here i had written a small script that will do that for you...

open the zip-folder, don't extract the zip-folder, only open and put your apexlauncher.apk to system/app!

now you can flash the zip with cwm-recovery.. but note, the application-name must be the same for the called app and the written name in the update-script! you can also look at the update-script in META-INF folder to learn what is going on..

apex-to-system.zip

updater-script
[Samsung Galaxy R i9103] fone_fanatic:
Thank you for that!

In the first post it says don't mess with the updater-script, but I take it that is what I was doing wrong!

I looked at the updater-script for the CWM flashable zip of Cerberus and in the cerberus one they have :

ui_print("Extracting files to /system");
package_extract_dir("system", "/system");
set_progress(0.625000);

The file name isn't there. Does that mean it'll move anything from the /system folder in the zip to whatever directory it is? Like move /app/apexlauncher.apk to /system/app/apexlauncher.apk?

If so can I throw more than one apk in the zip if need be and not have to modify the script every time?

Also for the Cerberus one, in the META-INF folder there are 3 files "CERT.RSA" "CERT.SF" and MANIFEST.MF" I Don't need those in my zip do I?

---update---

IT WORKED!! THANK YOU!

Also I just noticed that you have the same script as the one found in the cerberus zip package_extract_dir("system", "/system"); but after that you have package_extract_file("system/app/apexlauncher.apk", "/system/app/apexlauncher.apk");. The updater-script in the cerberus zip doesn't have the actual file name, just the package_extract_dir line and it works fine.
[Samsung Galaxy R i9103] jayjojayson:
nice that i could help you...

yes that's right package_extract_dir("system", "/system"); means you will moving all files in /system of the zip folder to /system on your device!

package_extract_file("system/app/apexlauncher.apk", "/system/app/apexlauncher.apk"); will do that only for the called file!

also you can delete the file in /system if you want! delete_recursive("/system"); will delete the complete content in system folder on your device and

delete_recursive("/system/app/apexlauncher.apk"); will only delete the apexlauncher in system folder..

yes you can do this...

I think so, don't know what these files will do, but for your example with the launcher you don't need them in your zip file...

nice.. ;)
[Samsung Galaxy R i9103] ardicli2000:
@pankaj88

Thanks all the effort you exerted here to teach some useful thing.

We would appreciate if you could write down the some basic scripts for;

-adding a new file

-deleting a file

-replacing a file

-setting permission (pwrmission numbers and how they are used, etc)

I also would like to contribute. I believe this will help everyone and you can also make easier explanations thanks to the method i am going to explain.

1. First go to http://xdaforums.com/showthread.php?t=1772338 and download Droid Manager.

The program has lots of features. However, one of them is totally about preparing CWM flashable zip. (You should write your own update script.)

2. Download sample.zip in the OP.

3. Run Droid manager. Click Custom Roms Tool. (You can use the program for lots of things, including modification the Rom exisiting in your phone, among others)

4. Now it will ask you project name and working directory (you are good to decide as you like). The other one is Base Rom. If you are a dev like pankaj88, then you can start from scratch (no need to select any base rom). If you are learning, then click base rom and choose sample.zip.

5. Now you are good to go. You have file browser, you have update script tab, etc, etc. When you are finished click "Publish Now".

That's all.

You all need to do is to add necessary files, and write scripts related to those files.

Regards.
[Samsung Galaxy R i9103] DaveDH:
Thanks

Hey Buddy Thanks a lot for this post , I tried to build my own flashable.zip , and now it worked true your apex.zip . I used this one on my Samsung Galaxy S3 . the first sample.zip did not work for me . i also succesfully did an mod in the updater -cript . The change i made was first an simple one , I changed the :

ui_print("| Writing System |");

run_program("/sbin/busybox", "mount", "/data");

package_extract_dir("data", "/data");

show_progress(0.200000, 10);

in ui_print("| Writing System |");

run_program("/sbin/busybox", "mount", "/system");

package_extract_dir("system", "/system");

show_progress(0.200000, 10);

I actuallychanged every data word in system word , so my app was installed in the folder i want . Then i made this change :

ui_print("|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|");

And made some foolish text for myself . :)

No i am gonna try installing multiple apps .

Wish me luck :)
[Samsung Galaxy R i9103] 7amada100:
quick question, if i inserted the build.prob file to flash it will it automatically set its permissions or do i have to add something?

sorry for newbie question
[Samsung Galaxy R i9103] Adam77Root:
It will not. You have to add 'set_perm(0, 0, 0644, "/system/build.prop");' to the updater-script.
[Samsung Galaxy R i9103] okizen:
Is it possible to convert CF-Root-SGS3-v6.4.tar file to zip?
[Samsung Galaxy R i9103] pratikmore:
updater script :-

http://pastebin.com/Aytv8UYQ

i got satus 6 error when changing mount points.

same happened with this scrpit :-

http://pastebin.com/F9Hap4s3

my tab has emmc partition.
[Samsung Galaxy R i9103] Grarak:
check out the recovery log
[Samsung Galaxy R i9103] vykana:
what if i wanted to flash something in data/data instead of system?

then what would i do?:confused:
[Samsung Galaxy R i9103] The-Droidster:
use

run_program("/sbin/busybox", "mount", "/data");

package_extract_dir("data", "/data");

instead of system.
[Samsung Galaxy R i9103] allesand:
ii would try to make a update zip with more ´.zips and that i can choose the zip what he has to install in the cwm zip is that pssible
[Samsung Galaxy R i9103] D™:
couldn't understand you buddy.
[Samsung Galaxy R i9103] DeepankarS:
Seems like a new tongue twister buddy :P
[Samsung Galaxy R i9103] Lao Mayer:
Any chance I can make a signed zip file from an unsigned one?
[Samsung Galaxy R i9103] Grarak:
AW: [GUIDE] How to make a cwm recovery flashable zip

It's possible with aroma installer but not with .zip's.
[Samsung Galaxy R i9103] adikasgw:
flashble SGW

how about thisI tried on galaxy W :fingers-crossed:

run_program("/sbin/busybox", "mount", "/system");

ui_print("Copying files...");

package_extract_dir("system/app", "/system/app");

set_perm(0, 0, 0644, "/system/app/SystemUI.apk");

how can I make a script to delete a file. apk ? ;)
[Samsung Galaxy R i9103] D™:
Why you want to delete if you can replace it while extracting..??

BTW for deleting use this one

For more go to this link for extra commands -> Thread
[Samsung Galaxy R i9103] SaM-RoN:
thanks a lot bro..

today i learned to write updater script only because of you...

(thumbs up)
[Samsung Galaxy R i9103] whitetiger_0603:
So, using this tut, can I take my stock rom backup file and make it into a flashable zip? Couldn't I just copy the META-INF folder in your sample to my system file, and then zip it up? Would doing this effect the MD5 sums already in my file?
[Samsung Galaxy R i9103] RobiGo:
it is possible to append a text to a file?

Hi all :) Anyone can give me a tutorial, how I can modify (exactly I want to append a text) to build.prop, with a cwm script...

Thank U!
[Samsung Galaxy R i9103] gnarg:
I follow all the steps in the tut, putting a csc folder and three other files under system folder, the zip flashes but no csc folder show up in system in root explorer...what can be wrong here? Or do I have to change the updater script?

Attached zip:
[Samsung Galaxy R i9103] DualJoe:
Is there some documentation or manual for all commands the 'update-binary' supports?
[Samsung Galaxy R i9103] Adam77Root:
http://lmgtfy.com/?q=updater-script+commands

Sent from my GT-I9103
[Samsung Galaxy R i9103] DualJoe:
Doesn't work. :(

But you didn't get the point either.. :p

The magic words are Edify script language.
[Samsung Galaxy R i9103] alicarbovader:
nice guide for noobs, but what is the purpose of the META Inf folder? I assume its for permissions eyc, or am I going wrong???
[Samsung Galaxy R i9103] D™:
Its consist update binaries and update script.
[Samsung Galaxy R i9103] RandomPooka:
It also can contain the md5 hashes of all contained files, so that you can guarantee that the zip isn't tampered with at flash time
[Samsung Galaxy R i9103] chrisgriner:
This is my script to install a few APKs after a new ROM is installed. I think I've got it right. It seems to work and I don't get any errors:
[Samsung Galaxy R i9103] j0rdz02:
How about

If I want to make a flashable zip for ogg files?. .where will I put them?. .I did make one and I flash it, after boot animations there was android upgrading but when i go to settings ringtones theres none of which I expected to be there, help please. .newbie here
[Samsung Galaxy R i9103] D™:
It must be in /system/media/audio/ringtones with -rw-r-r--(644) premission.
[Samsung Galaxy R i9103] j0rdz02:
hi

How to set permission on desktop?. .sorry newbie here. .
[Samsung Galaxy R i9103] D™:
It will be set in Update-script file.
[Samsung Galaxy R i9103] j0rdz02:
Can you

Can you make a tutorial as well for setting permissions on desktop using Update script or whatever how to set permission and how to really use notepad++ as a I think to update-script file?..I find some in xda about Update-script file, but Im not really sure how to use it,.:(
[Samsung Galaxy R i9103] D™:
buddy, you need to help your self here. You have to read OP first & need to check Sample zip file.
[Samsung Galaxy R i9103] j0rdz02:
Ok sir

Thanks for sharing, yes im working it now. .thanks. .
[Samsung Galaxy R i9103] Adam77Root:
What do you mean by setting permission on desktop?

Sent from my GT-I9103
[Samsung Galaxy R i9103] WhiteWolf:
Bro I need to flash a modded app .... Can u tell me the command line to make its permissions rw-r-- and make owner as 0:0 ???
[Samsung Galaxy R i9103] jesuinodsa:
help sir

In your thread the sample cwm flashable zip doesnt include CERT.RSA,CERT,SF, and MANIFEST.MF

while odae sample zip i downloaded from other thread contains them outside COM folder so is it ok if i use any of the sample zip???
[Samsung Galaxy R i9103] DualJoe:
These files are for integrity/validation check. I guess they are not parsed by CWM so he omitted them.

They are mandatory for APKs though.
[Samsung Galaxy R i9103] vahid8910:
i extracted files in root explorer and thet ziped them and flashed zip with CWM and it works.

why?

note: i replaced vold.fstab in /system/etc folder.
[Samsung Galaxy R i9103] Adam77Root:
Why shouldn't it?
[Samsung Galaxy R i9103] vahid8910:
i don't know why. i thought extracting may mess with something(i'm not good in android) because of what he said in first post:

"Right-click on it and choose: "7-Zip / Open archive" [*DO NOT extract; just *Open archive*];"

you see using 7 zip is not necessary but when he says use 7zip and do not extract in capital letters between stars that makes it sound necessary.

but thank him for good tutorial it really helped me.

and thank you for your attention.

i just wanted to know it happened by accident or it's normal.
[Samsung Galaxy R i9103] Adam77Root:
It's just a simple zip file, you can extract, modify and repack it and it will work as long as you don't mess up sth bigger. Replacing files shouldn't cause issues. Of course the signature won't match, but you can turn verification off and flash that way.
[Samsung Galaxy R i9103] vahid8910:
what about permissions?

do i need set permissions manually?

because most system files have restricted permissions(rw-r--r--) but when i copy modified files to make flashable zip they have permission like this rwxrwxr-x which is not same.

thanks
[Samsung Galaxy R i9103] D™:
Check the permission of other files in folder. Of all those are -rw-r--r- then change it to -rw-r--r.
[Samsung Galaxy R i9103] Nikhil:
Yes, you need to edit updater-script file to set appropriate permissions when required.

for eg.

set_perm(0, 0, 0644, "/system/app/AppName.apk");

adding this will set permissions rw-r--r-- to app. :)
[Samsung Galaxy R i9103] vahid8910:
wow thank you

but when you flash without this command what is its default ?
[Samsung Galaxy R i9103] Nikhil:
Apparently, as you said rwxrwxr-x (when it is user app) and rw-r--r--(when it is system app). :)
[Samsung Galaxy R i9103] limitedMUSCL:
I didn't have that success. I extracted a zip file (PA Gapps) with 7-zip, added a few files and compacted back. CWM couldn't open it to install.

I see 7-Zip has several options to compress, like Normal, Fast, bit size, etc. Any recommendations to that?
[Samsung Galaxy R i9103] D™:
What error is coming in cwm..?

Also, use normal compression.
[Samsung Galaxy R i9103] limitedMUSCL:
Lol! I have extracted the zip file to a folder, changed stuff (apk, META-INF script, ...) accordingly and compacted THE FOLDER back to the zip file, not what was INSIDE the folder.

Anyway, I compressed using Ultra at 7-Zip, with 128 keyword and it worked under CWM 6.0.4.4.
[Samsung Galaxy R i9103] dannyben:
I've created a MOD and a flashable zip file to install it.

The issue, for which I cant seem to find any help on is:

On certain devices it is required to edit the /system/csc/feature.xml file.

I dont want to replace the file all together, but just add some lines (if the set isnt there) or edit the lines (if it already is there).

I figure its just some code i need to add into the updater-script, but dont know where to start?

Any help would be appreciated.

TIA.
[Samsung Galaxy R i9103] milkgreen:
Well, the system block isn't the same for all devices right?

Such as mmcblk0p3 for Samsung S Advance (I9070)