'How to build android AOSP to a specific target product

I am trying to generate a rom to install in my phone which is a Motorola 1Gen Codename Falcon. I have followed both instructions from the official tutorial on source.android.com and also this tutorial. Summing up what I did:

  • set up the build environment
  • Get the AOSP source:

repo init -u https://android.googlesource.com/platform/manifest
repo sync

  • Get the device tree and kernel for Falcon:

git clone github.com/CyanogenMod/android_device_motorola_falcon -b cm-14.1 device/motorola/falcon
git clone github.com/CyanogenMod/android_kernel_motorola_msm8226 -b cm-14.1 kernel/motorola/msm8226

(I removed the https:// because my account can only post two links)

  • Defined the target architecture:

. build/envsetup.sh
lunch aosp_arm-eng

  • and finally build it:

make -j8

Accordin to this tutorial from xda-developers I posted, after the successful build, it was going to create a .zip file to be flashed at out/target/product/*CODENAME*. But it created only a out/target/product/generic with a system.img file and not a out/target/product/falcon as I expected (was my expectation right?).

So anyway, did I miss something important in the process of making it? How to correctly make for my target? Thanks in advance.



Solution 1:[1]

Cyanogenmod is no longer actively developed or supported. It has become LineageOS, so your best bet is to look there. Building Cyanogenmod (or LineageOS) is slightly different than what is described on AOSP. Look here for specific instructions for the Moto G: https://wiki.lineageos.org/devices/falcon/build

Solution 2:[2]

You're intentionally building for generic, though you're not aware of. lunch aosp_arm-eng sets the target. aosp_arm-eng is not the falcon you want to build for, it's the very generic.

To build for falcon, pick the correct item from lunch menu.

Solution 3:[3]

If the Target Platform suffix is what you are looking for, then there are two solutions:

  1. Using a separate output directory:

    $> export OUT_DIR=out_armv7

    This will override the default out/ directory for your target binary.

  2. Searching in the out/snoog/ directory (Android > 7.0) and find Target Platform specific .mk file, e.g. Android-asop_arm.mk

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Larry Schiefer
Solution 2 frogatto
Solution 3 StndFish