How To Port Rom

***How To Port Rom***



Follow STEP - I if you have port rom flashable via CWM.Those who having SP Tools flashable port rom follow STEP - II 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

1. 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.


2. Now create a folder under original update of kitchen- " WORKING_XXXX "


3. 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)


4. 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.


5. After sucessful extraction you will find a folder under kitchen named BOOT EXTRACTED.


6. 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.


7. 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.


8. Now Open System Folder In port Zip and drag drop build.prop file out of it to anywhere you wish.


9. Now edit it with Notepad++.


10. 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.


11. 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=

12. 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)

13. Now after editing done drag build.prop to port zip.

14. Now keep opened port zip one side and open stock rom system folder which we extracted in post 2.

15. Open System/etc/firmware in both zip and stock folder.Now drag modem.img from stock folder to zip and drop it.

16. Now head to lib folder in both.Here you have to drag and drop libcamercustom.so file to port zip.

17. 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.

18. Go to usr/keylayout in both and drag drop Generic.kl file from stock to port zip.

19. Lastly drag and drop a launcher like nova,apex or any to system/app/ of port zip in case port launcher did not worked.

20. IF you rom did not booted by applying all above steps then replace these folder/files from stock to port:-

a. system/etc/firmware

b. system/lib/hw

c. system/lib/modules

d. system/vendor

21. If your cwm port rom zip have these files then delete those.

a. uboot.bin

b. preloader

c. logo.bin(you can keep it but you need your stock logo.bin which is available in sptool flahable roms.I will also tell you how to create own logo.bin and bootanimation in below post.)

22. Your zip should look like this:-

a. Meta-inf

b. system

c. boot.img

d. data (in some roms)

23. 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.


24. 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");

25. 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.


26. 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 delete 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"));

27. And replace this line

assert(package_extract_file("boot.img", "/tmp/boot.img"),

write_raw_image("/tmp/boot.img", "bootimg"),

delete("/tmp/boot.img"));

28. From this if any error occurs during installtion like boot.img assert failed.

package_extract_file("boot.img", "/dev/boot");

29. 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.

No comments

Powered by Blogger.