How to build STM32MPU distribution for Android

Revision as of 15:19, 21 August 2019 by Registered User

This article explains how to build the STM32MPU distribution for Android™. It is intended for Distribution Package users.

1. Prerequisites[edit source]

The environment must be installed using the Distribution Package adapted to your selected microprocessor device. See the list of Android Distribution Package.

You should also follow the PC prerequisites dedicated to Android to ensure all necessary packages to use the environment are present.

2. Build[edit source]

Before doing anything, execute:

 source ./build/envsetup.sh

This will set all the necessary environment variables needed to execute every script and to work in the distribution environment. It is mandatory to start with this command as soon as you are in a new terminal.

The command:

 hmm 

will list some interested aliases created by envsetup.sh.

If you have never set up an environment to build Android continue to read. Otherwise you can directly go to Choosing a build target

2.1. Memory settings[edit source]

It is possible to change the memory size and type you want to use. More information in How to customize the STM32MPU distribution for Android

Edit the file device/stm/<STM32Series>/layout/android_layout.config.

Locate the two lines below:

PART_MEMORY_TYPE
PART_MEMORY_SIZE

Current options are :

  • PART_MEMORY_TYPE sd and PART_MEMORY_SIZE 8GiB
  • PART_MEMORY_TYPE sd and PART_MEMORY_SIZE 4GiB
  • PART_MEMORY_TYPE emmc and PART_MEMORY_SIZE 4GiB

When change have been done on the file you need to relaunch the previous command:

 source ./build/envsetup.sh

2.2. Setup[edit source]

This <STM32Series>setup needs to be executed only once. As for example for STM32MP1 series:

 stm32mp1setup

This will apply specific patches link with your <STM32Series> to customize Android and load the necessary libraries and modules.

2.3. Choose a build target[edit source]

To choose your target device, execute:

 lunch aosp_<BoardId>-<build_type>

Available build_type values:

  • user: to generate an end-user production image;
  • userdebug: similar to an user build but with root access and debug capabilities;
  • eng: development configuration with additional debugging tools.

2.4. Generating the image[edit source]

You are now ready to compile. Just do:

 make -j

This command can take several hours on the first build, depending on your computer settings.

The result can be found in the out folder. The generated partition images are located in out/target/product/<BoardId>

To flash images please refer to Flashing the built image