Team D1-MIUI Example MOD

Discussion in 'Team D1-MIUI' started by zenulator, Oct 20, 2010.

  1. zenulator
    Offline

    zenulator Premium Member Premium Member Developer

    Joined:
    Jul 12, 2010
    Messages:
    194
    Likes Received:
    0
    Trophy Points:
    0
    I'm doing this as an example of what a Mod should be.

    A good example is the iOS theme. It only updates the necessary parts of the rom that need changing to get the desired effect. EDIT JAMEZELLE: also makes debugging easier

    So making an update "mod"

    I'll upload a shell update and explain the update script.

    Unzip the example.

    Inside you will see 3 folders. system data META-INF

    system:

    system is where you are going to put your extra apps/ringtones/bootanimations

    if you want to add an app open up system and make an app directory and drop in your app(s)

    if you want to add ringtones from another rom open up system and make a directory called media and drop in the audio directory from the other rom

    if you want to add a different bootanimation the open up system and make a directory called media and drop in the bootanimation.zip from another rom or theme.

    data:

    data is where you want to copy downloaded apps that you don't want on system

    if you want to make an add on pack this is prob the best place for extra apps like wireless tether etc...

    open data and make a directory called app. drop your apps there.

    META-INF:

    this holds the update-binary and update-script as well as other information needed if your recovery requires zips to be signed. (not necessary on droid 1 using clockwork recovery)

    the update script is the only thing you want to modify. it is located at:

    com/google/android/

    navigate there and open the update script in a Coding text editor such as gedit or nano in linux or notepad ++ in windows.

    It should look something like the following:

    Code:
    show_progress(0.500000, 0);
    mount("MTD", "userdata", "/data");
    package_extract_dir("userdata", "/data");
    unmount("/data");
    mount("MTD", "system", "/system");
    package_extract_dir("system", "/system");
    set_perm(0, 0, 0755, 0644, "/system/app/foo.apk");
    set_perm(0, 0, 0755, 0644, "/system/app/foobar.apk");
    show_progress(0.100000, 0);
    unmount("/system");
    This update will copy whatever is in system and data to the rom.

    The set_perm part sets correct permissions for any app copied over. Change it accordingly.

    After your done rezip the system data and META-INF directories into a new zip and flash away.

    If successful upload your results and share it with everyone else.

    Attached Files:

  2. publicanimal
    Offline

    publicanimal New Member

    Joined:
    Jan 15, 2010
    Messages:
    474
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Austin, TX
    This is super helpful and a great reference, thanks. I had previously wondered how to push things into /data/ and this tells me how to do it.
  3. USCChem
    Offline

    USCChem New Member

    Joined:
    Mar 29, 2010
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Los Angeles, CA
    I'm so glad to be a good example! ;)

    I just thought I would add that if you're doing a theme that changes the shapes of the icons in the launcher, (like the iOS theme does), in order for people to be able to see the changes in the icon shape, the icons that MIUI created on its first boot need to be deleted. This series of commands (placed somewhere in the updater-script...my script for the iOS theme does it right before it does the system stuff) will do that:
    Code:
    mount("MTD", "userdata", "/data");
    delete_recursive("/data/system/customized_icons");
    unmount("/data");
    
    This is only useful for themes that change the customized icon shapes like the iOS theme.
  4. whiskeycoke
    Offline

    whiskeycoke New Member

    Joined:
    Jun 14, 2010
    Messages:
    205
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Iowa
    Awsome explanation! This post should be stickied in the Theme section. I've caught bits and pieces of this info in different threads but I haven't seen anyone break it down as easily as you have Zen. Thanks for your lines to USCChem.

    Now if I didn't suck so bad with photoshop I might be able to put a respectable theme together.
  5. publicanimal
    Offline

    publicanimal New Member

    Joined:
    Jan 15, 2010
    Messages:
    474
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Austin, TX
    I am using this code:
    mount("MTD", "userdata", "/data");
    package_extract_dir("userdata", "/data");
    unmount("/data");

    But still failing to push a local.prop file into /data/

    Any ideas? I can make changes to /system/ work all day long but I cannot push a file into the /data folder.

    EDIT: I figured it out!
    Correct code should read:

    mount("MTD", "userdata", "/data");
    package_extract_dir("data", "/data");
    unmount("/data");
  6. c_hale22
    Offline

    c_hale22 Theme Developer Theme Developer

    Joined:
    Mar 9, 2010
    Messages:
    207
    Likes Received:
    4
    Trophy Points:
    0
    Very nice zen. Def signature link material.
  7. teddyearp
    Offline

    teddyearp Active Member

    Joined:
    Jan 13, 2010
    Messages:
    1,800
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    Randle, WA
    And yes, excellent observation, as I was having the self same problem with the file and the script commands in the OP of this thread. Then I had to go back and re-read the PM's between publicanimal and I where we were trying to get this figured out when MIUI was first released. But you and I have it down now, eh publicanimal? Thx, zen, publicanimal, and myself. ;)