Last edited 3 years ago

STM32MP1 Distribution Package for Android: Difference between revisions

Registered User
Registered User
 
(24 intermediate revisions by the same user not shown)
Line 28: Line 28:


== Installing the STM32MPU distribution for Android ==
== Installing the STM32MPU distribution for Android ==
{{SoftwareLicenseAgreement | distribution=Android}}


''By downloading this software package, you agree to be bound to the terms of the [[STM32MPU distribution for Android licenses#Top Software license agreement (SLA) and third-party licences|software license agreement (SLA)]]''. ''The detailed content licenses can be found [[STM32MPU distribution for Android licenses|here]]''.
The installation relies on the <code>repo</code> command. If the Repo tool (a Google-built repository management tool that runs on top of Git) is not already installed and configured on the host PC, refer to the [[PC prerequisites]] article.
 
The installation relies on the ''repo'' command. If the Repo tool (a Google-built repository management tool that runs on top of Git) is not already installed and configured on the host PC, refer to the [[PC prerequisites]] article.


Create a working directory for the distribution (we recommended using the distribution name):
Create a working directory for the distribution (we recommended using the distribution name):
  {{PC$}} mkdir <working directory>
  {{PC$}} mkdir {{HighlightParam|<working directory>}}
  {{PC$}} cd <working directory>
  {{PC$}} cd {{HighlightParam|<working directory>}}


=== Use manifest ===
=== Use manifest ===


Initialize repo in the working directory:
1- Initialize repo in the working directory:
  {{PC$}} repo init -u https://github.com/STMicroelectronics/android-manifest  -b <STM32MPU delivery version> -m stm32mp1droid.xml
  {{PC$}} repo init -u https://github.com/STMicroelectronics/android-manifest  -b refs/tags/{{HighlightParam|<Tag>}} -m stm32mp1droid.xml
With
With
* <STM32MPU  delivery version> = '''tag''' selecting the required version of the STM32MPU distribution for Android&trade;
* {{HighlightParam|<Tag>}} = '''tag''' selecting the required version of the STM32MPU distribution for Android&trade; (see following table)


{|class="st-table"
{|class="st-table"
Line 48: Line 47:
| colspan="3" | '''STM32MPU distribution for Android&trade;'''
| colspan="3" | '''STM32MPU distribution for Android&trade;'''
|-
|-
| style="width:25%; text-align:center" | Tag
| style="width:30%; text-align:center" | Tag
| style="width:25%; text-align:center" | android-<version>
| style="width:20%; text-align:center" | android-<version>
| style="width:50%; text-align:center" | Release note
| style="width:50%; text-align:center" | Release note
|-
|-
| st-android-9.0.0-2019-09-27
| style="text-align:center" | st-android-11.0.0-2021-01-29
| android-9.0.0_r46
| style="text-align:center" | android-11.0.0_r27
| [[STM32MP15 distribution for Android release note - v1.0.0 | st-android-9.0.0-2019-09-27 release note]]
| style="text-align:center" | [[STM32MP15 distribution for Android release note - v2.0.0 | st-android-11.0.0-2021-01-29 release note (v2.0.0)]]
|-
| style="text-align:center" | st-android-11.0.0-2021-06-01
| style="text-align:center" | android-11.0.0_r37
| style="text-align:center" | [[STM32MP15 distribution for Android release note - v2.0.0 | st-android-11.0.0-2021-06-01 release note (v2.0.1)]]
|-
| style="text-align:center" | st-android-11.0.0-2021-08-31
| style="text-align:center" | android-11.0.0_r37
| style="text-align:center" | [[STM32MP15 distribution for Android release note - v2.0.0 | st-android-11.0.0-2021-08-31 release note (v2.0.2)]]
|}
|}




Synchronize the local project directories with the remote repositories specified in the manifest:
2- Synchronize the local project directories with the remote repositories specified in the manifest:
  {{PC$}} repo sync  
  {{PC$}} repo sync  


Line 66: Line 73:


If you have been provided with an archive <code><STM32MPU delivery version>.tar.gz</code>, you need to follow those steps:
If you have been provided with an archive <code><STM32MPU delivery version>.tar.gz</code>, you need to follow those steps:
* Download the official Android version compatible with the provided package (with or without mirror):
 
  {{PC$}} repo init -u https://android.googlesource.com/platform/manifest -b android-<version>
1- Download the official Android version compatible with the provided package (with or without mirror):
  {{PC$}} repo init -u https://android.googlesource.com/platform/manifest -b android-{{HighlightParam|<version>}}
  {{PC$}} repo sync
  {{PC$}} repo sync
For more info on available version please refer to the official page<ref>https://source.android.com/setup/start/build-numbers#source-code-tags-and-builds</ref>.
For more info on available version please refer to the official page<ref>https://source.android.com/setup/start/build-numbers#source-code-tags-and-builds</ref>.
Line 73: Line 81:
This may take several hours.
This may take several hours.


* Download the archive depending on the required version (tag):
 
2- Download the archive depending on the required version (tag):
{|class="st-table"
{|class="st-table"
|-
|-
Line 83: Line 92:
| style="width:30%; text-align:center" | Release note
| style="width:30%; text-align:center" | Release note
|-
|-
| st-android-9.0.0-2019-09-27
| style="text-align:center" | st-android-11.0.0-2021-01-29
| [https://www.st.com/content/ccc/resource/technical/sw-updater/firmware2/group0/f1/da/1a/e9/28/f8/47/3e/STM32MP1_Distribution_Package_for_Android/files/st-android-9.0.0-2019-09-27-source.tar.gz/jcr:content/translations/en.st-android-9.0.0-2019-09-27-source.tar.gz st-android-9.0.0-2019-09-27-source.tar.gz]
| style="text-align:center" | [https://st.com/content/ccc/resource/technical/software/application_sw/group0/78/ae/a6/58/9c/1a/4b/66/STM32MP1_Distribution_Package_for_Android/files/st-android-11.0.0-2021-01-29-source.tar.gz/jcr:content/translations/en.st-android-11.0.0-2021-01-29-source.tar.gz en.st-android-11.0.0-2021-01-29-source.tar.gz]
| android-9.0.0_r46
| style="text-align:center" | android-11.0.0_r27
| [[STM32MP15 distribution for Android release note - v1.0.0 | st-android-9.0.0-2019-09-27 release note]]
| style="text-align:center" | [[STM32MP15 distribution for Android release note - v2.0.0 | st-android-11.0.0-2021-01-29 release note]]
|}
|}


* Extract the archive inside the <working directory>:
{{PC$}} tar xzf <STM32MPU  delivery version>.tar.gz


=== Use local mirror ===
3- Extract the archive inside the <working directory>:
{{PC$}} tar xzf en.{{HighlightParam|<Tag>}}-source.tar.gz
 
== Local mirror ==


It can be of interest to create a local mirror of the different repositories used.
It can be of interest to create a local mirror of the different repositories used.


A helper script <code>cachesetup</code> is available for this purpose, which creates / updates the mirrors based on the configuration file <code>device/stm/<STM32Series>/scripts/cache/android_cache.config</code>.
There are two possible kinds of cache:
 
Update the cache configuration file (android_cache.config) depending on your needs. There are two possible kinds of cache:
* REPO mirror: mirror of list of modules in repositories based on provided manifest (for example Android AOSP)
* REPO mirror: mirror of list of modules in repositories based on provided manifest (for example Android AOSP)
* GIT mirror: mirror of one module (for example Linux kernel)
* GIT mirror: mirror of one module (for example Linux kernel)


Take care that if you change environment the variable name, you  have to adapt the associated scripts <code>load_xxxx</code> available in <code>device/stm/<STM32Series>-xxxx/source</code> directory.
=== REPO mirror ===
 
It's mainly used to mirror the Android AOSP sources.
 
1- Create and go to the cache directory
{{PC$}} mkdir {{HighlightParam|<PathToRepoCacheDir>}}
{{PC$}} cd {{HighlightParam|<PathToRepoCacheDir>}}
 
2- Mirror the required sources
 
case AOSP sources needed for the required version (recommended)
{{PC$}} repo init -u https://android.googlesource.com/platform/manifest -b {{HighlightParam|<Tag>}} --mirror
{{PC$}} repo sync -q
 
case full AOSP sources
{{PC$}} repo init -u https://android.googlesource.com/platform/manifest --mirror
{{PC$}} repo sync -q
 
3- Create environment variable for this cache directory
{{PC$}} export CACHE_DIR={{HighlightParam|<PathToRepoCacheDir>}}
 
{{Info|It's recommended to add this line also in your <code>.bashrc</code> file available in your HOME directory}}
 
4- Use the cache directory
 
Add {{HighlightParam|--reference{{=}}$CACHE_DIR}} option to your <code>repo init</code> command.
{{PC$}} repo init {{HighlightParam|--reference{{=}}$CACHE_DIR}} -u https://github.com/STMicroelectronics/android-manifest  -b refs/tags/{{HighlightParam|<Tag>}} -m stm32mp1droid.xml
or
{{PC$}} repo init {{HighlightParam|--reference{{=}}$CACHE_DIR}}  -u https://android.googlesource.com/platform/manifest -b android-<version>
 
=== GIT mirror ===
 
While the distribution has been installed, a helper script <code>cachesetup</code> is available for this purpose, which creates / updates the mirrors based on the configuration file <code>device/stm/<STM32Series>/scripts/cache/android_cache.config</code>.
 
Take care that if you change the environment variable name, you  have to adapt the associated scripts <code>load_xxxx</code> available in <code>device/stm/<STM32Series>-xxxx/source</code> directory.


Create the mirrors by executing the following commands:
Create the mirrors by executing the following commands:
Line 112: Line 154:


For more information on how to use this command, look at the cachesetup usage (execute <code>cachesetup -h</code>).
For more information on how to use this command, look at the cachesetup usage (execute <code>cachesetup -h</code>).
 
{{Info|It's possible to update the AOSP or the Android REPO mirror using the command <code>cachesetup aosp</code> or <code>cachesetup android</code>}}
From this stage, you can use the local mirror instead of the remote repository by adding <code>--reference=$CACHE_DIR)</code> to the repo init commands (the CACHE_DIR environment variable name is set in <code>android_cache.config</code> file).
 
{{PC$}} repo init {{HighlightParam|--reference{{=}}$CACHE_DIR}} -u <STM32MPU  manifest URL>  -b <STM32MPU  delivery version> -m <STM32Series>droid.xml
or
{{PC$}} repo init {{HighlightParam|--reference{{=}}$CACHE_DIR}}  -u https://android.googlesource.com/platform/manifest -b android-<version>
 
This copies all necessary files defined by the manifest from the mirror, instead of downloading it from the remote repository.


== Building the STM32MPU distribution for Android==
== Building the STM32MPU distribution for Android==

Latest revision as of 17:25, 2 September 2021

This article describes how to obtain and use the Distribution Package for Android of the STM32MPU Embedded Software for any STM32MP1 family (STM32MP15 boards) development platform, in order to modify or add pieces of software, and to create the right Android distribution for the targeted product.

It lists some prerequisites in terms of knowledge and development environment, and gives step-by-step instructions to download and install the STM32MPU Embedded Software packages for this Package.

1. Distribution Package content[edit source]

If you are not familiar with the STM32MPU Embedded Software for Android distribution and its Packages, please read the following articles:

In summary, this Distribution Package provides:

  • An Android build framework (aka distribution builder)
  • For the STM32MPU distribution for Android (development on Arm Cortex-A processor):
    • the BSP (Linux kernel, U-Boot, TF-A, optionally OP-TEE) pieces in binary (prebuilt). Several scripts are provided to load source code and re-build them
    • the application frameworks (including hardware abstraction code) pieces in source code
  • For the STM32Cube MPU Package (development on Arm Cortex-M processor), all pieces of software in source code: BSP, HAL, middlewares and applications
  • A toolset to tune the system for your needs, and to handle the built image (for example STM32CubeProgrammer to install the built image on the board).

2. Prerequisites[edit source]

2.1. Knowledge[edit source]

The STM32MP1 Distribution Package aims to create an Android distribution for the targeted product: solid knowledge of Linux and Android are recommended to make the most of this Package.

The STM32MPU distribution for Android is an Android distribution based on the Android build framework: a short introduction about Android is available in AOSP[1].

Reading the STM32MPU Embedded Software for Android architecture overview is also highly recommended.

2.2. Development setup[edit source]

The recommended setup for the development PC (host) is specified in the following article: PC prerequisites.

Whatever the development platform (board) and development PC (host) used, the range of possible development setups is illustrated by the picture below.

Development setup for Developer and Distribution Packages


The following components are mandatory:

  • Host PC for cross-compilation and cross-debugging, installed as specified above
  • Board assembled and configured as specified in the associated Starter Package article
  • Mass storage device (for example, microSD card) to load and update the software images (binaries)

The following components are optional, but recommended:

  • A serial link between the host PC (through Terminal program) and the board for traces (even early boot traces), and access to the board from the remote PC (command lines)
  • An Ethernet link between the host PC and the board for cross-development and cross-debugging through a local network. This is an alternative or a complement to the serial (or USB) link
  • A display connected to the board, depending on the technologies available on the board: DSI LCD display, HDMI monitor (or TV) and so on
  • A mouse and a keyboard connected through USB ports

Additional optional components can be added by means of the connectivity capabilities of the board: cameras, displays, JTAG, sensors, actuators, and much more.

3. Installing the STM32MPU distribution for Android[edit source]

The software package is provided AS IS, and by downloading it, you agree to be bound to the terms of the software license agreement (SLA). The detailed content licenses can be found here.

Warning white.png Warning
To download a package, it is recommended to be logged in to your "myst" account [1]. If, trying to download, you encounter a “403 error”, you could try to empty your browser cache to workaround the problem. We are working on the resolution of this problem.
We apologize for this inconvenience

The installation relies on the repo command. If the Repo tool (a Google-built repository management tool that runs on top of Git) is not already installed and configured on the host PC, refer to the PC prerequisites article.

Create a working directory for the distribution (we recommended using the distribution name):

 mkdir <working directory>
 cd <working directory>

3.1. Use manifest[edit source]

1- Initialize repo in the working directory:

 repo init -u https://github.com/STMicroelectronics/android-manifest  -b refs/tags/<Tag> -m stm32mp1droid.xml

With

  • <Tag> = tag selecting the required version of the STM32MPU distribution for Android™ (see following table)
STM32MPU distribution for Android™
Tag android-<version> Release note
st-android-11.0.0-2021-01-29 android-11.0.0_r27 st-android-11.0.0-2021-01-29 release note (v2.0.0)
st-android-11.0.0-2021-06-01 android-11.0.0_r37 st-android-11.0.0-2021-06-01 release note (v2.0.1)
st-android-11.0.0-2021-08-31 android-11.0.0_r37 st-android-11.0.0-2021-08-31 release note (v2.0.2)


2- Synchronize the local project directories with the remote repositories specified in the manifest:

 repo sync 

This may take several hours.

3.2. Use packages[edit source]

If you have been provided with an archive <STM32MPU delivery version>.tar.gz, you need to follow those steps:

1- Download the official Android version compatible with the provided package (with or without mirror):

 repo init -u https://android.googlesource.com/platform/manifest -b android-<version>
 repo sync

For more info on available version please refer to the official page[2].

This may take several hours.


2- Download the archive depending on the required version (tag):

STM32MPU distribution for Android™
Tag Link android-<version> Release note
st-android-11.0.0-2021-01-29 en.st-android-11.0.0-2021-01-29-source.tar.gz android-11.0.0_r27 st-android-11.0.0-2021-01-29 release note


3- Extract the archive inside the <working directory>:

 tar xzf en.<Tag>-source.tar.gz

4. Local mirror[edit source]

It can be of interest to create a local mirror of the different repositories used.

There are two possible kinds of cache:

  • REPO mirror: mirror of list of modules in repositories based on provided manifest (for example Android AOSP)
  • GIT mirror: mirror of one module (for example Linux kernel)

4.1. REPO mirror[edit source]

It's mainly used to mirror the Android AOSP sources.

1- Create and go to the cache directory

 mkdir <PathToRepoCacheDir>
 cd <PathToRepoCacheDir>

2- Mirror the required sources

case AOSP sources needed for the required version (recommended)

 repo init -u https://android.googlesource.com/platform/manifest -b <Tag> --mirror
 repo sync -q

case full AOSP sources

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

3- Create environment variable for this cache directory

 export CACHE_DIR=<PathToRepoCacheDir>
Info white.png Information
It's recommended to add this line also in your .bashrc file available in your HOME directory

4- Use the cache directory

Add --reference=$CACHE_DIR option to your repo init command.

 repo init --reference=$CACHE_DIR -u https://github.com/STMicroelectronics/android-manifest  -b refs/tags/<Tag> -m stm32mp1droid.xml

or

 repo init --reference=$CACHE_DIR  -u https://android.googlesource.com/platform/manifest -b android-<version>

4.2. GIT mirror[edit source]

While the distribution has been installed, a helper script cachesetup is available for this purpose, which creates / updates the mirrors based on the configuration file device/stm/<STM32Series>/scripts/cache/android_cache.config.

Take care that if you change the environment variable name, you have to adapt the associated scripts load_xxxx available in device/stm/<STM32Series>-xxxx/source directory.

Create the mirrors by executing the following commands:

 source build/envsetup.sh
 cachesetup --new

Regular updating of your mirror is recommended by executing:

 cachesetup

For more information on how to use this command, look at the cachesetup usage (execute cachesetup -h).

Info white.png Information
It's possible to update the AOSP or the Android REPO mirror using the command cachesetup aosp or cachesetup android

5. Building the STM32MPU distribution for Android[edit source]

When the installation is complete, please refer to the How to build STM32MPU distribution for Android page to learn how to build it.

6. Flashing the built image[edit source]

When the distribution has been built, please refer to the How to populate boards for Android page to learn how to flash your device.

7. References[edit source]