[Nexus S General] Oogway13:
Use wisely!!

If you plan to use it, please share anything that might be missing or any step taken to resolve bootloops, FC's, etc.

:good: Thanks and Credits to: :good:

Peteragent5- Original Thread:

http://xdaforums.com/showthread.php?t=1598713

GalaxyUser for his great contribution on this tutorial!

[Disclaimer]

:rolleyes:

I'm not responsible for any problems this may cause on your phone.

And I will repeat this.

I'm not responsible for any problems this may cause on your phone.

!!!YOU DO THIS UNDER YOUR OWN RISK!!!

-----------------!!!!IMPORTANT!!!!-----------------

This tutorial is not meant to port the following Touchwizz, Sense, Motoblur or from different vendors

If your Device is not from the same manufacturer, unpack the kernel and edit the BOOTCLASSPATH in init.rc to match the BASE kernel and then repack Kernel

You can try, but it's under you own risk.

-----------------!!!!IMPORTANT!!!!-----------------

IMPORTANT:

1. You must know if your Device is Armv7, Armv6, or Armv5. YOUR BASE AND PORTED MUST BE THE SAME CPU!!

''''''Nexus S is ARMv7''''''

Example: SGS I9000 can be used as PORT.​

List of Devices CPU:

http://xdaforums.com/showthread.php?t=1596800

2. If your BASE has problems, then your ported ROM is going to have the same problems.

3. Make sure both PORTED and BASE are on the same Android Version. As for what I know, you cannot Port ROM on GB using Base on ICS and viceversa.

So let's get started geeks and trolls:

[PROCEDURE]

Step 1. ROM Download

Download ROM you want to 'PORT' and download ROM you want to use as 'BASE'.​

Step 2. Unzip

Unzip both PORT and BASE on separate folders (Just to keep it clean).​

Step 3. [OPTIONAL] Backup important files

Make a backup of the following files from both PORT and Base (This is just in case you have the original one)(modify the name with something unique to the ROM - add it at the end maybe):

/system/lib/libandroid_runtime.so

/META-INF/com/google/android/updater-script

/system/build.prop​

Step 4. Backup and copy important Apps

From BASE, backup the following from /system/app:

stk.apk

vpnservices.apk

camera.apk

bluetooth.apk

VpnDialogs.apk

nfc.apk

tag.apk

Add these apps into PORTED /system/app folder.​

Step 5. Inside Ported

Remove kernel:

boot.img | zImage | kernel.sin | etc...

Remove folders on PORTED /system:

cameradata

tts

usr

vendor

modules

/etc/wifi

Now you get 2 options:

Delete bin & xbin & lib folder, but keep libandroid_runtime.so inside /system/lib

Keep bin & xbin & lib folder

Explanation:

If PORTED has no tweaks or addons to those folders.

If PORTED has tweaks and addons.

Remove every folder inside /system/etc except:

init.d

permissions

license

Remove the following inside META-INF:

CERT.RSA

CERT.SF

MANIFEST.MF

Remove: META-INF/com/google/android/update-binary​

Step 6. Inside Base

Move kernel to PORTED:

boot.img | zImage | kernel.sin | etc...

Delete libandroid_runtime.so inside /system/lib

Move the following inside /system to PORTED:

(If prompted, select YES to copy and Replace all)

cameradata

bin

lib

tts

usr

vendor

firmware

modules

wifi

xbin

(If prompted, select YES to copy and Replace all)

Move everything inside /system/etc

To: PORTED's /system/etc

(If prompted, select YES to copy and Replace all)

Move: META-INF/com/google/android/update-binary

To: PORTED's META-INF/com/google/android/

For ICS & Newer:

Move the following inside /system/media to PORTED's media:

LMprec_508.emd

PFFprec_600.emd​

Step 7. Build.prop edition

Open /system/build.prop from both PORTED and BASE with Notepad++ (or any other text editor you like)

Edit PORTED build.prop to match BASES's build.prop.

!!!IMPORTANT!!! - Make sure the following fields on the PORTED matches your BASE fields:

ro.build.description=

ro.build.fingerprint=

ROM WILL NOT boot without this.

Most of the options that would need to be modified are from the 'build properties' section.

Copy & Replace the following:

ro.modversion

ro.cm.version

ro.config.ringtone

ro.config.notification_sound

ro.config.alarm_alert

ro.config.sms_received_sound

ro.config.sms_delivered_sound

persist.sys.themeId

persist.sys.themePackageName

and anything similar to that, to: BASE's build.prop

For MIUI:

Add & Make sure the following values are like this:

ro.build.id=MIUI

ro.build.display.id=MIUI x.x.x

ro.build.version.incremental=x.x.x

ro.config.ringtone=MI.ogg​

For Lewa OS:

Add & Make sure the following values are like this:

ro.build.display.id=LeWa_ROM_DeviceNickname_xx.xx.xx

ro.lewa.version=LeWa_ROM_DeviceNickname_xx.xx.xx

ro.lewa.device=DeviceNickname

ro.lewa.swapper.part_path=PORTED's_Value

ro.lewa.swapper.flash_swappiness=PORTED's_Value

ro.lewa.swapper.sd_swappiness=PORTED's_Value

ro.error.receiver.system.apps=com.lewa.fc

ro.error.receiver.default=com.lewa.fc​

Make sure the following is for your Device:

rild.libpath=

rild.libargs=

Inside BASE:

Highlight from: ro.build.tags=

to: # ADDITIONAL_BUILD_PROPERTIES

Copy & Replace that highlighted part to: PORTED's build.prop's highlighted part

Copy everything from: # ADDITIONAL_BUILD_PROPERTIES

To: the end of the file

Paste it to PORTED's build.prop

Save PORTED build.prop.

For XPERIA devices:

The whole build.prop is untidy and filled with tweaks and addons.

To edit an XPERIA build.prop you really just need to use your common sense.

Make sure you follow the above and just decide on your own on what to do​

For HTC devices (Sense):

The whole build.prop is filled with tweaks, addons and extra libs values.

To edit an HTC build.prop you really just need to use your common sense.

Make sure you follow the above and just decide on your own on what to do​

Step 8. META-INF updater-script edition

Inside BASE:

Move the following, to PORTED:

(If prompted, select YES to copy and Replace all)

META-INF/com/google/android/update-binary

META-INF/com/android/metadata

META-INF/com/android/otacert

Open /META-INF/com/google/android/updater-script from both PORT and BASE.

8.a. Modify PORTED updater-script

8.b. Replace 'assert' line in PORTED with the one on BASE.

'assert' will verify 'build.prop' values to make sure you are flashing a ROM meant for your device.

Make sure any 'assert' check matches your BASE build.prop field.

If this check fails, you will most likely get CWM error status 7 (if I'm not mistaken)

8.c. Replace 'format' and 'mount' lines in PORTED with the ones on BASE. Should be like this:

format("ext4", "EMMC", "/dev/block/platform/s3c-sdhci.0/by-name/system", "0");

mount("ext4", "EMMC", "/dev/block/platform/s3c-sdhci.0/by-name/system", "/system");

This is a HIGHLY important step, so don't miss this step.

8.d. If 'retouch_binaries' exists on BASE, copy line into PORTED file where SYMLINKS ends. Replace if necessary.

8.e. DO NOT CHANGE ANY SYMLINK on PORTED.

8.f. Change/Edit/Add 'set_perm' from BASE to PORTED (Take note of the added set_perms & set_perm_recursives that PORTED added. Then replace all set_perm and set_perm_recursive from BASE to PORTED. Put back in the noted set_perms & set_perm_recursive you wrote down, to PORTED's updater-script(If the updater-script in PORTED is modded to have tweaks & addons do the set_perms procedure above)).

8.g. Modify any 'ui_print' as you wish.

8.h. The installation of the kernel (Something like: assert(package_extract_file("boot.img",)

8.i. Save PORTED updater-script.

8.j. Now use BASE's entire META-INF Folder. Copy it to PORTED (Do not replace the updater-script we just modified).

ALWAYS use COMMON SENSE to edit build.prop and updater-script to avoid bricks!

For MIUI v4:

Add the following values to PORTED:

set_perm(0, 0, 06755, "/system/xbin/invoke-as");

set_perm(0, 0, 0755, "/system/lib/liblbesec.so");​

Step 9. Porting from a different Manufacturer

If you are porting from a different manufacturer like, HTC or Sony, you have to check the kernel from them.

Unpack the kernel from PORTED

Unpack your Device's kernel

Open PORTED's init.rc

Replace the BOOTCLASSPATH from PORTED's init.rc to BASE's init.rc

Compare the two files, and addon to your Kernel's init.rc

Packup/Repack your Kernel​

Step 10. Clean your workspace

Double check the ROM if it has any leftover files or folders you need to modify or edit.

And delete any file or folder if it has nothing to do with your Device.​

Step 11. Assure Boot Image

Make sure you replace the Kernel with one compiled for your Device.

This needs to be on '/' and named boot.img​

Step 12. Add what you want

If you like to add special apps, or update the existing ones like Superuser and it's Binaries, Busybox, and more, you can do it now!

Maybe add Beats Audio, XLoud, MegaBeatsBass?? Your Choice!! Goooo crazy!​

Step 13. Zip your ROM and tranfer to SDCARD

PORTED is your final ROM.

Now zip your ROM Workspace (You can compress the zip).

You can also sign your ROM but it's not necessary.

But if your recovery only reads signed zips, then sign your ROM.​

Step 14. Don't worry, be HAPPY!! :D

If you encounter any problems during flash, boot, or processes FC'ing:

ADB Logcat and DDMS are your FRIENDS....and maybe Google.​

Happy Porting!!!