[Miscellaneous Android Development] Snigdho:
its about making patch modpack for my rom and

making update script full...

So,Let's start...

________________________________________

________________________________________

How to make modpack or patch...

Frist make sure that what you want to add on your

rom..like i want to add my modded

systemui,framwork_res,some importent app,some

brinery like su,mkbootimg,some wallpaper,new

ringtone,boot logo,boot animation and some app

with data...

ok now i explain you somethings which are very

very important...

frist in a modpack this folders are added..like>>>

1.Meta_inf

2.data

3.sdcard

4.system...etc etc...

you will also see more folder or file but now i will

tell you about this folders ^^^...

1.Meta_inf...

i think everybody know this folder...i give a short

example...

in this folder you will found update script and

update brinary...

[Q]what is update script?

[Ans.] updater-script - it is just a text file which

contains all the commands which tells the

clockworkmod what to do with the given

zip file. the updater-script is written in the edify

scripting language.

[Q]what is update brinary?

[ans] update-binary - it is a binary which is

requiered by the clockworkmod to translate the

human readable format of the updater-

script to machine readable format for execution

of the updater-script in our device.

now i think you would understand what is update

script and brinary...

ok now 2.Data folder...in data folder you can add

some app with data...fir this what you need?!!

Frist install your app on your mobile and mod

it...like i want to add Xposed installer with

frimwere updated in my modpack...so frist i

installed the app and open it..then click on install/

update...then reboot my device...now my modding

was complete...now its time to add it with data...

.

so i made a folder on sdcard like (modpack for my

rom) then open it and made another folder name

(data) then in data folder i made two folders like

(app) and (data)

then i opened root explorer and went to root

derectory...then go to data...then go to app folder

and choosed my app thats mean xposed...then

copied it to sdcard/modpack/data/app and again

go to root derectory/data...this time i go to data

folder and find my apps data.then copy it to

sdcard/modpack/data/data...thats all...

This is an example...now you can add you app

with data like i had added...but i recommend you

that dont add more then 4 apps with data...

ok now 3.sdcard...

by this folder you can add anythings to your

sdcard...like i want to add some themes of mi

home luncher and all kernel,profile of viper 4

fx...frist made (sdcard)folder on your sdcard/

modpack...now copy all things from your sdcard

which you want to add..like i copied viper4fx

folder from my sdcard and paste it to sdcard/

modpack/sdcard...you can add themes in this way

too...just copied the themes with the whole

derctory in your sdcard/modpack/sdcard

folder...like i copied miui folder to my sdcard/

modpack/sdcard folder...beacuse all themes of

miui are in miui folder...

now comes 4.System folder.. so make a folder

(system) on your sdcard/modpack...then open

system folder and made some folder like

app,etc,lib,bin,xbin etc if you want to add

somethings on your roms system folder..i think

every body know this folder...if you want to add

your modded app,just sing it and drop it to...

Now full completed...you can see some extra

folders and files...if you want to add these to then

comment here i will told you how add these

folder...or you can pm me too

________________________________________

now its time to make update script for your

modpack..

...........

frist copy a meta_inf to your sdcard/modpack and

open update script...delect all things...

you can edit this line as your wish>>>

ui_print(“xolo – next level”);

now see what is ui print?

ui_print – This command prints the prints the

word inside the quotations

Example – ui_print(“xolo – next level”); prints

xolo next level in your cwm recovery

______________________

then you need to mount system partition...and

also another pertition like data,etc (if you want

to add anythings to this folderd)...but no need to

mount sdcard...For mount system-

mount(“ext4″, “EMMC”, “/

dev/block/mmcblk0p5″, “/system”);

if you want to mount data folder then write data

insted of system like-

mount(“ext4″, “EMMC”, “/

dev/block/mmcblk0p5″, “/data”);

okey...done mounting...

Now see what is mount?

mount – This command mounts the partition, if

you want to add files to system partition you

have to mount system partition, data for data

partition

To mount system - mount(“ext4″, “EMMC”, “/

dev/block/mmcblk0p5″, “/system”);

Here mmcblk0p5 is the name of system

partition for mtk 6589 chipsets (this name

varies from device to device)

To mount data - mount(“ext4″, “EMMC”, “/dev/

block/mmcblk0p7″, “/data”); (partition name

varies from device to device)

_____________________

Now formating...what is format>

format - This command formats the partition

specified

It is highly recommended to include this

command to format system and data if you are

making updater-script for ROM

To Format system - format(“ext4″, “EMMC”, “/

dev/block/mmcblk0p5″, “0″);(partition name

varies from device to device)

To Format data - format(“ext4″, “EMMC”, “/

dev/block/mmcblk0p7″, “0″);(partition name

varies from device to device)

NB.dont use it in your modpacks script its for

custom rom....

_______________________

Now you done mounting and its time to install all

things in all folder thats mean extracting...like

sustem folder will extract in your system

pertition...data folder will be in data pertition

and sdcard folder in your sdcard...for extract

system files use this command>>>

package_extract_file(”system“,”/system”)

for data>>> just delect system and add data like.

package_extract_file(”data“,”/data”)

for sdcard do same...

Now what is this>>>

package_extract_dir(” “, “/”) – This command

extracts all the files from the folder mentioned

inside first quotation to the partition or

directory

inside second quotation

For system - package_extract_dir(“system”, “/

system”);

(this copies all files from system folder in zip to

system partition in phone)

For data - package_extract_dir(“data”, “/

data”);

____________________

Ok now symlink...

symlink("mksh", "/system/bin/sh");

the above command creates a symlink.

okay, now let's see about symlinks,

symlink is nothing but shortcuts, for example if

a file is requiered in two different places instead

of copy pasting the file

in two different locations, the file is copied to

one of the two locations and in the other

location a shortcut to the file(symlink)

is created. the source and the symlink can have

different names (actually this is the prime use

of symlinks).

to explain in a noob friendly manner,

take the above symlink, it creates a shortcut

(symlink) for the command "mksh" and places

it in the path of the operating system.

the shortcut(symlink) directs to the file "/

system/bin/sh" , so whenever the os gets a

request to execute the "mksh" command, the

actual

binary that gets excuted will be "/system/bin/

sh" .

creating symlinks saves a lot of space because

instead of copying the whole file and placing it

in requiered places we are just

creating shortcuts which directs to the source

file which can be placed anywhere in the file

system (generally placed in the path of the os)

i think you understood...if you not then dont

use...its just use then when you want to add

somethings on system/bin folder and its for

advance user..

______________________

ok now seting permission..its not need if you

wont want anything in system/bin...but if add

then you must need add permission for this gile

and seting petmission are really too much easy

and so funny just see what is it and how to

set>>>

set_perm_recursive - This command sets

permission for folders

here android uses unix permission system

in unix

4 – read

2 – write

1 – execute

so

rwx is 4+2+1 = 7

rw is 4+2 = 6

rx is 4+1 = 5

Example - set_perm_recursive(0, 0, 0755,

0644, “/system”);

In this 0 is a user id for owner that refers to

root. It means that permission owner for

system folder. and 0 is root user means it

unrestricted access to system. it is given in

order to run programs to run properly

second 0 also refers to root. but here it refers

to group id 0

we are only seeing about folders because

“set_perm_recursive” is a command that sets

permission to folders

next 0755 it means rwxr-xr-x permission has

been given to system folder and rw-r-r is set

for all folders inside system folder

hope you understan...

___________________

Now another things...and its use in seting

permissions to but its defferent just see>>>

set_perm – This command sets permission for

a specific file

Example - set_perm(1000, 1000, 0640, “/

system/etc/bluetooth/auto_pairing.conf”);

here the 1000 refers to user id system and

0640 is rw-r—–

and this command sets the permission rw-r—–

for the file auto_pairing.conf

this is use for one files auto_praing.conf

__________________

Now you need to unmount these folder which you

mounted...see it>>>

unmount – This command unmounts the

partition

Example - unmount(“/system”); – unmounts

system...you need to unmount another folder

too..like for unmount data>>>

unmount(“/data”);

___________________

ok guys all done...i hope you understood all that i

have told...if you not then ignore it...and now try

to make a script for your modpack...

____________________

now give you a short example of my modpack and

update script...

...................

in my modpack i have these folders>>>

1.meta_inf,

2.data,

3.sdcard,

4.system,

.....now have a look in my script >>>

ui_print("====================

===============");

ui_print("Installing cayno x v2 modpack for all

cayno x users");

ui_print(" ");

ui_print(" By: MD.Shafikul main dev of cayno x ");

ui_print("====================

===============");

ui_print("");

ui_print("mounting system");

show_progress(0.500000, 0);

mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/

system");

ui_print("mounting data");

mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/

data");

show_progress(0.200000, 0);

ui_print("[ ] Installing all files");

package_extract_dir("system", "/system");

show_progress(0.200000, 0);

package_extract_dir("data", "/data");

ui_print("installing themes ");

package_extract_dir("sdcard", "/sdcard");

set_perm(0, 1000, 0755, "/system/xbin/busybox");

symlink("/system/xbin/busybox", "/system/bin/

busybox");

ui_print("letast busybox installed");

run_program("/system/xbin/busybox", "--install", "-

s", "/system/xbin");

ui_print("installing abrouted!");

show_progress(0.500000, 0);

set_perm(0, 0, 06755, "/system/xbin/su");

symlink("/system/xbin/su", "/system/bin/su");

set_perm_recursive(0, 0, 0777, 0777, "/system/etc/

init.d");

ui_print("init.d activated!");

ui_print("jocking man... ");

show_progress(0.200000, 0);

unmount("/system");

ui_print("[*] unmount system succeced! ");

unmount("/data");

ui_print("[*] unmount dataoo succeced! ");

unmount("/sdcard");

ui_print("");

ui_print(" Thanks for downloading cayno x ");

ui_print(" Auto rebooting ");

sleep(2);

ui_print(" Please wait... ");

sleep(2);

run_program("/sbin/sleep", "5");

run_program("/sbin/reboot");

^^^^^thats all that i wrote

_______________________________________

NB.(must read)>>>1.General rule in updater-script

– all commands

should end with semi colon ; otherwise it

will show error and if cwm or twrp shows status

7 error the error is in updater-script

2.if you dont understand then ignore beacuse its

can bootlooped...

3.if felt in installing zip then pm me pr comment

here or give me your script i will try my best to

correct it...

4.if the post help you,then give me some

respect...please..

5.dont forget to click on like botton its can

inspared me to write more post...

6.if you copy these post then give me credit,if

you not then i will understood that you are a

busted...

7.and never stop customization

Credit goes to my friend Md. Shafiqul for writting this..

HIT A THANKS IF I HAVE HELPED YOU