Please remember to add a category to the bottom of each page that you create.
See categories help for further details, but most will probably be [[Category:HTC ModelName]].
Device codename
Before you begin your port (i.e. to CyanogenMod), you will want to collect as much information about your device as you can. Also it is interesting include it using the {{device}} template when describing a machine page (see category:devices and its subdirectories about phones, tablets...).
Go to wikipedia and identify the product name, code name, architecture, memory size, internal storage size, and platform architecture. Put this information in a file for easy retrieval. Try to learn as much about the device, including any similarities it may have to other devices.
Tip=Many devices are architecturally similar to other devices that are already on the market and have existing CM ports. When a new device comes out, see if you can find out if it may be identical to another device, only with a different sized screen or more memory or some other minor difference. If you find an "ancestor" or "sibling" of your device, much of the work may already be done for you!
Much of the information you need may be available online, but assuming the device is already running a non-CyanogenMod version Android, you may also get some of that information from the device itself. To view the files containing this information, the device may need to be rooted. However, sometimes you can find a stock firmware update package online, and can view the files from the .zip archive file.
Contents
Look at the device's current /system/build.prop
Assuming the device is already running a version of Android, there should be a file, /system/build.prop, on the device which may contain useful information that will come into play as you do your port. This file contains definitions for various parameters and settings used by Android.
So, if you have previously installed adb onto your computer, you can use the following command to pull this file to your computer:
adb pull /system/build.prop
If you receive an error relating to permissions, the device may need to be rooted to gain access to this file. However, there are other ways to locate this file. For example, it may be included in any stock firmware "upgrade" package online.
You can also use Build Prop Editor, from here (rooting is a prerequisite to used it).
Once you have the file...
- Write down the value of the
ro.product.manufacturerparameter. This will be your vendor name. The [vendor] is the name of the manufacturer/vendor of the device. CM has established naming conventions for most major vendors, such assamsung,htc,lge, etc. Note that in these directory names, the vendor is always lowercase and contains no spaces. - Write down the value of the
ro.product.deviceparameter. This will be your device codename. The [codename] corresponds to the project code name of the device itself. This is almost never the sales name of the device. If you have built CM before (and again, you better have!), you should be familiar with the concept of a code name for each device. Like the vendor name, the codename is always lowercase and contains no spaces.
Note=Sometimes a device is identified in other parameters such as ro.product.board
Keep the build.prop file handy, as you may refer to it later.
Examine boot.img and recovery.img
As stated, when doing your port, you may wish to use an existing pre-built kernel that you know works instead of building one from source code. Depending on your device, you may need to extract this kernel file from the device. The kernel may exist as a single file (as it does on many OMAP devices) or may be wrapped up along with the ramdisk in a boot or recovery partition.
Similarly, the contents of the stock ramdisk may be extremely helpful and can often be extracted and reviewed. It may be the case that a device requires specific files from the stock ramdisk in order to boot properly, load a module, etc. In most cases you can view files in the ramdisk from the device itself, but it you may prefer to look at the full directory.
N=The ramdisk is a tiny group of files and directories that are loaded into memory along with the kernel. The kernel then runs one of the files in the ramdisk called init, which then runs a script (init.rc, init.[codename].rc, etc.) that in turns loads the rest of Android. The ramdisk and kernel can be packaged together in a number of different ways using tools with names like mkbootimg, mkimage, and other methods.
You can frequently extract the boot and recovery images (to a file you name boot.img and recovery.img) on a rooted Android device using dd.
Or, if you have access to an update .zip file from the vendor (that could call it firmware), you can often find those files within.
Collect any available existing source code
The manufacturer or vender of any device using Android will minimally need to make the source code available for all GPL components upon request, including (and especially) the kernel. You definitely want to request a copy of the kernel source and keep it handy.
Determine the partition scheme
The primary long-term storage portion of your mobile device-- usually an "emmc" (embedded multimedia card)-- is much like a computer hard drive in that it is prepared in a particular way to identify and isolate different areas of data. These unique areas are called partitions and they can have any kind of data stored there. Some partitions contain raw data-- firmware, kernels, ramdisks, etc. More often, a partition is formatted to use a particular file system that the kernel will recognize so that individual files and directories can be read and written there.
Before you can replace the stock operating system with CyanogenMod, it is therefore important to ascertain the partition scheme of the device. The recovery image you build will need this information to know where to find the various Android directories. Particularly, you want to know which partitions are assigned to /system, /data, /cache, and /sdcard.
You want to know which partitions exist, on what device, how they are mounted, as well as the size of the partitions. This information may be transferred later to the BoardConfig.mk file in your /vendor directory.
If you're lucky, a recovery.fstab file can be located in a recovery.img file, speeding up the process of figuring out what goes where. Also, the init.[codename].rc file in the ramdisk may have the information. Look for the lines near the top where the partitions are mounted.
Also, the command:
$ cat /proc/partitions
from a running device can also help you identify the partitions. Also see /proc/emmc, /proc/mounts or /proc/mtd. You may also get some information from the command mount (run as root).
Also check /cache/recovery.log or /tmp/recovery.log.
Finally, if you have source code to the bootloader (such as the u-boot used by many OMAP-based devices), you will likely find the information there as well.
Note:Be aware that in some rare cases, such as the HP Touchpad, an abstracted virtual file system is used.

