FORUMS
Remove All Ads from XDA

[WIP] How to Write an Updater-Script with Edify Code

488 posts
Thanks Meter: 159
 
By Karadorde, Senior Member on 16th March 2011, 01:30 AM
Post Reply Email Thread
First and foremost I take no credit for the majority of this thread. I am merely posting this here as a reference for you all. I had to dig around a lot for this information and piece it together from several different threads as well as pull examples from updater-scripts in several different roms/theme/etc. Everyone else put in the work, I am just trying to make it easier for the rest of us .

Mounting Partitions:
MTD:
Code:
mount("MTD", "system", "/system");
mount("MTD", "userdata", "/data");
mount("MTD", "cache", "/cache");
mount("MTD", "sdcard", "/sdcard");
EMMC with EXT3 and EXT4 file systems:
Code:
mount("ext4", "EMMC", "/dev/block/mountpoint", "/system");
mount("ext4", "EMMC", "/dev/block/mountpoint", "/data");
mount("ext4", "EMMC", "/dev/block/mountpoint", "/cache");
Code:
mount("ext3", "EMMC", "/dev/block/mountpoint", "/system");
mount("ext3", "EMMC", "/dev/block/mountpoint", "/data");
mount("ext3", "EMMC", "/dev/block/mountpoint", "/cache");
“mountpoint” will vary from device to device. Decide what partition you want to mount, find where it mounts (there will be resources in the second post, and paste it in place of “mountpoint” in your script.

Mounting system, data, and cache on the EVO 3D
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p23", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p24", "/data");
mount("ext4", "EMMC", "/dev/block/mmcblk0p25", "/cache");
Amend
Code:
none



Unmounting Partitions:
MTD and EMMC:
Code:
unmount("/system");
unmount("/data"); OR unmount("/userdata");
unmount("/cache");
unmount("/sdcard");
Amend
Code:
none



Format Partitions:
MTD:
Code:
format("MTD", "system");
format("MTD", "cache");
format("MTD", "data");
format("MTD", "boot");
EMMC EXT3/4:
Code:
format("ext4", "EMMC", "/dev/block/mountpoint");
Code:
format("ext3", "EMMC", "/dev/block/mountpoint");
Formatting system, data, cache, and boot on EVO 3D.
Code:
format("ext4", "EMMC", "/dev/block/mmcblk0p23");
format("ext4", "EMMC", "/dev/block/mmcblk0p24");
format("ext4", "EMMC", "/dev/block/mmcblk0p25");
format("ext4", "EMMC", "/dev/block/mmcblk0p22");
Amend:
Code:
format SYSTEM:
format DATA:
format BOOT:
format CACHE:



Copy files from .zip file to phone partition or sd card:
Code:
package_extract_dir("Source", "Destination");
“Source” = folder in .zip file. "Destination" = partition to copy to,
Code:
package_extract_dir("system", "/system");
package_extract_dir("data", "/data");
package_extract_dir("sdcard", "/sdcard");
Amend:
Code:
copy_dir PACKAGE:system SYSTEM:
copy_dir PACKAGE:data DATA:
copy_dir PACKAGE:sdcard SDCARD:



Write an .img file:
MTD:
Code:
assert(package_extract_file("boot.img", "/tmp/boot.img"),
write_raw_image("/tmp/boot.img", "boot"),
delete("/tmp/boot.img"));
EMMC:
Code:
package_extract_file("boot.img", "/dev/block/mountpoint");
Amend
Code:
write_raw_image PACKAGE:boot.img BOOT:



Output a line of text:
MTD/EMMC:
Code:
ui_print("Text Here");
Amend
Code:
none



Delete a file:

Use delete for a single file. Use delete recursive for an entire folder.

Code:
delete_recursive("file/path");
Code:
delete("/path/to/file");
Amend
Code:
delete_recursive PARTITION:path/to/file
Code:
delete PARTITION:path/to/file



Set ownership and permissions for folder:
Code:
set_perm_recursive(uid, gid, dmode, fmode, “/path/to/folder”);
Amend
Code:
set_perm_recursive uid gid dmode fmode PARTITION:path





Set ownership and permissions for a file:
Code:
set_perm(uid, gid, mode, “/path/to/file”);
Amend
Code:
set_perm uid gid mode PARTITION:file



Run a program:
Code:
run_program("programtorun");
Amend
Code:
run_program PACKAGE:programtorun



Creating symlinks:
Code:
symlink("/path/to/file", "/path/tofile");
Amend
Code:
symlink /path/to/file PARTITION:path/to/file



Progress bar:
Code:
show_progress(fraction, duration);
Amend
Code:
show_progress fraction, duration
The Following 50 Users Say Thank You to Karadorde For This Useful Post: [ View ] Gift Karadorde Ad-Free
 
 
16th March 2011, 01:31 AM |#2  
Karadorde's Avatar
OP Senior Member
Flag Sugar Creek
Thanks Meter: 159
 
Donate to Me
More
Mount points for selected devices:

Evo 3D
Code:
mmcblk0p21          /boot
mmcblk0p23          /system
mmcblk0p24          /data
mmcblk0p25          /cache
Evo Shift 4G
Code:
mmcblk0p22          /boot
mmcblk0p26          /system
mmcblk0p27          /data
mmcblk0p28          /cache
Nexus S
Code:
mtdblock4				/cache
platform/s3c-sdhci.0/by-name		/system
platform/s3c-sdhci.0/by-name		/userdata
The Following 12 Users Say Thank You to Karadorde For This Useful Post: [ View ] Gift Karadorde Ad-Free
16th March 2011, 01:31 AM |#3  
Karadorde's Avatar
OP Senior Member
Flag Sugar Creek
Thanks Meter: 159
 
Donate to Me
More
reserved for more info at a later date
The Following 4 Users Say Thank You to Karadorde For This Useful Post: [ View ] Gift Karadorde Ad-Free
16th March 2011, 05:51 PM |#4  
dkelle4's Avatar
Retired Recognized Developer
Flag Chicago, IL
Thanks Meter: 84
 
Donate to Me
More
excellent tutorial. answered a lot of questions i had
The Following User Says Thank You to dkelle4 For This Useful Post: [ View ] Gift dkelle4 Ad-Free
16th March 2011, 10:20 PM |#5  
-shift-'s Avatar
Senior Member
Thanks Meter: 824
 
Donate to Me
More
w00t w00t! thanks for this, dude!
16th March 2011, 10:30 PM |#6  
DrRyder's Avatar
Senior Member
Flag Hudson, FL
Thanks Meter: 231
 
Donate to Me
More
http://forum.xda-developers.com/showthread.php?t=936175

A lot of information in there that I have bookmarked and used without problems.
16th March 2011, 10:47 PM |#7  
Karadorde's Avatar
OP Senior Member
Flag Sugar Creek
Thanks Meter: 159
 
Donate to Me
More
Quote:
Originally Posted by raiden89

http://forum.xda-developers.com/showthread.php?t=936175

A lot of information in there that I have bookmarked and used without problems.

Thanks. Will update. Just wanted to post something for the EVO users so we have our own thread to reference.

EDIT: Also, looks like he might be missing a few commands. Not a big deal. Any and all help is appreciated.
17th March 2011, 01:18 AM |#8  
DrRyder's Avatar
Senior Member
Flag Hudson, FL
Thanks Meter: 231
 
Donate to Me
More
Oh yeah. Of course. I know some stuff is missing, but I also like the color coding of it and showing what the Amend syntax is compared to the Edify. So, I thought I would post it. It's been useful to me.
17th March 2011, 06:34 AM |#9  
dkdude36's Avatar
Senior Member
Flag los angeles
Thanks Meter: 716
 
Donate to Me
More
thank you so much for making this. now people will stop bothering me and tiffany about our fantastic zips not working in cwm 3.+
23rd March 2011, 04:43 AM |#10  
nubecoder's Avatar
Inactive Recognized Developer
Thanks Meter: 560
 
Donate to Me
More
Some more resources for you all...

Here and here (source code is included if you would like to see the conversions being done).

=]
The Following 2 Users Say Thank You to nubecoder For This Useful Post: [ View ] Gift nubecoder Ad-Free
18th May 2011, 10:03 AM |#11  
Droidzone's Avatar
Inactive Recognized Developer
Flag Kochi
Thanks Meter: 2,296
 
Donate to Me
More
Is there any way to change the color of text output in ui_print?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes