[Guide] Edify Script Tutorial - Replacing the Google Market - T-Mobile myTouch 4G Slide

Return to Contents Page - doubleshot Developers Reference
This guide will teach you how to write an Edify script that replaces the Google market with a different version.
Big thanks to charlieb620 for posting the new market .apks with different color schemes, see the thread Here for more market colors.
The Google market is a great example for a guide on how to replace an app, because not only is it a system app but it's one with a lot of dependencies and will teach you how to deal with this. This is also an app you can't just install an .apk file for, you have to take specific steps to install it.
If you were going to just install a new Google market, you would have to:
Stop all apps that require market licensure to work, halt the market processes, delete the old vending.apk. Then you have to delete the market data directory at /data/data/com.android.vending and find the dalvik-cache file that belongs to the market ( [email protected]@[email protected] ) and delete that too.
Then you rename the new market .apk file to Vending.apk and use root explorer to copy it into your /system/app directory. Once there, you long-press on the Vending.apk file and select 'permissions' from the menu that pops up.
Change the permissions to read/write for owner, read for group, read for others, and nothing for the bottom 3 check boxes. Now it reads rw-r--r-- like all the other apps in the /system/app directory.
Then you reboot your phone and it should work, but you should clear the whole dalvik-cache in recovery, and you should clear cache in recovery too, so all the dependencies on the market get rebuilt the right way.
Click to expand...
Click to collapse
Who want's to deal with all that, and still have it maybe not work right?
No, the right way to replace the market is while the system is down, so doing it as an update you flash through clockworkmod is really the correct answer.
I will assume a windows computer from here on out - that's what I have.
Let's walk through this, and start by listing what you need to begin:
1 - A program you can write the script in. notepad++ is preferred.
2 - A tool to sign your update package. This one is the one i've been using. XDA link. Must be in your main directory, C:
3 - The right update-binary file to work with the MT4GS. I attached the one i've been using to this thread. Thank computerkid23 for that. Go into your signing tool and go to:
/update/META-INF/com/google/android/
...and replace the update-binary with the new one. Here also:
update-binary
Download Link
MD5: f570141f6c8cf7273a58228d0241704d
Size: 190.04 KB
Or you could hit post 10 of this thread for a flashable zip template file.
4 - Some knowledge of Edify scripting. I wrote up some notes that covers some of it, but also links to other threads around XDA with Edify script information. Read up on it, my link Here
5 - A new market .apk file to play with. Here is where ours came from, and it's called Dark.apk
6 - winrar
7 - A MT4GS phone to test your script on, before releasing it to the community.
Now that that we have that all taken care of, let's get started:
1 - Go to the flashable zip builder folder, go to the update folder, then system, and then make a new folder called app
2 - In this new folder, place the new market.apk and rename it to Vending.apk - the capital V is important.
3 - go back up 2 levels to the update folder, and then go to /META-INF/com/google/android/ and open updater-script in Notepad++
4 - Select all and then delete all the text in the updater-script file. Once done, move on to the next part of the guide.
Writing the script:
Since this is my tutorial, i'm going to pass on a concept that means a lot to me - which is formatting the printed output on the screen during installation to be useful. 23 lines down of 40 characters wide is our window to work with.
We will also be using the printed output to the screen to keep the user updated instead of using a progress bar, it's nice to keep them from thinking their phone froze.
Start out by typing these 3 lines of code:
Code:
ui_print("");
ui_print("MT4GS - Market Update Install");
ui_print("");
The ui_print("") command will print to the screen anything between the quotes in the parenthesis. After about 40 characters it will split your text to a new line, wherever the break happens. Could be in the middle of a word.
The second line is the title of our script. When the script is done running, in clockworkmod 4.0.0.9, this will be at the very top of the screen on the phone.
The third line will print blank, just like the first, and seperates our text output to make it easier to read on the MT4GS screen.
The ; character tells the phone to read the next line of code.
Next, we'll type in this code:
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p22", "/system");
ui_print("Removing old market ...");
delete("/system/app/Vending.apk");
unmount("/system");
ui_print("");
The mount command will make a partition ready to do things to. Unmounted partitions can be formatted, for anything else they need to be mounted. The way this mount command is written mounts the /system partition specifically on the MT4GS phone.
Next we print a line saying what we are about to do.
Then we do it, which is to delete the old Vending.apk - this is the market app.
Then we unmount the /system partition, since we are done with it for now. This is a good practice to get into, in my opinion, because you won't forget to unmount the partition when you are done with it and you won't accidentally do something to it while you aren't using it.
Lastly, we print a blank line of text to keep things clean on the output screen. We are up to 5 lines of printed text so far.
Next, we'll type in this code:
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p23", "/data");
ui_print("Wiping old market data ...");
delete_recursive("/data/data/com.android.vending");
ui_print("");
ui_print("Wiping dalvik-cache ...");
delete_recursive("/data/dalvik-cache");
unmount("/data");
ui_print("");
Again, mounted the /data partition, called for specifically for the MT4GS phone.
Next we print a line saying what we are about to do.
Then we do it, which is to delete the old market /data directory located at /data/data/com.android.vending
Then we print a blank line of text, and another line saying what we are about to do.
Then we do the next thing, which is to wipe the dalvik cache. It's located at /data/dalvik-cache, so we are just going to delete the whole folder. A new one will be generated by Android on the next boot. This is the same as if you did it from the clockworkmod menu.
Then we unmount the /data partition, since we are done with it.
Lastly, we print a blank line. We are up to 9 printed lines so far.
Next, we'll type in this code:
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p24", "/cache");
ui_print("Wiping cache ...");
delete_recursive("/cache");
unmount("/cache");
ui_print("");
Again, mounted the /cache partition, called for specifically for the MT4GS phone.
Next we print a line saying what we are about to do.
Then we do it, which is to wipe the /cache. We just wipe the whole partition with the delete recursive command, it's the same as if you did this from the clockworkmod menu.
Then we unmount the /cache partition, since we are done with it.
Lastly, we print a blank line. We are up to 11 printed lines so far.
Next, we'll type in this code:
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p22", "/system");
ui_print("Installing new market ...");
package_extract_dir("system", "/system");
set_perm(0, 0, 0644, "/system/app/Vending.apk");
unmount("/system");
ui_print("");
ui_print("...Finished.");
Again, mounted the /system partition. Notice it's the second time we've mounted the same partition. This time, we are going to put on instead of taking away.
Next we print a line saying what we are about to do.
Then we do it, which is to copy the contents of the /system/app folder included in our script to the /system/app folder on the phone. This puts the new Vending.apk file where it is supposed to be.
Then we set the permissions for the new Vending.apk file, this is a very important step. This makes the permissions description on the file read rw-r--r-- like the rest of the files in the /system/app folder.
Then we unmount the /system partition.
Then we print a blank line, and then the last line which says we are done. This puts us at 14 lines, we still need 9 more.
Since we still ned 9 more lines to fill the output screen so that your script output is all the user sees when it's done, heres what I did:
Code:
ui_print("");
ui_print("New Market application provided by:");
ui_print("");
ui_print("charlieb620 at XDA");
ui_print("");
ui_print("Press your hardware back button, then");
ui_print("select 'reboot system now' from the main");
ui_print("menu to continue.");
ui_print("");
I credited the person who provided the market .apk file, then told the user what to do next now that the script is done.
I am sure you could find a useful way of using any blank space you have, or managing the 23 lines of print you get when it's over.
Reading through my notes thread that I linked should get you set in the right directions for any further information you need about commands or their syntax.
The only thing not covered in-depth yet in any of my guides are permissions as far as this script is concerned, but that's coming. Meantime, you can find the information you need by browsing through XDA.
We have successfully removed the old market, cleared all the temporary files that had old market information, installed the new market in the correct location, and then set the proper permissions for the file.
This script is now a self contained update, where all the user has to do is run this script and then reboot their phone. No need to format this, wipe that, it's all done for them by the script itself.
The last steps in the process to make our zip is to save the file we just edited, which looks like this:
Code:
ui_print("");
uiprint("MT4GS - Market Update Install");
ui_print("");
mount("ext4", "EMMC", "/dev/block/mmcblk0p22", "/system");
ui_print("Removing old market ...");
delete("/system/app/Vending.apk");
unmount("/system");
ui_print("");
mount("ext4", "EMMC", "/dev/block/mmcblk0p23", "/data");
ui_print("Wiping old market data ...");
delete_recursive("/data/data/com.android.vending");
ui_print("");
ui_print("Wiping dalvik-cache ...");
delete_recursive("/data/dalvik-cache");
unmount("/data");
ui_print("");
mount("ext4", "EMMC", "/dev/block/mmcblk0p24", "/cache");
ui_print("Wiping cache ...");
delete_recursive("/cache");
unmount("/cache");
ui_print("");
mount("ext4", "EMMC", "/dev/block/mmcblk0p22", "/system");
ui_print("Installing new market ...");
package_extract_dir("system", "/system");
set_perm(0, 0, 0644, "/system/app/Vending.apk");
unmount("/system");
ui_print("");
ui_print("...Finished.");
ui_print("");
ui_print("New Market application provided by:");
ui_print("");
ui_print("charlieb620 at XDA");
ui_print("");
ui_print("Press your hardware back button, then");
ui_print("select 'reboot system now' from the main");
ui_print("menu to continue.");
ui_print("");
and then go back to the flashable zip builder folder, and then into the update folder. Select both META-INF and system folders, and zip in winrar. ZIP not RAR. Name your zip New_Market.zip
Now move this zip file up one level, to the main flashable zip folder. Drag it onto the DRAGandDROPsignONLY.bat file in the folder.
Wait until the dos prompt finishes and closes.
Go to the _out folder and get your new ready to install update, called New_Market_Signed.zip
That's it, just get that to the phone and flash in clockworkmod recovery.
Hope this was helpful!
*Unzip the update-binary to use.
*Go to charlieb620's Thread for ready-made install scripts for the rest of the market colors.

wow you really put a lot of work into your write ups lol =D. good job.

I don't think I've appreciated a single post on xda more than this one. Thank you. This is the kind of thing I love.

My goodness... you never cease to amaze me Blue. As a developer I've never had much patience for write-ups, so I can applaud your efforts! Learning the hard way blows (although does yield better lessons sometimes)!
On a side note, I applied the Dark Market update zip thinking that it applied the (regular) market... I wasn't really sure what "Dark" stood for. So I opened it and was surprised to see a - you guessed it - DARK version of the newest Market. Anyways, point being is that I opened it, checked it out, closed it and a few minutes later it was uninstalled and replaced with the regular (newest) Market. I like the regular Market, so it worked out for the best, but just figured I'd let you know.

nbetcher said:
My goodness... you never cease to amaze me Blue. As a developer I've never had much patience for write-ups, so I can applaud your efforts! Learning the hard way blows (although does yield better lessons sometimes)!
On a side note, I applied the Dark Market update zip thinking that it applied the (regular) market... I wasn't really sure what "Dark" stood for. So I opened it and was surprised to see a - you guessed it - DARK version of the newest Market. Anyways, point being is that I opened it, checked it out, closed it and a few minutes later it was uninstalled and replaced with the regular (newest) Market. I like the regular Market, so it worked out for the best, but just figured I'd let you know.
Click to expand...
Click to collapse
You know, it's funny - one of those little things that's a D'oh! moment.
When I first saw that, I thought you meant you just installed a different (or your stock) version of the market over it.
I browsed the thread again since I directed someone here and when I got to the bottom I just realized you were letting me know Google forced a market update when you connected to them. Funny I didn't read that right sooner.

Hi guys!
If i want to Freeze some app in updater-script, how could I do it?
What codes i have to use?
THanks!

Thank you blue! You might not know it but you just contributed to the cause of adding devs to the forum. :thumbup:
Achievement unlocked: knowledge acquired!
sent from a Nokia 3210

is there any syntax highlighter + editor for edify script.?

Notepad ++.....but I don't think it highlights

Template: flashable zip update
Return to Contents Page - doubleshot Developers Reference
nfs1mw said:
is there any syntax highlighter + editor for edify script.?
Click to expand...
Click to collapse
Not sure, I use notepad++ in windows and while my preference is ever for the lightest weight program notepad++ is too awesome to not use, it's the only editor of that type you need on windows pretty much.
If the regular windows notepad could do this stuff without destroying the files i'd use that instead, so i've never checked into anything that was like that in notepad++.
I taught myself html in a notebook with a pen way back when, and the advantages of writing the code down and typing it in beyond the memory exercise itself is not having to jog back and forth between another document on your screen(s) and keeping the actual machine in use more clutter free.
(that said - syntax highlighting and end-user formatting to code in editors is so nice...)
Besides, if the internet dies tomorrow your physical notebook that takes nothing more then opening up and looking at will still work. Then again, i'm anal about backups.
In linux I just use gedit.
----
Flashable Zip Template:
unsigned template zip download:
doubleshot_unsigned_flashable-update_template.zip
Download Link
MD5: 7591ff4996f84a394c46ae375c254a4c
Size: 125.64 KB
Edit before flashing.
signed template zip download:
doubleshot_signed_flashable-update_template.zip
Download Link
MD5: afc51c4bf34dcdd76d1d62061fa3ee5b
Size: 124.25 KB
Edit before flashing.
Zip Contains:
- Empty data folder.
- Empty system folder.
- Empty sdcard folder.
- META-INF folder set up, with the correct update-binary and a template updater-script file.
updater-script template:
- wipe cache
- wipe dalvik cache
- wipe data
- wipe system
- wipe sdcard
- extract whatever ends up in the system, data, sdcard folders.
- clean up
Pastebin of updater-script.​Edit before using, otherwise you will erase everything on the device...
...just delete what you don't want and go from there. I got tired of typing the same stuff in all the time so here ya go.
Compatible with all versions of CWM to date (April 2012) - CWM 4xx Recovery versions don't support format correctly and is why it's not here.
Current CWM is 5xx​
Need to sign it? On windows This one is great.
Want to fill those empty folders? Start with system and this thread:
doubleshot de-odexed system images

Is there anybody know this? Or is there anybody know where to ask this question?
in .zip file (for CWM) there is an updater-script file...
I want to delete some files but i dont want to write the exact names of the files... Is there any way to delete some thing like x*.* or t*.apk or talk*.* etc...
for example if i want to delete all the files which starts with "a" letter... How can i do this?
I know
delete("...");
delete_recursive("...");
commands... But i couldn't find out if there is any way to do this?
Thank you for your answers...

Thank you for taking the time to write this. I had some questions regarding editing updater-scripts (for a different device) and this helped me out a lot.
-h311s|DR0ID
.

Quick question, for a delete command can you use a wildcard?
Like this:
delete("/system/app/SamsungHub.*");
I only ask because some roms have .apk and some are .odex (for example). Looking to make one script work for any stock rom on my phone.
Also, according to my TWRP log I'm able to mount /system but /data threw an error:
mount: failed to mount /dev/block/mmcblk0p29 at /data: Device or resource busy
Looks right in the partition area:
Symlink_Path: /data/media/0
Symlink_Mount_Point: /sdcard
Primary_Block_Device: /dev/block/mmcblk0p29
Any thoughts why?

I don't know if there is an option for wild card, never tried. But it can't hurt just to throw in a remove line for both options, simple fix
Being you have an emulated SD, when flashing something from data I believe data partition is mounted by default and that's why it says busy. My best guess is you don't need to add the mount data command
Sent from my Nexus 4 using XDA Premium 4 mobile app

Related

[Q] Manually flash a new recovery

I've been looking around, and I can't really find anything on how to do this on a Transformer TF101(C10). Most of what I've read either uses outdated commands in the terminal that don't work anymore, or are just flashing a default recovery using an app. As the one that Gnufabio's recovery installer app flashes is very outdated and barely works, I'd like to flash something more recent, specifically CWM Touch Recovery. I have the recovery.img downloaded, but how would I go about flashing this?
If you really want to flash the recovery.img, use Wolf's method 3 or if you're already rooted, use RecoveryInstaller, flash cwm. Use the cwm to flash Roach's touch version. FYI touch version only read from internal sd.
Also on post 218 in the RecoveryInstaller thread is a modify version that flash Rouge XM recovery.
Here is the link of Rogue in case you need it.
http://forum.xda-developers.com/showthread.php?t=1446019&page=18
For learning purposes, if you still want to go about flashing manually, take a look at the update script (used from extracted RougeXM recovery) that CWM reads and uses to flash recovery.zips.
Code:
ui_print("[AnyKernel Updater by Koush]");
ui_print("Rogue XM Recovery 1.3.0 (CWM-based Recovery v5.0.2.7)");
ui_print("Built for the Asus Transformer TF101");
set_progress(1.000000);
ui_print(" ");
ui_print("Extracting dd...");
package_extract_dir("recovery", "/tmp");
set_perm(0, 0, 0777, "/tmp/dd");
ui_print(" ");
ui_print("Extracting new recovery blob...");
package_extract_file("recoveryblob", "/tmp/recoveryblob");
ui_print(" ");
ui_print("Flashing new recovery blob...");
run_program("/sbin/busybox", "dd", "if=/tmp/recoveryblob", "of=/dev/block/mmcblk0p4");
ui_print(" ");
ui_print("Cleaning up...");
delete("/tmp/recoveryblob");
If you look you see the commands:
dd if=/your/blob/here of=/dev/block/mmcblk0p4
So place the extracted recoveryblob on your tf, boot it up and using an onboard terminal app or adb shell run these commands (needs root and busybox):
adb shell (only if running off computer with adb)
su (gives a pound sign, approve root access when it asks you.)
dd if=/your/blob/here of=/dev/block/mmcblk0p4 (your/blob/here is the path on the storage of the recoveryblob you placed on the tf)
reboot.
You should get the asus logo with a blue line that fills up, then it reboots again, and you have new recovery!
EDIT: also, you want the recoveryblob file extracted from touch recovery's zip. it just says recoveryblob with no extension. Download, extract, extract, put on tf, run commands. Easy
Thing O Doom said:
For learning purposes, if you still want to go about flashing manually, take a look at the update script (used from extracted RougeXM recovery) that CWM reads and uses to flash recovery.zips.
Code:
ui_print("[AnyKernel Updater by Koush]");
ui_print("Rogue XM Recovery 1.3.0 (CWM-based Recovery v5.0.2.7)");
ui_print("Built for the Asus Transformer TF101");
set_progress(1.000000);
ui_print(" ");
ui_print("Extracting dd...");
package_extract_dir("recovery", "/tmp");
set_perm(0, 0, 0777, "/tmp/dd");
ui_print(" ");
ui_print("Extracting new recovery blob...");
package_extract_file("recoveryblob", "/tmp/recoveryblob");
ui_print(" ");
ui_print("Flashing new recovery blob...");
run_program("/sbin/busybox", "dd", "if=/tmp/recoveryblob", "of=/dev/block/mmcblk0p4");
ui_print(" ");
ui_print("Cleaning up...");
delete("/tmp/recoveryblob");
If you look you see the commands:
dd if=/your/blob/here of=/dev/block/mmcblk0p4
So place the extracted recoveryblob on your tf, boot it up and using an onboard terminal app or adb shell run these commands (needs root and busybox):
adb shell (only if running off computer with adb)
su (gives a pound sign, approve root access when it asks you.)
dd if=/your/blob/here of=/dev/block/mmcblk0p4 (your/blob/here is the path on the storage of the recoveryblob you placed on the tf)
reboot.
You should get the asus logo with a blue line that fills up, then it reboots again, and you have new recovery!
EDIT: also, you want the recoveryblob file extracted from touch recovery's zip. it just says recoveryblob with no extension. Download, extract, extract, put on tf, run commands. Easy
Click to expand...
Click to collapse
This is probably the most helpful response I've ever gotten. Problem is though, that the touch recovery doesn't come in a zip. It's just a .img file. Is that the blob, just rename that to recoveryblob?
alunral said:
This is probably the most helpful response I've ever gotten. Problem is though, that the touch recovery doesn't come in a zip. It's just a .img file. Is that the blob, just rename that to recoveryblob?
Click to expand...
Click to collapse
Have you looked at Roach's thread?
http://forum.xda-developers.com/showthread.php?t=1213723
and now the new Team Rouge Touch
http://forum.xda-developers.com/showthread.php?t=1446019
both have CWM flashable zip.
Yeah, look in those linked threads for a CWM flashable zip to use, and either flash that or use the method I wrote above to extract and flash. I highly recommend RougeXM touch (second link)
Thanks!
Thing O Doom said:
For learning purposes, if you still want to go about flashing manually, take a look at the update script (used from extracted RougeXM recovery) that CWM reads and uses to flash recovery.zips.
If you look you see the commands:
dd if=/your/blob/here of=/dev/block/mmcblk0p4
So place the extracted recoveryblob on your tf, boot it up and using an onboard terminal app or adb shell run these commands (needs root and busybox):
adb shell (only if running off computer with adb)
su (gives a pound sign, approve root access when it asks you.)
dd if=/your/blob/here of=/dev/block/mmcblk0p4 (your/blob/here is the path on the storage of the recoveryblob you placed on the tf)
reboot.
You should get the asus logo with a blue line that fills up, then it reboots again, and you have new recovery!
EDIT: also, you want the recoveryblob file extracted from touch recovery's zip. it just says recoveryblob with no extension. Download, extract, extract, put on tf, run commands. Easy
Click to expand...
Click to collapse
I am going to have to do this..as I have just had to get a B80 version ands it got the Chinese HC rom on.. I have rooted it so now I have to push a recovery to it.
will have a play.. wish me luck..
Edit: Fantastic..worked like a charm.. shifted rogue's CWM 5.0.2.7 in and booted in to like a charm.. using on board terminal commands. now I can drop the US versions of ICS onto it and start having some fun..
Glad to hear, it's good to understand the mystery behind "install zip from..."

[Q] Is it possible to flash a kernel without CWM? Android/Ubuntu Dualboot on SBKv2

For the purpose of dualbooting between Ubuntu and Android on a sbkv2 device, I was wondering if it would be safe to overwrite the kernel partition (/dev/mmcblk0p4, apparently?) while booted into either Android or Ubuntu, skipping cwm entirely. This would probably be followed by an immediate reboot in any case.
From dissecting an update.zip it seems like mmcblk0p4 is where the kernel is written to. I'm just not totally sure that the partition numbers don't change for some reason (?) between cwm and android. Is it the right partition? Has anyone tried this?
It's possible to do and not too hard, boot into android. (Cwm just makes it easier on you.)
Here's the flash update-script from Guevor's kernel:
Code:
show_progress(0.100000, 0);
run_program("/sbin/busybox", "mount", "/system");
show_progress(0.300000, 0);
ui_print("Modules...");
delete_recursive("/system/lib/modules");
package_extract_dir("system", "/system");
show_progress(0.200000, 10);
show_progress(0.100000, 0);
unmount("/system");
ui_print("Kernel..");
package_extract_file("kern.blob", "/tmp/kern.blob");
run_program("/sbin/busybox", "dd", "if=/tmp/kern.blob", "of=/dev/block/mmcblk0p4");
delete("/tmp/kern.blob");
Put the modules somewhere on your Tf, and also the 'blob' file (Preferably somewhere easy like /sdcard/)
So take the modules out of /system/lib and put them in /system/lib/modules (Cut and paste with a root explorer)
Then run the dd command to flash the kernel:
dd if=/where/you/put/the/blob/file/on/yourtf of=/dev/block/mmcblk0p4
Note that the blob has no file extension and doesn't need one.
Worked going from Android to Ubuntu, but not in the other direction. I was still able to get into cwm so whatever. Thanks for the advice.
Mmcblk0p4 is the staging partition. If it still works, I suppose it would be possible, but you would need to know what the partition name is. It should be listed in whatever flash.cfg file you used to reformat for ubuntu. Once you know the name, you can use the blob tools to pack up the boot.img(LNX on stock partition tables) and *maybe* flash via staging.
sent while running with scissors
Oh, I should clarify that I didn't repartition for ubuntu. I'm using a loop mounted filesystem on the internal storage.

[INTRODUCTION] Updater script

Hi guys this is a small intro to updater script by a newbie for a newbie to understand more and more what it has and what it means:highfive::highfive::highfive:
now what is the updater-script and update-binary present in the META-INF>com>google>android in any flashable zip package
1. updater-script - it is just a text file which contains all the commands which tells the clockworkmod what to do with the given
zip file. the updater-script is written in the edify scripting language.
2. update-binary - it is a binary which is requiered by the clockworkmod to translate the human readable format of the updater-
script to machine readable format for execution of the updater-script in our device.
exploring the updater-script:
now let's start exploring the updater-script !
1. open the updater script with notepad++ (strongly recommended)
2. now i will try and explain commands generally used in the updater-script,
assert(getprop("ro.product.device") == "ST15i" || getprop("ro.build.product") == "ST15i" ||
getprop("ro.product.device") == "ST15a" || getprop("ro.build.product") == "ST15a" ||
getprop("ro.product.device") == "smultron" || getprop("ro.build.product") == "smultron");
the above bunch of lines checks the device model to confirm that the zip file is flashed on the device
for which it is specifically created for. These bunch of lines are very important because it prevents
flashing of zip file which is not intended for the device hence avoiding any problems due to flashing
the wrong zip. for example the above lines checks for the value of "ro.product.device" and
"ro.build.product"in the build.prop file of the already existing rom in the device, if any of the three
defined values ST15i, ST15a, smultron are found it will continue with the next line of updater-script
otherwise flashing gets aborted with error in getprop.
format("yaffs2", "MTD", "system", "/system");
the above command explains itself, it is used to format the specified partition
syntax explanation:
format - the main command to direct the cwm to format using the following parameters
"yaffs2" - filesystem type used in the device
"MTD" - type of the partition used in the file system
"system" - location of the partition to be formatted
"/system" - name of the partition to be formatted
ui_print("Format Completed");
the above command is also self explanatory, it directs the cwm to display the following text
enclosed in double quotes in the user interface (display).
after succesful formatting it displays "Format Completed" in the device screen.
mount("yaffs2", "MTD", "system", "/system");
the mount command directs the cwm to mount the following file system and the following partition
the syntax is just as explained in the format command except that this command mounts the
defined partition whereas the format command formats the defined partition.
let's review what we have done till now,
1. we have checked the device to confirm that this is the device for which we created the zip.
2. we have formatted the system partition of the device.(this is only done when a new complete rom is being flashed, for flashing mods you
should never format the system partition!)
3. we have mounted the system partition of the device.
now let's continue,
package_extract_dir("system", "/system");
this command searches for the directory (folder) named "system" in the root of the zip file and
copies all the content of the "system" folder from the zip file into the "/system" partition
which is already mounted by the previous mount command.
remember the structure of the file system in the zip file and the "/system" partition of the device must be always identical.
for eg., you have created a mod by editing the systemUI.apk and you want to flash it, the system UI.apk resides in "/system/app"
so the structure of the file system in the update zip should be "/system/app/systemUI.apk"
ie., the update zip should contain folder named "system" at the root of it and folder named "app" inside the "system" folder and the
modded "systemUI.apk" must be placed inside the "app" folder.
package_extract_file("autoroot.sh", "/tmp/autoroot.sh");
this command searches for the file named "autoroot.sh" in the root of the zip file and
copies the file to "/tmp" folder and names it as "autoroot.sh" (here it does not change the name)
symlink("mksh", "/system/bin/sh");
the above command creates a symlink.
okay, now let's see about symlinks,
symlink is nothing but shortcuts, for example if a file is requiered in two different places instead of copy pasting the file
in two different locations, the file is copied to one of the two locations and in the other location a shortcut to the file(symlink)
is created. the source and the symlink can have different names (actually this is the prime use of symlinks).
to explain in a noob friendly manner,
take the above symlink, it creates a shortcut(symlink) for the command "mksh" and places it in the path of the operating system.
the shortcut(symlink) directs to the file "/system/bin/sh" , so whenever the os gets a request to execute the "mksh" command, the actual
binary that gets excuted will be "/system/bin/sh" .
creating symlinks saves a lot of space because instead of copying the whole file and placing it in requiered places we are just
creating shortcuts which directs to the source file which can be placed anywhere in the file system (generally placed in the path of the os).
set_perm_recursive(0, 0, 0755, 0644, "/system");
the above command is used to set permission recursively for the files and folders present inside a folder (in this case for "/system" folder).
syntax explanation:
0 - uid - it defines that the following permission is set for the user id 0 .
0 - gid - it defines that the following permission is set for the group id 0 .
0775 - dirmode - it defines that 0775 permission to set to directories contained within the specified directory.
0644 - filemode - it defines that 0644 permission to set to files contained within the specified directory.
"/system" - target directory to set the above mentioned permissions.
set_perm(0, 3003, 06755, "/system/bin/ip");
the above command is used to set permission for a individual file (in this case for "/system/bin/ip" file).
syntax explanation:
0 - uid - it defines that the following permission is set for the user id 0 .
3003 - gid - it defines that the following permission is set for the group id 3003 .
06775 - it defines that 06775 permission to set to the specific file.
"/system/bin/ip" - target file to set the above mentioned permissions.
run_program("/tmp/autoroot.sh");
remember the file autoroot.sh from package_extract_file command?
that file is supposed to be a shell script, the above command directs cwm to execute the "autoroot.sh" shell script present in "/tmp" folder.
unmount("/system");
the unmount command directs the cwm to unmount the following partition
the syntax is just as explained in the mount command except that this command unmounts the
defined partition whereas the mount command mounts the defined partition.
Okay now going into slightly complex and/or not widely used updater-script commands,
Ifelse
Syntax:
Ifelse(condition),(do_this),(else_do_this);
Example:
ifelse mount("yaffs2", "MTD", "system", "/system") == "system", ui_print("Mounted!"), ui_print("Mount Failed!");
Ifelse command can be explained simply as asking the system to do something based on the result of a condition.
From the example:
The ifelse command would attempt to mount the MTD partition named "system" to "/system".
If the mounting process succeeds (the condition), the script will display "Mounted!", else it will display "Mount Failed!"
abort()
It just abort's the script execution
Note: it is usually paired with some other command for example the getprop command or with ifelse.
Independently specifying abort() in the updater-script will kill the script abruptly right there so use this command carefully.
ALWAYS LEAVE A BLANK LINE AT THE END OF THE update-script (if the code contains 50 lines then 51 lines should be visible
in the notepad++ including a blank line after the end of the script)
ALWAYS REMEMBER TO SET THE EOL (end of line) CONVERSION OF updater-script
IN UNIX FORMAT BEFORE SAVING (notepad++ > edit > EOL conversion > UNIX format)
the above mentioned commands are just basic edify scripting commands which are generally used in updater-script.
for detailed scripting and coding in edify scripting language check out the following sources:
source of update-binary
introdution to edify
http://forum.xda-developers.com/wiki...cript_language
scratchpad-documenting-edify-commands-for-android-updater-scritps
http://forum.xda-developers.com/show....php?t=1290062
Broken Links!!!
source of update-binary
introdution to edify
http://forum.xda-developers.com/wiki...cript_language
scratchpad-documenting-edify-commands-for-android-updater-scritps
http://forum.xda-developers.com/show....php?t=1290062[/QUOTE]
broken links!!! :silly:
Dude cut the reply short
Sent from my Droid Bionic using xda app-developers app
Sorry brother! i mean these links are not working!!
Current Device : MT11i Xperia Neo V
ROM : Xperia Ultimate HD ™
Build Number : 2.0.3
Kernel : Suave Kernel
Root Status : Rooted
Bootloader : Unlocked
Previous Devices : Samsung Galaxy Y
GT-5360(Sold)
Sent from my MT11i using XDA Premium HD app
tharu_roxx said:
Sorry brother! i mean these links are not working!!
Sent from my MT11i using XDA Premium HD app
Click to expand...
Click to collapse
Dont quote large posts on a whole...be specific...if u dont be specific..it may annoy others and even may affect the beauty of XDA... Next time do take a note of this....
Now please modify ur post..and keep only those links that u were referring to...
-via my "Galaxy Royale"
First i noticed it dude! When um gonna edit it, xda doesn't allowed me(as i was a new member) now it's ok....thanx!!!
Current Device : MT11i Xperia Neo V
ROM : Xperia Ultimate HD ™
Build Number : 2.0.3
Kernel : Suave Kernel
Root Status : Rooted
Bootloader : Unlocked
Previous Devices : Samsung Galaxy Y
GT-5360(Sold)
Sent from my MT11i using XDA Premium HD app
kartiknnn said:
Dude cut the reply short
Sent from my Droid Bionic using xda app-developers app
Click to expand...
Click to collapse
Thanks kartik for the thread...
Learnt some new stuff...thank you...
I would suggest u to add some ready made zips with standard updater scripts... So that people can use them for faster modding...
What say?
Sent from my GT-I9103 using xda app-developers app
bhargav143 said:
Thanks kartik for the thread...
Learnt some new stuff...thank you...
I would suggest u to add some ready made zips with standard updater scripts... So that people can use them for faster modding...
What say?
Sent from my GT-I9103 using xda app-developers app
Click to expand...
Click to collapse
Try these threads
http://forum.xda-developers.com/showthread.php?t=1561463
http://forum.xda-developers.com/showthread.php?t=732957
Hit thanks if i helped!!
Current Device : MT11i Xperia Neo V
ROM : Xperia Ultimate HD ™
Build Number : 2.0.3
Kernel : Suave Kernel
Root Status : Rooted
Bootloader : Unlocked
Previous Devices : Samsung Galaxy Y
GT-5360(Sold)
Sent from my MT11i using XDA Premium HD app
Lemme see guys will try and upload them today
Sent from my GT-I9103 using xda premium
kartiknnn said:
Dude cut the reply short
Sent from my Droid Bionic using xda app-developers app
Click to expand...
Click to collapse
dont you have your exams buddy..
Sent from my GT-I9103 using xda premium
Yup formative 2 be exact
Sent from my GT-I9103 using xda premium
Where to get the update-binary file from???
prohank said:
Where to get the update-binary file from???
Click to expand...
Click to collapse
Read the second paragraph.
Sent from my CM10.1-powered GT-I9103
2. update-binary - it is a binary which is requiered by the clockworkmod to translate the human readable format of the updater-
script to machine readable format for execution of the updater-script in our device.
Click to expand...
Click to collapse
you mean this one?
It says what it is but where to get it from?
prohank said:
you mean this one?
It says what it is but where to get it from?
Click to expand...
Click to collapse
its in any CWM zip of Galaxy R. check in Meta-info/...../Android
prohank said:
you mean this one?
It says what it is but where to get it from?
Click to expand...
Click to collapse
This:
now what is the updater-script and update-binary present in the META-INF>com>google>android in any flashable zip package
Click to expand...
Click to collapse
Sent from my CM10.1-powered GT-I9103

Make your own updater-script!

To create updater-script or to edit updater-script you need Notepad++ (don’t use notepad). Download it from Here and install in your pc
updater-script is located in Meta-inf/com/google/android/updater-script
To create your own updater-script
Open notepad++ and from file menu select new and create the commands and create your own updater-script with this tutorial
After typing the commands save it as all types(*.*) and name it as updater-script and click save and put it in folder Meta-inf/com/google/android/updater-script
In this tutorial i will explain you all commands used in updater-script so that you can edit or create updater-script
ui_print – This command prints the prints the word inside the quotations
Example – ui_print(“xolo – next level”); prints xolo next level in your cwm recovery
mount – This command mounts the partition, if you want to add files to system partition you have to mount system partition, data for data partition
To mount system - mount(“ext4″, “EMMC”, “/dev/block/mmcblk0p5″, “/system”);
Here mmcblk0p5 is the name of system partition for mtk 6589 chipsets (this name varies from device to device)
To mount data - mount(“ext4″, “EMMC”, “/dev/block/mmcblk0p7″, “/data”); (partition name varies from device to device)
format - This command formats the partition specified
It is highly recommended to include this command to format system and data if you are making updater-script for ROM
To Format system - format(“ext4″, “EMMC”, “/dev/block/mmcblk0p5″, “0″);(partition name varies from device to device)
To Format data - format(“ext4″, “EMMC”, “/dev/block/mmcblk0p7″, “0″);(partition name varies from device to device)
package_extract_dir(” “, “/”) – This command extracts all the files from the folder mentioned inside first quotation to the partition or directory inside second quotation
For system - package_extract_dir(“system”, “/system”);
(this copies all files from system folder in zip to system partition in phone)
For data - package_extract_dir(“data”, “/data”);
package_extract_file(” “,”/”) - This command extract the single file inside between first quotation from zip to the partition or directory inside second quotation
symlink – This command creates links to its executable files
Here is an example
for super su binaries - symlink(“/system/xbin/su”, “/system/bin/su”);
set_perm_recursive - This command sets permission for folders
here android uses unix permission system
in unix
4 – read
2 – write
1 – execute
so
rwx is 4+2+1 = 7
rw is 4+2 = 6
rx is 4+1 = 5
Example - set_perm_recursive(0, 0, 0755, 0644, “/system”);
In this 0 is a user id for owner that refers to root. It means that permission owner for system folder. and 0 is root user means it unrestricted access to system. it is given in order to run programs to run properly
second 0 also refers to root. but here it refers to group id 0
we are only seeing about folders because “set_perm_recursive” is a command that sets permission to folders
next 0755 it means rwxr-xr-x permission has been given to system folder and rw-r-r is set for all folders inside system folder
set_perm – This command sets permission for a specific file
Example - set_perm(1000, 1000, 0640, “/system/etc/bluetooth/auto_pairing.conf”);
here the 1000 refers to user id system and 0640 is rw-r—–
and this command sets the permission rw-r—– for the file auto_pairing.conf
unmount – This command unmounts the partition
Example - unmount(“/system”); – unmounts system
General rule in updater-script – all commands should end with semi colon ; otherwise it will show error and if cwm or twrp shows status 7 error the error is in updater-script:laugh:
try fixing it by going through this thread
Use zipme app from Playstore to Make .Zip Flashable Files....
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
Zeuscluts said:
Use zipme app from Playstore to Make .Zip Flashable Files....
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
Click to expand...
Click to collapse
i use kitchen always
anyways thanks for the info :good:
and do you know any app to decompile in phone like apk multitool in pc?
Renaming is the Option
pradeepxtremehacker said:
i use kitchen always
anyways thanks for the info :good:
and do you know any app to decompile in phone like apk multitool in pc?
Click to expand...
Click to collapse
Bro its not possible,
but if you rename the .apk to .zip
you can decompile it,
but you need a PC to recompile.
Eg
sms.apk to sms.zip
then just Unzip sms.zip
you can get the Details.
Zeuscluts said:
Bro its not possible,
but if you rename the .apk to .zip
you can decompile it,
but you need a PC to recompile.
Eg
sms.apk to sms.zip
then just Unzip sms.zip
you can get the Details.
Click to expand...
Click to collapse
bro i think you are saying like extract
in fact we no need even to rename to extract we can directly extract with es file explorer from .apk but when we extract the xml will not be editable it will show like boxes
i am asking like a app like apk multi tool
No not Possible in Mobile.
Yet
Hope anyone Make this Possible In Future.
:Fingercrossed:
Let's Hope for the Better. ..
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
OK thanks
Sent from my GT-I9070 using xda app-developers app
I have a question, i and my friend both port the rom for HTC One International to HTC One J (the japan variant of HTC One) and we edit the updater-script the same way but then my friend's rom can be flashed without any error and my, it's stuck at format step, the log file say:
Code:
format() expects 4 args, got 5
format() expects 4 args, got 5
here is the command line that was corrupted:
HTML:
format("ext4", "EMMC", "/dev/block/mmcblk0p38", "0", "/system")
my friend use the same and he has no error @@
Can you tell me why i can't make the rom to be able to flashed
Very helpful... Thanks.
KuroKeita said:
I have a question, i and my friend both port the rom for HTC One International to HTC One J (the japan variant of HTC One) and we edit the updater-script the same way but then my friend's rom can be flashed without any error and my, it's stuck at format step, the log file say:
Code:
format() expects 4 args, got 5
format() expects 4 args, got 5
here is the command line that was corrupted:
HTML:
format("ext4", "EMMC", "/dev/block/mmcblk0p38", "0", "/system")
my friend use the same and he has no error @@
Can you tell me why i can't make the rom to be able to flashed
Click to expand...
Click to collapse
The format command depends on the update-binary you are using. If you use the one your friend is using it will probably work with the existing command. If you would like to keep using your existing update-binary, change the above line to
Code:
format("ext4", "EMMC", "/dev/block/mmcblk0p38");
SuperR. said:
The format command depends on the update-binary you are using. If you use the one your friend is using it will probably work with the existing command. If you would like to keep using your existing update-binary, change the above line to
Code:
format("ext4", "EMMC", "/dev/block/mmcblk0p38");
Click to expand...
Click to collapse
Yeah, i changed to that and the rom was flashed properly, thanks guys
Sent from my HTC J One using Tapatalk
Zeuscluts said:
No not Possible in Mobile.
Yet
Hope anyone Make this Possible In Future.
:Fingercrossed:
Let's Hope for the Better. ..
----------Signature---------
Need Some Cool Guides Visit Hmpshah Guides
Click to expand...
Click to collapse
Yes I think so. Even Stericson's NinjaMorph can't do it.
Hello. I am making a flashable zip that flashes a modified build.prop. i dont know much about how to do it. the screenshot attached below, shows the code i already have. All i want is an updater script that will delete the build.prop and replace it with the modified one.
[HELP] generic updater script
I do have a "strange" question: is possible to update (overwrite) just specific files/dir ?
This could allow to make "generic" roms for a whole class of devices (for example all MT65xx).
Thanks in advice for any suggestion you can provide.
How to delete files in order to replace them with new ones? You didn't specify any commands for that one.
Sent from my Nokia_XL
I need help porting a ROM that always gives me status 7 and error setting permissions.
I think it is having problems identifying my device and I might've erased the get_prop commands.
Any help?
thank you
Hey. was wondering if you had any idea what im doind wrong by this log:
AROMA INSTALLER version 2.70B6
(c) 2013 by amarullz xda-developers
ROM Name : Project Unity
ROM Version : Google Apps
ROM Author : LiquidSmokeX64
Device : Any Device
Start at : Sat Aug 9 19:34:06 2014
Installing Google Core Apps
Mounting system...
Copying files...
Extract: /system/app/GoogleContactsSyncAdapter.apk
Extract: /system/etc/permissions/com.google.android.ble.xml
Extract: /system/etc/permissions/com.google.android.camera2.xml
Extract: /system/etc/permissions/com.google.android.maps.xml
Extract: /system/etc/permissions/com.google.android.media.effects.xml
Extract: /system/etc/permissions/com.google.widevine.software.drm.xml
Extract: /system/etc/permissions/features.xml
Extract: /system/etc/preferred-apps/google.xml
Extract: /system/framework/com.google.android.ble.jar
Extract: /system/framework/com.google.android.camera2.jar
Extract: /system/framework/com.google.android.maps.jar
Extract: /system/framework/com.google.android.media.effects.jar
Extract: /system/framework/com.google.widevine.software.drm.jar
Extract: /system/lib/libAppDataSearch.so
Extract: /system/lib/libconscrypt_gmscore_jni.so
Extract: /system/lib/libgames_rtmp_jni.so
Extract: /system/lib/libgcastv2_base.so
Extract: /system/lib/libgcastv2_support.so
Extract: /system/lib/libgmscore.so
Extract: /system/lib/libgoogle_hotword_jni.so
Extract: /system/lib/libgoogle_recognizer_jni_l.so
Extract: /system/lib/libjgcastservice.so
Fixing Permissions...
Installing Google Chrome
package_extract_file: can't open /system/app/Chrome.apk for write: Read-only file system
package_extract_file: can't open /system/lib/libchrome.1985.128.so for write: Read-only file system
Installing Cloud Print
package_extract_file: can't open /system/app/CloudPrint.apk for write: Read-only file system
Installing Google Play Music
package_extract_file: can't open /system/app/Music2.apk for write: Read-only file system
Installing Gmail
package_extract_file: can't open /system/app/Gmail.apk for write: Read-only file system
Installing YouTube
package_extract_file: can't open /system/app/YouTube.apk for write: Read-only file system
package_extract_file: can't open /system/lib/libm2ts_player.so for write: Read-only file system
Fixing permissions again...
Finished
script result was [@Finished]
Installer Sucessfull (Status 0)
End at : Sat Aug 9 19:34:06 2014
Problems with script
Greetings, I am new to the forum and have a question, I use a program to change my boot image, this generates me an update.zip and works perfect, but using as a basis the same script and copy any file to the same path, the script does nothing at all.
this is the script that changes the boot image
ui_print("Flashing logo...");
show_progress(0.200000, 0);
package_extract_file("logo.bin", "/dev/logo");
ui_print("Patched!");
ui_print("");
ui_print("Now you can reboot your phone");
Click to expand...
Click to collapse
and this is my script
ui_print("Flashing logo...");
show_progress(0.200000, 0);
package_extract_file("test.txt", "/dev/test.txt");
ui_print("Patched!");
ui_print("");
ui_print("Now you can reboot your phone");
Click to expand...
Click to collapse
i don't see what the problem is, any ideas?
Gorgonitte said:
Greetings, I am new to the forum and have a question, I use a program to change my boot image, this generates me an update.zip and works perfect, but using as a basis the same script and copy any file to the same path, the script does nothing at all.
this is the script that changes the boot image
and this is my script
i don't see what the problem is, any ideas?
Click to expand...
Click to collapse
if understood correctly, your script should extract to /tmp/scriptname.sh or /temp/scriptname.sh
after which your updater script in you meta-inf/com/google/android directory of your update.zip
need to include instruction to set permission and execute the script that actually performs the function.
m

Flashable zip for /su/su.d

I'm sorry if this has been asked already but I can't find it anywhere:
I have two su.d scripts that I always was putting in /system/su.d after every rom update. But ever since I switched to SuperSU 2.76 Systemless those scripts don't work. I do use an app from Chainfire called LiveBoot that uses su.d and I noticed ever since I switched to systemless root that su.d is no longer in /system/su.d: it's in /su/su.d.
Here's my edify script for one of the flashable zips:
Code:
ui_print(" Flashing Balanced Kernel Settings ");
ui_print(" ");
show_progress(0.99, 30);
run_program("/sbin/busybox", "mount", "/su");
package_extract_dir("su", "/su");
set_perm(0, 0, 0700, "/su/su.d/ZZZ-Elite-Kernel-Settings");
show_progress(1.0, 1);
unmount("/su");
ui_print("----------------------------------------------");
ui_print("| Done!!! |");
ui_print("----------------------------------------------");
ui_print(" ");
What I've noticed is that after I flash both zips and go to the file manager in TWRP that the files are there in /su/su.d. But after it's done booting and I go look in that folder with a file explorer, they're gone. Any idea why these disappear? It seems I have to flash these on every boot. That's obviously ridiculous. I must be doing something wrong and I figure that it's related to my ignorance about systemless SuperSU.
A permissions thing maybe, this happens with me if I transfer files in TWRP then booting the device. I can`t find them in any file explorer.
It's late though, but for the guidance of other noobs like me. /su/su.d/ can't be flashed in recovery because this isn't available. For system-less roots, binaries/libraries required to start supersu daemon and to manage root permissions, don't reside in /system/bin but in /data/su.img while (at least) two files reside in boot.img i.e. boot.img/ramdisk/init.supersu.rc and boot.img/ramdisk/sbin/.*daemonsu*.sh. When ROM boots, init.supersu.rc mounts /data/su.img on /su directory and calls /sbin/*daemonsu*.sh for initial setup which starts /su/bin/daemonsu and other se-linux related stuff and then executes any scripts found in /su/su.d/ and /system/su.d.
You can find this:
Code:
mido:/ # mount | grep loop
/dev/block/loop0 on /su type ext4 (rw,seclabel,noatime,data=ordered)
So, the init.d scripts placed in /su/su.d actually reside in /data/su.img which isn't mounted in recovery mode and anything flashed to /su/su.d goes to volatile rootfs which is gone on reboot. Either mount su.img in recovery, or place this script while ROM is running or instead flash to /system/su.d which is permanent filesystem unlike rootfs (which lives in RAM). And finally don't forget to set permissions to 0700 as advised here. Another thing, mostly init.d scripts don't work with .sh extension. Avoid this too.

Categories

Resources