Hi,
This is a all in one guide for making custom roms for Infinix Hot 2.
The guide will have 3 parts:
1) Normal porting
2) Crossporting => Click here
3) Bug fixing => Click here
Disclaimer:
Code:
I, XDA or anyone else involved in the making of this guide
can NEVER be held for any damage to your device if you
follow an even small part of this guide. We won't bear
any responsability for dead sdcards, thermonuclear
explosions, fried mother, your device gave birth to a
dragon or goes to mars!
If anything happens, bad or good, consider it as fate and
live with it.
Basics & Terms:
Terms:
Stock ROM: This is your original ROM. Can also be called Stock.
Port ROM: This is the ROM you want to port. Can also be called Port.
Boot.img: This is the kernel and the ramdisk.
BootP.img: This should be Port ROM Boot.img
BootS.img: This should be Stock ROM Boot.img
Normal Porting: This is for porting from the same Chipset (MT6580 to MT6580)
Crossporting: This is for porting from a different but close Chipset (MT6582 to MT6580 or MT6592 to MT6580). These chipsets have Mali-400MP GPU with different cores.
Basics:
What is porting ?
Porting is simply making another device's software work on yours.
Benefits ?
Well, you can enjoy many custom UI beside the stock ROM's UI such as:
- Amigo OS
- HTC Sense
- Samsung Touchwiz
- Freeme OS
- Flyme OS
- Asus Zen UI
- Etc
Porting rules: PORTING ONLY WORK WITH SAME ANDROID VERSION. YOU CAN NOT PORT KITKAT ROM TO HOT 2. YOU CAN'T PORT MARSHMALLOW ROM WITH LOLLIPOP BOOT.IMG
Click to expand...
Click to collapse
Part 1: Normal porting
Fast and Automatic Porting Tool:
Update:
The XDA user @RendyAK created an awesome tool that will automate this process for you!
All you just need is Port ROM system.img and Boot.img
If your ROM comes in Recovery format, go to "Get Port ROM ready" section, because this tool requires a system.img
Download here Fastport v1.zip (Google Drive)
I. Get Stock ROM ready
A- Method 1:
1) Connect your phone to your PC.
- Make sure it's rooted and you're on stock rom.
- Make sure you have installed all necessary drivers including ADB, Fastboot, Vcom PreLoader etc.
- Make sure you have enabled "USB Debugging" in "Developer Options"
2) Create a folder on your desktop and name it "System". Open it and click on "Shift" on your keyboard now click "Open command window here"
3) Now type in the following command:
Code:
adb devices
adb pull /system
Once done, you should find your files in system folder you created in step 2.
4) Now time to extract stock boot.img. Type the following commands (press enter after each command):
Code:
adb shell
su
cd /sdcard
mkdir dd.out
dd if=/dev/block/platform/mtk-msdc.0/by-name/boot of=/sdcard/dd.out/boot.img
exit
adb pull sdcard/dd.out/boot.img
Now you should have boot.img inside system folder. Create a new folder and name it "Stock". Move boot.img from system folder created in step 2 to the newly created "Stock" folder. Move the system folder itself to "Stock" folder.
B- Method 2:
If for some reasons that doesn't work, then follow these.
1) Get a Stock ROM for your Hot 2 (Infinix 5.1 recommended).
2) Extract it, you'll get a folder with a bunch of files inside it. We just need boot.img and system.img
3) Download and extract this file Extract_System.rar
4) Open the extracted folder, open ext4_unpacker.exe and click on the little folder near the Exit button.
5) Locate the system.img file of the stock rom you extracted in step 2.
6) Wait till it loads, now select all the files on the right column. Right click and select "Extract", point it to the system (guide by Nonta, stolen by Nayan Deka) folder inside the extracted archive (extracted in step 3).
7) When done, move the system folder from the extracted archive to a new folder (name that new folder "Stock"). Copy boot.img from the extracted folder in step 2.
II. Get Port ROM ready
The Port ROM will come in either Recovery flashable or SP Flash tool flashable format. Procedure is different for each.
A- Recovery version:
If the ROM comes in Recovery version, you'll see system.new.dat inside the archive instead of system.img Follow these to get it extracted.
1) Download and extract the ROM
2) Download the this file Extract_System.rar and extract it somewhere.
3) Move everything except META-INF from the extracted folder in step 1 to the extracted folder in step 2.
4) Do "Shift" and right click to open CMD here. Now read the IMPORTANT.txt file. Open README.txt, copy one of the command and paste it in the CMD terminal. Press enter.
5) When done, you should see a new file named "new_system.ext4"
6) Open ext2explore.exe Click file and then Open Image, locate the "new_system.ext4" file.
7) When it's loaded, right click on the file on the right column and then save, point it to the "system" folder inside the extracted folder (extracted on step 2). When done move it to a new folder (name that folder "Port"). Also copy boot.img from the Port ROM to that folder.
B- SPFT version:
If the ROM is in SPFT format, then you'll see system.img and many other .img files.
Just follow Method 2 of Stock ROM extraction :cyclops:
If for some reasons it doesn't work, Follow these:
1) Download this program ImgExtractor.rarand extract it in the Port ROM folder alongside all the .img and .bin files.
2) Drag and drop system.img into the ImgExtractor.exe file. Wait till the end. You'll find the extracted system.img inside system_ folder.
3) Done! So easy
III. Porting
Once you have Stock ROM and Port ROM ready. You can now start to port.
A- Porting system:
1) Open Stock ROM and Port ROM folders side-by-side
2) Copy these files from Stock/system/lib: libcamalgo.so , libcameracustom.so . Paste them in Port ROM/system/lib folder, replace when prompted.
3) Go to Port/system/etc and delete "firmware" folder. Now go to Stock/system/etc and copy "firmware" folder from there to Port/system/etc
4) Open build.prop of port ROM with a text editor. Search for "qemu.hw.mainkeys" and set its value to "0". If it doesn't exist then add it at the end of build.prop. It should look like this qemu.hw.mainkeys=0 Sometimes the 0 value doesn't work, (guide by Nonta, stolen by Nayan Deka) you'll have to try with 1 (qemu.hw.mainkeys=1). If it still doesn't, then you'll have to use third-party navbars like "Simple Control" from Play Store.
5) Still inside build.prop, make sure that ro.sf.lcd_density value is 320. Save and exit.
A- Porting kernel:
1) Download Carliv Image Kitchen from this thread Extract it somewhere
2) Copy Stock boot.img to the extracted Carliv Image Kitchen/boot-ressources. Rename it to BootS.img
3) Move (yes, move) boot.img of Port ROM to Carliv Image Kitchen/boot-ressources. Rename it to BootP.img
4) Double click "Carliv.bat" and follow steps to extract both img files.
5) Now, open BootS folder, copy all the 9 files (not the ramdisk folder). Paste them in BootP folder. Replace when prompted.
6) Go back to Carliv Image Kitchen CMD window, make sure that BootP.img is selected. Now press "2" to repack the kernel.
7) When done, go to Carliv Image Kitchen/Output and copy the repacked boot.img (should be named boot_201x_xxx.img). Paste it in the Port ROM folder.
8) Copy the META-INF folder from "Extract_System.rar" archive. Paste it in Port ROM folder so that you have META-INF, system and boot.img.
9) Select all the files and zip them. Copy them to your Hot 2. Boot to recovery. Wipe data and factory reset. Click advanced wipe and select cache, dalvik-cache, system and slide to wipe. Go back and select your created ROM. Install!
10) Congratulations! You just ported a ROM to your Hot 2 :laugh:
Alternatively, you can simply follow these steps (only if Port ROM comes in SPFT format).
1) Extract both ROMs
2) Port Kernel using the above guide
3) Open SPFT, load the scatter file of your Stock ROM.
4) Uncheck everything. Click on boot column and load the ported kernel from step 2.
5) Click on system column and select system.img of the Port ROM
Flash your device with these two files.
!!! WARNING !!!
NEVER USE ANOTHER DEVICE'S SCATTER FILE.
THIS METHOD IS KNOWN TO EASILY CORRUPT SYSTEM PARTITION. YOU WILL HAVE TO MANUALLY FORMAT IT IN RECOVERY IF THAT HAPPENS.
Credits:
- xpirt
- Carliv
- And_PDA
Anyone is free to use my work. You are even free to give credits. But before doing so, remember that Android is about sharing. Open source is what makes Android's beauty. Many people work on MTK but they never expose all their porting secrets. Using this guide doesn't give you the right to port someone else's ROM without their permission.
Part 2: Crossporting
Before you continue, please understand these:
This section is intended for advanced users only. If you never ported a rom, please stop here!
- This Method is NOT fail-proof. Your device will simply bootloop even if you follow this guide.
- It does NOT work with AOSP based ROMs. Always bootloop.
- Only Cyanogenmod 12.1 ROMs are supported. CM-13 ROMs give black screen.
- It does NOT work if you port from sprout (4/8)
Click to expand...
Click to collapse
1) Get a stable CM-12.1 ROM for Hot 2. You can grab one here This will be called "Stock"
2) Get a CM-12.1 or based ROM for MT6582 or MT6592. This will be called "Port"
3) Extract both. Follow one of the methods in part 1 if needed.
4) Open both "Stock" and "Port" folders side-by-side.
5) Go to Stock/system delete (Guide by Nonta, Stolen by Nayan Deka) these: app, fonts, framework, media, priv-app, build.prop
6) Go to Port/system and copy app, fonts, framework, media, priv-app, build.prop from there to Stock/system. Copy any extra folder from Port/system to Stock/system (only extra folders. It's extra if it doesn't exist in stock rom).
7) Go to Port/system/bin and copy everything , paste them in Stock/system/bin. Skip when prompted! DO NOT REPLACE EXISTING ONES.
8) Repeat previous steps but this time copy from lib folder. Don't copy folders inside lib folder. Just .so files. Also do the same with files inside etc folder (copy just files inside "etc" folder) and xml files inside etc/permissions. Finally copy any extra folder that is in Port/system/etc folder and paste in Stock/system/etc.
9) Now go to Port/system/lib and copy these: libandroid.so, libandroid_runtime.so, libandroid_server.so, libandroidfw.so, libmedia_jni.so, libwebviewchromium.so, libwebviewchromium_loader.so, libwebviewchromium_plat_support.so now paste them in Stock/system/lib and replace the existing ones.
10) Repeat Step 7 with permissions folder, xbin folder and (Guide by Nonta, Stolen by Nayan Deka) vendor folder (including vendor subfolders).
11) Edit build.prop file in Stock/system and replace all MT6582 or MT6592 or sprout with MT6580. Also add the qemu.hw.mainkeys=0 line and make sure ro.sf.lcd_density value is 320
12) Now zip Stock folder and flash it.
If it doesn't boot then go to Part 3 for bug fixing.
Credits:
Special thanks to
@RendyAK
@Besik_13
Part 3: Fixing bugs
If your ROM boots, you'll likely get some bugs such as camera, sound, RIL etc.
For Stock or stock based ROMs
Audio fix:
Copy libaudio.primary.default from Stock ROM.
Camera fix:
If camera can't connect or force close
Copy libcamalgo.so and libcameracustom.so from stock ROM
If it still doesn't work, then copy all files with libcam from Stock ROM.
If it still persists, edit unpack boot.img using the method in Part 1. Compare both init.rc files and add extra lines from BootP/ramdisk/init.rc to BootS/ramdisk/init.rc
If camera size is wrong or swapped
Copy libcam.paramsmgr.so from Stock ROM
SIM card detection fix:
- Use Stock ROM's firmware folder
- Compare both build.prop files and make changes according (Guide by Nonta, stolen y Nayan Deka) to what is in Stock build.prop starting from # ADDITIONAL_BUILD_PROPERTIES DON'T TOUCH RINGTONE AND NOTIFICATIONS SETTINGS.
- Also think about restoring your IMEI or rewriting it using for example ToolHero.apk
For CM-12.1 or based ROMs
Bootloop fix:
- Unpack both BootS.img and BootP.img following the steps provided in Part 1.
- Compare init.environ.rc files and make changes according to what is in BootP init.environ.rc file. Only compare BOOTCLASSPATH section!
- Compare both init.rc files and add extra lines from BootP.
Shared by Rendy
RendyAK said:
Some more thing.
Fix bootloops:
After compare init.environ.rc.
Compare init.rc.
If some apps still FC after replace libwebchromexxx.so
Check the port updater-script/.img and check if there are some symlinks that arent in base one
Click to expand...
Click to collapse
If it still doesn't work, then sorry! I can't help further :fingers-crossed:
Sdcard detection fix:
If SD Card doesn't appear in file manager, follow these:
- Open Stock/system/framework/framework-res.apk file with 7-zip and go to res/xml. Extract storage_list.xml somewhere.
- Open Port/system/framework/framework-res.apk file with 7-zip and go to res/xml. Delete storage_list.xml. Drag and drop the storage_list.xml file you extracted in step (Guide by Nonta, stolen y Nayan Deka) one into 7-zip window.
RIL fix:
To fix RIL in cm-12.1 or based ROMs, follow:
- Unpack boot.img of your cm-12.1 or based ROM using the steps provided in Part 1. Let assume you named it BootS
- Go to BootS/ramdisk and edit init.modem.rc. Delete everything inside that file and copy paste the lines below.
Code:
# Copyright (C) 2012 The Android Open Source Project
#
# IMPORTANT: Do not create world writable files or directories.
# This is a common source of Android security bugs.
#
on post-fs-data
write /proc/bootprof "post-fs-data: on modem start"
# Modem related device nodes
mkdir /data/nvram/md 0770 root system
mkdir /data/nvram/md2 0770 root system
# Build-in Modified - S
# insmod /system/lib/modules/ccci_plat.ko
# insmod /system/lib/modules/ccci.ko
# Build-in Modified - E
# chown radio radio /sys/class/BOOT/BOOT/boot/md
chown radio radio /sys/kernel/ccci/boot
# xplod: this is not in the original mtk file... But I have no
# idea what kind of sorcery normally sets them
chown radio radio /dev/ccci_fs
chown radio radio /dev/ccci_ioctl0
chown radio radio /dev/ccci_ioctl1
chown radio radio /dev/ccci_ipc_1220_0
chown radio radio /dev/ccci_md_log_rx
chown radio radio /dev/ccci_md_log_tx
chown radio radio /dev/ccci_monitor
chown radio radio /dev/ccci_pcm_rx
chown radio radio /dev/ccci_pcm_tx
(Guide by Nonta, stolen y Nayan Deka)
chown radio radio /dev/ccci_uem_rx
chown radio radio /dev/ccci_uem_tx
#SeLinux
mkdir /data/ccci_cfg 0770 system radio
restorecon /data/ccci_cfg
restorecon_recursive /protect_f
restorecon_recursive /protect_s
# Encrypt phone function
setprop vold.post_fs_data_done 1
service gsm0710muxd /system/bin/gsm0710muxd -s /dev/ttyC0 -f 512 -n 8 -m basic
class core
user root
group radio cache inet misc
disabled
oneshot
service gsm0710muxdmd2 /system/bin/gsm0710muxdmd2 -s /dev/ccci2_tty0 -f 512 -n 8 -m basic
class core
user root
group radio cache inet misc
disabled
oneshot
service muxreport-daemon /system/bin/muxreport
class core
user radio
group radio cache inet misc
disabled
oneshot
service ril-daemon /system/bin/rild
class core
socket rild stream 660 root radio
socket rild2 stream 660 root radio
socket rild3 stream 660 root radio
socket rild4 stream 660 root radio
socket rild-ims stream 660 root radio
socket rild-debug stream 660 radio system
socket rild-oem stream 660 radio system
socket rild-mtk-ut stream 660 radio net_bt
socket rild-mtk-ut-2 stream 660 radio net_bt
socket rild-mtk-modem stream 660 radio system
socket rild-atci stream 660 root radio
user root
group radio cache inet misc audio sdcard_r sdcard_rw log system
disabled
oneshot
service ril-daemon-md2 /system/bin/rildmd2
class core
socket rild-md2 stream 660 root radio
socket rild2-md2 stream 660 root radio
socket rild-debug-md2 stream 660 radio system
socket rild-oem-md2 stream 660 radio system
socket rild-mtk-ut-md2 stream 660 radio net_bt
socket rild-mtk-ut-2-md2 stream 660 radio net_bt
socket rild-mtk-modem-md2 stream 660 radio system
socket rild-atci-md2 stream 660 root radio
user root
group radio cache inet misc audio sdcard_r sdcard_rw log system
disabled
oneshot
service md_minilog_util /system/bin/md_minilog_util
user radio
disabled
oneshot
#
# Modem related services (Begin)
#
service permission_check /system/bin/permission_check
class main
user root
group nvram
group system radio
oneshot
service ccci_fsd /system/bin/ccci_fsd 0
user root
user radio
group radio system
class core
oneshot
service ccci2_fsd /system/bin/ccci_fsd 1
user root
user radio
group radio system
class core
oneshot
service ccci_mdinit /system/bin/logwrapper /system/xbin/strace -s 1024 /system/bin/ccci_mdinit 0
user root
user system
group radio system
class core
oneshot
service ccci2_mdinit /system/bin/ccci_mdinit 1
user root
user system
group radio system
class core
oneshot
service ccci_rpcd /system/bin/ccci_rpcd 0
user radio
group radio system
class core
oneshot
service ccci2_rpcd /system/bin/ccci_rpcd 1
user radio
group radio system
class core
oneshot
service pppd_gprs /system/bin/pppd_dt /dev/ttyACM0 debug noauth refuse-eap usepeerdns nodetach
user root
group radio cache inet misc
disabled
oneshot
#Add by T.Zh for ppp daemon
service pppd /system/bin/pppd file /data/misc/ppp/ppp_options
user root
disabled
oneshot
#
#
# Modem related services (End)
#
#Add by hp.chen for
#
# Telephony Early Read service
#
service terservice /system/bin/terservice
class core
(Guide by Nonta, stolen y Nayan Deka)
user radio
group radio cache inet misc
oneshot
on property:ril.muxreport=1
start muxreport-daemon
- Repack the BootS.img and flash it.
- Download this file Fix_RIL_CM12.1.zip and flash it in recovery.
- Reboot your device, RIL should start to work. If not, try restoring or rewriting your IMEI.
Other bugs can be fixed using stock rom bug fixing methods as well
Credits:
Special thanks to
@RendyAK
@Besik_13
One more ...
good work,hope u will port more rom for our device :good:
Anything specific for 6.0
AonSyed said:
Anything specific for 6.0
Click to expand...
Click to collapse
This guide should apply without problem.
Some more thing.
Fix bootloops:
After compare init.environ.rc.
Compare init.rc.
If some apps still FC after replace libwebchromexxx.so
Check the port updater-script/.img and check if there are some symlinks that arent in base one
Can rendy tool be used to port Hot 3 firmware automatically?
Sent from my Infinix X510 using XDA-Developers mobile app
Mysteryagr said:
Can rendy tool be used to port Hot 3 firmware automatically?
Sent from my Infinix X510 using XDA-Developers mobile app
Click to expand...
Click to collapse
I'm not sure
Plus it doesn't seem to be stable.
You need to use the crossporting method for the Hot 3 ROM to work
Nonta72 said:
I'm not sure
Plus it doesn't seem to be stable.
You need to use the crossporting method for the Hot 3 ROM to work
Click to expand...
Click to collapse
Okay, I'm waiting for XUI version 2
Then I will give it a try
Sent from my Infinix X510 using XDA-Developers mobile app
---------- Post added at 12:03 PM ---------- Previous post was at 11:39 AM ----------
I know it is a stupid question, but how to edit "updater-script" cause always when I try to edit it I get flashing errors in recovery
Sent from my Infinix X510 using XDA-Developers mobile app
Mysteryagr said:
Okay, I'm waiting for XUI version 2
Then I will give it a try
Sent from my Infinix X510 using XDA-Developers mobile app
---------- Post added at 12:03 PM ---------- Previous post was at 11:39 AM ----------
I know it is a stupid question, but how to edit "updater-script" cause always when I try to edit it I get flashing errors in recovery
Sent from my Infinix X510 using XDA-Developers mobile app
Click to expand...
Click to collapse
Edit with Notepad ++ program
Make sure every line ends with an " ; " (without the quotes)
Nonta72 said:
Edit with Notepad ++ program
Make sure every line ends with an " ; " (without the quotes)
Click to expand...
Click to collapse
Thanks, btw I noticed that there are two roms for Hot 3 (3G Version) one with A1 in its name and the second has A2 in its name, do you know what's the difference?
Sent from my Infinix X510 using XDA-Developers mobile app
Mysteryagr said:
Thanks, btw I noticed that there are two roms for Hot 3 (3G Version) one with A1 in its name and the second has A2 in its name, do you know what's the difference?
Sent from my Infinix X510 using XDA-Developers mobile app
Click to expand...
Click to collapse
Nope
But I assume they are same
Tried porting Hot 3 using cross porting method and as my previous attempted, ended in bootloop :/
Sent from my Infinix X510 using XDA-Developers mobile app
Mysteryagr said:
Tried porting Hot 3 using cross porting method and as my previous attempted, ended in bootloop :/
Sent from my Infinix X510 using XDA-Developers mobile app
Click to expand...
Click to collapse
I will get back to you soon.
Nonta72 said:
I will get back to you soon.
Click to expand...
Click to collapse
Okay, take your time
Sent from my Infinix X510 using XDA-Developers mobile app
@Nonta72 there is something not clear for me in cross porting method, after step 7, any existing matching file should be skipped, as we do in step 7?
I mean in permission, xbin, vendor.. etc
Or they should be replaced?
Thanks in advance ^^
Sent from my Infinix X510 using XDA-Developers mobile app
Mysteryagr said:
@Nonta72 there is something not clear for me in cross porting method, after step 7, any existing files should be skipped!?
I mean in permission, xbin, vendor.. etc
Or they should be replaced?
Thanks in advance ^^
Sent from my Infinix X510 using XDA-Developers mobile app
Click to expand...
Click to collapse
Seemed clear to me
You shouldn't replace them. They should be skipped.
And something is wrong with your XUI porting.
You also need to port the kernel. I noticed that using the stock boot.img or boot.img from XUI (Note port) won't make it boot.
So follow kernel porting step too. I just applied crossporting method and kernel porting method, they worked.
USE XUI FROM HOT NOTE AS BASE! DON'T USE INFINIX 5.1 OR ANDROID ONE 5.1
:good:
Thanks for the tips, will try again today ??
Sent from my Infinix X510 using XDA-Developers mobile app