[Q] Creating a CWM flashable zip - AT&T Samsung Galaxy S II SGH-I777

Hey all,
I'm trying to create a flashable zip for myself, for some ringtones I have to manually copy to /system/media/ everytime I flash a ROM (I flash nightlies) so I want to simplify this task with this zip.
I'm software developer, I know my way around linux consoles but are in general inclined towards web development. So I can understand most of the process of creating cwm zips.
My first guess was to check how other cwm zips were made. I grabbed the sgs3 ringtones zip and check it up.
It looks like an easy task to do, just replace those ringtones with mine, since on updater-script they only copy whatever there is on "system" to "/system". Before that there's the mount /system, then after that, unmount system.
But this is where my question comes from. Mounting and Unmounting /system.
I've seem some CWM zips that mount this way:
Code:
run_program("/sbin/busybox", "mount", "/system");
However, busybox is definitely not at that location, I checked. It could be a symlink though, I don't know if root explorer doesn't show symlinks. Busybox seems to be in /system/xbin/busybox.
Also, my other question is for unmounting. I've seen this:
Code:
unmount("/system");
AND this:
Code:
run_program("/sbin/busybox", "umount", "/system");
So, as for the first question, is it safe to use that line of code for mounting /system? is there a "hidden" symlink to busybox somehow?
2. Unmounting /system, what's the difference between the unmount() command and using the run_program(busybox) command? They both work? Why are there two of them? Which one should I use?
On this CWM flashable zip I took as an example, they mount /system with busybox and unmounts /system with unmount("/system");
It's really confusing. Can anyone help me?

You can install busy box in either location, it works (at least for me) in /system/bin or /system/xbin. Someone correct me if I'm wrong.
Sent from my SGH-I777 using Tapatalk 2

Related

Anti-theft android system?

Hi there, guys. I don't know if I should ask this here or in the general forum, so... here I go.
I use cerberus in my nexus one since several months ago, and after watching the SassiBoB review of this program, I started to think how could I get it permanently configured into my system, just in case the thief knows how to restore the system configuration of the phone.
She says something about installing it as a system app with... ¿Rom manager?
I can't understand it perfectly, english isn't my mother tongue.
Anyway, I used titanium backup and I was able to get it installed as a system app (I could also add it to the rom zip, but... I know, I'm such a lazy ), so this step is done. Next problem: the configuration. When you do the factory reset, the configuration of the cerberus app is deleted, so it doesn't matter if it's installed or not. It won't work.
Is there any way to keep the configuration in the system, even if you do a system reset?
I know there are several other problems, like the root apps to flash the phone, or even the recovery menu, but I would like to solve all the problems step by step, and I think this is the first one.
Thank you, guys.
Pretty sure this belongs in the question section.
I don't have it cerb but, my friend told me you go to there website https://www.cerberusapp.com/ and there's a flashable zip you download and install with Rom manger.
Yes, you are right. In the cerberus web page there is a zip file which contains the cerberus app, so you can flash it as a rom, and it keeps it installed as a system app, but unfortunately there isn't any difference with the other methods. It keeps the app after a factory reset, but the configuration is deleted, so it's like the app isn't installed. I have already sent an email to them asking if there is a way to keep the configuration, but I haven't received any answer yet (and it's new year, it's weekend...).
OK, step done. They will release another version (2.0) that keeps a copy of the configuration in /etc/system, so if we add the apk and this file to the ROM, it will be safe.
Next step: the app is installed and configured BUT it has to be added to the list of devices administration in the security and privacy option (it has to manage the device). To add it, you must open the app and set the "activate" option, so we have the same problem that we had, so now it's not an app problem, but a ROM problem.
Is there any way to change the apps aded to the devices administrator option? I supose it should be, as the configuration has to be stored somewhere...
A little step more. I think I found the file where the administration params are stored. It's in /data/system/device_policies.xml
New problem: this file is in the installed system, but I can't find it in the ROM.
¿Any idea? Thanks
Another hint: I found this:
http://hi-android.info/src/com/android/server/DevicePolicyManagerService.java.html
It seems this is the class who creates the file. It should be easy to modify it so it adds the required data to the file. New problem: I can't find this class in the ROM file. I'll keep searching...
FOUND!
It's in services.jar, inside the framework directory.
It's necessary to extract the classes.dex, convert it into .jar, extract the DevicePolicyManagerService class and decompile it as java code, and here it is:
Code:
private static JournaledFile makeJournaledFile()
{
File localFile1 = new File("/data/system/device_policies.xml");
File localFile2 = new File("/data/system/device_policies.xml.tmp");
return new JournaledFile(localFile1, localFile2);
}
I think I should be able to modify it. I can't right now, but I'll post it when I try it.
I was trying to change that java file, but it's a real pain in the ass to recompile it and avoid all the errors. Then I realized that I can just modify the update script to copy the file (yes, I'm such an idiot lol).
I was trying to get it done with the update-script in META-INF/com/google/andriod/updater-script, but I can't get it working. A little help would be appreciated
Another update (Were you missing me?). I decided to modify the flasheable zip of the cerberus, so it has all the configuration files. I added the data/system/device_policies.xml and also de etc/cerberus_conf.xml files to this zip. Then, I changed the updater:
Code:
show_progress(1.000000, 0);
ui_print("Mounting /system");
run_program("/sbin/busybox", "mount", "/system");
set_progress(0.125000);
ui_print("Mounting /data");
run_program("/sbin/busybox", "mount", "/data");
set_progress(0.250000);
ui_print("Deleting old APK from /system");
delete("/system/app/Cerberus.apk");
set_progress(0.375000);
ui_print("Deleting old APK from /data");
delete("/data/app/com.lsdroid.cerberus.apk");
delete("/data/app/com.lsdroid.cerberus-1.apk");
delete("/data/app/com.lsdroid.cerberus-2.apk");
set_progress(0.500000);
ui_print("Extracting files to /system");
package_extract_dir("system", "/system");
set_progress(0.625000);
--------------ADDED-------------------
ui_print("Extracting files to /data");
package_extract_dir("data", "/data");
set_progress(0.680000);
---------------------------------------
ui_print("Unmounting /data");
unmount("/data");
set_progress(0.750000);
ui_print("Unmounting /system");
unmount("/system");
set_progress(0.875000);
ui_print("Installation complete!");
set_progress(1.000000);
It's a standalone zip file, so you need to flash your ROM and flash this zip file after it. Anyway,
WARNING
This doesn't work. After flashing the second zip file, the ROM won't boot (It keeps booting, with the boot animation in loop). I suppose I break the data directory or something like that. I'll keep trying.
Yep, I tried several things and the problem is with this line:
package_extract_dir("data", "/data");
It seems it breaks the data directory or something like that. The other files are copied perfectly.
OK, problem found with adb. With this command, it deletes completely the /data/system directory, so it keeps only the new file. Time to fix it...
EDIT: my fault. /data/system is empty until we start the system for first time. We must flash the rom, boot it, restart and flash the patch with cerberus. This is starting to be kinda stupid... If we do this, we can select cerberus in the administrators menu, instead of flashing anything...
Last post for the moment with partial conclussions.
When we do a factory reset, it deletes ALL the content of the data directory. So it's impossible to solve this problem just flashing anything after the ROM. Is the ROM who HAS TO COPY the device_priorities.xml into /data/system/. There isn't any other way, it would be erased after a factory reset.
Now, time to find out how to get it done by the ROM. I'll let you know as soon as I get it.
Work!
I did a full wipe (Wipe Data / Factory Reset + Wipe Cache Partition Wipe Dalvik Cache) and installed the official samsung rom (Android 4.1.2). I installed the flashable ZIP from the site on my galaxy s2 and did not have to reconfigure anything. Everything worked as it should. I believe that the application connects to the user's account based on the information of the device recorded previously.
Avast anti-theft has a Function to protect the configuration after a wipe. Just discover how avast achieves this.
(Translated via google translator)
That's the one thing is that even Avast and Cerberus won't escape if /system is formatted, but Avast did make it through a full SBF followed by factory reset on my phone.

[Q] Recovery script for removing system apps

I've been running CM nightlies as long as they've been available for my device (Samsung Captivate). After each flash though, I have to go in through Titanium Backup and uninstall a number of system apps (mail, exchange services, music, DSP manager, news & weather, dev tools) that I do not use for various reasons. I know the ROM runs fine without these elements, as I've been removing them for years now. Manually removing them wasn't such an issue until my phone received a TWRP recovery, which effectively gets me much closer to a "one-click" nightly update making the manual cleanup more of a burden to my lazy lifestyle.
My question is, I'd like to create a CWM flashable zip that contains only an update script that removes the system apk's that I specify. Using TWRP I'd like to be able to flash the update, the kernel, and my custom "cleanup" zip in that order. I know the path to all the subject apks, but I know little about scripting or creating CWM zips. Can anyone point me in the right direction to do so? I know my way around a bash script, but I'm not even sure if that's relevant.
Why not open the zip on you pc with, for example Winrar, and remove the apk files from system\app ?
Much easier!
airtower said:
I've been running CM nightlies as long as they've been available for my device (Samsung Captivate). After each flash though, I have to go in through Titanium Backup and uninstall a number of system apps (mail, exchange services, music, DSP manager, news & weather, dev tools) that I do not use for various reasons. I know the ROM runs fine without these elements, as I've been removing them for years now. Manually removing them wasn't such an issue until my phone received a TWRP recovery, which effectively gets me much closer to a "one-click" nightly update making the manual cleanup more of a burden to my lazy lifestyle.
My question is, I'd like to create a CWM flashable zip that contains only an update script that removes the system apk's that I specify. Using TWRP I'd like to be able to flash the update, the kernel, and my custom "cleanup" zip in that order. I know the path to all the subject apks, but I know little about scripting or creating CWM zips. Can anyone point me in the right direction to do so? I know my way around a bash script, but I'm not even sure if that's relevant.
Click to expand...
Click to collapse
Good source is here: http://forum.xda-developers.com/showthread.php?p=17684719
To remove files you'll want:
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p22", "/system");
delete("/system/app/blah.apk");
unmount("/system");
Your mount command will probably be different, so check the CM update-script for the equivalent one
RoadXY said:
Why not open the zip on you pc with, for example Winrar, and remove the apk files from system\app ?
Much easier!
Click to expand...
Click to collapse
I rarely use my own PC in the flashing process. Grandfathered in on an unlimited data plan, and I usually flash at work and connecting my phone to my work PC is verboten. Plus it takes about as much time to just uninstall them from TiBu.
Atarii said:
Good source is here: http://forum.xda-developers.com/showthread.php?p=17684719
To remove files you'll want:
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p22", "/system");
delete("/system/app/blah.apk");
unmount("/system");
Your mount command will probably be different, so check the CM update-script for the equivalent one
Click to expand...
Click to collapse
That's exactly what I need! Thanks a ton!!
Posted in that other thread linked here but going to ask here as well:
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?
script file
airtower said:
I rarely use my own PC in the flashing process. Grandfathered in on an unlimited data plan, and I usually flash at work and connecting my phone to my work PC is verboten. Plus it takes about as much time to just uninstall them from TiBu.
That's exactly what I need! Thanks a ton!!
Click to expand...
Click to collapse
Hello, I'm also looking for same. can you share your remove/delete apk script file. I'll make the necessary changes myself.
Thankyou
jd2050 said:
Hello, I'm also looking for same. can you share your remove/delete apk script file. I'll make the necessary changes myself.
Thankyou
Click to expand...
Click to collapse
I'm not using one anymore. This thread is nearly 5 years old.

[Q] New cooked ROM from android kitchen gets status 7 error when flashing

Okay so uh...I'm trying to make my own custom ROM from a stock Galaxy S3 sgh-i747, using dsixda's Kitchen.
My problem is that I am getting a status 7 error when trying to flash it.
Now I know, since I read the FAQ, that it has something to do with the updater-script. The only info I could gather is that you need to go in and change the format/mount code.
I have this:
Code:
format("ext4", "EMMC", "/dev/block/mmcblk0p14");
mount("ext4", "EMMC", "/dev/block/mmcblk0p14", "/system");
mount("ext4", "EMMC", "/dev/block/mmcblk0p15", "/data");
So I suppose my real question is...what am I supposed to change (it to) so I can make it work? (and what else might I need to change?)
Any help greatly appreciated!
Edit: Oh and um...I'm also wondering.... If I put any new apks in the rom (such as note2 camera, etc.), do I have to put specific code in the script for them? (I'm a bit new to all this--everyone starts somewhere I guess)
same issue with me also .. Any one there to help?
Figure out your mount points if this is your error, also depending on your update-binary youay need to change the format of the arguments
As for the question about adding .apks, yes you need to modify updater-script to reflect this, and it depends on what folder they are in for ROM.zip and what partition you want them stored in.
Can't answer any further without more info but Google is your friend
Sent from my Nexus 4 using Tapatalk 2
Thats why i don't use kitchen, you wont LEARN anything.
and then you have this kind of problems, and you cant fix them.
And the last reply it usefull, check your mount points.
may be the updater-binary making the cause, try updater binary of working rom.
TroubleShooter™ said:
may be the updater-binary making the cause, try updater binary of working rom.
Click to expand...
Click to collapse
Try from the stock rom first (if the stock is running the same Android os version)

[Q] CWM recovery doesnt work

Hi guys I am new here and I can write into this topic: http://forum.xda-developers.com/showthread.php?t=1721680
So here is my problem...
I made a zip file following the instructions here. The only difference is I need to put files into data (but there was an answer in the topic how to make it so.. I renamed the folder system to data and changed the script)
My script looks like this
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
ui_print("Enjoy!");
I put the .zip file into mnt/sdcard/clockworkmod/backup and tried to use titanium backup to run it...
But it always crashes when I click the file sample.zip
Whats wrong?Can I use other apps to start it?
LetisXXX said:
Hi guys I am new here and I can write into this topic: http://forum.xda-developers.com/showthread.php?t=1721680
So here is my problem...
I made a zip file following the instructions here. The only difference is I need to put files into data (but there was an answer in the topic how to make it so.. I renamed the folder system to data and changed the script)
My script looks like this
run_program("/sbin/busybox", "mount", "/data");
package_extract_dir("data", "/data");
ui_print("Enjoy!");
I put the .zip file into mnt/sdcard/clockworkmod/backup and tried to use titanium backup to run it...
But it always crashes when I click the file sample.zip
Whats wrong?Can I use other apps to start it?
Click to expand...
Click to collapse
what are you trying to do? Install an app?

Updater-script help

Hello everyone!
I am trying learning how to create cwm flashable items. I have some questions though.
While i was trying to see how an updater-script was made, i edited some scripts from cwm for themes, wallpapers etc.
I saw that some files have:
run_program("/sbin/unmount", "/dev/block/mmcblk0p2", "/system");
run_program("/sbin/unmount", "/dev/block/mmcblk0p10", "/system");
run_program("/sbin/unmount", "/dev/block/mmcblk0p12", "/system");
What does it stand for? Which is the difference between mmcblk0p2,mmcblk0p10 and mmcblk0p12?
Thanks in advance
Anyone?
Thhey are the mount points for the memory, they are different for each device. If you have some that work for your device that point to the system partition, then just use them. Changing them will mean you will get a bootloop, or the mod wont flash
gregbradley said:
Thhey are the mount points for the memory, they are different for each device. If you have some that work for your device that point to the system partition, then just use them. Changing them will mean you will get a bootloop, or the mod wont flash
Click to expand...
Click to collapse
Thanks mate, but what if i want to create a cwm for another device? How am i supposed to know which one fits?
See my flashable zip tool thread
On general section
Press thanks if I helped

Categories

Resources