[GUIDE]How to Port Armv7 Roms to Armv6

I believe many people wanted to learn how to do this. Well I was one of them until a while ago..

WHAT YOU'LL NEED:
apktool
ddms for logcat(or adb, whichever you like. I prefer ddms as its more detailed and easy to understand)

File comparison and merging tool.
Araxis Merge(I've been using Araxis Merge during the time I was on Windows. Its a paid tool but its available for free for 30 days)

WinMerge(Windows)
Meld(if you are on linux. Its available on Ubuntu Software Center)

Alternatively, you can google for other file comparison tools; https://www.google.com/search?client...utf-8&oe=utf-8

LET'S BEGIN!
N
ow ,I don't want to write the instructions on how to make a basic port.

Anyways, follow his guide to get over with the simple porting process .. I highly recommend you to use dsixda's Android Kitchen. It will help a lot in porting. (from deodexing to easily unpacking/re-building ROM zips, signing, zipaligning apks, etc. etc.)
dsixda's Kitchen
Guide for installing and using the Kitchen

The actual porting begins now!..
I assume you already got built your zip following the above given guide, now we can go on..

Firstly flash the zip you built. It will obviously not boot.. so called 'bootloop'... What we are going to do is to observe the logcat and find errors causing bootloop, and fix them..

COMPARING AND PATCHING/DIFFING
We are going to fix errors by finding the error causing .smali files by observing the log (There might of course be other factors for a bootloop, but that doesn't interest us yet. If in the porting process we get different kind of errors we are goin to look into them then..)

Please look below at "UNDESTANDING LOGS AND DEBUGGING" section for better understanding of logcat and what we are gonna do exactly!
Patching?? What's that?
OK! Let's imagine logcat gave us this info;
Code:
E/dalvikvm( 8925): ERROR: could E/dalvikvm( 8925): Requested: L E/JNIHelp ( 8925): RegisterNati

I'm pretty sure you can all see

Code:
android/content/res/AssetManage
and

Code:
ERROR: couldn't find native met
these show us that there is a missing native method in AssetManager.smali file under android/content/res of framework.jar

Now, I assume you already got apktool set up, we should decompile both base framework.jar(the one in the base rom, obviously) and port framework.jar(the one you are porting). Rename the base framework.jar file to "framework_base.jar" and leave the port stay "framework.jar" and put them in apktool directory..

Run a cmd, cd to the apktool directory and decompile the jars by

typing
Code:
apktool d framework.jar
Code:
apktool d framework_base.jar

Once the de-compilation is finished you will get two folders in the apktool directory. One "framework.jar.out" and the other "framework_base.jar.out"

Navigate to "smali/android/content/res" in both the folders and find AssetManager.smali.

Get your comparison tool opened up and import the base AssetManager.smali to one side and the port to the other.

Now, you can start adding missing stuff..

NOTE: While patching AssetManager.smali, DO NOT REPLACE ANYTHING! JUST ADD MISSING LINES!!

Ok after you make sure you have added missing lines, save files and close the program.
Switch back to apktool and recompile the port framework.jar by typing the following command:
Code:
apktool b framework.jar.out

OK! you are good to go. Now either put this in a small flashable.zip for sake of time. or put it in your WORKING_FOLDER and rebuild the whole zip. Flash it and you shouldn't see the AssetManager.smali error any more.

But wait! You didn't think you would get you Port booting? did you? Well, if you did you were to be happy too fast! You are going to face this kind of errors again and again..

Then sometime you'll see you rom booting and will be the happiest guy
Anyways, when you see other similar errors just apply the same technique to them. The technique of "patching"!
Porting ARMv7 to v6 might throw up some other errors except smali files.

Source Post Click HERE!

Comments

Popular Posts