Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create specific device tree for AOSP

I followed official Google`s tutorial to build my own AOSP and succeeded in all steps: I have a "Pure AOSP version" running on a nexus emulator. https://source.android.com/source/building.html

The story is I have some rare device came with some Android version full of a pre-installed app's obviously I don't want. I want to port Pure AOSP to my device - without any improvements or new features (So, for example, I don`t want to know how to build CM git repo).

  1. Is it working just add to my local above master branch correct files into /device/vendor/model and then under cwd of master branch execute $ . build/envsetup.sh ?

  2. If so, what are the files and their content I need to put under /device/vendor/model? I found a lot of guides how to pull already existing tree of CM or something else (http://xda-university.com/as-a-developer/porting-aosp-roms-using-source-code) and including this Android device configuration for AOSP and looking on some git repo's of several devices, I tried to figure out the minimum complete set of files & their content but I didn't find a correlation. I think there must be the minimum complete set and there is programming reason for the existence of each file. And what I saw in existed git repo`s was this set + custom extras each developer added for his own reasons.

  3. Aftermath How do I determine the Build name & Buildtype to execute $ lunch <Build name>-<Buildtype >?

  4. How to integrate $ make otapackage in order to build the familiar one zip file to load via recovery like CWM?

This is following my previous post: Porting AOSP to specific hardware device, But here the questions are more specific.

like image 381
michael Avatar asked Jul 19 '15 20:07

michael


People also ask

What is Android device tree?

A device tree (DT) is a data structure of named nodes and properties that describe non-discoverable hardware. Operating systems, such as the Linux kernel used in Android, use DTs to support a wide range of hardware configurations used by Android-powered devices.

How do I get to device tree?

Starting the Bringup Basically while flashing ROMs based on this device tree you do not need to wipe vendor. You'll need to figure out the codename of the device by looking at the build number or reading the build. prop or checking the stock rom dump. This is not important and you can use any codename for your device.

What is a device tree overlay?

Device tree overlays are special device tree blob fragments that allow you to override specific parts of a device tree on-the-fly, before booting the operating system. A 'blob' is the compiled version of a device tree source file.

What is device tree?

A device tree is a tree-structured data format that represents information about the devices on a board. For developing a product with the platform, the device tree data is automatically included in the flashed image.


1 Answers

  1. Process of adding new device to AOSP: First the device definition should be placed in device/vendor/model path. and then you should add AndroidProducts.mk file with COMMON_LUNCH_CHOICES which specify the name and the build type of your AOSP (Eng,userdebug,release) and PRODUCT_MAKEFILES which should point to you main device makefile.

  2. What goes to device/vendor/model: device/vendor/model contains the core configuration of the device itself such as Bluetooth configs, audio_policy configs, wpa_supplicant configs, device-tree, prebuilt hardware firmware or prebuilt images for boot or recovery. Also it contains The framework overlays that you can configure some of the framework parameter and for example decide the your android should have a navigation bar or what type of status bar you want. It also contains the SELinux policies that you can make rules for different processes, defines new contexts, and even ban some processes of running or having access to some resources. and at last it contains the makefiles that you can include what packages you need for you AOSP (aosp.mk) or what is you device configuration (BoardConfig.mk) for example what is the cpu architecture, gpu driver name or should it use hardware composer or does you system have wifi, bluetooth and if it has what is the address and the name of the required drivers. Also we have the init (in case that you want to add some additional changes to android boot process), fstab (describes the android partition and how should they be mounted) and ueventd and some udev rules that should be in this directory.

  3. Look at the number 1.

  4. For OTA update packages, first you need to generate the required keys that is essential for generating a zip for ota updates. if you are starting now , I suggest that you use fastboot. but if you want I put a link that shows how you can encrypt the required packages. when the encryption is done, you can generate your OTA image by this command:

    img_from_target_files signed-target-files.zip signed-img.zip

OTA update guide: https://source.android.com/devices/tech/ota/sign_builds

  1. I think what you are looking for are not OTA packages, but how to form the unified zip. OTA packages will have changes made after the system was installed once. My OTA package has ~500mb of files (payload) etc. This was Full Update. Incremental Updates are much smaller. However when I build a flashable package, I get ~2.6gb of files. Flashing varies device to device. QCom (Qualcomm) requires QFil Tool to flash the full system. Or you flash the individual images through fastboot. So I don't know how 4. works for you. Looks like the original Answer was based on the poor documentation from Google. When it comes to AOSP, experience is must, documentation is never enough
like image 70
Nima Mohammadi Avatar answered Oct 24 '22 09:10

Nima Mohammadi