New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
Karadorde
Old
(Last edited by Karadorde; 20th August 2011 at 07:50 AM.)
#1  
Karadorde's Avatar
Senior Member - OP
Thanks Meter 141
Posts: 488
Join Date: Aug 2010
Location: Sugar Creek

 
DONATE TO ME
Default [WIP] How to Write an Updater-Script with Edify Code

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 36 Users Say Thank You to Karadorde For This Useful Post: [ Click to Expand ]
 
Karadorde
Old
(Last edited by Karadorde; 15th August 2011 at 06:13 AM.)
#2  
Karadorde's Avatar
Senior Member - OP
Thanks Meter 141
Posts: 488
Join Date: Aug 2010
Location: Sugar Creek

 
DONATE TO ME
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 8 Users Say Thank You to Karadorde For This Useful Post: [ Click to Expand ]
 
Karadorde
Old
(Last edited by Karadorde; 28th August 2011 at 02:03 PM.)
#3  
Karadorde's Avatar
Senior Member - OP
Thanks Meter 141
Posts: 488
Join Date: Aug 2010
Location: Sugar Creek

 
DONATE TO ME
reserved for more info at a later date
The Following 4 Users Say Thank You to Karadorde For This Useful Post: [ Click to Expand ]
 
dkelle4
Old
#4  
dkelle4's Avatar
Recognized Developer
Thanks Meter 80
Posts: 432
Join Date: Jun 2010
Location: Chicago, IL

 
DONATE TO ME
excellent tutorial. answered a lot of questions i had
The Following User Says Thank You to dkelle4 For This Useful Post: [ Click to Expand ]
 
-shift-
Old
#5  
-shift-'s Avatar
Senior Member
Thanks Meter 822
Posts: 4,596
Join Date: Jun 2010

 
DONATE TO ME
w00t w00t! thanks for this, dude!
 
DrRyder
Old
#6  
DrRyder's Avatar
Senior Member
Thanks Meter 184
Posts: 944
Join Date: Aug 2009
Location: Port Richey, FL

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

A lot of information in there that I have bookmarked and used without problems.
Dr. Ryder
 
Karadorde
Old
(Last edited by Karadorde; 16th March 2011 at 10:58 PM.)
#7  
Karadorde's Avatar
Senior Member - OP
Thanks Meter 141
Posts: 488
Join Date: Aug 2010
Location: Sugar Creek

 
DONATE TO ME
Quote:
Originally Posted by raiden89 View Post
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.
 
DrRyder
Old
#8  
DrRyder's Avatar
Senior Member
Thanks Meter 184
Posts: 944
Join Date: Aug 2009
Location: Port Richey, FL

 
DONATE TO ME
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.
Dr. Ryder
 
dkdude36
Old
#9  
dkdude36's Avatar
Recognized Themer
Thanks Meter 713
Posts: 3,901
Join Date: Aug 2010
Location: los angeles

 
DONATE TO ME
thank you so much for making this. now people will stop bothering me and tiffany about our fantastic zips not working in cwm 3.+

OFWGKTA
Yes, i am in 9th grade. No, that does not mean you are better than me.
if you feel the need to give me some lunch money, please donate!
or just give me a thanks or two so i can look better than others...
i'm a bitch (lost that ics release date bet thing)
Email and Gtalk: dkdude36@gmail.com
 
nubecoder
Old
#10  
nubecoder's Avatar
Recognized Developer
Thanks Meter 553
Posts: 567
Join Date: Dec 2010

 
DONATE TO ME
Some more resources for you all...

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

=]
"Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." --Albert Einstein
Check GitHub and Google Code for my sources.

The Following 2 Users Say Thank You to nubecoder For This Useful Post: [ Click to Expand ]