CWM code questions - Galaxy S I9000 Q&A, Help & Troubleshooting

I don't like flashing things without knowing what do they do.
So it helps that I'm a programmer by day, and I make it a point to look at the code of the scripts I'm CWM-flashing.
I downloaded a modem from Perka's stash and I'm not sure what I'm looking at with this one:
Code:
package_extract_dir("updates", "/tmp");
show_progress(0.100000, 10);
set_perm(0, 0, 0755, "/tmp/redbend_ua");
set_perm(0, 0, 0777, "/tmp/redbend_ua");
run_program("/tmp/redbend_ua", "restore", "/tmp/modem.bin", "/dev/block/bml12");
set_perm(0, 0, 0777, "/tmp/redbend_ua");
run_program("/tmp/redbend_ua", "restore", "/tmp/zImage", "/dev/block/bml7");
show_progress(1.000000, 0);
I'm unsure about a few things here:
1. Why is there a need to chmod redbend_ua twice, and then again after running it?
2. We've run the first run_program, and we have a modem. Lovely. Why is the script then messing with the kernel? Especially since there isn't a kernel in this package. I have a suspicion this is simply a sort of template package, and you can put in a kernel, modem or both and it will work, but I'm unsure about this. (Also, how would it react in the case of a file being missing?)
On the whole - What scripting language is this? Where can I find a proper documentation for it? How do I create one myself? I've googled it plenty and didn't seem to come to a proper conclusion..

Why dont you PM Perka himself/herself? she/he would be the best person to answer your questions!!!
Good Luck

Related

need help write update script

hello i need your help.
i want to write an update script to make a backup of a file
here is my script, but i have a syntax error
mount("MTD", "system", "/system");
ui_print("Installing system...");
show_progress(0.100000, 0);
set_progress(1.000000);
mv /system/app/Email.apk /system/app/Email.original ;
set_perm_recursive(0, 2000, 0755, 0755, "/system/app/Email.apk");
set_perm_recursive(0, 2000, 0755, 0755, "/system/app/Email.original");
ui_print("ok");
unmount("/system");
Click to expand...
Click to collapse

[Q] redbend error in updater-script

No views? Cmon
mount("MTD", "system", "/system");
package_extract_file("redbend_ua", "redbend_ua");
package_extract_file("zImage", "zImage");
set_perm(0, 0, 0755, "redbend_ua");
run_program("redbend_ua", "restore", "zImage", "/dev/block/bml7");
(from voodoo script, working for me)
Okay, will try to mount system first. But i dont think that this is the error -.-
And the other lines are the same from mine...
Doesnt work. Still the same error...
Exchanged the update-binary with the one from Voodoo and now it works. ****, i have to learn how to compile my own update-binary. Help in this?

[SOLVED] Updater-script How to flash userdata in "data/data" with cwm???

Hi guys...
I'm trying to make a flashable zip that copy my user data in "data/data" folder.
I did this:
1) Create a zip file with "data" folder
2) "data" folder has contains "app" and "data"
3) Updater-script contains this:
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
unmount("/data");
Click to expand...
Click to collapse
My rom.zip flash correctly the rom and the apps in "data\app" but I don't see my preferences because the files in "data\data" were not copied.
What can I do?
What I must write on updater-script?
Thank you very much!
Example of my rom.zip: DOWNLOAD
SOLUTION:
Code:
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
set_perm(1000, 1000, 0771, "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/data");
package_extract_dir("sdcard", "/sdcard");
run_program("/sbin/busybox", "umount", "/data");
thanks to (Roadrunner Team Member)
Could you attach a sample zip with some random data (doesn't have to be some paid apps, free ones are sufficient)? Then I could look at the structure...
TheSSJ said:
Could you attach a sample zip with some random data (doesn't have to be some paid apps, free ones are sufficient)? Then I could look at the structure...
Click to expand...
Click to collapse
Thanks.
I do this in first post...
I'm waiting for you...
putting them in /data/data in the zip should work...
try this
package_extract_dir("example", "/data/data");
and put the files in the zip in the map example
owain94 said:
putting them in /data/data in the zip should work...
try this
package_extract_dir("example", "/data/data");
and put the files in the zip in the map example
Click to expand...
Click to collapse
Did you see the attached zip?
I have already done as you say ..
thank you very much
erestor6 said:
Did you see the attached zip?
I have already done as you say ..
thank you very much
Click to expand...
Click to collapse
Yeah i saw it but try the second one
Make a folder like system and data give it a rondom name you like and tell the updater script to flash folder "x" to /data/data
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
package_extract_dir("x", "/data/data");
set_perm_recursive(x, x, x, x, "/data/data");
unmount("/data");
Sent from my Optimus 2X using xda premium
Code:
mount("MTD", "[B]userdata[/B]", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
unmount("/data");
NickHu said:
Code:
mount("MTD", "[B]userdata[/B]", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
unmount("/data");
Click to expand...
Click to collapse
Thanks but but I already tried this script.
My problem is in "data/data"
owain94 said:
Yeah i saw it but try the second one
Make a folder like system and data give it a rondom name you like and tell the updater script to flash folder "x" to /data/data
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
package_extract_dir("x", "/data/data");
set_perm_recursive(x, x, x, x, "/data/data");
unmount("/data");
Sent from my Optimus 2X using xda premium
Click to expand...
Click to collapse
What should the value of x?
Code:
mount("EXT3", "/dev/block/mmcblk0p8", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
unmount("/data");
Rusty! said:
Code:
mount("EXT3", "/dev/block/mmcblk0p8", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
unmount("/data");
Click to expand...
Click to collapse
Thanks but my problem is about "data/data" not "data/app"
erestor6 said:
What should the value of x?
Click to expand...
Click to collapse
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
package_extract_dir("data2", "/data/data");
set_perm_recursive(x, x, x, x, "/data/data");
unmount("/data");
now you need to make your zip like this
- system
- - app
- - bin
- - lib
- - etc
- - etc
- - etc
- data
- - app
- data2
FILES FOR DATA/DATA HERE!! NOT IN A SUB MAP
one dash for folder in root of the zip
double dash for a subfolder in the root folder
for the x just try 777 and see if it flash if it does it will just work with 777
so this line
set_perm_recursive(x, x, x, x, "/data/data");
should be
set_perm_recursive(0777, 0777, 0777, 0777, "/data/data");
just try it i don't know if it even works i hope so!
owain94 said:
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
package_extract_dir("data2", "/data/data");
set_perm_recursive(x, x, x, x, "/data/data");
unmount("/data");
now you need to make your zip like this
- system
- - app
- - bin
- - lib
- - etc
- - etc
- - etc
- data
- - app
- data2
FILES FOR DATA/DATA HERE!! NOT IN A SUB MAP
one dash for folder in root of the zip
double dash for a subfolder in the root folder
for the x just try 777 and see if it flash if it does it will just work with 777
so this line
set_perm_recursive(x, x, x, x, "/data/data");
should be
set_perm_recursive(0777, 0777, 0777, 0777, "/data/data");
just try it i don't know if it even works i hope so!
Click to expand...
Click to collapse
I try also in this way but if I go (throught rootexplorer) in "data/data" there are only new files and not my files!
I tried to manually copy my configuration files in "data/data" folder and I immediately see my preferences working.
BUT WHEN I REBOOT THE PHONE I LOST MY PREFERENCES.
I noticed that the fonder that I manually copied in "data/data" had different permissions from the other folders in "data/data".
Other folders in in "data/data", all have the following code in permissions:
"rwxr-x--x"
in my opinion I have to set these permission in "data/data" but I don't know to which numbers correspond this code!
I have to set
set_perm_recursive(?, ?, ?, ?, "/data/data");
to obtain this code "rwxr-x--x"
Im having the same issue. Im trying to replace my libswypecore.so in data/data/com.swype.android.inputmethod ive tried manually doing it in root explorer with no prevail. I tried flashing and the file stays original. Any more ideas of what I can do?
Hunting for albino ducks in a snow storm.
1. get the recovery.log after you've flashed - that will tell you what the script is doing.
2. mount and look in /data/data in recovery before you reboot to tell you what the script left behind
3. log the first boot to see what Android does with /data/data upon boot
Self-help my friend using the tools you have.
Post all of those results if you have no success and we can take another look.
Bad script or bad permissions is my bet.
Probably wouldn't hurt to post up your updater-script for analysis either.
I ended up getting it to work but I think the permissions were screwing it up. At first I had "set_perm_recursive(0777, 0777, 0777, 0777, "/data/data")" and it actually turned my lib folder into some type of file (I don't know what as I have already deleted it). I deleted that line and it flashed. I had to manually edit the permission though. The file seems to be getting replaced from somewhere else tho upon reboot but thats a different thread. Anyone know how to set the "set_perm_recursive(xxxx, xxxx, xxxx, xxxx, "/data/data")" as to obtain permission of rwxr-x--x
smoochiezz24 said:
I ended up getting it to work but I think the permissions were screwing it up. At first I had "set_perm_recursive(0777, 0777, 0777, 0777, "/data/data")" and it actually turned my lib folder into some type of file (I don't know what as I have already deleted it). I deleted that line and it flashed. I had to manually edit the permission though. The file seems to be getting replaced from somewhere else tho upon reboot but thats a different thread. Anyone know how to set the "set_perm_recursive(xxxx, xxxx, xxxx, xxxx, "/data/data")" as to obtain permission of rwxr-x--x
Click to expand...
Click to collapse
That would be:
owner, group, dir, files
So if you want it owned by root (0):
Code:
0, 0, 0755, 0711
Or owned by system (1000)
Code:
1000, 1000, 0755, 0711
But I suspect these will be incorrect... they just don't look right (I'd try 0777, 0755) have a play around with chmod/chown in a recovery console first to see what they need to be.
Either way, 0777 will not work for the first two parameters, the only values you can reliably use here for system level files is 0 or 1000.
Indeed, if you use 0, 0, 0777, 0777 it's guaranteed to work, it's just a little less secure (not that it matters).
So, perhaps start with 1000, 1000, 0777, 0777 and then tighten down the last one to 0755 as necessary.
Hey guys I am from the MIUI Roadrunner Team and here is the code that will work. We use it for our own updater-script and it works perfect
Code:
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
set_perm(1000, 1000, 0771, "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/data");
package_extract_dir("sdcard", "/sdcard");
run_program("/sbin/busybox", "umount", "/data");
jackmu95 said:
Hey guys I am from the MIUI Roadrunner Team and here is the code that will work. We use it for our own updater-script and it works perfect
Code:
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
set_perm(1000, 1000, 0771, "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/data");
package_extract_dir("sdcard", "/sdcard");
run_program("/sbin/busybox", "umount", "/data");
Click to expand...
Click to collapse
It's true!
Thank you very very very much!!
Inviato dal mio LG-P990 usando Tapatalk

/etc/system/snd_soc_msm/snd_soc_msm_2x_fusion3 from Stock ROM

Hi, can anyone post the captioned file from stock roms? i want to compare it with cm/fxp's and see what's the problems with 2nd mic and maybe improve the low volume.
thx!
Android 4.3 FW (10.4.B.0.569)
Go Ahead
trying to push this into cm11 build, stopped by sony ric kernel it seems... tired, try again another day.
maybe i can make this a flashable zip? but how..?
nostupidthing said:
maybe i can make this a flashable zip? but how..?
Click to expand...
Click to collapse
I think you may check This Thread
DoO37 said:
I think you may check This Thread
Click to expand...
Click to collapse
tried, but when i flash it, it says something like "cannot mount /system"... apparently the script needs to adapt...?
here is an example
nostupidthing said:
tried, but when i flash it, it says something like "cannot mount /system"... apparently the script needs to adapt...?
here is an example
Click to expand...
Click to collapse
First You need to edit the META-INF\com\google\android\ "updater-script" file with any text editor (i suggest Notepad++)
and replace the line
Code:
[COLOR="Red"]mount("yaffs2", "MTD", "system", "/system");[/COLOR]
with
Code:
[COLOR="Lime"]mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");[/COLOR]
Second you should set the right permissions for the file (as for me i don't know what is the right one for system/etc ,i would use the whole "set permission" script from Sijav flashable zip ,it will work anyway
Code:
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_pair_devlist.conf");
set_perm(3002, 3002, 0444, "/system/etc/bluetooth/blacklist.conf");
set_perm(1002, 1002, 0440, "/system/etc/bluetooth/main.conf");
set_perm(1002, 1000, 0640, "/system/etc/bluetooth/auto_pairing.conf");
set_perm(1002, 1002, 0440, "/system/etc/bluetooth/audio.conf");
set_perm(3002, 3002, 0444, "/system/etc/bluetooth/bt_did.conf");
set_perm(3002, 3002, 0444, "/system/etc/bluetooth/bt_stack.conf");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm(0, 0, 0755, "/system/etc/install-recovery.sh");
set_perm(0, 0, 0755, "/system/etc/init.d/99SuperSUDaemon");
set_perm(0, 0, 0755, "/system/etc/init.d");
set_perm_recursive(0, 2000, 0755, 0644, "/system/etc/firmware/wlan");
set_perm(0, 0, 0644, "/system/etc/firmware/wlan/prima/WCNSS_cfg.dat");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm(0, 2000, 0755, "/system/vendor");
set_perm(0, 2000, 0755, "/system/vendor/camera");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/etc");
set_perm(0, 0, 0644, "/system/vendor/etc/audio_effects.conf");
set_perm(0, 2000, 0755, "/system/vendor/lib");
set_perm(0, 2000, 0755, "/system/vendor/lib/hw");
set_perm(0, 0, 0644, "/system/vendor/lib/libwvdrm_L3.so");
set_perm(0, 0, 0644, "/system/vendor/lib/libwvm.so");
set_perm(0, 0, 0644, "/system/vendor/lib/libWVStreamControlAPI_L3.so");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor/lib/drm");
set_perm(0, 0, 0644, "/system/vendor/lib/drm/libdrmwvmplugin.so");
set_perm(0, 2000, 0755, "/system/vendor/firmware");
set_perm(0, 0, 0644, "/system/vendor/firmware/libpn544_fw_c2.so");
set_perm(0, 0, 0644, "/system/vendor/firmware/libpn544_fw_c3.so");
set_perm(0, 0, 0644, "/system/build.prop");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
set_perm(0, 0, 06755, "/system/bin/su");
set_perm(0, 1000, 0755, "/system/xbin/busybox");
set_perm(0, 0, 0755, "/system/bin/ctrlaltdel");
Third your flashable zip only contains "etc" folder in root ,while it should be in system/etc
Anyway i made it for you ,haven't test it but it should work ,you may try flashing it and don't forget to take backup before flashing
with proper setperm.... : )
edit: handset volume seems better, but 2nd mic (e.g. video record) still work subpar, any idea to improve??
nostupidthing said:
with proper setperm.... : )
edit: handset volume seems better, but 2nd mic (e.g. video record) still work subpar, any idea to improve??
Click to expand...
Click to collapse
I wish that i could help ,but unfortunately i'm still having Locked Bootloader ,and not planning to unlock it till the end of warranty
Downgrading...
nostupidthing said:
with proper setperm.... : )
edit: handset volume seems better, but 2nd mic (e.g. video record) still work subpar, any idea to improve??
Click to expand...
Click to collapse
I had the same 2nd Mic problem with my ZR. It came with the 10.3.1.a.2.67 firmware out of the box. I went ape trying to find a solution since January. Luckily i found a post from user "nigoc" in Sonymobile forums who said downgrading the phone to 10.1.1.A.1.310 (JellyBean 4.1.2) solves the problem. I did it, and heck he was right. My camera now works as expected. All those "streaming-like" sounds in my video recordings are gone and the sound quality is very good.
I'm attaching the /etc/system/snd_soc_msm/snd_soc_msm_2x_fusion3 file from my phone. Hope it works in 4.2.2 :fingers-crossed:
il2stormo said:
I had the same 2nd Mic problem with my ZR. It came with the 10.3.1.a.2.67 firmware out of the box. I went ape trying to find a solution since January. Luckily i found a post from user "nigoc" in Sonymobile forums who said downgrading the phone to 10.1.1.A.1.310 (JellyBean 4.1.2) solves the problem. I did it, and heck he was right. My camera now works as expected. All those "streaming-like" sounds in my video recordings are gone and the sound quality is very good.
I'm attaching the /etc/system/snd_soc_msm/snd_soc_msm_2x_fusion3 file from my phone. Hope it works in 4.2.2 :fingers-crossed:
Click to expand...
Click to collapse
am not having "stream" noise in video recording... but low volume... think it's mainly 2nd mic, which in turn affect noise cancellation functionality.
i guess maybe cm/fxp devs used yuga (xperia z) config on zr, and that's causing a problem???
anyway, too tried to try now, later... later...
with soundfix (http://forum.xda-developers.com/showthread.php?p=52514028)

[Fixed] Error Flashing two flashable zips I created

I created two flashable zips that I'd like to use after every rom flash:
One is all my Layers overlay apks and the other is all the font files I want to use.
Here is my updater-script that I use in both zips, the only difference being the ui_print and file names, of course:
Code:
ui_print(" Installing Layers overlays... ");
ui_print(" ");
show_progress(0.99, 30);
run_program("/sbin/busybox", "mount", "/system");
package_extract_dir("system", "/system");
set_perm_recursive(0, 0, 0644, "/system/vendor/overlay");
show_progress(1.0, 1);
unmount("/system");
ui_print("----------------------------------------------");
ui_print("| Done!!! |");
ui_print("----------------------------------------------");
ui_print(" ");
And here is the error I get in recovery when I flash either zip:
Code:
set_perm_recursive() expects 5+ args, got 4
E:Error executing updater binary in zip '/sdcard/Mods/Zips/Layers-Themes-signed.zip'
Error flashing zip '/sdcard/Mods/Zips/Layers-Themes-signed.zip'
Obviously, I did set
Code:
set_perm_recursive(0, 0, 0644, "/system/vendor/overlay");
to be the right permissions. I know that the contents of that directory, /system/vendor/overlay need to be 644 but I don't know the proper edify script syntax for
Code:
set_perm_recursive(0, 0, 0644, "/system/vendor/overlay");
Does anyone know what I need to do differently to make these zips flash properly?
EDIT: I found this post that said that the correct syntax should be: set_perm_recursive(0, 0, 0755, 0644, "/system/vendor/overlay"); instead. Problem solved!!
I know you figured it out, but the set_perm_recursive needs 5 arguments (as stated in the error message you received). It would be for group:user ownership and then permissions for directories & files (in that order) followed by the directory that you're setting permissions in.
imnuts said:
I know you figured it out, but the set_perm_recursive needs 5 arguments (as stated in the error message you received). It would be for group:user ownership and then permissions for directories & files (in that order) followed by the directory that you're setting permissions in.
Click to expand...
Click to collapse
@imnuts, would it be this?
Code:
set_perm_recursive(0, 0, 0, 0755, 0644, "/system/vendor/overlay");

Categories

Resources