title: AOSP build on custom device
body: <p>I'm building <code>AOSP 4.2 Jelly Bean</code>.
  Everything is ok when I build default <code>full-eng</code> configuration and run it on emulator.</p>
  
  <p>I need to build custom device and run it (on <code>emulator</code> - for testing if it really works, and on real device).
  When I create custom device based on <code>full_base.mk</code> file, and run it on <code>emulator</code> - <code>emulator</code> just hangs up on first screen with ANDROID text, and will not load at all.
  I have <code>system.img, userdata.img, ramdisk.img</code> after building in out directory. Is this all what I need for building custom AOSP and run it on device? Can I run my build on emulator or just on real device?</p>
  
  <p>Should I have something additional for building AOSP for real device: kernel, device drivers, etc.?</p>
  
  <p>custom device folder files (device/my_company/my_product):</p>
  
  <p><strong>Android.mk</strong></p>
  
  <pre><code>LOCAL_PATH := $(call my-dir)
  include $(CLEAR_VARS)
  
  ifneq ($(filter my_product,$(TARGET_DEVICE)),)
  include $(call all-makefiles-under,$(LOCAL_PATH))
  endif
  </code></pre>
  
  <p><strong>AndroidProducts.mk</strong></p>
  
  <pre><code>PRODUCT_MAKEFILES := \
      $(LOCAL_DIR)/full_myproduct.mk
  </code></pre>
  
  <p><strong>BoardConfig.mk</strong></p>
  
  <pre><code>TARGET_NO_BOOTLOADER := true
  TARGET_NO_KERNEL := true
  
  TARGET_ARCH := arm
  
  TARGET_ARCH_VARIANT := armv7-a
  TARGET_CPU_VARIANT := generic
  TARGET_CPU_ABI := armeabi-v7a
  TARGET_CPU_ABI2 := armeabi
  
  HAVE_HTC_AUDIO_DRIVER := true
  BOARD_USES_GENERIC_AUDIO := true
  
  # no hardware camera
  USE_CAMERA_STUB := true
  
  # Enable dex-preoptimization to speed up the first boot sequence
  # of an SDK AVD. Note that this operation only works on Linux for now
  ifeq ($(HOST_OS),linux)
    ifeq ($(WITH_DEXPREOPT),)
      WITH_DEXPREOPT := true
    endif
  endif
  
  # Build OpenGLES emulation guest and host libraries
  BUILD_EMULATOR_OPENGL := true
  
  # Build and enable the OpenGL ES View renderer. When running on the emulator,
  # the GLES renderer disables itself if host GL acceleration isn't available.
  USE_OPENGL_RENDERER := true
  </code></pre>
  
  <p><strong>full_myproduct.mk</strong></p>
  
  <pre><code>$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)
  $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
  
  #DEVICE_PACKAGE_OVERLAYS :=
  #PRODUCT_PACKAGES +=
  #PRODUCT_COPY_FILES +=
  
  PRODUCT_NAME := full_myproduct
  PRODUCT_DEVICE := myproduct
  PRODUCT_MODEL := Customized Android
  PRODUCT_BRAND := Android
  </code></pre>
  
  <p><strong>vendorsetup.sh</strong></p>
  
  <pre><code>add_lunch_combo full_myproduct-userdebug
  </code></pre>