• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root [GUIDE] [General] [Rom Porting] CM Based Roms

Curtis1973

Android Expert
Jul 1, 2012
2,188
1,661
50
Greenville,SC USA
[GUIDE] [PORTING] [CM BASED ROMS]​


This Is NOT A 100% Sure Shot For Every Port. No Guide Is.​



- Requirements -​


Experience Level : NOT NOVICE :) Somewhere Above This Level Is A Nice Place To Begin LOL..​

Winrar​

Notepad ++​

Base Rom From Your Device That Works​

Port Rom With Similar Hardware Specifications To Your Device That Works...Mostly.
(meaning processor type,on board memory of all types,proper display size isn't to much of a biggie as long as the port rom is built using same dpi as your device..)​

Some Patience​

Ability To Diagnose Problems​

Testing Potential Ports And Finding Errors And Fixing If Possible
(Some Cant Be...)​


- Definitions -​

Base Rom Is Any CM Based Rom On Your Device That Has Already Been Built And Works,This Will Be Used As Base For The Port​

Port Rom Is What You Want Working On Your Device From Another Device Of Similar Type..There Are Many Out There.​





Let's Begin...



Step 1. Extract All Contents Of Base Rom To A Folder On Your Work PC Called "Base"


Step 2. Extract All Contents Of Port Rom To A Folder On Your Work PC Called "Port"


Step 3. We Will Start With Editing The Updater-Script (Located In Meta-Inf/Com/Google/Android Folder Of Base And Port Roms... First Open The Base Rom Updater Script In Notepad++. We Want To Edit All Lines You See In The Provided Picture Below (Mainly The Setting Permissions Lines..But You May See Something Near End Or Even At Start...Usually A Line Your Experience Tells You Needs To Be In The Base Roms Edited Updater-Script...Experience Here Is A Big Plus...). Open The Port Rom Updater-Script And Copy The Same Lines And Paste Them..Replacing The Base Roms Lines With Those From The Port Rom..Now There May Be Other Pertinent Items As All Roms Are Different. But In General These Are The Ones You Want To Change. You Will Have To Examine The Scripts. Anything That Looks As If It Needs To Be Added. Try It. May Result In Failure Of Script. But This Is What Porting Is. You Have To Try Many Things. Feel Free To Experiment.


perms.jpg



Step 4. Now We Want To Move On To Replacing The Files And Folders In System That Need To Be Replaced In Base Rom From Port Rom. First Delete From Base Rom folders App,Priv-app,Media,Fonts, And Framework. Now Copy Over The Same Folders From Port Rom To Base Rom.


Step 5. We Want To Enter Etc Folder Of Base Rom And Replace All Files In Permissions Folder Except Platform.xml and Handheld_core_hardware.xml With All Files Except Platform.xml and Handheld_core_hardware.xml From Port Rom.

(Now...In Some Port Tries..You Will Find You Just Need To Leave Original Base Rom Files In Permissions And ONLY Add Files From Port Roms Permissions Folder That Do Not Exist In Base Roms Permissions Folder....Trial And Error Folks.. In Some Ports This Step Causes Issues With Data,Hardware,Other..But In Some Ports It Will Cause Same Issues If You Do Not Do Step 5. No Hard And Fast Rule Here. Trial And Error. Must Do It To See If You Get Issues. And There Will Be Some I Assure You. And Some Wont Be Related To This Step But Some Will.)


Step 6. Now We Want To Copy Over All Files In Etc/Init.d To Base Rom From Port Rom Except 00banner. You May Encounter Issues Here With Items Associated With Key Layout,NFC And Other Depending On What Files Are In Init.d. Use Best Judgement To Decide After Opening These Files To See What They Are Trying To Accomplish As To Whether Or Not They Will Adversely Effect System. I Personally Leave Them Then Diagnose The Issues As I Go Along. If I Think One Or More Made Things Funky..I Remove It And Try Another Build.)


Step 7. This Step Is Important. Examine The Port Rom For Folders That Are Not In Base Rom..No Matter Where They Are. And Put Them In Base Rom In Same Location As They Were In Port Rom.

Step 8. Now We Want To Fix Framework-res.apk. Of Port Rom With A Few Files From Base Roms Framework-res.apk. Open Base Rom Framework.apk That You Swapped Over From Port In A Window Of Winrar And Navigate To XML Folder. Drag These Files In To The Apk From Original Base Framework-res.apk : Vendors.xml,Storage_list.xml,Power_profile.xml,Eri.xml And Apns.xml. Winrar Will Repack As You Go. Once Done Just Exit The Winrar Window And The New Files Will Be In Place.

Step 9. Here Is Where We Have To Experiment A Bit. First Do A Build WITHOUT Doing This. But If Calling Fails Or Phone Crashes,Etc..Do This... Copy Back To Base Rom Its Own Original Files From Framework Folder...The Files Are Telephony-common.jar,Telephony-msim.jar,Mms-common.jar,Input.jar and Ime.jar. Depending On The Issue. Replace One Or More Of The Files Listed.


Step 10. Now We Want To Edit The Build.prop To Reflect Changes Made. In General These Are The Lines You Want Right. But Each Rom Has Lines Specific To It...Use Your Head And Examine The Port Roms Build.prop For All Lines You May Need.



Needed Lines From Port To Base Build.prop​

(There May Be Other Lines That Are Obvious To You That Need To Be There..These Are In General. All Roms Have Specific Build.prop Properties. Some Knowledge Here Is Extremely Helpful To Potential Porter.)​



ro.build.id=

ro.build.display.id=

ro.product.name=

ro.product.locale.language=

ro.product.locale.region=

ro.config.alarm_alert=

ro.config.ringtone=

ro.config.notification_sound=



Can Edit These


ro.build.date=

ro.build.user=

ro.build.host=


Step 10. Now We Want To Zip Up Our Project And Try Booting It Up. Use Winrar To Zip All FIles In ROOT Of Base Rom Folder.


Step 11. Reboot To Recovery And See What You Get.






Now. You Will Inevitably Encounter Errors. So Get To Doing Some Detective Work. "Ok...My Hardware Keys Are Acting Funky..Could It Be Something In Init.d? Or Maybe Input.jar In Framework?...) This Kind Of Thing. In The End. You May Get It Going Fine. But Expect That Some Just Wont Work.​




May Revise This Guide As I And Others Find New Methods For Doing Something That Will Replace A Step Above Of Improve A Step Above Or Even Add A Step Above.​
 
Last edited:
I've been attememting to sync the repo for cm12.1, it's timed out a few times while syncing (and once my cat jumped on the lid) but it's a work in progress.
The hard part was getting all the packages since the guide in the forum is old and certain packages and dependencies have changed.
My build laptop: lUbuntu 15.10, 2.50ghz quadcore 64bit, 8gb RAM, 750gb HD.
 
Upvote 0
All ports must stay within their android version. Cant use lets say a kit kat base for a lollipop port. wont work. step 3 is as clear as i can make it. you need to copy the set permissions section from updater script in port rom to the base rom updater script. nothing was cut off in image.
 
Upvote 0
I'm a little lost on applying KK base to LP port. I think I'll go fix some ROMs later today.
It's amazing how this phone started so small and became so supported hardcore over a year later.
Also kind of happened with my Hauwei Mercury (aka Honor). We got it to ICS. The thing that always holds development back though is not having the full source and a locked bootloader.

But we have all made some great improvements!
 
Upvote 0
I did get boot loops..or rather boot screen hangs...just sits there..never loads. No actual looping. You can set up adb via pc to run a log while booting to determine the errors that are occuring. It can be many things. Simple things like an invalid setting in build.prop to a bad file. Usually it is a framework problem. Going to update guide a bit more today to add some things that need to be in framework-res apk. Heres what you need in that file. apns.xml,eri.xml,power profile.xml and storage_list.xml from cm base framwork-res.apk ....located in xml folder of apk. Just drag them in to the port framework-res apk. These files can cause boot hangs due to storage being read improperly,data issues with mms and other. These are just a few examples. Could be many things. Google setting up log via adb. It will be more reliable.
 
Upvote 0
I did get boot loops..or rather boot screen hangs...just sits there..never loads. No actual looping. You can set up adb via pc to run a log while booting to determine the errors that are occuring. It can be many things. Simple things like an invalid setting in build.prop to a bad file. Usually it is a framework problem. Going to update guide a bit more today to add some things that need to be in framework-res apk. Heres what you need in that file. apns.xml,eri.xml,power profile.xml and storage_list.xml from cm base framwork-res.apk ....located in xml folder of apk. Just drag them in to the port framework-res apk. These files can cause boot hangs due to storage being read improperly,data issues with mms and other. These are just a few examples. Could be many things. Google setting up log via adb. It will be more reliable.
Thanks will Give It A Go
 
  • Like
Reactions: Curtis1973
Upvote 0
Something I almost forgot about:
I was porting a ROM and kept getting flash error with the binary. I checked with @scary alien OTA Verifier app on strict mode. Found out that I had an issue with a remnant otasigcheck. Maybe it can help others with checking the zip created before flashing.

Description (brief)
The OTA Verifier app can be used to evaluate an over-the-air (OTA) update.zip or other flashable .zip file before you attempt the install or afterwards to help you figure-out why the installation may have failed. OTA Verifier will point-out what files and conditions are being tested so that you can more easily attempt to correct these issues.

Support
http://forum.xda-developers.com/showthread.php?t=1960543

Play Store
https://play.google.com/store/apps/details?id=sa.ota.verifier
 
Upvote 0
Thanks, @Hash_BownN! :)

I really need to re-visit the app sometime and do some updating w/regard to Android 6.x and SE Linux enforcing (ugh! :p).

Also, this is a file-based verifier and won't be much use for block-mode OTAs for now, but it looks like it still hopefully useful to some.

Cheers!
 
Upvote 0
[GUIDE] [PORTING] [CM BASED ROMS]​


This Is NOT A 100% Sure Shot For Every Port. No Guide Is.​



- Requirements -​


Experience Level : NOT NOVICE :) Somewhere Above This Level Is A Nice Place To Begin LOL..​

Winrar​

Notepad ++​

Base Rom From Your Device That Works​

Port Rom With Similar Hardware Specifications To Your Device That Works...Mostly.
(meaning processor type,on board memory of all types,proper display size isn't to much of a biggie as long as the port rom is built using same dpi as your device..)​

Some Patience​

Ability To Diagnose Problems​

Testing Potential Ports And Finding Errors And Fixing If Possible
(Some Cant Be...)​


- Definitions -​

Base Rom Is Any CM Based Rom On Your Device That Has Already Been Built And Works,This Will Be Used As Base For The Port​

Port Rom Is What You Want Working On Your Device From Another Device Of Similar Type..There Are Many Out There.​





Let's Begin...



Step 1. Extract All Contents Of Base Rom To A Folder On Your Work PC Called "Base"


Step 2. Extract All Contents Of Port Rom To A Folder On Your Work PC Called "Port"


Step 3. We Will Start With Editing The Updater-Script (Located In Meta-Inf/Com/Google/Android Folder Of Base And Port Roms... First Open The Base Rom Updater Script In Notepad++. We Want To Edit All Lines You See In The Provided Picture Below (Mainly The Setting Permissions Lines..But You May See Something Near End Or Even At Start...Usually A Line Your Experience Tells You Needs To Be In The Base Roms Edited Updater-Script...Experience Here Is A Big Plus...). Open The Port Rom Updater-Script And Copy The Same Lines And Paste Them..Replacing The Base Roms Lines With Those From The Port Rom..Now There May Be Other Pertinent Items As All Roms Are Different. But In General These Are The Ones You Want To Change. You Will Have To Examine The Scripts. Anything That Looks As If It Needs To Be Added. Try It. May Result In Failure Of Script. But This Is What Porting Is. You Have To Try Many Things. Feel Free To Experiment.


View attachment 100179


Step 4. Now We Want To Move On To Replacing The Files And Folders In System That Need To Be Replaced In Base Rom From Port Rom. First Delete From Base Rom folders App,Priv-app,Media,Fonts, And Framework. Now Copy Over The Same Folders From Port Rom To Base Rom.


Step 5. We Want To Enter Etc Folder Of Base Rom And Replace All Files In Permissions Folder Except Platform.xml and Handheld_core_hardware.xml With All Files Except Platform.xml and Handheld_core_hardware.xml From Port Rom.

(Now...In Some Port Tries..You Will Find You Just Need To Leave Original Base Rom Files In Permissions And ONLY Add Files From Port Roms Permissions Folder That Do Not Exist In Base Roms Permissions Folder....Trial And Error Folks.. In Some Ports This Step Causes Issues With Data,Hardware,Other..But In Some Ports It Will Cause Same Issues If You Do Not Do Step 5. No Hard And Fast Rule Here. Trial And Error. Must Do It To See If You Get Issues. And There Will Be Some I Assure You. And Some Wont Be Related To This Step But Some Will.)


Step 6. Now We Want To Copy Over All Files In Etc/Init.d To Base Rom From Port Rom Except 00banner. You May Encounter Issues Here With Items Associated With Key Layout,NFC And Other Depending On What Files Are In Init.d. Use Best Judgement To Decide After Opening These Files To See What They Are Trying To Accomplish As To Whether Or Not They Will Adversely Effect System. I Personally Leave Them Then Diagnose The Issues As I Go Along. If I Think One Or More Made Things Funky..I Remove It And Try Another Build.)


Step 7. This Step Is Important. Examine The Port Rom For Folders That Are Not In Base Rom..No Matter Where They Are. And Put Them In Base Rom In Same Location As They Were In Port Rom.

Step 8. Now We Want To Fix Framework-res.apk. Of Port Rom With A Few Files From Base Roms Framework-res.apk. Open Base Rom Framework.apk That You Swapped Over From Port In A Window Of Winrar And Navigate To XML Folder. Drag These Files In To The Apk From Original Base Framework-res.apk : Vendors.xml,Storage_list.xml,Power_profile.xml,Eri.xml And Apns.xml. Winrar Will Repack As You Go. Once Done Just Exit The Winrar Window And The New Files Will Be In Place.

Step 9. Here Is Where We Have To Experiment A Bit. First Do A Build WITHOUT Doing This. But If Calling Fails Or Phone Crashes,Etc..Do This... Copy Back To Base Rom Its Own Original Files From Framework Folder...The Files Are Telephony-common.jar,Telephony-msim.jar,Mms-common.jar,Input.jar and Ime.jar. Depending On The Issue. Replace One Or More Of The Files Listed.


Step 10. Now We Want To Edit The Build.prop To Reflect Changes Made. In General These Are The Lines You Want Right. But Each Rom Has Lines Specific To It...Use Your Head And Examine The Port Roms Build.prop For All Lines You May Need.



Needed Lines From Port To Base Build.prop​

(There May Be Other Lines That Are Obvious To You That Need To Be There..These Are In General. All Roms Have Specific Build.prop Properties. Some Knowledge Here Is Extremely Helpful To Potential Porter.)​



ro.build.id=

ro.build.display.id=

ro.product.name=

ro.product.locale.language=

ro.product.locale.region=

ro.config.alarm_alert=

ro.config.ringtone=

ro.config.notification_sound=



Can Edit These


ro.build.date=

ro.build.user=

ro.build.host=


Step 10. Now We Want To Zip Up Our Project And Try Booting It Up. Use Winrar To Zip All FIles In ROOT Of Base Rom Folder.


Step 11. Reboot To Recovery And See What You Get.






Now. You Will Inevitably Encounter Errors. So Get To Doing Some Detective Work. "Ok...My Hardware Keys Are Acting Funky..Could It Be Something In Init.d? Or Maybe Input.jar In Framework?...) This Kind Of Thing. In The End. You May Get It Going Fine. But Expect That Some Just Wont Work.​




May Revise This Guide As I And Others Find New Methods For Doing Something That Will Replace A Step Above Of Improve A Step Above Or Even Add A Step Above.​
Hey Curtis I Have The Issue Of system ui has stoped Do U Know A Fix For It Is one Of The Issues Im Having and Would Love To Fix So I Can See What Else Works But That Dialog Box Isnt Letting Me Do Anything
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones