Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AOSP build on custom device

I'm building AOSP 4.2 Jelly Bean. Everything is ok when I build default full-eng configuration and run it on emulator.

I need to build custom device and run it (on emulator - for testing if it really works, and on real device). When I create custom device based on full_base.mk file, and run it on emulator - emulator just hangs up on first screen with ANDROID text, and will not load at all. I have system.img, userdata.img, ramdisk.img 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?

Should I have something additional for building AOSP for real device: kernel, device drivers, etc.?

custom device folder files (device/my_company/my_product):

Android.mk

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

ifneq ($(filter my_product,$(TARGET_DEVICE)),)
include $(call all-makefiles-under,$(LOCAL_PATH))
endif

AndroidProducts.mk

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

BoardConfig.mk

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

full_myproduct.mk

$(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

vendorsetup.sh

add_lunch_combo full_myproduct-userdebug
like image 803
Veaceslav Gaidarji Avatar asked Mar 30 '13 17:03

Veaceslav Gaidarji


People also ask

How do you make an AOSP device?

To download and build the AOSP project you should have a 64-bit version of either Linux (18.04 or greater) or Mac OS installed. Here, RAM plays a very crucial role when it comes to building / compiling the android source code. According to the official docs, it is recommended that you should have at least 16GB of RAM.

Is AOSP owned by Google?

Google oversees the development of the core Android open source platform and works to create robust developer and user communities.

How long does it take to compile AOSP?

As of June 2021, Google is using 72-core machines with 64 GB of RAM internally, which take about 40 minutes for a full build (and just a few minutes for incremental builds, depending on exactly which files were modified).


2 Answers

It seems like you have a good hold on the AOSP build system, especially on how to add new devices.

full-eng only targets the emulator. Usually you build custom .img for the device in question, as the hardware drivers play a big role in whether the device works or not.

For example, if you have a grouper or a maguro, you would end up building for that device instead of full-eng. lunch should list the additional devices as you add them to your device/ and vendor/ trees. Google provides the files necessary to build for the line of Nexus devices on their [website][https://developers.google.com/android/nexus/drivers].

What is the custom device that you are building for? If your device is commercially sold, chances are someone on XDA is trying to port AOSP and friends (CM, AOKP, etc) to your device.

Even if your device isn't on XDA, chances are it has hardware common with a bunch of other devices that you can find on AOSP. At that point, you'd have to go cherry pick driver-specific bits of code, like wifi chipsets, sound devices, etc.

I don't have a good primer for building off the top of my head, but http://wiki.cyanogenmod.org/w/Main_Page should be fairly helpful to you. This wiki has improved a lot since its creation and now has a chockful of useful information.

like image 124
Ehtesh Choudhury Avatar answered Oct 16 '22 16:10

Ehtesh Choudhury


You are missing some of the vendor's drivers. goto: https://developers.google.com/android/nexus/drivers

download the appropriate drivers for the exact device. put the *.sh file in your aosp top directory. run each of the shell file and accept the terms.

then recompile the code!

like image 26
tutormike Avatar answered Oct 16 '22 14:10

tutormike