How to port any ROM for Qualcomm Devices
Here is guide if you wanna learn How to port any ROM for Qualcomm Devices. This guide is made for porting any Qualcom ROMS with Same chipset. Using this method you can port any ROM like Linegae OS, MIUI or any other CM based ROMS.
Before starting the porting consider following guidelines and requiremnt.
1. The Port ROM and the Base ROM should have the same android version. (Example: Both should have 5.0.2 Lollipop)
2. Both the ROM should have same chipset and same processor.(Example: Both ROM should be ARM64 & MSM8939)
3. ROMs containing DAT(system.new.dat) files should be unpacked.
4. Should have PC with windows or any LINUX OS
5. Notepad++ to edit Scripts. (Download)
6. Meld to compare files & folders. (Download)
7. Winrar or Winzip for extracting zips.
8. Android Image Kitchen to modify boot.img. (Download)
Steps for Porting
Creat two folders as Boot Editing & ROM Porting.
In ROM porting folder create two folder as Port ROM & Base ROM.
Extract zip file of both the ROMS (i.e the your device stock ROM & the ROM you want to port) and place the extracted file contents in their respective folders.
From Port ROM folder delete some unwanted files and keep only ‘META-INF‘ folder, ‘data‘ folder(if available), ‘system‘ folder, ‘boot.img’ and ‘file_contexts‘ file(if available).
Open the updater-script file in PORT/META-INF/com/google/android/ with Notepad++. Then delete the first line containing “get_device_compatible(….”or”assert(getprop…” which restricts the flashing process.
Now unpack the Port Rom boot.img and Base ROM boot.img and place in two new folders as port boot & base boot respectively.
Replace the files boot.img-zImage, boot.img-dtb, boot.img-ramdisk.cpio.gz in BOOT-PORT/split_img/ with that of BOOT-BASE/split_img.
In the BOOT-PORT/ramdisk/ folder compare the file fstab.qcom with that of the base i.e. BOOT-BASE/ramdisk/fstab.qcom.
After this repack your boot.img and place it in your port ROM folder (i.e. PORT) and create a flashable zip. Now your ROM is ready to get flashed via TWRP.
Fixing common bugs after porting boot.img
After porting the boot.img file you may face many bugs. So here are common methods how you fix bugs
1. SD Card not mounting.
Replace BOOT-PORT/ramdisk/init.qcom.rc file from base to port. Remove ‘#’ from the lines containing scripts for mounting sdcard. You may also need to add some lines if missing in the port init.qcom.rc.
2. Sensors not working
Compare the port uneventd.qcom.rc in BOOT-PORT/ramdisk folder with that of base and add the missing lines to the port.
Even after doing the above steps you may find that sensors are not working then compare other BOOT-PORT files like uneventd.rc, file_contexts etc. with boot.img of base.
3. Camera & Led not working
Edit the init.rc and init.target.rc files by comparing from base boot.img files.
Making changes in file system
1. Debloating Port ROM
Delete unwanted apps or bloatwares from your port ROM. You will find them in /data/, /system/app/ and /system/priv-app/ folders.
2. Adding missing files and folders
You may add missing files from BASE/system/bin/to PORT/system/bin/. For this you can just copy all the files from BASE/system/bin/ to your PORT/system/bin/ without replacing any file.
Similarly do the same process in system/xbin/, system/fonts/, system/etc/, system/usr/ etc. and their sub-folders.
Also add some missing folders from your base ROM to your port ROM, e.g. system/tts folder, system/etc/init.d and other important folders.
4. Fixing permission
Just compare handheld_core_hardware.xml and platform.xml of port ROM with that of base and add or replace some lines if required from system/etc/permissionsfolder.
5. Replacing files
Copy and replace files in system/etc/firmware and in system/etc/wifi from base to port.
Copy and replace the files goodix.kl, gpio-keys.kl, Generic.kl in system/usr/keylayout/ from base to port.
6. Editing build.prop
You can edit required parts of build.prop to reflect the brand, model no. etc. according to your pference.
So finally by this method you learned How to port any ROM for Qualcomm Devices. So this was all about the topic How to port any ROM for Qualcomm Devices.
Enjoy & Happy Porting