PortingGuideS5PC110

This guide assumes your phone has a S5PC110/Exynos 3110 SoC

Prerequisites

Before porting your device to Replicant, you must make sure it complies with the following:

Investigating the phone hardware

Before doing anything, you will need to know the codename of the device. You can find it out on CyanogenMod Wiki or on CyanogenMod download page.
For instance, the Nexus S codename is: crespo.

First thing to consider before starting a port, when all of the above is assumed, is to see how many non-free components are required by CyanogenMod.
The easiest way to do this is to spot the device repository in CyanogenMod repos and look for the extract-files.sh or proprietary-blobs.txt file.
For instance, the list of non-free components for the Nexus S is extract-files.sh

From that list, spot what is related to what hardware component (audio, camera, sensors, gps, modem, etc): that gives an idea of the amount of work required to add support for the phone.

During the port, you might need to find precise infos about the hardware that is in the phone. A good to do this is by looking at the kernel defconfig for the device, another way is to download the Service Manual for the device.

Getting everything ready

In order to prepare everything for the Replicant port:

Cloning the device files

Once your Replicant tree is ready, you can start by adding the necessary repos for your device.
That means cloning the necessary repos in the right place. These repos are:

Creating the kernel repo

If the kernel repo is nowhere to be found, you'll need to get the kernel source directly from the vendor, especially if your device is supported by a 3rd party CyanogenMod fork.
Keep in mind that the Linux kernel is GPLv2, so vendors have the legal obligation to release the modified kernel sources as soon as they sell you the device.
That means the kernel sources will be available online. Here are some websites where such releases are done:

Once you have the kernel sources, read the instructions to find out which defconfig to use.

Since manufacturers usually don't release the git history along with the files, you'll need to recreate a git repo:

Now that you have a git repo, you can move it to the Replicant code tree, under the name: kernel/vendor/devices (e.g. kernel/samsung/aries).
Make sure to make the devices name match the devices in android_device_vendor_devices-common if the kernel is shared across these devices or to match the device in android_device_vendor_device.

Building the kernel

The first step when porting a new device to Replicant is to build a kernel image and ensure it works.
Start by looking if

For doing that, you need to sport where the kernel source is held. CyanogenMod

Get the source and build a kernel image

Various hardware and software fixes to get things working.

To get software video decoding (OMX stuff):