[TUTORIAL] How to create an CWM installable .zip (Mod)

Search This thread

FlorisNL

Senior Member
Jun 28, 2011
523
415
Amersfoort
Hey guys, made an tutorial on how to make an CWM installable .zip :)

Requirements
Notepad++
An CWM/Feamod installable .zip for your device


Instructions:

1. Get yourself an CWM installable .zip for your device.
2. Extract the .zip
3. Go into the META-INF folder, delete CERT.RSA, CERT.SF and MANIFEST.MF.
4. go to META-INF/com/google/android
5. Right-Click on updater-script and select Notepad++
6. You see an script. Edit it. If you want to extract the folder (zip)/system/media/audio/ui use this script:
Code:
package_extract_dir("system/media/audio/ui", "/system/media/audio/ui");

ui_print("text"); means the text shown when you install the .zip in CWM.
run_program("text"); means that CWM runs a program
delete("/system"); means that you delete /system
package_extract_dir("framework", "/system/etc"); means that the files in /system/framework are extracted in /system/etc (on the device)


Make the script. My script for my iPhone Sounds is
ui_print("iPhone-Sounds by FlorisNL");
Code:
show_progress(1.000000, 0);

mount("ext4", "/dev/block/mmcblk0p15", "/system");
set_progress(0.400000);

package_extract_dir("system/media/audio/ui", "/system/media/audio/ui");
set_progress(0.800000);

unmount("/system");
set_progress(0.900000);

ui_print("Installed Iphone-Sounds. Enjoy.");
set_progress(1.000000);

When your done, create an .zip with 7z. and test it. If you still got problems, feel free to post it in this topic.
(Sorry for my poor english sometimes ;p)

Floris
 
Last edited:

O-T

Senior Member
Sep 28, 2010
934
389
No need to make CWM flashable mod for audio files.

Put ogg/m4a/mp3 files in

sdcard/Alarms
sdcard/Notifications
sdcard/Ringtones

Reboot and media scanner will make them available in Settings > Sounds.

sdcard/Ringtones/.nomedia <- (0 size file)
Reboot and media scanner skip the folder sdcard/Ringtones
 
  • Like
Reactions: FlorisNL

FlorisNL

Senior Member
Jun 28, 2011
523
415
Amersfoort
But I want to know. And im not porting ringtones only but also lock sounds, camera shutter sound, etc.

Sent from my GT-I9001 using xda premium
 

O-T

Senior Member
Sep 28, 2010
934
389
Then you must promise not to include aiPhaun sounds... :*

I don't want to be held responsible for distributing that to Android platform :\
 

wintel_mac

Senior Member
Jun 20, 2011
452
181
Nuremberg
Just take a normal zip for your device, extract it, look at the file in META-INF\com\google\android --> updater-script (edit only with notepad++ under windows os, otherwise with normal notepad or other software the line endings might get converted from UNIX style to windows style which will not work!)

Files to be copied will most likely be in a folder structure like \system\YourFile.

Be sure to remove in \META-INF files CERT.RSA, CERT.SF and MANIFEST.MF.
Those are the files that gurantee the file is correct and integer ("signed zip") will become invalid after repacking.

Then pack everything with 7zip (with format .zip and lightest compression) and make sure that when you open up your zip META-INF is in the zip root.

More information on updater-scripts can be found on XDA or google with search for edify script.
 

wintel_mac

Senior Member
Jun 20, 2011
452
181
Nuremberg
Yes. For example, this is the start of crybert's AIO package script for 9001.
Code:
ui_print(" AIO - Package v1 by crybert		");
ui_print("**********************************");
ui_print("  	root      					");
ui_print("  	busybox						");
ui_print("  	init.d						");
ui_print("  	custom bootanimation 		");
ui_print("  	FeaModRecovery 1.4			");
ui_print("**********************************");
ui_print("  Credits:						");
ui_print("  	manveru0 - FeaModRecovery	");
ui_print("  	KeksKlip - Root				");
ui_print("  								");
ui_print("**********************************");
show_progress(1.000000, 0);

ui_print("Preparing device");
mount("ext4", "EMMC", "/dev/block/mmcblk0p15", "/system");
package_extract_dir("system", "/system");
set_progress(0.200000);

ui_print("Activating SuperUser");
set_perm(0, 0, 06755, "/system/bin/su");
symlink("/system/bin/su", "/system/xbin/su");
set_progress(0.400000);
 

FlorisNL

Senior Member
Jun 28, 2011
523
415
Amersfoort
Yes. For example, this is the start of crybert's AIO package script for 9001.
Code:
ui_print(" AIO - Package v1 by crybert		");
ui_print("**********************************");
ui_print("  	root      					");
ui_print("  	busybox						");
ui_print("  	init.d						");
ui_print("  	custom bootanimation 		");
ui_print("  	FeaModRecovery 1.4			");
ui_print("**********************************");
ui_print("  Credits:						");
ui_print("  	manveru0 - FeaModRecovery	");
ui_print("  	KeksKlip - Root				");
ui_print("  								");
ui_print("**********************************");
show_progress(1.000000, 0);

ui_print("Preparing device");
mount("ext4", "EMMC", "/dev/block/mmcblk0p15", "/system");
package_extract_dir("system", "/system");
set_progress(0.200000);

ui_print("Activating SuperUser");
set_perm(0, 0, 06755, "/system/bin/su");
symlink("/system/bin/su", "/system/xbin/su");
set_progress(0.400000);

This is my script how it's now. It is installing but its not replacing the Lock.ogg - Unlock.ogg - TW_Unlock.ogg files... Can you help me?

Code:
ui_print("iPhone-Sounds by FlorisNL");
show_progress(1.000000, 0);

mount("MTD", "/system/media/audio/ui", "/system/media/audio/ui");
set_progress(0.400000);

package_extract_dir("system/media/audio/ui", "/system/media/audio/ui");
set_progress(0.800000);

unmount("/system/media/audio/ui");
set_progress(0.900000);

ui_print("Installed Iphone-Sounds. Enjoy.");
set_progress(1.000000);

My Folder:
Code:
system/media/audio/ui/Lock.ogg TW_Unlock.ogg Unlock.ogg
Code:
META-INF/com/google/android/updater-binary and updater-script
 
Last edited:

scheichuwe

Senior Member
Sep 23, 2009
473
270
happy place
This is my script how it's now. It is installing but its not replacing the Lock.ogg - Unlock.ogg - TW_Unlock.ogg files... Can you help me?

Code:
ui_print("iPhone-Sounds by FlorisNL");
show_progress(1.000000, 0);

mount("MTD", "/system/media/audio/ui", "/system/media/audio/ui");
set_progress(0.400000);

package_extract_dir("system/media/audio/ui", "/system/media/audio/ui");
set_progress(0.800000);

unmount("/system/media/audio/ui");
set_progress(0.900000);

ui_print("Installed Iphone-Sounds. Enjoy.");
set_progress(1.000000);

My Folder:
Code:
system/media/audio/ui/Lock.ogg TW_Unlock.ogg Unlock.ogg
Code:
META-INF/com/google/android/updater-binary and updater-script

Folders are ok.
script:
Code:
mount("ext4", "EMMC", "/dev/block/mmcblk0p15", "/system");
package_extract_dir("system", "/system");
All the rest is unneeded ui stuff. Nice to look at, not necessary...
 

FlorisNL

Senior Member
Jun 28, 2011
523
415
Amersfoort
Thank you so much! I did it :D http://xdaforums.com/showthread.php?t=1502660 here is the result so far :)

Sent from my GT-I9001
 
Last edited:

limitedMUSCL

Senior Member
Nov 23, 2013
494
171
San Giuseppe dei Campi
And be sure if you extracted the zip to a directory, when you zip back, zip what's INSIDE the folder and not the folder... yeah, I did that... :(

The updater-script must also be in UNIX format (definitely, but that mistake I didn't make... :D)

With CWM 6.0.4.4 you can zip with the "Ultra" compression in 7-zip and CWM will manage to open it.
 

bflmpsvz

Senior Member
Jan 26, 2013
552
45
Hi, can anyone help me with this
trying to create own package which CWM still fails to install
gives error E: failed to open update.zip (bad)
Aborted

Q1: Am I require to use 7zip and lightest compression?
Q2: what actually does the mount("ext4", "...) command do and is it required to use?
Q3: if I want to put custom apk file into /system/app/ and set rw-r-r permissions for it, which command do I use?
 

nikagl

Senior Member
Jun 11, 2006
2,878
619
51
Nieuwegein, NL
OnePlus 6
Hi, can anyone help me with this
trying to create own package which CWM still fails to install
gives error E: failed to open update.zip (bad)
Aborted

Q1: Am I require to use 7zip and lightest compression?
Q2: what actually does the mount("ext4", "...) command do and is it required to use?
Q3: if I want to put custom apk file into /system/app/ and set rw-r-r permissions for it, which command do I use?

A1: I always just zipped it, never looked at the compression quality. Just make sure to make a ZIP and not RAR or 7Z
A2: It mounts your system so you can write to it. Make sure to use an example mount command from a working ZIP of someone else for your specific device. The mount command is different in every device. On some recoveries with rooted ROMs you can use:
Code:
run_program("/sbin/busybox", "mount", "/system");
A3: For instance something like this:
Code:
show_progress(1.000000, 0);
 
ui_print("  Mounting SYSTEM...");
run_program("/sbin/busybox", "mount", "/system");
set_progress(0.100000);
 
ui_print("  Extracting files to SYSTEM...");
package_extract_dir("system", "/system");
set_progress(0.400000);
 
ui_print("  Setting /system/app/NAME.apk permission to 644...");
set_perm(0, 0, 644, "/system/app/NAME.apk");
set_progress(0.600000);
 
ui_print("  Unmounting SYSTEM...");
unmount("/system");
set_progress(0.900000);
 
ui_print("Install complete...");
set_progress(1.000000);

Why not use ADB for something like this (from your PC)?

Code:
adb remount 
adb push NAME.apk_here /system/app/ 
adb shell chmod 644 /system/app/NAME.apk 
adb reboot

Regards,

Nika.
 
  • Like
Reactions: bflmpsvz

bflmpsvz

Senior Member
Jan 26, 2013
552
45
Nice. I've found the error source - some files names had international accents. Now install passes to the end.

But another problem I have is that my files aren't mirrored into system.
Is package_extract_dir("system", "/system") recursive or do I have process every nested folder in it for extraction?

system\fonts
system\media\audio\alarms
system\media\audio\notifications
system\media\audio\ringtones
system\etc
system\bin
system\app

My script

Code:
ui_print("Integrating own fonts, sounds and customizations into system");
show_progress(1.000000, 0);
set_progress(0.000000);
package_extract_dir("system", "/system");
set_progress(1.000000);
ui_print("Installed custom files. Enjoy.");

Finishes successfully but when I boot into OS, the files aren't in place, and I install this zip as last package.
 

nikagl

Senior Member
Jun 11, 2006
2,878
619
51
Nieuwegein, NL
OnePlus 6
Looks to me like you're not mounting system. It therefore cannot add the files. Yes, with package_extract_dir it recursively extracts all files...

Verstuurd vanaf mijn E380 met Tapatalk

---------- Post added at 07:56 PM ---------- Previous post was at 07:52 PM ----------

BTW, in most cwm you can also mount system from the menu. Try that first and then run your script. Again, mounting system is required when you want to copy file to it. Figure out what command to use for your specific rom... Possibly also checkout how they do it for gapps and other generic installable zips...

Verstuurd vanaf mijn E380 met Tapatalk
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    Hey guys, made an tutorial on how to make an CWM installable .zip :)

    Requirements
    Notepad++
    An CWM/Feamod installable .zip for your device


    Instructions:

    1. Get yourself an CWM installable .zip for your device.
    2. Extract the .zip
    3. Go into the META-INF folder, delete CERT.RSA, CERT.SF and MANIFEST.MF.
    4. go to META-INF/com/google/android
    5. Right-Click on updater-script and select Notepad++
    6. You see an script. Edit it. If you want to extract the folder (zip)/system/media/audio/ui use this script:
    Code:
    package_extract_dir("system/media/audio/ui", "/system/media/audio/ui");

    ui_print("text"); means the text shown when you install the .zip in CWM.
    run_program("text"); means that CWM runs a program
    delete("/system"); means that you delete /system
    package_extract_dir("framework", "/system/etc"); means that the files in /system/framework are extracted in /system/etc (on the device)


    Make the script. My script for my iPhone Sounds is
    ui_print("iPhone-Sounds by FlorisNL");
    Code:
    show_progress(1.000000, 0);
    
    mount("ext4", "/dev/block/mmcblk0p15", "/system");
    set_progress(0.400000);
    
    package_extract_dir("system/media/audio/ui", "/system/media/audio/ui");
    set_progress(0.800000);
    
    unmount("/system");
    set_progress(0.900000);
    
    ui_print("Installed Iphone-Sounds. Enjoy.");
    set_progress(1.000000);

    When your done, create an .zip with 7z. and test it. If you still got problems, feel free to post it in this topic.
    (Sorry for my poor english sometimes ;p)

    Floris
    4
    Just take a normal zip for your device, extract it, look at the file in META-INF\com\google\android --> updater-script (edit only with notepad++ under windows os, otherwise with normal notepad or other software the line endings might get converted from UNIX style to windows style which will not work!)

    Files to be copied will most likely be in a folder structure like \system\YourFile.

    Be sure to remove in \META-INF files CERT.RSA, CERT.SF and MANIFEST.MF.
    Those are the files that gurantee the file is correct and integer ("signed zip") will become invalid after repacking.

    Then pack everything with 7zip (with format .zip and lightest compression) and make sure that when you open up your zip META-INF is in the zip root.

    More information on updater-scripts can be found on XDA or google with search for edify script.
    1
    No need to make CWM flashable mod for audio files.

    Put ogg/m4a/mp3 files in

    sdcard/Alarms
    sdcard/Notifications
    sdcard/Ringtones

    Reboot and media scanner will make them available in Settings > Sounds.

    sdcard/Ringtones/.nomedia <- (0 size file)
    Reboot and media scanner skip the folder sdcard/Ringtones
    1
    Hi, can anyone help me with this
    trying to create own package which CWM still fails to install
    gives error E: failed to open update.zip (bad)
    Aborted

    Q1: Am I require to use 7zip and lightest compression?
    Q2: what actually does the mount("ext4", "...) command do and is it required to use?
    Q3: if I want to put custom apk file into /system/app/ and set rw-r-r permissions for it, which command do I use?

    A1: I always just zipped it, never looked at the compression quality. Just make sure to make a ZIP and not RAR or 7Z
    A2: It mounts your system so you can write to it. Make sure to use an example mount command from a working ZIP of someone else for your specific device. The mount command is different in every device. On some recoveries with rooted ROMs you can use:
    Code:
    run_program("/sbin/busybox", "mount", "/system");
    A3: For instance something like this:
    Code:
    show_progress(1.000000, 0);
     
    ui_print("  Mounting SYSTEM...");
    run_program("/sbin/busybox", "mount", "/system");
    set_progress(0.100000);
     
    ui_print("  Extracting files to SYSTEM...");
    package_extract_dir("system", "/system");
    set_progress(0.400000);
     
    ui_print("  Setting /system/app/NAME.apk permission to 644...");
    set_perm(0, 0, 644, "/system/app/NAME.apk");
    set_progress(0.600000);
     
    ui_print("  Unmounting SYSTEM...");
    unmount("/system");
    set_progress(0.900000);
     
    ui_print("Install complete...");
    set_progress(1.000000);

    Why not use ADB for something like this (from your PC)?

    Code:
    adb remount 
    adb push NAME.apk_here /system/app/ 
    adb shell chmod 644 /system/app/NAME.apk 
    adb reboot

    Regards,

    Nika.