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

From Compulab Mediawiki
Jump to: navigation, search
imported>Igor.vaisbein
(What's next?)
 
imported>Kirill.kapranov
(Create a bootable SD-card)
Line 52: Line 52:
  
 
{{note|1=This sample is for an 8G-card.}}
 
{{note|1=This sample is for an 8G-card.}}
* Obtain a USB card reader and an 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>8GB</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:
 +
<pre>sudo dd if=/dev/zero bs=1M count=16 of=/dev/sdX
 +
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

Revision as of 18:40, 10 June 2019

Prerequisites

Make sure that the necessary packages have been installed.

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

Install repo tool:

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

Getting Android source code

NXP sources

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

CompuLab sources

  • Clone this repository
mkdir ~/compulab-imx8-android
git clone https://github.com/compulab-yokneam/imx8-android.git ~/compulab-imx8-android
export C=~/compulab-imx8-android/p9

Apply the patches

  • U-boot
git -C ${A}/vendor/nxp-opensource/uboot-imx checkout -b compulab-imx8-android p9.0.0_1.0.0-ga
git -C ${A}/vendor/nxp-opensource/uboot-imx am ${C}/vendor/nxp-opensource/uboot-imx/*.patch
  • Kernel
git -C ${A}/vendor/nxp-opensource/kernel_imx checkout -b compulab-imx8-android p9.0.0_1.0.0-ga
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 p9.0.0_1.0.0-ga
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}-userdebug
make 2>&1 | tee build-log.txt

When the build process is complete, check the build-log.txt file errors.

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 8GB (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 7 -f ${SOC} /dev/sdX

What's next?

Boot using the resulting Android SD card as described here.