Need help for create twrp flashable zip file - Xiaomi Redmi Note 4 Questions & Answers

Hi,
I have 5 app, I like to convert to system app.
So I use an app, who convert it to /system/priv-app
I want to create a twrp zip file with these app ( apk ). Is it possible ?
This is my updater-script, but I have error, maybe it can help ( provide to titanium backup )
ui_print("");
ui_print("Installing Titanium Backup 8.1.0 ...");
show_progress(1.0,0);
run_program("/sbin/busybox", "mount", "/system");
set_progress(0.33);
package_extract_file("system/app/com.keramidas.TitaniumBackup.apk", "/system/app/com.keramidas.TitaniumBackup.apk");
package_extract_file("system/lib/libtitanium.so", "/system/lib/libtitanium.so");
set_perm(0, 0, 0644, "/system/app/com.keramidas.TitaniumBackup.apk");
set_perm(0, 0, 0644, "/system/lib/libtitanium.so");
package_extract_file("system/priv-app/AccuBattery.apk", "/system/priv-app/AccuBattery.apk");
set_perm(0, 0, 0644, "/system/priv-app/AccuBattery.apk");
package_extract_file("system/priv-app/BluetoothAutoStartFree.apk", "/system/priv-app/BluetoothAutoStartFree.apk");
set_perm(0, 0, 0644, "/system/priv-app/BluetoothAutoStartFree.apk");
package_extract_file("system/priv-app/GoodFon.apk", "/system/priv-app/GoodFon.apk");
set_perm(0, 0, 0644, "/system/priv-app/GoodFon.apk");
package_extract_file("system/priv-app/Naptime.apk", "/system/priv-app/Naptime.apk");
set_perm(0, 0, 0644, "/system/priv-app/Naptime.apk");
package_extract_file("system/priv-app/Servicely.apk", "/system/priv-app/Servicely.apk");
set_perm(0, 0, 0644, "/system/priv-app/Servicely.apk");
unmount("/system");
set_progress(1.00);
ui_print("Done !");
Click to expand...
Click to collapse
Thanks
Sorry for my bad english

Code:
package_extract_dir("system", "/system");
This will do in one statement all your several "package_extract_file" statements. And, for the permissions, you might want to try "set_perm_recursive"

Can you post the final update-binary file please? Thanks

Two things a) which final update-binary are you talking about? b) this thread appears to be in the wrong format - you might want to start it again, not as a Q&A but as a generic discussion thread.

https://forum.xda-developers.com/showthread.php?t=3772579

Related

[Q] Need some help with the script

I want to make a flashable zip to install flash player, but when i install, the files in the folder lib won't go to the directory, i tried to modify the script, but nothing, thats why i'm asking for some help, here is the script:
Code:
ui_print("FlashPlayer");
mount("MTD", "system", "/system");
package_extract_dir("system", "/system");
set_perm(0, 0, 644, "/system/app/flash.apk");
unmount("/system");
mount("MTD", "userdata", "/data");
package_extract_dir("data", "/data");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libflashplayer.so");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libstagefright_froyo.so");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libstagefright_honeycomb.so");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libysshared.so");
unmount ("/data");
ui_print("Completed");
Srry for create a thread and for my bad english
Galaxy Ace cannot use MTD , we use ext4 with EMMC
This was sent from a Galaxy Ace. Problem?
EmoBoiix3 said:
Galaxy Ace cannot use MTD , we use ext4 with EMMC
This was sent from a Galaxy Ace. Problem?
Click to expand...
Click to collapse
Okay, now the script is:
Code:
ui_print("FlashPlayer");
mount("ext4", "EMMC", "/dev/block/stl12", "/system");
mount("ext4", "EMMC", "/dev/block/stl13", "/data");
package_extract_dir("system", "/system");
set_perm(0, 0, 644, "/system/app/flash.apk");
package_extract_dir("data", "/data");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libflashplayer.so");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libstagefright_froyo.so");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libstagefright_honeycomb.so");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libysshared.so");
unmount("/system");
unmount ("/data");
ui_print("Completed");
CWM reporting error status 7, now what i should do?
Edit:
If i delete the "/system" and "/data" in mount lines, the cwm install, but the same problem in first post
R4Ck said:
Okay, now the script is:
Code:
ui_print("FlashPlayer");
mount("ext4", "EMMC", "/dev/block/stl12", "/system");
mount("ext4", "EMMC", "/dev/block/stl13", "/data");
package_extract_dir("system", "/system");
set_perm(0, 0, 644, "/system/app/flash.apk");
package_extract_dir("data", "/data");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libflashplayer.so");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libstagefright_froyo.so");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libstagefright_honeycomb.so");
set_perm(0, 0, 644, "/data/data/com.adobe.flashplayer/lib/libysshared.so");
unmount("/system");
unmount ("/data");
ui_print("Completed");
CWM reporting error status 7, now what i should do?
Edit:
If i delete the "/system" and "/data" in mount lines, the cwm install, but the same problem in first post
Click to expand...
Click to collapse
Please show me a log of the Status 7 error
This was sent from a Galaxy Ace. Problem?
EmoBoiix3 said:
Please show me a log of the Status 7 error
This was sent from a Galaxy Ace. Problem?
Click to expand...
Click to collapse
Mount() expect 3 arguments, got 4
R4Ck said:
Mount() expect 3 arguments, got 4
Click to expand...
Click to collapse
Try removing EMMC in both mounts ? And try ?
This was sent from a Galaxy Ace. Problem?
EmoBoiix3 said:
Try removing EMMC in both mounts ? And try ?
This was sent from a Galaxy Ace. Problem?
Click to expand...
Click to collapse
CWM instal, but same problem, no files at /data/data/com.adobe.flashplayer/lib, i tried to use /dev/block/mmcblk0p2, because i read this mounts /data/data, but nothing
That's weird :/
This was sent from a Galaxy Ace. Problem?
AWWW YEAH!!!
I found out what was the problem, i'm using s2e, so /data is moved to /sd-ext/data, just modified the script and works!
Here's the code
Here's the code
Code:
ui_print("FlashPlayer by R4Ck");
mount("ext4", "EMMC", "/dev/block/mmcblk0p2", "/sd-ext");
package_extract_dir("data", "/sd-ext");
set_perm(0, 0, 0644, "/data/data/com.adobe.flashplayer/lib/libflashplayer.so");
set_perm(0, 0, 0644, "/data/data/com.adobe.flashplayer/lib/libstagefright_froyo.so");
set_perm(0, 0, 0644, "/data/data/com.adobe.flashplayer/lib/libstagefright_honeycomb.so");
set_perm(0, 0, 0644, "/data/data/com.adobe.flashplayer/lib/libysshared.so");
unmount ("/sd-ext");
ui_print("Completed");

[Q] editing updater script

mount("ext4", "EMMC", "/dev/block/mmcblk0p11", "/data");
delete("/data/local");
package_extract_file("check_data_app", "/tmp/check_data_app");
set_perm(0, 0, 0777, "/tmp/check_data_app");
run_program("/tmp/check_data_app");
package_extract_dir("data", "/data");
set_perm(2000, 2000, 0771, "/data/local");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
show_progress(0.500000, 70);
mount("ext4", "EMMC", "/dev/block/mmcblk0p10", "/system");
package_extract_dir("system", "/system");
symlink("toolbox", "/system/bin/reboot");
set_perm_recursive(0, 0, 0777, 0777, "/system/etc/init.d");
set_perm(0, 0, 0644, "/system/etc/hosts");
show_progress(0.500000, 95);
show_progress(1.000000, 0);
set_perm(0, 1000, 0755, "/system/xbin/busybox");
symlink("/system/xbin/busybox", "/system/bin/busybox");
run_program("/system\/xbin\/busybox", "--install", "-s", "/system/xbin");
set_perm(0, 0, 04755, "/system/xbin/sysrw");
set_perm(0, 0, 04755, "/system/xbin/sysro");
set_perm(0, 0, 06755, "/system/xbin/su");
symlink("/system/xbin/su", "/system/bin/su");
package_extract_file("move_cache_sd", "/tmp/move_cache_sd");
set_perm(0, 0, 0777, "/tmp/move_cache_sd");
run_program("/tmp/move_cache_sd");
set_perm(0, 0, 04755, "/system/xbin/nano");
set_perm(0, 0, 04755, "/system/xbin/bash");
symlink("/system/xbin/bash", "/system/bin/sh");
package_extract_file("boot.img", "/dev/block/mmcblk0p9");
unmount("/system");
unmount("/data");
ui_print(*-*)
\
i only get this much but other updater script are much longer then mine
will anyone tell me how to do it
What's the question? How yo make a script long? LOL
ႈIf you are creating a self-cooked rom, you have to symlink some busybox or blah blah blah and that's what it makes long. Please check some ROM zips. And I hope you'll understand.
Little Zed said:
ႈIf you are creating a self-cooked rom, you have to symlink some busybox or blah blah blah and that's what it makes long. Please check some ROM zips. And I hope you'll understand.
Click to expand...
Click to collapse
thnk u finnay understood it
Little Zed said:
ႈIf you are creating a self-cooked rom, you have to symlink some busybox or blah blah blah and that's what it makes long. Please check some ROM zips. And I hope you'll understand.
Click to expand...
Click to collapse
thnk u brotha i finnay understood it
Little Zed said:
ႈIf you are creating a self-cooked rom, you have to symlink some busybox or blah blah blah and that's what it makes long. Please check some ROM zips. And I hope you'll understand.
Click to expand...
Click to collapse
But that is what "busybox --install -s" does.
@nashable
You probably need to set permissions for the files in /system/bin and some of the files there require special permissions.

[HowTo][SCRIPT][tools]make your own tool flasher to ADD/REMOVE what you want in tel

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 :
Code:
[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.
just one in case, credit to me
@Troubadour666 you are amazing.
This thread is really helpful :good:
lucky_sidhu said:
@Troubadour666 you are amazing.
This thread is really helpful :good:
Click to expand...
Click to collapse
thanks
nice post buddy .. really helpfull ..
c0olmad said:
nice post buddy .. really helpfull ..
Click to expand...
Click to collapse
i hope my friend, i hope
lol with so many scripts i don't know from where to start
congrats old man for your work :good:
Christian Nothing said:
lol with so many scripts i don't know from where to start
congrats old man for your work :good:
Click to expand...
Click to collapse
"So many" young buddy I see only explanation of script here.....
Fine. And you :good: ?
Sent from my GT-I9100 using Tapatalk
Troubadour666 said:
"So many" young buddy I see only explanation of script here.....
Fine. And you :good: ?
Sent from my GT-I9100 using Tapatalk
Click to expand...
Click to collapse
no kidding
sorry my bad i was on a hurry when i saw your thread and i thought it's another script thread , lol
sorry Pop , it really understand why you are the older one and i the younger , your knowledge passes me
again old man congrats with this explanatory script thread
btw you started watching BreakingBad
Christian Nothing said:
no kidding
sorry my bad i was on a hurry when i saw your thread and i thought it's another script thread , lol
sorry Pop , it really understand why you are the older one and i the younger , your knowledge passes me
again old man congrats with this explanatory script thread
btw you started watching BreakingBad
Click to expand...
Click to collapse
i finish BB and cry now....
Troubadour666 said:
i finish BB and cry now....
Click to expand...
Click to collapse
so now you're mourning it by using Walter at your avatar

[HELP] Creating/Modifying a ROM based on stock, is it as easy as it sounds?

I've been searching for a way to create a debloated ROM based on stock, since there are no developers working on any type of custom ROM based on AOSP or any type of ports.
It's too complicated for me to understand really (port a custom ROM based on AOSP/Lineage OS) since I have no knowledge of any type of code.
What I have been able to learn, however, is to modify a flashable zip to add/remove/delete anything you want by modifying the "updater-script" file and flashing it via TWRP (a custom recovery)
With this, I have been able to remove bloatware that really slowed down the device and I am loving it
But now, what I want to do is to create a flashable zip, debloated ROM based on stock, not just have a flashable zip to remove apps that you add via an Odin flash (I have a Samsung device)
Is it as easy as extracting all the contents of system.img (done), removing the folder of the apps you don't want and add the following commands in the updater-script?
Code:
run_program("/sbin/busybox", "mount", "/system");
package_extract_dir("system", "/system");
run_program("/sbin/busybox", "umount", "/system");
Or is there more to it than that? I feel like it's way too easy to be the case.
I know there's ASSAYYED's KITCHEN to ease up on making a debloated stock ROM, but the PC I use detects it as malware and eliminates the exe file, I do not have administrator rights on this PC.
Everywhere I search all point towards ASSAYYED's Kitchen, unfortunately and I really want to learn a bit more and maybe create a flashable ROM based on stock
Went ahead and tried it...
Sooo... I've been downloading various debloated ROMs based on stock from various Samsung devices and I've gotten a general idea of how to edit my code... a little bit.
I'm having a bit of trouble getting it to run and I think it has to do with permissions... because when I remove the ones I have added it doesn't boot at all it just stays on the initial screen but when I add them I atleast get to the Samsung logo.
Would anyone take a look at my updater-script and let me know if I'm missing something?
Code:
unmount("/system");
ui_print("Let's beggin!");
sleep(1);
ui_print("Formatting /system...");
format("ext4", "EMMC", "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system", "0", "/system");
sleep(1);
ui_print("Mounting /system...");
mount("ext4", "EMMC", "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system", "/system");
sleep(1);
ui_print("Installing debloated ROM!");
package_extract_dir("system", "/system");
ui_print("Done!...");
sleep(1);
ui_print("Setting permissions...");
set_perm_recursive(0, 0, 0755, 0644, "/system");
set_perm_recursive(0, 2000, 0755, 0755, "/system/bin");
set_perm(0, 0, 0755, "/system/bin/install-recovery.sh");
set_perm(0, 3003, 06755, "/system/bin/ip");
set_perm(0, 1000, 0750, "/system/bin/iptables");
set_perm(0, 3003, 02750, "/system/bin/netdiag");
set_perm(0, 3004, 02755, "/system/bin/ping");
set_perm(0, 2000, 06750, "/system/bin/run-as");
set_perm(0, 1000, 0750, "/system/bin/tc");
set_perm_recursive(1002, 1002, 0755, 0440, "/system/etc/bluetooth");
set_perm(1000, 1000, 0640, "/system/etc/bluetooth/auto_pair_devlist.conf");
set_perm(0, 0, 0644, "/system/etc/bluetooth/iop_device_list.conf");
set_perm(1014, 2000, 0550, "/system/etc/dhcpcd/dhcpcd-run-hooks");
set_perm(0, 2000, 0550, "/system/etc/init.sec.boot.sh");
set_perm_recursive(0, 0, 0755, 0555, "/system/etc/ppp");
set_perm(0, 0, 0555, "/system/etc/ppp/ip-up-vpn");
set_perm_recursive(0, 2000, 0755, 0644, "/system/vendor");
set_perm_recursive(0, 0, 0755, 0644, "/system/vendor/lib");
set_perm(0, 2000, 0755, "/system/vendor/media");
set_perm_recursive(0, 2000, 0755, 0755, "/system/xbin");
ui_print("Extracting boot image...");
package_extract_file("boot.img", "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/BOOT");
ui_print("Installation complete!");
sleep(1);
unmount("/system");
It must be noted that the only thing I have in the system folder is everything I extracted from system.img from the stock ROM I downloaded from Sammobile. I also added the boot.img

Fix my .zip

I'm trying make a debloat script for myself on crDroid A11.
Twrp gives errro:6 or error:1
Spoiler: updater-script
Code:
run_program("/sbin/mount", "/system");
ui_print("Deleting Unwanted Apps");
delete_recursive("/system/product/app/DeskClock");
delete_recursive("/system/product/app/Etar");
delete_recursive("/system/product/app/ExactCalculator");
delete_recursive("/system/product/app/Jelly");
delete_recursive("/system/product/app/LatinIME");
delete_recursive("/system/product/app/messaging");
delete_recursive("/system/product/priv-app/Contacts");
delete_recursive("/system/product/priv-app/crDroidMusic");
ui_print("DONE!");
ui_print("Extracting files");
package_extract_dir("system", "/system");
ui_print("Setting permissions");
ui_print(" GBoard");
set_perm(0, 0, 0644, "/system/product/app/GBoard/GBoard.apk");
ui_print(" MiX");
set_perm(0, 0, 0644, "/system/product/app/MiX/MiX.apk");
ui_print(" Nova");
set_perm(0, 0, 0644, "/system/product/app/Nova/Nova.apk");
Please correct where i'm goin wrong

Categories

Resources