[Galaxy S II Android Development] Troubadour666:
Hi All,

with some minimun knowlegde about script, i can help you with this tuto i have idea to share now .

How to make your own flasher to add or remove something in installed ROM on tel , in normal use of rom or on dualbooted rom.

For now, to dualboot, we use /data/sec_data/ folder instead of /preload/ folder and we symlink same way in normal use, with a modified symlink_tool script.

you can use one of the 2 flashers in attachment, depends of your type of usage rom, preload (normal) or dualboot.

Flasher have ,just necessary samples to show you, only empty folders and updater-script with symlink_tool corresponding script in /tmp/ folder too.

in this tuto :

Effective lines of script are in RED color. In Blue color, optionnal lines. In Bold Black , the explain.

sample updater-script :

common lines :

PRESENTATION Lines :

ui_print("");

ui_print(" ############################## ");

ui_print(" ############################## ");

ui_print("");

MOUNTING Lines:

unmount("/system");

unmount("/cache");

unmount("/preload");

run_program("/sbin/mount", "/dev/block/mmcblk0p9", "/system");

run_program("/sbin/mount", "/dev/block/mmcblk0p10", "/data");

run_program("/sbin/mount", "/dev/block/mmcblk0p7", "/cache");

run_program("/sbin/mount", "/dev/block/mmcblk0p12", "/preload");

CLEANING Lines: optionnal for a clean dalvik and cache during flash

ui_print("Cleaning cache and dalvik...");

delete_recursive("/cache");

delete_recursive("/data/dalvik-cache");

delete("/data/system/batterystats.bin");

COMMAND LINES SCRIPT TO ADD STUFF ON TEL

you can add subfolder in /data/ folder of your personnal flasher , like /data/app/ with some APKS or /data/local/ with bootanimation.zip for example , they will be added in your tel with this command

you can add subfolder in /system/ , the same way, they will be installed in your tel too. /system/bin/ , /system/etc/ ......

ui_print("Installing stuff ...");

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

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

for normal use of rom, like JB Sammy 4.1.2 with /preload/ partition :

package_extract_dir("preload", "/preload"); will extract system apks in /preload/symlink/system/app/ folder of partiton tel

if you use DUALBOOT , please use dualboot version flasher in attachment and put files system in /data/sec_data/ folder of ZIP.

package_extract_dir("data/sec_data", "/data/sec_data"); will extract system apks in /data/sec_data/ folder of partiton tel

package_extract_dir("data", "/data"); will extract system apks in /data/sec_data/ folder of partiton tel

COMMAND LINES SCRIPT TO DELETE STUFF in TEL

ui_print("Deleting stuff ...");

TO DELETE FOLDER

: just put his entire path in command below :

delete_recursive("/XXXXXX/...../YYYYYY/NAME FOLDER"); XXXXXX YYYYYY are parts of path to access folder to delete

sample :

delete_recursive("/data/data/com.android.SystemUI"); delete com.android.SystemUI folder in /data/data/

TO DELETE SPECIFIC FILE

: just put is apk name here, with his entire path to access too:

delete("/XXXXXX/...../YYYYYY/abcdefg.apk"); XXXXXX , YYYYYY , are parts of path to access to abcdef.apk file to delete

sample:

delete("/data/system/batterystats.bin"); delete batterystats.bin file in /data/system/ folder

SYMLINK Lines

package_extract_file("tmp/symlink_tool", "/tmp/symlink_tool");

set_perm(0, 0, 0777, "/tmp/symlink_tool");

run_program("/tmp/symlink_tool");

this symlink_tool is different on the two versions in attachment, be careful to use the good one.

PERMs Lines

be carreful, specific files in /system/ subfolders have some specifics rights and perms like some of them here as sample in case of installation ROM :

[COLOR="Blue"]ui_print("Setting Permissions");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 0, 0755, 0755, "/system/etc/init.d");
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm(0, 3003, 06755, "/system/bin/ip");
set_perm(0, 3003, 02750, "/system/bin/netcfg");
set_perm(0, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 06750, "/system/bin/run-as");
set_perm_recursive(1002, 1002, 0755, 0440, "/system/etc/bluetooth");
set_perm(0, 0, 0755, "/system/etc/bluetooth");
set_perm(1000, 1000, 0640, "/system/etc/bluetooth/auto_pairing.conf");
set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.conf");
set_perm(1002, 1002, 0440, "/system/etc/dbus.conf");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm(0, 2000, 0550, "/system/etc/init.goldfish.sh");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm_recursive(0, 0, 0755, 0644, "/system/vendor/firmware");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 06755, "/system/xbin/su");[/COLOR]

PERMs lines in all cases

set_perm_recursive(0, 0, 0755, 0644, "/preload"); preload (normal) case

or

set_perm_recursive(0, 0, 0755, 0644, "/data/sec_data"); dualboot case

set_perm(2000, 2000, 0771, "/data/local");

set_perm(0, 0, 0777, "/data/local/bootanimation.zip");

set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");

delete("/tmp/symlink_tool");

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

run_program("/sbin/umount", "/data");

run_program("/sbin/umount", "/cache");

run_program("/sbin/umount", "/preload");

ui_print("");

ui_print("");

ui_print(" ############################## ");

ui_print(" ############################## ");

ui_print(" Enjoy and Please reboot ");

thanks.