Difference between revisions of "UCM-iMX8M-Mini: Android: Building images"

From Compulab Mediawiki
Jump to: navigation, search
imported>Kirill.kapranov
(Create a bootable SD-card)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
= Prerequisites =
 
= Prerequisites =
 +
==repo==
 
Make sure that the necessary packages have been installed.<br/>
 
Make sure that the necessary packages have been installed.<br/>
 
<pre>sudo apt-get install xz-utils make flex lib32z1 zip curl</pre>
 
<pre>sudo apt-get install xz-utils make flex lib32z1 zip curl</pre>
 
Install {{filename|repo}} tool:
 
Install {{filename|repo}} tool:
<pre>mkdir ~/bin
+
<pre>mkdir ~/Android/{bin,}
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
+
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/Android/bin/repo
 
chmod a+x ~/bin/repo
 
chmod a+x ~/bin/repo
export PATH=${PATH}:~/bin</pre>
+
export PATH=~/Android/bin:${PATH}</pre>
 +
 
 +
==GCC==
 +
Download and unpack the tool chain under '''/opt''' folder for the A-profile architecture from: [https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads arm Developer GNU-A Downloads page]</pre>
 +
Recommended tool chain is '''gcc-arm-8.3-2019.03-x86_64-arm-eabi'''
 +
<pre>export AARCH64_GCC_CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/aarch64-elf-
 +
export AARCH32_GCC_CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-arm-eabi/bin/arm-eabi-</pre>
  
 
= Getting Android source code =
 
= Getting Android source code =
 
==NXP sources==
 
==NXP sources==
* Download the NXP Android sources from this location: [https://www.nxp.com/webapp/sps/download/license.jsp?colCode=P9.0.0_1.0.0_GA_ANDROID_SOURCE&appType=file2&DOWNLOAD_ID=null&lang_cd=en imx-p9.0.0_1.0.0-ga.tar.gz]
+
* Download the NXP Android sources from this location: [https://www.nxp.com/webapp/sps/download/license.jsp?colCode=Q10.0.0_2.5.0_ANDROID_SOURCE&appType=file1&DOWNLOAD_ID=null imx-android-10.0.0_2.5.0.tar.gz]
  
 
* Untar the image:
 
* Untar the image:
<pre>tar -C ~/ -xf imx-p9.0.0_1.0.0-ga.tar.gz</pre>
+
<pre>tar -C ~/Android -xf imx-android-10.0.0_2.5.0.tar.gz</pre>
  
 
* Download and setup source:
 
* Download and setup source:
<pre>source ~/imx-p9.0.0_1.0.0-ga/imx_android_setup.sh
+
<pre>source ~/Android/imx-android-10.0.0_2.5.0/imx_android_setup.sh
 
export A=$(pwd)</pre>
 
export A=$(pwd)</pre>
* Follow the instructions in the <b><i>~/imx-p9.0.0_1.0.0-ga/README</i></b> and make sure that the build environment is ready.
+
* Follow the instructions in the <b><i>~/Android/imx-android-10.0.0_2.5.0/README</i></b> and make sure that the build environment is ready.
 +
 
 +
For more details found [https://www.nxp.com/docs/en/user-guide/ANDROID_USERS_GUIDE.pdf the NXP Android User Guide]
  
 
==CompuLab sources==
 
==CompuLab sources==
 
*Clone this repository
 
*Clone this repository
<pre>mkdir ~/compulab-imx8-android
+
<pre>git clone https://github.com/compulab-yokneam/imx8mm-android-q10.git
git clone https://github.com/compulab-yokneam/imx8-android.git ~/compulab-imx8-android
+
export C=$(pwd)/imx8mm-android-q10</pre>
export C=~/compulab-imx8-android/p9</pre>
 
  
 
==Apply the patches==
 
==Apply the patches==
 
*U-boot
 
*U-boot
<pre>git -C ${A}/vendor/nxp-opensource/uboot-imx checkout -b compulab-imx8-android p9.0.0_1.0.0-ga
+
<pre>git -C ${A}/vendor/nxp-opensource/uboot-imx checkout -b compulab-imx8-android android-10.0.0_2.5.0
 
git -C ${A}/vendor/nxp-opensource/uboot-imx am ${C}/vendor/nxp-opensource/uboot-imx/*.patch</pre>
 
git -C ${A}/vendor/nxp-opensource/uboot-imx am ${C}/vendor/nxp-opensource/uboot-imx/*.patch</pre>
 +
*ATF
 +
<pre>git -C ${A}/vendor/nxp-opensource/arm-trusted-firmware/ checkout -b compulab-imx8-android android-10.0.0_2.5.0
 +
git -C ${A}/vendor/nxp-opensource/arm-trusted-firmware am ${C}/vendor/nxp-opensource/arm-trusted-firmware/*.patch</pre>
 
*Kernel
 
*Kernel
<pre>git -C ${A}/vendor/nxp-opensource/kernel_imx checkout -b compulab-imx8-android p9.0.0_1.0.0-ga
+
<pre>git -C ${A}/vendor/nxp-opensource/kernel_imx checkout -b compulab-imx8-android android-10.0.0_2.5.0
 
git -C ${A}/vendor/nxp-opensource/kernel_imx am ${C}/vendor/nxp-opensource/kernel_imx/*.patch</pre>
 
git -C ${A}/vendor/nxp-opensource/kernel_imx am ${C}/vendor/nxp-opensource/kernel_imx/*.patch</pre>
 
*Board
 
*Board
<pre>git -C ${A}/device/fsl checkout -b compulab-imx8-android p9.0.0_1.0.0-ga
+
<pre>git -C ${A}/device/fsl checkout -b compulab-imx8-android android-10.0.0_2.5.0
 
git -C ${A}/device/fsl am ${C}/device/fsl/*.patch</pre>
 
git -C ${A}/device/fsl am ${C}/device/fsl/*.patch</pre>
  
Line 45: Line 56:
 
<pre>cd ${A}
 
<pre>cd ${A}
 
source build/envsetup.sh
 
source build/envsetup.sh
lunch ${MACHINE}-userdebug
+
lunch ${MACHINE}-eng
make 2>&1 | tee build-log.txt</pre>
+
./imx-make.sh -j16 2>&1 | tee build-log.txt</pre>
When the build process is complete, check the {{filename|build-log.txt}} file errors.
 
  
 
==Create a bootable SD-card==
 
==Create a bootable SD-card==
  
 
{{note|1=This sample is for an 8G-card.}}
 
{{note|1=This sample is for an 8G-card.}}
* Obtain a USB card reader and a micro-SD сard. Any commercially available micro-SD card of <b>8GB</b> (or larger) may be used for the installation.
+
* Obtain a USB card reader and a micro-SD сard. Any commercially available micro-SD card of <b>16GB</b> (or larger) may be used for the installation.
* Plug the USB SD card reader into the host PC. Insert the micro-SD сard into the сard reader. From now we assume the device name of the MMC/SD card on your Linux PC is {{filename|/dev/sdX}}.
+
* Plug the USB SD card reader into the host PC. Insert the micro-SD сard into the сard reader. From now we assume the device name of the MMC/SD card on your Linux PC is {{filename|/dev/'''sdX'''}}.
 
* Prepare the uSD card:
 
* Prepare the uSD card:
 
<pre>sudo dd if=/dev/zero bs=1M count=16 of=/dev/sdX
 
<pre>sudo dd if=/dev/zero bs=1M count=16 of=/dev/sdX
sudo partprobe /dev/sdx</pre>
+
sudo partprobe /dev/sdX</pre>
 
* In the Android build directory issue the following commands:
 
* In the Android build directory issue the following commands:
 
<pre>export MACHINE=ucm_imx8m_mini SOC=imx8mm
 
<pre>export MACHINE=ucm_imx8m_mini SOC=imx8mm
 
cd out/target/product/${MACHINE}
 
cd out/target/product/${MACHINE}
sudo ./fsl-sdcard-partition.sh -c 7 -f ${SOC} /dev/sdX</pre>
+
sudo ./fsl-sdcard-partition.sh -c 14 -f ${SOC} /dev/sdX</pre>
  
 
==What's next?==
 
==What's next?==
 
Boot using the resulting Android SD card as described [[UCM-iMX8M-Mini:_Android:_Running_from_SD_card#Boot from the SD-card|here]].
 
Boot using the resulting Android SD card as described [[UCM-iMX8M-Mini:_Android:_Running_from_SD_card#Boot from the SD-card|here]].
 +
 +
=Building previous versions of UCM-iMX8M-Mini Android=
 +
 +
* [[Building_UCM-iMX8M-Mini_Android_r1.1|Building UCM-iMX8M-Mini Android r1.1]]
  
 
[[Category:Android]]
 
[[Category:Android]]
 
[[Category:UCM-iMX8M-Mini]]
 
[[Category:UCM-iMX8M-Mini]]

Latest revision as of 14:22, 19 September 2024

Prerequisites

repo

Make sure that the necessary packages have been installed.

sudo apt-get install xz-utils make flex lib32z1 zip curl

Install repo tool:

mkdir ~/Android/{bin,}
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/Android/bin/repo
chmod a+x ~/bin/repo
export PATH=~/Android/bin:${PATH}

GCC

Download and unpack the tool chain under /opt folder for the A-profile architecture from: arm Developer GNU-A Downloads page

Recommended tool chain is gcc-arm-8.3-2019.03-x86_64-arm-eabi

export AARCH64_GCC_CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/aarch64-elf-
export AARCH32_GCC_CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-arm-eabi/bin/arm-eabi-

Getting Android source code

NXP sources

  • Untar the image:
tar -C ~/Android -xf imx-android-10.0.0_2.5.0.tar.gz
  • Download and setup source:
source ~/Android/imx-android-10.0.0_2.5.0/imx_android_setup.sh
export A=$(pwd)
  • Follow the instructions in the ~/Android/imx-android-10.0.0_2.5.0/README and make sure that the build environment is ready.

For more details found the NXP Android User Guide

CompuLab sources

  • Clone this repository
git clone https://github.com/compulab-yokneam/imx8mm-android-q10.git
export C=$(pwd)/imx8mm-android-q10

Apply the patches

  • U-boot
git -C ${A}/vendor/nxp-opensource/uboot-imx checkout -b compulab-imx8-android android-10.0.0_2.5.0
git -C ${A}/vendor/nxp-opensource/uboot-imx am ${C}/vendor/nxp-opensource/uboot-imx/*.patch
  • ATF
git -C ${A}/vendor/nxp-opensource/arm-trusted-firmware/ checkout -b compulab-imx8-android android-10.0.0_2.5.0
git -C ${A}/vendor/nxp-opensource/arm-trusted-firmware am ${C}/vendor/nxp-opensource/arm-trusted-firmware/*.patch
  • Kernel
git -C ${A}/vendor/nxp-opensource/kernel_imx checkout -b compulab-imx8-android android-10.0.0_2.5.0
git -C ${A}/vendor/nxp-opensource/kernel_imx am ${C}/vendor/nxp-opensource/kernel_imx/*.patch
  • Board
git -C ${A}/device/fsl checkout -b compulab-imx8-android android-10.0.0_2.5.0
git -C ${A}/device/fsl am ${C}/device/fsl/*.patch

Set the machine configuration to ucm-imx8m-mini:

export MACHINE=ucm_imx8m_mini SOC=imx8mm
Admolition important.png Underscore in the MACHINE name is not a typo.

Build Android

  • Go to Android build directory and issue:
cd ${A}
source build/envsetup.sh
lunch ${MACHINE}-eng
./imx-make.sh -j16 2>&1 | tee build-log.txt

Create a bootable SD-card

Admolition note.png This sample is for an 8G-card.
  • Obtain a USB card reader and a micro-SD сard. Any commercially available micro-SD card of 16GB (or larger) may be used for the installation.
  • Plug the USB SD card reader into the host PC. Insert the micro-SD сard into the сard reader. From now we assume the device name of the MMC/SD card on your Linux PC is /dev/sdX.
  • Prepare the uSD card:
sudo dd if=/dev/zero bs=1M count=16 of=/dev/sdX
sudo partprobe /dev/sdX
  • In the Android build directory issue the following commands:
export MACHINE=ucm_imx8m_mini SOC=imx8mm
cd out/target/product/${MACHINE}
sudo ./fsl-sdcard-partition.sh -c 14 -f ${SOC} /dev/sdX

What's next?

Boot using the resulting Android SD card as described here.

Building previous versions of UCM-iMX8M-Mini Android