[Android] itzdarockz:
What you will need

Windows or Ubuntu

A couple months knowledge about linux and android

Common sense

Notepad ++ (if on windows)

An MTD rooted android phone or tablet

NOTICE: This guide probably will NOT build a rom with no bugs, it will only give you a place to start. You will have to fix the bugs on your own. I will be referring devicename to your phones model id (my phone is samsung conquer 4g and its model id is SPH-D600) I will also be referring manufacturer to your manufacturer (duh!) and source to the source you are trying to build (CyanogenMod, aosp, etc.). As far as I know this only works for CyanogenMod 7.2 and AOSP GB.

First you might want to find out what device is closest to yours (same cpu (arm7, arm6, etc) and platform (msm7k, msm7x30, etc.) and grab its device tree for whatever rom you want to compile. It may have more fixes.

Create a folder where you want with your devices name (mine is SPH-D600). Inside create a files folder and these files

AndroidBoard.mk

AndroidProducts.mk

BoardConfig.mk

devicename.mk

extract-files.sh

proprietary-files.txt

recovery.fstab

setup-makefiles.sh

system.prop

vendorsetup.sh

Look for devicename inside the codes you are pasting

Open up AndroidBoard.mk and paste this:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := init.devicename.sh
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_CLASS := SCRIPT
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/
LOCAL_SRC_FILES := /files/init.devicename.sh
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := init.rc
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_CLASS := SCRIPT
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/
LOCAL_SRC_FILES := /files/init.rc
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := ueventd.rc
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_CLASS := SCRIPT
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/
LOCAL_SRC_FILES := /files/ueventd.rc
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := lpm.rc
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_CLASS := SCRIPT
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/
LOCAL_SRC_FILES := /files/lpm.rc
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := init.lpm.sh
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_CLASS := SCRIPT
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/
LOCAL_SRC_FILES := /files/init.lpm.sh
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := init.devicename.rc
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE_CLASS := SCRIPT
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/
LOCAL_SRC_FILES := /files/init.devicename.rc
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)

# include the non-open-source counterpart to this file
-include vendor/samsung/chief/AndroidBoardVendor.mk

These files are in your ramdisk in your boot.img. Use a boot.img unpacker to get these files and paste them in the files folder. Replace devicename with your phones device name. If you do not have one of these files than just erase it from the mk file.

Next open AndroidProducts.mk and paste this:

PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/devicename.mk

Next is BoardConfig.mk, You will have to do some research to get these. This is where the cousin devices tree will come in handy. Paste this:

# inherit from the proprietary version
-include vendor/samsung/devicename/BoardConfigVendor.mk

(get most of this from build.prop)
# Board General info
TARGET_BOOTLOADER_BOARD_NAME := devicename
TARGET_BOARD_PLATFORM := platform
BOARD_HAS_NO_SELECT_BUTTON := true
TARGET_CPU_ABI := cpu
TARGET_CPU_ABI2 := cpu2
TARGET_ARCH_VARIANT := cpu-a-neon
ARCH_ARM_HAVE_TLS_REGISTER := ?
BOARD_USES_QCOM_HARDWARE := ?
BOARD_USES_QCOM_GPS := ?
BOARD_USES_QCOM_LIBS := ?
BOARD_USES_QCOM_LIBRPC := ?
BOARD_USE_QCOM_PMEM := ?

(i cant figure this one out, please pm me if you find it out)
# ril

# audio
HAVE_HTC_AUDIO_DRIVER := ?
BOARD_USES_GENERIC_AUDIO := ?
TARGET_PROVIDES_LIBAUDIO := ?

(get this information from system/etc and /modules)
# wifi
BOARD_WPA_SUPPLICANT_DRIVER := ?
WPA_SUPPLICANT_VERSION := ?
BOARD_WLAN_DEVICE := ?
WIFI_DRIVER_FW_PATH_STA := "/system/etc/wifi/?"
WIFI_DRIVER_FW_PATH_AP := "/system/etc/wifi/?"
WIFI_DRIVER_MODULE_NAME := "?"
WIFI_DRIVER_MODULE_PATH := "/lib/modules/?"
WIFI_DRIVER_MODULE_ARG := "firmware_path=/system/etc/wifi/? nvram_path=/system/etc/wifi/?"

(get this from system/etc)
# video
BOARD_EGL_CFG := device/manufacturer/devicename/files/?
TARGET_BOARD_PLATFORM_GPU := ?

# Bluetooth
BOARD_HAVE_BLUETOOTH := true
BOARD_HAVE_BLUETOOTH_BCM := ?

(get this from your boot.img unpacking)
# kernel
BOARD_KERNEL_CMDLINE := ?
BOARD_KERNEL_BASE := ?
BOARD_KERNEL_PAGESIZE := ?
TARGET_PREBUILT_KERNEL := devicemanufacturer/devicename/kernel

# Partitioning setup (fix this up by examining /proc/mtd on a running device)
BOARD_BOOTIMAGE_PARTITION_SIZE := ?
BOARD_RECOVERYIMAGE_PARTITION_SIZE := ?
BOARD_SYSTEMIMAGE_PARTITION_SIZE := ?
BOARD_USERDATAIMAGE_PARTITION_SIZE := ?
BOARD_FLASH_BLOCK_SIZE := ?

## PARTITION LAYOUT/INFO ##
BOARD_DATA_DEVICE := /dev/block/mtdblock?
BOARD_DATA_FILESYSTEM := ?
BOARD_DATA_FILESYSTEM_OPTIONS := rw,nosuid,nodev,noatime,nodiratime 0 0 (the permissions, replace these with your devices)
BOARD_SYSTEM_DEVICE := /dev/block/mtdblock?
BOARD_SYSTEM_FILESYSTEM := ?
BOARD_SYSTEM_FILESYSTEM_OPTIONS := rw,noatime,nodiratime 0 0 (the permissions, replace these with your devices)
BOARD_CACHE_DEVICE := /dev/block/mtdblock?
BOARD_CACHE_FILESYSTEM := ?
BOARD_CACHE_FILESYSTEM_OPTION := rw,nosuid,nodev,noatime,nodiratime 0 0 (the permissions, replace these with your devices)
BOARD_MISC_DEVICE := /dev/block/mtdblock?
BOARD_BOOT_DEVICE := /dev/block/mtdblock?
BOARD_RECOVERY_DEVICE := /dev/block/mtdblock?
TARGET_USERIMAGES_USE_EXT4 := ?
BOARD_SDCARD_DEVICE_PRIMARY := /dev/block/vold/?

# recovery
BOARD_RECOVERY_HANDLES_MOUNT := true
BOARD_CUSTOM_GRAPHICS:= graphics.c (you might need this so check for it in your recovery source)

# JIT / Optimizations
WITH_DEXPREOPT := true
JS_ENGINE := v8

TARGET_SPECIFIC_HEADER_PATH += device/manufacturer/devicename/files

TARGET_RELEASETOOL_OTA_FROM_TARGET_SCRIPT :=

next is devicename.mk use common sense in this one (chief is now devicename for this one)

$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)
# The gps config appropriate for this device
$(call inherit-product, device/common/gps/gps_us_supl.mk)
# Inherit some common cyanogenmod stuff.
(may or may not have to use this)
$(call inherit-product, vendor/source/products/common_full.mk)

$(call inherit-product-if-exists, vendor/samsung/chief/chief-vendor.mk)

DEVICE_PACKAGE_OVERLAYS += device/samsung/chief/overlay

ifeq ($(TARGET_PREBUILT_KERNEL),)
LOCAL_KERNEL := device/samsung/chief/kernel
else
LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
endif
PRODUCT_COPY_FILES += \
$(LOCAL_KERNEL):kernel

PRODUCT_PACKAGES += \
hostap \
librs_jni \
gralloc.msm7k \
overlay.default \
screencap \
libOmxCore \
libOmxVenc \
libOmxVdec \
com.android.future.usb.accessory \
hostapd

PRODUCT_PACKAGES += \
sensors.default \
lights.msm7k

#kernel modules
PRODUCT_COPY_FILES += \
device/samsung/chief/files/lib/modules/bthid.ko:root/lib/modules/bthid.ko \
device/samsung/chief/files/lib/modules/cmc7xx_sdio.ko:root/lib/modules/cmc7xx_sdio.ko \
device/samsung/chief/files/lib/modules/dhd.ko:root/lib/modules/dhd.ko \
device/samsung/chief/files/lib/modules/qce.ko:root/lib/modules/qce.ko \
device/samsung/chief/files/lib/modules/qcedev.ko:root/lib/modules/qcedev.ko \
device/samsung/chief/files/system/lib/libdiag.so:system/lib/libdiag.so \
device/samsung/chief/files/lib/modules/qcrypto.ko:root/lib/modules/qcrypto.ko

# Fix Logcat / Misc
PRODUCT_COPY_FILES += \
device/samsung/chief/files/logcat:system/bin/logcat \
vendor/samsung/chief/proprietary/lib/libgsl.so:system/lib/libgsl.so

# system/etc/init's
PRODUCT_COPY_FILES += \
device/samsung/chief/init.cdma-pppd:system/etc/init.cdma-ppd \
device/samsung/chief/init.gprs-pppd:system/etc/init.gprs-ppd \
device/samsung/chief/init.qcom.bt.sh:system/etc/init.qcom.bt.sh \
device/samsung/chief/init.qcom.coex.sh:system/etc/init.qcom.coex.sh \
device/samsung/chief/init.qcom.fm.sh:system/etc/init.qcom.fm.sh \
device/samsung/chief/init.qcom.sdio.sh:system/etc/init.qcom.sdio.sh \
device/samsung/chief/init.qcom.wifi.sh:system/etc/init.qcom.wifi.sh \
device/samsung/chief/files/SPH-D600.rle:root/SPH-D600.rle \
device/samsung/chief/files/charging.rle:root/charging.rle

# wifi files
PRODUCT_COPY_FILES += \
device/samsung/chief/files/egl.cfg:system/lib/egl/egl.cfg \
device/samsung/chief/files/system/etc/wifi/bcm4329_sta.bin:/system/etc/wifi/bcm4329_sta.bin \
device/samsung/chief/files/system/etc/wifi/bcm4329_aps.bin:/system/etc/wifi/bcm4329_aps.bin \
device/samsung/chief/files/system/etc/wifi/nvram_net.txt:system/etc/wifi/nvram_net.txt \
device/samsung/chief/files/system/etc/wifi/bcm4329_mfg.bin:/system/etc/wifi/bcm4329_mfg.bin \
device/samsung/chief/files/system/etc/wifi/wpa_supplicant.conf:system/etc/wifi/wpa_supplicant.conf \
device/samsung/chief/files/system/etc/dhcpcd/dhcpcd.conf:system/etc/dhcpcd/dhcpcd.conf \
device/samsung/chief/files/system/bin/BCM4329B1_002.002.023.0746.0871.hcd:system/bin/BCM4329B1_002.002.023.0746.0871.hcd

# video drivers
PRODUCT_COPY_FILES += \
device/samsung/chief/files/system/etc/firmware/vidc_720p_command_control.fw:/system/etc/firmware/vidc_720p_command_control.fw \
device/samsung/chief/files/system/etc/firmware/vidc_720p_mp4_dec_mc.fw:/system/etc/firmware/vidc_720p_mp4_dec_mc.fw \
device/samsung/chief/files/system/etc/firmware/yamato_pfp.fw:/system/etc/firmware/yamato_pfp.fw \
device/samsung/chief/files/system/etc/firmware/vidc_720p_h263_dec_mc.fw:/system/etc/firmware/vidc_720p_h263_dec_mc.fw \
device/samsung/chief/files/system/etc/firmware/vidc_720p_mp4_enc_mc.fw:/system/etc/firmware/vidc_720p_mp4_enc_mc.fw \
device/samsung/chief/files/system/etc/firmware/yamato_pm4.fw:/system/etc/firmware/yamato_pm4.fw \
device/samsung/chief/files/system/etc/firmware/vidc_720p_h264_dec_mc.fw:/system/etc/firmware/vidc_720p_h264_dec_mc.fw \
device/samsung/chief/files/system/etc/firmware/vidc_720p_vc1_dec_mc.fw:/system/etc/firmware/vidc_720p_vc1_dec_mc.fw \
device/samsung/chief/files/system/etc/firmware/vidc_720p_h264_enc_mc.fw:/system/etc/firmware/vidc_720p_h264_enc_mc.fw

# misc firmware
PRODUCT_COPY_FILES += \
device/samsung/chief/files/system/etc/firmware/wlan/cfg.dat:system/etc/firmware/wlan/cfg.dat \
device/samsung/chief/files/system/etc/firmware/wlan/qcom_fw.bin:system/etc/firmware/wlan/qcom_fw.bin \
device/samsung/chief/files/system/etc/firmware/wlan/volans/WCN1314_qcom_fw.bin:system/etc/firmware/wlan/volans/WCN1314_qcom_fw.bin \
device/samsung/chief/files/system/etc/firmware/wlan/volans/WCN1314_qcom_wlan_nv.bin:system/etc/firmware/wlan/volans/WCN1314_qcom_wlan_nv.bin \
device/samsung/chief/files/system/etc/firmware/wlan/volans/WCN1314_cfg.dat:system/etc/firmware/wlan/volans/WCN1314_cfg.dat \
device/samsung/chief/files/system/etc/firmware/wlan/volans/WCN1314_qcom_cfg.ini:system/etc/firmware/wlan/volans/WCN1314_qcom_cfg.ini \
device/samsung/chief/files/system/bin/pppd_runner:system/bin/pppd_runner \
device/samsung/chief/files/system/bin/drexe:system/bin/drexe \
device/samsung/chief/files/system/etc/wifi/wifi.conf:system/etc/wifi/wifi.conf \
device/samsung/chief/files/system/etc/wifi/wl:system/etc/wifi/wl \
device/samsung/chief/files/system/etc/wifi/nvram_mfg.txt:system/etc/wifi/nvram_mfg.txt

# Telephony property for CDMA
PRODUCT_PROPERTY_OVERRIDES += \
ro.config.vc_call_vol_steps=15 \
ro.telephony.default_network=4 \
ro.com.google.clientidbase=android-sprint-us \
ro.cdma.home.operator.numeric=310120 \
ro.cdma.home.operator.alpha=Sprint \
net.cdma.pppd.authtype=require-pap \
net.cdma.pppd.user=user[SPACE]SprintNextel \
net.cdma.datalinkinterface=/dev/ttyCDMA0 \
net.interfaces.defaultroute=cdma \
net.cdma.ppp.interface=ppp0 \
net.connectivity.type=CDMA1 \
mobiledata.interfaces=ppp0,uwbr0 \
ro.telephony.ril_class=samsung \
ro.ril.samsung_cdma=true

# WiMAX Property setting for checking WiMAX interface
PRODUCT_PROPERTY_OVERRIDES += \
ro.wimax.interface=uwbr0 \
net.tcp.buffersize.wimax=4092,87380,1520768,4092,16384,1520768

# misc for now
PRODUCT_COPY_FILES += \
device/samsung/chief/files/system/etc/apns-conf.xml:system/etc/apns-conf.xml \
device/samsung/chief/files/system/vendor/lib/libsec-ril.so:system/vendor/lib/libsec-ril.so \
device/samsung/chief/files/system/bin/qmuxd:system/bin/qmuxd \
device/samsung/chief/files/system/bin/rmt_storage:system/bin/rmt_storage \
device/samsung/chief/files/system/bin/netmgrd:system/bin/netmgrd \
device/samsung/chief/files/system/bin/thermald:system/bin/thermald \
device/samsung/chief/files/system/bin/geomagneticd:system/bin/geomagneticd \
device/samsung/chief/files/system/bin/orientationd:system/bin/orientationd \
device/samsung/chief/files/system/bin/cnd:system/bin/cnd \
device/samsung/chief/files/system/bin/mfgloader:system/bin/mfgloader \
device/samsung/chief/files/system/bin/wlandutservice:system/bin/wlandutservice \
device/samsung/chief/files/system/bin/btld:system/bin/btld \
vendor/cyanogen/prebuilt/mdpi/media/bootanimation.zip:system/media/bootanimation.zip \
device/samsung/chief/files/system/etc/01_qcomm_omx.cfg:system/etc/01_qcomm_omx.cfg \
device/samsung/chief/files/system/etc/cdma-carriers-conf.xml:system/etc/cdma-carriers-conf.xml \
device/samsung/chief/files/system/etc/loc_parameter.ini:system/etc/loc_parameter.ini \
device/samsung/chief/files/system/etc/media_profiles.xml:system/etc/media_profiles.xml \
device/samsung/chief/files/system/etc/wimax_boot.bin:system/etc/wimax_boot.bin \
device/samsung/chief/files/system/etc/wimaxfw.bin:system/etc/wimaxfw.bin \
device/samsung/chief/files/system/etc/wimaxloader.bin:system/etc/wimaxloader.bin \
device/samsung/chief/files/system/etc/thermald.conf:system/etc/thermald.conf

# These are the hardware-specific features
PRODUCT_COPY_FILES += \
frameworks/base/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
frameworks/base/data/etc/android.hardware.camera.flash-autofocus.xml:system/etc/permissions/android.hardware.camera.flash-autofocus.xml \
frameworks/base/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \
frameworks/base/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \
frameworks/base/data/etc/android.hardware.telephony.cdma.xml:system/etc/permissions/android.hardware.telephony.cdma.xml \
frameworks/base/data/etc/android.hardware.location.xml:system/etc/permissions/android.hardware.location.xml \
frameworks/base/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
frameworks/base/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \
frameworks/base/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \
frameworks/base/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml \
frameworks/base/data/etc/android.hardware.sensor.compass.xml:system/etc/permissions/android.hardware.sensor.compass.xml \
frameworks/base/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml \
frameworks/base/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
frameworks/base/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \
packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:system/etc/permissions/android.software.live_wallpaper.xml

$(call inherit-product, build/target/product/full.mk)

PRODUCT_BUILD_PROP_OVERRIDES += BUILD_UTC_DATE=0

PRODUCT_PROPERTY_OVERRIDES := \
wifi.interface=eth0\
wifi.supplicant_scan_interval=15\
ril.subscription.types=NV

# Perfomance tweaks and misc
PRODUCT_PROPERTY_OVERRIDES += \
dalvik.vm.execution-mode=int:jit \
dalvik.vm.heapsize=48m \
persist.sys.use_dithering=1 \
ro.compcache.default=0

# Properties taken from build.prop
PRODUCT_PROPERTY_OVERRIDES += \
ro.setupwizard.mode=DISABLED \
ro.com.google.gmsversion=2.3_r9 \
ro.com.google.clientidbase=android-samsung \
ro.com.google.clientidbase.ms=android-sprint-us \
ro.com.google.clientidbase.yt=android-sprint-us \
ro.com.google.clientidbase.am=android-sprint-us \
ro.com.google.clientidbase.gmm=android-samsung

# Set region
PRODUCT_DEFAULT_LANGUAGE := en_US
PRODUCT_DEFAULT_REGION := US

# Chief uses medium-density artwork where available
PRODUCT_LOCALES += mdpi

PRODUCT_COPY_FILES += \
$(LOCAL_KERNEL):kernel

$(call inherit-product, build/target/product/full.mk)

PRODUCT_NAME := cyanogenmod_chief
PRODUCT_DEVICE := chief
PRODUCT_BRAND := samsung
PRODUCT_MODEL := SPH-D600
PRODUCT_MANUFACTURER := samsung
CDMA_GOOGLE_BASE := android-sprint-us
CDMA_CARRIER_ALPHA := Sprint
CDMA_CARRIER_NUMERIC := 310120

next extract-files.sh

BASE=../../../vendor/manufacturer/devicename/proprietary
rm -rf $BASE/*

for FILE in `egrep -v '(^#|^$)' proprietary-files.txt`; do
DIR=`dirname $FILE`
if [ ! -d $BASE/$DIR ]; then
mkdir -p $BASE/$DIR
fi
adb pull /system/$FILE $BASE/$FILE
done

./setup-makefiles.sh

For propietary-files.txt put in the directories of the needed files. Example

lib/libsec-ril.so
lib/liboncrpc.so
bin/mm-abl-tes
etc.

next setup-makefiles.sh NOTICE: there will be coding such as $DEVICE do NOT replace this with your devices name. This code will be set with what ever you put in the beginning.

#!/bin/sh

# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

DEVICE=devicename
VENDOR=manufacturer
OUTDIR=vendor/$VENDOR/$DEVICE
MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk
mkdir -p ../../../vendor/$VENDOR/$DEVICE

(cat << EOF) > $MAKEFILE
# Copyright (C) 2011 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh

# Prebuilt libraries that are needed to build open-source libraries
#$OUTDIR/proprietary/lib/libcamera.so:obj/lib/libcamera.so \\
#$OUTDIR/proprietary/lib/libcameraservice.so:obj/lib/libcameraservice.so \\
#$OUTDIR/proprietary/lib/libcamera_client.so:obj/lib/libcamera_client.so \\
#$OUTDIR/proprietary/lib/liboemcamera.so:obj/lib/liboemcamera.so \\

PRODUCT_COPY_FILES += \\
$OUTDIR/proprietary/lib/libaudioalsa.so:obj/lib/libaudioalsa.so \\
EOF

LINEEND=" \\"
COUNT=`cat proprietary-files.txt | grep -v ^# | grep -v ^$ | wc -l | awk {'print $1'}`
for FILE in `cat proprietary-files.txt | grep -v ^# | grep -v ^$`; do
COUNT=`expr $COUNT - 1`
if [ $COUNT = "0" ]; then
LINEEND=""
fi
echo " $OUTDIR/proprietary/$FILE:system/$FILE$LINEEND" >> $MAKEFILE
done

(cat << EOF) > ../../../$OUTDIR/$DEVICE-vendor.mk
# Copyright (C) 2011 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh

# Live wallpaper packages
PRODUCT_PACKAGES := \\
LiveWallpapers \\
LiveWallpapersPicker

# Publish that we support the live wallpaper feature.
PRODUCT_COPY_FILES := \\
packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:/system/etc/permissions/android.software.live_wallpaper.xml

# Pick up overlay for features that depend on non-open-source files
DEVICE_PACKAGE_OVERLAYS := vendor/$VENDOR/$DEVICE/overlay

\$(call inherit-product, vendor/$VENDOR/$DEVICE/$DEVICE-vendor-blobs.mk)
EOF

(cat << EOF) > ../../../$OUTDIR/BoardConfigVendor.mk
# Copyright (C) 2011 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh

USE_CAMERA_STUB := ?
EOF

Next is system.prop, this is basically the props for your device in build.prop

#
# system.prop for devicename
#
rild.libpath=/system/vendor/lib/?
rild.libargs= ?

Finally vendorsetup.sh

#
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

# This file is executed by build/envsetup.sh, and can use anything
# defined in envsetup.sh.
#
# In particular, you can add lunch options with the add_lunch_combo
# function: add_lunch_combo generic-eng

add_lunch_combo source_devicename-eng

There you go! It may have been a lot of work but its worth it. If you have any questions comment them.