[GUIDE]How to Port Manufacturer Rom

How to port manufacturer ROM

As many people ask me how i’m porting ROMs to my Nexus S i share my method in this thread.
This method works for the Nexus but should also work on a lot of devices. The list of files that I would write in this thread is not exhaustive.
Please for all improvements, send me a MP. I’m french and it’s possible for me to misspellings
This thread is in constant progress thanks to your feedback.

Do not use this guide to port rom based on CM / AOSP roms. Please

use this guide to port Sense / TouchWizz / Motoblur etc ... If you want to port based on AOSP roms there are others guide available.

This method is not perfect, much work will then be necessary to fix all the bugs, and nothing says that this method is functional rather than every time ....

I. What you need
Ubuntu and dsixda's Android Kitchen. Please refer to this link
Notepad++
Winrar
A brain =)
NB : Before you start porting a ROM you need to know several things. Over the phone you want to port the rom will have a hardware close to your, more porting will be simple and functional.
Example : Same screen resolution, processor of the same type (ARM6, ARM7, etc ....)
PORT is the ROM you want to port and BASE is the ROM developed for your device (AOSP/CM)

II. Let’s go !

1. Create new folder where you want and name it « Rom_port_for_yourdevice »

2. Download AOSP/CM developed for you device with the same android version which the rom you want to port

3. Download the rom you want to PORT

4. Extract each zip ROM in separate folder in « Rom_port_for_yourdevice »

5. Now it will appears two folders. Open both.
In PORT folder delete META-INF folder and copy/paste the META-INF folder of BASE in PORT folder.

6. Open system folder in PORT rom and delete
vendor folder

7. Now in PORT folder open lib folder and delete these folders :
modules
hw
egl

8. Now go in BASE folder and select (if exists) these folders :
addon.d
bin
etc
customize
framework
lib
vendor
xbin

Now copy these in system folder of PORT but do not replace anything ! (If forgot « ETC » folder on screenshot)

9. Open bin folder in BASE and PORT folders. Copy and replace these files from BASE to PORT :
adb
brcm_patchram_plus
hostap
hostapd
init.vsnet
linker
logcat
logwrapper
radiooptions
rild
rmt_storage
vold
wpa_cli
wpa_supplicant
glgps

10. Now in BASE and PORT system folder open etc folder and copy and replace (if exist) these files/folders from BASE to PORT :
Bluetooth
Dhcpcd
Firmware
gps
init.d
permissions
ppp
pppd
security
ssh
terminfo
updatecmds
wifi
audio_effects.conf
audio_policy.conf
dbus.conf
gps.conf
init.*.sh
media_codecs.xml
media_profiles.xml
nfcee_access.xml
secomxregistry
vold.conf
vold.fstab
wrs_omxil_components.list

11. Now copy usr folder from BASE to PORT and replaces all files

12. Open lib folder in BASE and PORT folders. Copy and replace these files from BASE to PORT :
liblog.so
libsecril-client
libreference-ril.so
libril.so
libs3cjpeg.so
libaudioflinger.so (if port does not boot, use from PORT rom)
libaudioutils.so
libtinyalsa.so
libpn544_fw.so
libSEC_OMX_Core.so
libOMX.SEC.***.Decoder.so

For HTC devices:
libhardware_legacy.so
libhtc_ril.so
libhtc_ril_switch.so

For LGE devices:
lge-ril.so

More commonly:
Add all the lib files with "ril" in their name

13. Open framework folder in BASE and PORT folders. In both folder rename framework-res.apk to framework-res.apk.zip and open the two files with Winrar.
In both files go to /res/xml/ and replace
storage_list.xml of PORT framework-res.apk with the one of BASE.
Now close Winrar and rename framework-res.apk.zip in framework-res.apk in both folders.

14. Very important: By the way, there are some proprietary binaries missing from the guide (just depending on the device, as it's impossible to include all), so what I recommend is if your device has official cm, go to github.com/themuppets, pick the repo corresponding to your manufacturer and branch corresponding to your android version and download it and copy the files in your device's folder to the ROM you are porting. Lib to lib, bin to bin, etc. You may also need to look at the Mk files in the cm device source for your device to see what is built from source that you'll need such as libs and bins. For example, if it has Product_packages += \libwifi \
You would need to copy libwifi from cm.

15. Now open build.prop of PORT rom and replace these lines with BASE build.prop :
Code:
ro.product.model= ro.product.brand= ro.product.name= ro.product.device= ro.product.board= ro.product.cpu.abi= ro.product.cpu.abi2= ro.product.manufacturer= ro.wifi.channels= ro.board.platform= ro.build.product= ro.build.characteristics= rild.libpath= rild.libargs=

16. Reboot to Ubuntu.

Steps for android 4.3 and older
Open dsixda's Android Kitchen
Decompile both boot.img/kernel
Open both init.rc files
In CM/AOSP kernel replace
BOOTCLASSPATH by the one from PORT boot.img ROM
Save and recompile kernel
Use CM/AOSP modified kernel in your rom.

Steps for android 4.4 and newer
Open dsixda's Android Kitchen
Decompile both boot.img/kernel
Open both init.environ.rc files
In CM/AOSP kernel replace
BOOTCLASSPATH by the one from PORT boot.img ROM
In CM/AOSP kernel do these changes:
--> ro.secure=1 to ro.secure=0
--> ro.debuggable=0 to ro.debuggable=1
--> persist.sys.usb.config=mtp to persist.sys.usb.config=mtp,adb
--> ro.adb.secure=1 to ro.adb.secure=0
Save and recompile kernel
Use CM/AOSP modified kernel in your rom.

17. Now ZIP your PORT rom folder and flash it.
Please don't forget to use LOGCAT to debug the rom.....

Trouble Shooting->

Files to fix ...

You can try to replace some of these files (if exists) to fix ...

NFC
/system/app/Nfc.apk
/system/lib/libnfc*.so
/system/bin/pcscd

Radio FM
/system/bin/fmradio
Sensors
/system/bin/akmd*
/system/lib/libsensors.so
Bluetooth
/system/bin/bd_prov
/system/bin/uim*
/system/bin/hcid
/system/bin/bluetooth*
/system/bin/hciattach
/system/bin/sdptool
/system/xbin/hciconfig

Wifi
/system/bin/netcfg
/system/bin/dhcpcd
/system/bin/ifconfig
/system/bin/hostap
/system/bin/hostapd
/system/bin/hostapd_bin
/system/bin/pcscd
/system/bin/wlan*
/system/bin/wpa*

RIL
/system/bin/stmd
/system/bin/rild*
/system/etc/rril

Camera
Copy libcamera*.so from base to port rom
If rom does not boot after that, replace file one by one and see which file is the problem.

If you port on HTC Devices, try these:
Fix Network auto select
Decompile framework-res.apk
Go to this folder \framework-res\res\values
Open bools.xml
Change <bool name="skip_restoring_network_selectibool>
To Change <bool name="skip_restoring_network_selectibool>

Fix graphichal issues
Decompile framework.jar
Change these files with your CM base
smali\smali\android\os
Environment
SystemProperties
smali\smali\android\view
HardwareCanvas
HardwareRenderer$Gl20Renderer
HardwareRenderer$GlRenderer
HardwareRenderer

Source Post Click HERE!

Popular Posts