[General PAC Discussion] iurnait:
Adding Support for a device

To add support for your device, the first thing you need to do is to hunt down your device tree. If you are not sure where your device tree is located, google it or ask in your device's subforum. Now, it is time to add the files required to build.

From the root of directory where you have downloaded the pac source (~/android/pac), go to the vendor/pac directory. This is where we will be making the changes necessary to build for your device. Here are the files that need to be modified/added. Obviously, substitute your devices codename for CODENAME.

1. dependencies/CODENAME.dependencies

This file grabs your device and kernel tree. Look at the dependencies file of a device that is similar to yours to figure out what you need to place in here. A list of all the devices we support and their respective codenames can be found here. Again, if you are unsure about what to place here, you may want to ask for help in your devices subforum. Whenever possible, try to use the CM device tree. For the vendor files, keep the account name as "Pinky-Inky-and-Clyde" but change the repository to the appropriate OEM (check here for repos). Do not worry if the vendor files for your device are not in that repository. We will be adding them later.

Here is a sample CODENAME.dependencies file for a Samsung device (note that the account names are case sensitive):

[
{
"account": "Pinky-Inky-and-Clyde",
"repository": "proprietary_vendor_samsung",
"target_path": "vendor/samsung",
"revision": "cm-11.0"
},
{
"account": "CyanogenMod",
"repository": "android_device_samsung_CODENAME",
"target_path": "device/samsung/CODENAME",
"revision": "cm-11.0"
},
{
"account": "CyanogenMod",
"repository": "android_kernel_samsung_CODENAME",
"target_path": "kernel/samsung/CODENAME",
"revision": "master"
},
{
"account": "CyanogenMod",
"repository": "android_hardware_samsung",
"target_path": "hardware/samsung",
"revision": "cm-11.0"
}
]

Once you have done this, go to the root of your pac source (~/android/pac for this guide), and run

./vendor/pac/tools/getdependencies.py CODENAME

This will attempt to create the file .repo/local_manifests/roomservice.xml and then sync up the sources. If you have to make changes to your dependencies, please remove the roomservice.xml file and re-run the script again to ensure that no incorrect repositories are left lingering.

Go to the vendor files directory (~/android/pac/vendor/YOUR_OEM), and search for the vendor files of your device. If they are not there, you will have to search for them online and copy them into the folder.

Alternatively, if your device has an extract-files.sh script, in the device tree (located in device/OEM/CODENAME), you can hook up your device via usb and run that command to grab the vendor files directly from your device. In this case, connect your device and run:

cd device/OEM/CODENAME
./extract-files.sh

2. products/pac_CODENAME.mk

Again, look at the same file for a device that is similar to yours and make the appropriate changes for your device.

Here is a sample pac_CODENAME.mk file for a hdpi device:

# Check for target product
ifeq (pac_CODENAME,$(TARGET_PRODUCT))

# OVERLAY_TARGET adds overlay asset source
OVERLAY_TARGET := pa_hdpi

# PAC device overlay
PRODUCT_PACKAGE_OVERLAYS += vendor/pac/overlay/pac/hdpi_480x800

# PAC boot logo
PRODUCT_COPY_FILES += \
vendor/pac/prebuilt/common/bootlogo/pac_logo_480x800.rle:root/logo.rle

# Copy bootanimation
PRODUCT_COPY_FILES += \
vendor/pac/prebuilt/480x800/bootanimation.zip:system/media/bootanimation.zip

# include PAC common configuration
include vendor/pac/config/pac_common.mk

# Inherit CM device configuration
$(call inherit-product, device/samsung/CODENAME/cm.mk)

PRODUCT_NAME := pac_CODENAME

endif

Note: for the PAC device overlay, look inside vendor/pac/overlay/pac for the available overlays. Likewise, for the bootanimation and boot logo, look in their respective directories for the available sizes.

3. vendorsetup.sh

Add a line that looks something like this in the appropriate area of this file (under the appropriate OEM, and in alphabetical order, please).

add_lunch_combo pac_CODENAME-userbebug

--- The below files are not necessary for successful compilation, but are required if you submit your device for official PAC support. ---

4. Contributors

5. Nightly.xml

6. XDAThreads

7. devices-breakdown.xml

For these files, follow the format of the other devices.