[HD2 Android NAND Development] htcfreak:
Finally the tutorial

Make your own Android Build for the HD2 by domineus ​

I have always lived by these words- if you give a man a fish, he can eat for a day; but if you teach a man to fish you can eat for a lifetime. Android on the HD2 has always been an interesting thing for me and I know a lot of people that want to create their own builds, but have no idea how. If you ask a build creator or maybe someone in the htc-linux-chat how to get started, there may not be an answer. In fact, some of the perplexing behavior has left me puzzled in several ways - as if how to get an android build is a vaulted secret of knowledge like the holy grail. To be honest, it's not. It's a bit of hard work, a few nods in the right direction, and ultimately it's a community involved project. Just like miui development is a community project spanning actual continents to get this thing on our device every single week! It has led to a lot of questions, in my inbox, of how to begin. For a long time, the answer to the question was not answered until Cass helped me out. I want to do the same and contribute how to get a build of miui (or any android build) to the HTC HD2.

Things you will need

In order to properly start android development, it would be a good idea to make sure you have the following (a lot of it is no duh when you think about it)

A computer running linux

I can't stress that enough. While there is a lot of things you can do in windows, you will need some sort of linux distro in order to get android properly running on your HD2. There are a lot of linux distros you can use; with many using ubuntu as it is the most user friendly. I use Fedora and I am quite happy with the results. It's simple and effective. It gets the job done. Get a distro that you feel can get the job done.

Android SDK - either windows or linux

Android SDK is something that can be freely accessed and downloaded from the following location:

http://developer.android.com/sdk/index.html

It is a developer environment, but probably the most important thing you can use here (for the time being) is logcat. Logcat provides you to visually see the libraries and files working together to get android to work as well as if you run into an issue, it is the first thing you should resort to. For instance, boot reloop? Take a look at your logcat and try again.

A kernel

There are quite a few kernels available for android previously and they are divided into evo kernel or nexus one kernel. Many builders have transitioned to an evo kernel for PPP and a few other nice details but it is totally up to you. I highly recommend hastarin's kernel. For most of the time, it works well. But as you have noted, on MIUI, it hasn't been working as fantastic on other builds.

Donor Files

This is a bit difficult to find because it appears that the files that work best are nexus one builds without CM6.1 modification. So far, only one chef has that and it is tytung's nexus one build. Regardless of whose files you're using (e.g. tytung or darkstone's system which is the preferred choice) you will need a well working android build. You will be pulling several files in order to port.

MIUI itself (well any build honestly just miui is a good example)

This is a given. However, if you download from miui.com you will probably have an untranslated rom with odex files. That's bad. And in Chinese! It would be a good idea to browse the English forum for a deodexed rom with appropriate english translation (apps and frameworks)

-If pulling files from windows, you will need this

system extractor

http://uranus.chrysocome.net/linux/explore2fs-old.htm

I use that if I download in windows. It's relatively straight forward and it allows you to pull the files you need from the system.ext2 you're using and copying them to folders necessary.

build.prop

This you will need. You can find one here:

http://www.multiupload.com/B59IU3S6XY

Patience

Probably the most important thing. One thing I have noticed is you need patience to make it through. Sometimes, your build works, sometimes it doesn't. And it is difficult to still keep going. But gotta pull it all in and keep trying...it does pay off.

Okay so you have your files, a nice linux distribution, your build you want to port (MIUI preferrably) and you're ready to go. Now it's time to begin the process!

Step One - The Setup

I usually grab my files in windows before transitioning to my linux distro to finish the process. If you using windows 7 and you are using explore2fs, you will definitely have to right click on the exe and make it compatible by selecting compatible with windows vista. The file should also need to be run by administrator. If you don't know how to do that you can google compatibility in windows 7.

First thing is first. Create a new folder, you can call it donor_files if you want because name is arbitrary. The most important thing is to just name it. Within that folder, create a new folder called system. Enter the system directory and create a new folder called etc. Within etc, select Once that is done, create a new folder within etc called firmware. Once completed, return back to the system folder, create the folder called lib. In the lib folder, create a new folder called hw. So your folder should look like this:

Folder Name

-system

--etc

---firmware

--lib

---hw

So far so good? Excellent. Now, if you're in windows you will need to do a few things. Extract the system.ext2 of your donor build and place it somewhere you will remember (like your desktop). Now open up explore2fs, select file, and open image file. Under files of type (drop down), select all files and navigate to your system.ext2 file. You should now see the ext loaded on the left side of the program's workspace. Located is a very small + that allows you to view all directories in your ext2 file. Click that.

You will see several system folders on the left and files on the root. Since you haven't selected a specific folder, in the right hand view, you should see the file build.prop. If you did select a folder (like app) you will see some files. And that's okay too. Get a feel of the program.

Now you will do a test file pull. On the left hand side, select the folder etc. On the right window, you will see several files. We want AudioBTID.csv. Once you see the file, right click on AudioBTID.csv and select export file. Navigate to the donor file folder (or whatever you named it) and place the file in system/etc of that folder. Congratulations you just pulled your first file! But you will need a lot more files. Within the same directory, pull gps.conf, hosts, media_profiles.xml and the ppp folder. Now, navigate to firmware and pull the following files:

BCM4329B1_002.002.023.0360.0362.hcd default_france.acdb htcleo.acdb

BCM4329B1_002.002.023.0436.0439.hcd default_nel.acdb yamato_pfp.fw

bcm4329.hcd fw_bcm4329_apsta.bin yamato_pm4.fw

default.acdb fw_bcm4329.bin

Ideally you should not be able to find htcleo.acdb. You can find it here

http://gitorious.org/xdandroid_leo/q...eo/htcleo.acdb

Now in explore2fs, go to the lib directory and pull these files and place them in your lib directory:

libcamera.so

libcamera_client.so

libcameraservice.so

libhtc_ril_wrapper.so

libmm-omxcore.so

liboemcamera.so

libomx_aacdec_sharedlibrary.so

libomx_amrdec_sharedlibrary.so

libomx_amrenc_sharedlibrary.so

libomx_avcdec_sharedlibrary.so

libomx_m4vdec_sharedlibrary.so

libomx_mp3dec_sharedlibrary.so

libomx_sharedlibrary.so

libomx_wmadec_sharedlibrary.so

libomx_wmvdec_sharedlibrary.so

libOmxCore.so

libOmxVdec.so

libOmxVidEnc.so

libqcomm_omx.so

libstagefright_omx.so

Once those files are pulled, navigate to the hw folder of the system and pull the following files:

sensors.htcleo.so

lights.htcleo.so

Once those files are pulled, you can save your donor files to a flash drive and then boot into your linux distro. Login to superuser in terminal. For fedora, the proper method involves typing in su --login and entering your password you set up. Minimize your terminal window.

Extract the miui (or any other build) to your desktop (the focus is the system folder). Ensure the rom is deodexed and in your own language (if its miui, you will have to apply the proper language translations). Now copy the files you pulled from your donor build and apply it to the appropriate folders (usually a copy and a paste-literally). In this instance there will be duplicate files, overwrite them. That's the point! Do not forget the build.prop file I linked to earlier. You should add that to system folder.

So the files are copied, the next step is to restore the minimized terminal window (the one that is logged in as root). cd to where your system is located (not to the system folder itself). Now you will have to enter the following commands in terminal

chmod -R 777 system/etc

chmod 755 system/bin/*

chmod 755 system/xbin/*

rm system/etc/firmware/default*acdb (if you have sound in call issues)

touch system/etc/ppp/active (If you have latest wrapper and need ppp)

chown root:2000 system/bin/pppd

chmod 4755 system/bin/pppd

chown root:root system/xbin/su

chmod 4755 system/xbin/su

chown root:root system/xbin/hci*

chmod 4755 system/xbin/hci*

dd if=/dev/zero of=system.ext2 bs=1048576 count=256

mke2fs -F system.ext2

sudo mount -o loop system.ext2 /mnt2

cp -rp system/* /mnt2

sudo umount /mnt2

A few words on this that I must bold. the /mnt2 directory may not exist. If not, try mnt, that usually works

Once this is done, you will have a nice system.ext2. The only thing you'd need now is a rootfs, a kernel, clrcad.exe and a startup.txt file. Once that is done, you can test your build out.

Any questions

Special thanks to Cass and the htc-linux-chat for the few pointers they gave me.

The guide is by "domineus - http://www.miui-dev.com/" & I take no credit what so ever​

Thanks to "white-energy" for giving us the link..!!!

Hope to have many more Chief's for our HD2, so that we [especially me] can satisfy our hunger to try different builds/ROM's..!!! ;)

Happy Cooking..!!!​

PLEASE PRESS THANKS IF YOU FOUND THIS THREAD USEFUL..!!!​

​