PORTING ROMS FOR MEDIATEK
FEATURE OF THIS GUIDE- NOOB ---> EXPERT
I DONT KNOW THE METHOD I USE TO PORT WILL WORK FOR OTHER CHIPSET DEVICES OR NOT AS I ONLY USED MEDIATEK DEVICE.
-----------------------------------------------------------------------------------------------------------------------------------
WORK BEGINS
-----------------------------------------------------------------------------------------------------------------------------------
THINGS NEEDED
WORK BEGINS
-----------------------------------------------------------------------------------------------------------------------------------
THINGS NEEDED
(INSTALL BELOW THINGS AS PER YOUR OS BIT VERSION,IF YOU HAVE 32 BIT OS THEN INSTALL 32 BIT STUFFS AND IF YOU HAVE 64 BIT OS THEN CHOOSE 64 BIT STUFFS.)
- WIndows Running PC or Laptop.
- JAVA - Download
- Cygwin - Download
- 7zip Compressor-Download
- Notepad++ -Download
- Android Kitchen- Download
- Time(as per you how much take to understand)
- Your Base Rom(stock Rom,in any format-CWM flashable or SP_tools Flashable,Prefer to have Both)
- CWM Recovery
- SD card & Card Reader.(some phones do not have SD slot so no worry for them,i have alternative way)
- APKTOOL- DOWNLOAD
- SP_Flash Tools to Unbrick In case Device Get Bricked- Download
SETTING UP IMPORTANT THINGS FIRST
JAVA
- Download Java From Above link as per your OS type.
- Install it by running its setup like normal softwares.
CYGWIN
- Download Cygwin From Above link.
- Extract the Zip
- By default it will be installed at c:\cygwin .i also recommend to install at default location.
- Run Setup and Select "Install from Local Directory"
- Then is will ask for packages location.Verify it.
- Hit next-next and finish at the end.
- Now you see a Cygwin folder under "C" drive and a shortcut Icon at desktop.
NOTE:For some 64 BIT users this method might not work,they can download setup from here-Download & install it from internet instead from local packages and select all packages during installation.
7ZiP
- Download 7Zip From Above link as per your OS type.
- Install it by running its setup like normal softwares.
Notepad++
- Download Notepad++ From Above link as per your OS type.
- Install it by running its setup like normal softwares.
dsixda's Android Kitchen
- Download dsixda's Android Kitchen From Above link.
- Extract it and then it will be like this- Android-Kitchen-0.224\Android-Kitchen-0.224\orgianal_update,tools etc....
- Now open Android-Kitchen-0.224 folder and you will again find Android-Kitchen-0.224 folder,then rename it to only " kitchen " (small letters).
- Now directory will look like this- Android-Kitchen-0.224\kitchen\orgianal_update,tools etc....
- Now copy that kitchen folder which we renamed and paste to c:\cygwin\home"your_username""paste here"
- Now your cygwin directory will look like this- C:\cygwin\home\your_username\kitchen\orignal_updat e,tools,etc.....
- To check Kitchen is working,open cygwin from desktop and type - "cd kitchen" and hit enter(small letters).
- If no error shown then you have sucessfully installed it or if error like- bash:cd :kitchen:No such file or dirctory hen you should check above steps again.
- >>OPENING KITCHEN- open cygwin,type "cd kitchen" hit enter,now type " ./menu " and hit enter.Now kitchen will load.
WHICH ROMS YOU CAN PORT
- Port rom should be of same android version as your stock rom.Like if your stock rom is 4.2 then you should only try with 4.2.In some cased you can port higher versions like kikat too,it will require Custom kernel but we are skipping that.
- The device from you porting should have same chipset,like if your device is MT6589 then you shoul only try with MT6589 chip-sets.You can port from MT6589T to MT6589 or MT659M but you cannot port from MT6592.
- Choose the port rom from most close specification device,like screen size,screen resolution,dual-sim,etc....higher resolution to lower resolution resolution or lower to higher can be ported but not all boots up.
MAKING PORTING ENVIRONMENT
Registering Your Device To Kitchen:-This step will help to write updater script automatically.
- Open kitchen and select option 0(advance options) and then select option 12(tools for unpack and repack boot.img etc.) and press "a"(Extract kernel+ramdisk from boot.img,recovery.img etc.) and hit enter.
- Now a folder will be created Under kitcehn directory named like this- bootimg_040714_132352
- Now copy your CWM recovery.img for your device to this folder and check that the name must be - recovery.img if not then rename it. and hit enter in kitchen terminal.It will extract your recovery in that folder.
- Open up boot.img-ramdisk folder, and look for /system/etc/recovery.fstab or /etc/recovery.fstab or similar FSTAB file location. Open this file by notepad++ to find the mount points.
- Download below file and paste it to C:\cygwin\home\username\kitchen\tools\edify_defs .Now rename it to your device code name.Mine is A110Q so i used this file. You can use as your choice also.
- Then open this file and recovery.fstab with notepad++ and compare and replace mount points and save it.Means copy mount points from recovery.fstab and paste/replace into Your device codenamed file.
- Now if you done all above steps right then kitchen will make updater script for you.
- If you porting for Micromax A110Q then just Download the below File and paste it.No need to edit.Just paste it.
- --------->Micromax A110Q file - http://d-h.st/Qa5
- --------->IF you have any confusion or you are unable
to create this file then PM me your recovery.fstab file and i will make
it.
GET BOTH ROMS- STOCK AND PORT
- STOCK-Your stock rom which was provided by device manufacturer.
- PORT- The Rom you selected to port after comparing your device to port device.
GETTING STOCK ROM SYSTEM FOLDER
IF your Stock ROM is in already in form of CWM flashable
zip then create a Stock Folder in any drive of Computer and extract it
for further Use.
Basic Strurture od CWM FLASHABLE ZIPs:
IF YOUR ROM IS SP_TOOLS FLASHABLE THEN DO THESE TO EXTRACT SYSTEM FOLDER FROM IT:-
Basically IN SP_TOOLS flashable zips the folder structure is-
[STEPS]
Basic Strurture od CWM FLASHABLE ZIPs:
- META-INF
- SYSTEM
- DATA
- boot.img
IF YOUR ROM IS SP_TOOLS FLASHABLE THEN DO THESE TO EXTRACT SYSTEM FOLDER FROM IT:-
Basically IN SP_TOOLS flashable zips the folder structure is-
- DATABASE
- boot.img
- cache.img
- EBR1
- EBR2
- IK.bin
- logo.bin
- MBR
- MT65xx_Android_scatter_emmc.txt
- Preloaded_xxxxxx.bin
- recovery.img
- secro.img
- system.mg
- userdata.img
[STEPS]
- Extract system.img from stock rom zip to C;\cygwin\home\username\kitchen\original_update
NOTE:You should add kitchen folder to favorites panel in my computer as you will be using this folder very frequent. - Now open cygwin,type "cd kitchen" hit enter,now press- " ./menu " then android kitchen will load with lots of functions numbering from 1 to ...
- Press 1 to setup working folder now again hit Enter.Now it will ask you to choose an option to select working folder.Select system.img one folder by pressing its value and hitting enter.
- Now it will ask about changing working folder name,leave it as default and hit enter.So kitchen will now start copying rom to working folder.
- After Copying files it will auto prompt and open Ext2Explore application.In some cases it will show that error message that "unable to read disk,please make sure you are running appliacation with administrative rights."But don't worry,click ok.
- Now after Ext2Explore opened,click on "FILE" on upper left corner and click on "OPEN IMAGE".Now browse to kitchen directory and go through newly created working folder and you will find "ext4_system.img" under system folder.Select it.
- Right click on file selected in Ext2Explore and Click on SAVE,now browse to same folder where "ext4_system.img" was.Means newly created working folder/system under kitchen directory.
- Then it will extract "ext4_system.img" to same folder.After finishing extraction close the Ext2Explore application.Now hit Enter in kitchen,again it will say "warning,no boot.img found" .Do not worry,HIT ENTER and go with default.
- It will ask to view Rom info,you can skit this.
- So finally you got system folder under working folder.So copy that
system folder to any drive and rename it to Stock rom folder for further
use.
[TIP:-]
>>IF your Rom is odexed then you should deodexed it before copying to any other drive for further use<<
HOW TO CHECK THE ROM IS ODEXED:-
- GO TO SYSTEM/APP and SYSTEM/FRAMEWORK folder and see that for every file there is clone file ending with .odex .If there is then your rom is odexed.
WHAT IS DEMAERIT OF ODEXED ROM FOR DEVELOPERS-- You will not able to theme and modify your rom if system and framework is odexed so better deodex the rom.Deodexing will combine file and its clone .odex to one unit.
DEODEXING:-- AFTER SETTING UP WORKING FOLDER AND DOING ALL ABOVE STEPS,now hit 0 in kithcen and select 11 option and hit enter.
- IT will show number of odex files in your Rom.Now Select "b" option to deodexing all files,it will take some time.
- After done,it will show that "0" files left odexed in Rom,now exit
kitchen and Now you should copy your system folder to any drive for
furter use.
GETTING STOCK ROM BOOT.IMG EXTRACTED
[STEPS]
- Now open Kitchen and select 0(advance options) and Hit enter,now select option 12(tools for unpack and repack boot.img etc.)
- Under 12th option,press "a"(Extract kernel+ramdisk from boot.img,recovery.img etc.) and hit Enter
- Now a folder will be created Under kitcehn directory named like this- bootimg_040714_132352 Now copy your boot.img and paste into this folder.
- Now switch to Kitchen Terminal and press Enter.Then it will do some
process and extract your boot.img,Now copy that folder and save it to
any drive and Rename it to stock boot for further use.
NOW DOWNLOAD PORT ROM YOU CHOOSED TO PORT AND MOVE TO NEXT STEP BELOW.
PORTING
>>>>>>>Follow STEP I if you have port rom flashable via cwm.To check that your rom is flashable via cwm see above post for structure.Those who having SP Tools flashable port rom follow StepII directly<<<<<<
First we will port and check that rom boots or not by simple way,then if it boots then we will modify it and tweak it by using kithcen.Or you can skip this step I and directly follow step II but you have to do almost all things from step I in Step II except modifying updater script.If you do these things in step I then no need to do in Step II.
STEP I
- Make a folder and name it as you want and copy and paste your port rom zip in it,means make a clone file of it and we will be working with clone zip,always keep in mind.I said to copy paste as if your rom did not boot up then you have a backup of clean port rom.
- Now create a folder under original update of kitchen- " WORKING_XXXX "
- Then open zip using 7zip(make 7zip is as default app) and drag drop boot.img to " WORKING_XXXX " folder.Now Open kitchen and Press 1 to setup working Folder.And go with default in all steps forward.(keep 7zip opened,you will need to drag back boot.img in it)
- After working folder setuped.Now press 0 for advance option and hit enter.Now press 12 and hit enter.Now you press "w" to extract boot.img from working folder.
- After sucessful extraction you will find a folder under kitchen named BOOT EXTRACTED.
- Now you have to copy zImage from stock boot extracted folder(which was created by you in second post last step) to this BOOT EXTRACTED folder and replace it.
- Then switch to kitchen and press "b" to
build boot.img from BOOT EXTRACTED folder then after repacking boot.img
finish,you have to drag and drop only boot.img(kitchen/working
folder)(not meta-inf) to port rom zip.
- Now Open System Folder In port Zip and drag drop build.prop file out of it to anywhere you wish.
- Now edit it with Notepad++.
- Add this line if you are porting from a higher resolution device- ro.sf.lcd.density=220 .Change its value after rom boots as to your display resolution.If after rom boots up and everything looking large then reduce the value and if looking small then increase it.
- You can Edit These Values as desired:-
Code:ro.build.id= ro.build.display.id= ro.custom.build.version= ro.build.version.release=This is Andriod version That Displays in Settings ro.product.model= ro.product.brand= ro.product.name= ro.product.device= ro.product.manufacturer= ro.build.bluetooth.name=
- EDIT BELOW LINES TO SET YOUR TIMEZONE AND AREA REGION.You can find
your default details in your stock rom's build.prop which you extracted
earlier.
Code:ro.product.locale.language=(en for English,ru for Russian and other similar codes for other language) ro.product.locale.region=(us for usa, IN for india etc.) persist.sys.timezone=( Asia/kolkata for india,Asia/... different for different regions)
- Now after editing done drag build.prop to port zip.
- Now keep opened port zip one side and open stock rom system folder which we extracted in post 2.
- Open System/etc/firmware in both zip and stock folder.Now drag modem.img from stock folder to zip and drop it.
- Now head to lib folder in both.Here you have to drag and drop libcamercustom.so file to port zip.
- Go to system/lib/modules now,here drag and drop mtk_stp_wmt.ko file to port zip.If rom did not boots forward then you should drag and drop whole modules folder under system/lib of port zip.
- Go to usr/keylayout in both and drag drop Generic.kl file from stock to port zip.
- Lastly drag and drop a launcher like nova,apex or any to system/app/ of port zip in case port launcher did not worked.
- IF you rom did not booted by applying all above steps then replace these folder/files from stock to port:-
1)system/etc/firmware
2)system/lib/hw
3)system/lib/modules
4)system/vendor
- If your cwm port rom zip have these files then delete those.
---uboot.bin
---preloader
---logo.bin(you can keep it but you need your stock logo.bin which is available in sptool flahable roms.) - Your zip should look like this-
--Meta-inf
--system
--boot.img
--data (in some roms)
- After deleting the extra files you need to modify the updater script
which can be found
under,Meta-inf/com/google/android/updater-script...we are modifying by
own only this time as we have to check only.During building rom from
kitchen,it will be automatically created
as we registered our device.If we do not register our device in kitchen then during making roms from kithcen our current updater script will converted to update script which will be again converted to updater script and that will cause installation aborted error. - Now drag and drop updater script from zip to anywhere and open it with notepad++,now find lines below-
Code:format("ext4", "EMMC", "/dev/block/mmcblk0p7", "0"); format("ext4", "EMMC", "/dev/block/mmcblk0p5", "0"); mount("ext4", "EMMC", "/dev/block/mmcblk0p7", "/data"); mount("ext4", "EMMC", "/dev/block/mmcblk0p5", "/system");
- Here you have to deal with text in red.Your updater script may be different so use your brain and understand what i am saying forward.Text in red is mount point.In above mmcblk0p7 is mount point of data folder and mmcblk0p5 is mount point of system folder.So you need to replace mount points of updater script with your device mount points.You must found mount points of your device during registering device to kitchen.So open recovery.fstab or that kitchen/tool/edify_defs/your file with notepad++ and copy replace mount points from your device file to updater-script of port zip.If you find those lines any more places in updater script then also replace there.Here you only need some mind to use.For example if you edited and replaced red text then you must also replace orange text as they are also same.
- Remove the lines of the files which you removed in zip if there,like
uboot.bin,logo.bin,preloader etc...they will look like below codes,you
only need to find the line matching to the file you removed and deleat
that.
Code:package_extract_file("uboot.bin", "/dev/uboot"); or assert(package_extract_file("uboot.img", "/tmp/uboot.img"), write_raw_image("/tmp/uboot.img", "uboot"), delete("/tmp/uboot.img")); or assert(package_extract_file("preloader.img", "/tmp/preloader.img"), write_raw_image("/tmp/preloader.img", "preloader"), delete("/tmp/preloader.img"));
- And replace this line
Code:assert(package_extract_file("boot.img", "/tmp/boot.img"), write_raw_image("/tmp/boot.img", "bootimg"), delete("/tmp/boot.img"));
From this if any error occurs during installtion like boot.img assert failed.
Code:package_extract_file("boot.img", "/dev/boot");
- Drag back the updater-script to zip from where it was taken from.
What we have done above is that we drag and drop some stock files from stock rom to port zip without extrating it.
Now you are good to flash your ported rom.Make CWM backup if you want to go back to previous rom or rom did not booted.After that wipe data factory reset,wipe cache partition,wipe dalvic cahce under advance option and then format system under mount and storage OF CWM RECOVEY then install zip from sd card and install your zip.I said SD card in first post if your rom did not booted and you understood your mistake and modified your port rom zip then you can do that directly by transferring zip to sd and flash instead of installing or restoring another rom.But for the users with not sd card must save their CWM backup or a working cwm flahable Rom zip otherwise they will have to reflash the rom by SP tools if rom didnot booted.
STEP II
NOTES BEFORE BEGINNING STEP II :-
- If you ported your ROM using STEP I and booted then for modifying use this STEP II.
- If you tried porting rom using STEP I but it is showing installation aboted then follow this STEP II directly.
- IF you have SP Flash tools format port rom and you extracted system folder and boot.img from your stock rom using my method then Follow STEP II directly.
- STEP II contains some steps from STEP I,so if you already did those steps in STEP I and using same zip here then you can skip steps here.If you get confused then again do all steps.
STEP(A)- ADDING A WORKING FOLDER IN KITCHEN
FOR CWM ROM:-
- Create a folder " WORKING_XXXX " under kitchen/original _update if you haven't.If you having it then check that it is empty.
- Now open your port zip (or zip you ported through STEP I and was booted) and extract its System and boot.img to "WORKING_XXXX " folder.
- Open kitchen and press "1" to setup a working folder.
- Press Enter and select "WORKING_XXXX " folder by it assigned digit and hitting Enter
- Now it will ask for name,you may change it or leave it,it does not matter.Skip it by pressing Enter.
- It will start copying files to a working folder,wait sometime.
- After it will ask to view Rom info,then press Y and see its info as your wish.
- Now you have a working folder setup-ed.
FOR SP TOOLS ROM:-
- Extract system.img & boot.img from port rom zip to C;\cygwin\home\username\kitchen\original_update
- Run Kitchen and press "1" to setup working folder and hit enter.
- Now again hit Enter,this time it will ask you to choose an option to select working folder,Select system.img&boot.img one folder by pressing its value and hitting enter.
- Now it will ask about changing working folder name,leave it as default and hit enter.So kitchen will now start copying rom to working folder.
- After Copying files it will auto prompt and open Ext2Explore application.In some cases it will show that error message that "unable to read disk,please make sure you are running appliacation with administrative rights."But don't worry,click ok.
- Now after Ext2Explore opened,click on "FILE" on upper left corner and click on "OPEN IMAGE".Now browse to kitchen directory and go through newly created working folder and you will find "ext4_system.img" under system folder.Select it.
- Right click on file selected in Ext2Explore and Click on SAVE,now browse to same folder where "ext4_system.img" was.Means newly created working folder/system under kitchen directory.
- Then it will extract "ext4_system.img" to same folder.After finishing extraction close the Ext2Explore application.Now hit Enter in kitchen and go with default then Press y to view ROM info as per your wish.
- Now you have a working folder setup-ed.
STEP(B)-Porting Rom
PATCHING BOOT.IMG:-
- After successful creation of working folder you will find a new folder created named like-"WORKING_041214_135729".
- Open kitchen then Press 0 for advance option and hit enter.Now press 12 and hit enter.Now you press "w" to extract boot.img from working folder.
- After sucessful extraction you will find a folder under kitchen named BOOT EXTRACTED.
- Now you have to copy zImage from stock boot extracted folder(which was created by you in second post last step) to this BOOT EXTRACTED folder and replace it.
- Now switch to kitchen and press "b" to build boot.img from BOOT EXTRACTED folder then after repacking boot.img finish press x to exit and back to main menu.
- you will find build.prop under kitchen/your_working_folder/system/
- Edit build.prop with notepad++
- You can Edit These Values as desired:-
Code:ro.build.id= ro.build.display.id= ro.custom.build.version= ro.build.version.release=This is Andriod version That Displays in Settings ro.product.model= ro.product.brand= ro.product.name= ro.product.device=NAME OF FILE WHICH YOU USED TO REGISTER YOUR DEVICE TO KITCHEN ro.product.manufacturer= ro.build.bluetooth.name=
- EDIT BELOW LINES TO SET YOUR TIMEZONE AND AREA REGION.You can find
your default details in your stock rom's build.prop which you extracted
earlier.
Code:ro.product.locale.language=(en for English,ru for Russian and other similar codes for other language) ro.product.locale.region=(us for usa, IN for india etc.) persist.sys.timezone=( Asia/kolkata for india,Asia/... different for different regions)
- Add this line if you are porting from higher resolution deice or
lower resolution device.If from higher to lower then put lower values
and if lower to higher then put higher values.
Code:ro.sf.lcd_density=xxx
- Now after editing done save it and exit.
Patching Rom With Some STOCK Rom Files:-
- Copy modem.img from stock Rom- System/etc/firmware to kitchen/working_folder/system/etc/firmware and replace it.
- Copy libcamercustom.so file from stock Rom- System/lib to kitchen/working_folder/system/lib and replace it.
- Copy mtk_stp_wmt.ko file from stock Rom- System/lib/modules to kitchen/working_folder/system/lib/modules and replace it.If ROM not booted then replace whole modules.
- Copy Generic.kl file from stock Rom- System/usr/keylayout to kitchen/working_folder/system/usr/keylayout and replace it.
- Download any launcher apk from net link nova,apex etc and paste into kitchen/working_folder/system/app/
- If after Building rom from next step,your rom did not booted then replace these files from stock to port then build rom.
1)system/etc/firmware
2)system/lib/hw
3)system/lib/modules
4)system/vendor
- After all above steps done,now switch to kitchen and press 99 to build ROM.
- But before pressing 99 check that you put name of file by which you registered your device to kitchen in build.prop/ro.product.device="".If you registered with name x then put like this-ro.product.device="x"
- If you have not done above step then you will get installation aborted error during installation.If you are confused to register device send me required fies as asked by me in above post.
- After all checked now press 99
- Select Build Option 1 then hit Enter
- Now it will ask to zip-lang the apk,do as your wish.
- After that step it will convert Updater Script and ask two option,Proceed or cancel,then Proceed by pressing "y".
- It will then start making update.zip.Wait some time.
- Next it will ask to sign the zip or not?You should go with default by signing update zip by hitting Enter or Pressing "y" then pressing enter.It will take some time.
- After that if you want to change your ROM name then put desired name by pressing y or leave as it is by hitting Enter or 'N' then enter.
- Collect you rom.zip from Output_zip folder created under kitchen directory.
- Flash it and check it.
- If you find some bugs then see post below to solve bugs or if you are not able to find bug solution below then post it.I will tell you how to solve it if i know.
Good Luck.
CREDITS: DIGYVIJAY KUMAR FOR HIS AWESOME GUIDE
0 comments:
Post a Comment