Difference between revisions of "IMX8/iMX8MEVK/Getting Started/Loading Pre-built Images"

From RidgeRun Developer Connection
Jump to: navigation, search
(Running the Android Platform with a Prebuilt Image)
m
 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<noinclude>{{IMX8/Head}}</noinclude>
+
<noinclude>{{IMX8/Head|previous=iMX8MEVK/Getting Started/Software Support|next=iMX8EVK/Yocto|metakeywords=evk,imx8evk,evaluation kit,i.MX8M Quad Evaluation Kit,iMX8MEVK,configure,configuring host machine,yocto images,android images,build,Building the Android platform}}</noinclude>
  
 
__TOC__
 
__TOC__
Line 30: Line 30:
 
  bunzip2 -dk -f  $IMAGE_NAME.sdcard.bz2
 
  bunzip2 -dk -f  $IMAGE_NAME.sdcard.bz2
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
===Write the image to the SD Card===
 +
<pre>
 +
DEVICE=/dev/sdX # The device may change in your system
 +
sudo dd if=$IMAGE_NAME.sdcard of=$DEVICE bs=4M && sync
 +
</pre>
  
 
== Android Images ==
 
== Android Images ==
This section describes how to build '''Android Oreo 8.1''' platform for the i.MX 8 series devices. The main information was taken from the [https://community.nxp.com/servlet/JiveServlet/download/482880-1-431773/Android_User%27s_Guide.pdf Android User's Guide]
 
  
===Requirements===
+
This section describes the boot process of loading the '''i.MX8MQuad EVK''' board with an Embedded Android system image and introduces how to build the software components that create your own system image. For more information refer to the [https://www.nxp.com/docs/en/user-guide/Android_User's_Guide.pdf Android User Guide].
The minimum recommended system requirements are the following:
+
 
*16 GB RAM
+
=== Image Storage ===
*300 GB hard disk
+
The storage devices on the development system (MMC/SD or NAND) must be programmed with the U-Boot boot loader. The boot process determines which storage device to access based on the [https://developer.ridgerun.com/wiki/index.php?title=IMX8/iMX8MEVK/Getting_Started/Selecting_Boot_Options switch settings]. When the boot loader is loaded and begins execution, the U-Boot environment space is then read to determine how to proceed with the boot process.
  
===Establishing a Build Environment (Host Machine)===
+
=== Get NXP Android BSP Image ===
The host development environment for Android is based on Ubuntu and Debian. Please install Ubuntu version [http://www.ubuntu.com/download/desktop 14.04/16.04 64bit LTS] or [https://www.debian.org/releases Debian 8.4 64bit]. Those are the recommended Operating Systems for Android.
 
  
====Setting up a Linux Environment====
+
The pre-built images from the package are categorized by the boot device and put in the directory with the device name. You can get the pre-built images from the latest [[IMX8/iMX8MEVK/Getting Started/Software_Support | Linux BSP]].
* '''Select a Branch:''' You can choose to download and build the latest source code (called ''master''), in which case you will simply omit the branch specification when you initialize the repository. Otherwise, you should specify the branch you plan to use. Find more information about platform codenames, versions, API Levels and NDK Releases in [https://source.android.com/setup/start/build-numbers.html this page]. You can access the whole Git repositories on Android in [https://android.googlesource.com/ here].
+
You need to decompress the BSP and decompress the bz2 image sdcard included in it.
  
====Required Packages====
+
===Loading images onto an SD Card===
In addition to the packages requested on the [http://source.android.com/source/initializing.html Android website], the following packages are also needed:
+
====Partition the SD card====
 +
The images are inside the downloaded BSP tarball called '''<package_name>'''. Let's consider the tarball content is uncompressed in a folder called '''MY_ANDROID''' by running the following command:
 
<pre>
 
<pre>
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib
+
tar -xvf <package_name>
sudo apt-get install libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils
 
sudo apt-get install xsltproc unzip mtd-utils u-boot-tools lzop liblzo2-2 liblzo2-dev zlib1g-dev liblz-dev uuid uuid-dev android-tools-fsutils
 
sudo apt-get install bc
 
sudo apt-get install device-tree-compiler
 
sudo apt-get install gdisk
 
 
</pre>
 
</pre>
  
====Installing the Java Development Kit (JDK)====
+
'''IMPORTANT:''' The minimum SD card size required is '''8 GB'''.
The ''master'' branch of Android comes with pre-built versions of OpenJDK below '''prebuilts/jdk/''' so no additional installation is required.
 
* For Ubuntu >= 15.04 run the following:
 
<pre>
 
sudo apt-get update
 
sudo apt-get install openjdk-8-jdk
 
</pre>
 
If your Ubuntu version is missing the package (which shouldn't happen), add the PPA repository and run the previous commands again:
 
<pre>
 
sudo add-apt-repository ppa:openjdk-r/ppa
 
</pre>
 
Update the default Java version by running:
 
<pre>
 
sudo update-alternatives --config java
 
sudo update-alternatives --config javac
 
</pre>
 
  
====Unpack the Android Release Package====
+
'''NOTE:''' Unmount all the SD card partitions before running any script inside the aforementioned folder:
After you have set up a computer running Linux OS, unpack the Android release package as follows:
 
 
<pre>
 
<pre>
cd ~ (or any other directory you like)
+
umount /dev/<device>
tar xzvf imx-o8.1.0_1.3.0_8m.tar.gz
 
 
</pre>
 
</pre>
  
===Building the Android platform for i.MX===
+
Where the '''device''' can be recognized as one of the following options by the host machine:
====Getting i.MX Android release source code====
+
*'''sdX'''
The image can be downloaded in the following link, this image is provided by Variscite.
+
*'''mmcblkX'''
 
+
*Other
[ftp://customerv:Variscite1@ftp.variscite.com/DART-MX8M/Software/Android/Android_iMX8M_O810_130/android_O8.1.0_1.3.0_8M_docs.tar.gz Android Oreo 8.1]
 
  
The i.MX Android release source code consists of 3 parts:
+
With '''X''' the disk index from ''''a'''' to ''''z''''. We have modified the original script in order to support any name the host computer assign to the SD card device. Such modified script can be obtained from [[iMX8MEVK/Getting_Started/Loading_Pre-built_Images/Android_SD_Partitions_RidgeRun_Script | this page]].  
*'''NXP i.MX public source code:''' maintained in the CodeAurora Forum repository.
 
*'''AOSP Android public source code:''' maintained in android.googlesource.com.
 
*'''NXP i.MX Android proprietary source code package:''' maintained in www.NXP.com. Get the code from the following link: [ftp://customerv:Variscite1@ftp.variscite.com/DART-MX8M/Software/Android/Android_iMX8M_O810_130/imx-o8.1.0_1.3.0_8m.tar.gz i.MX Android Source Code Package]
 
  
Assume you had i.MX Android proprietary source code package '''imx-o8.1.0_1.3.0_8m.tar.gz''' under '''~/'''. directory. To generate the i.MX Android release source code build environment, execute the following commands:
+
Once you have the pre-built images and the new version of the script, you are able to partition an SD card:
 
<pre>
 
<pre>
mkdir ~/bin
+
cd ${MY_ANDROID}/
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
 
chmod a+x ~/bin/repo
 
export PATH=${PATH}:~/bin
 
source ~/imx-o8.1.0_1.3.0_8m/imx_android_setup.sh
 
# By default, the imx_android_setup.sh script will create the source code build environment in the folder ~/android_build
 
# ${MY_ANDROID} will be refered as the i.MX Android source code root directory in all i.MX Andorid release documentation.
 
export MY_ANDROID=~/android_build
 
</pre>
 
 
 
====Running the Android Platform with a Prebuilt Image====
 
To test the Android platform before building any code, use the pre-built images from the following packages:
 
 
 
====Building Android images====
 
Commands lunch '''<buildName-buildType>''' to set up the build configuration and make to start the build process are executed.
 
The build configuration command lunch can be issued with an argument '''<Build name>-<Build type>''' string, such as lunch '''evk_8mq-userdebug''', or can be issued without the argument, which will present a menu of options to select.
 
The Build Name is the Android device name found in the directory '''${MY_ANDROID}/device/fsl/'''. The following table lists the i.MX ''Build Names''.
 
  
{| class="wikitable" style="margin-right: auto; margin-left: auto; border: none;"
+
sudo ./fsl-sdcard-partition-rr.sh -f imx8mq -c <size_parameter> /dev/<device>
|-
 
! style="background: black; color: white;" | Build Name!! style="background: black; color: white;" | Description
 
|-
 
! scope="row" | evk_8mq
 
| style="text-align: center" | i.MX 8MQuad EVK Board
 
|}
 
 
 
The build type is used to specify what debug options are provided in the final image. The following table lists the ''Build Types''.
 
{| class="wikitable" style="margin-right: auto; margin-left: auto; border: none;"
 
|-
 
! style="background: black; color: white;" | Build Type!! style="background: black; color: white;" | Description
 
|-
 
! scope="row" | user
 
| style="text-align: center" | Production-ready image, no debug
 
|-
 
! scope="row" | userdebug
 
| style="text-align: center" | Provides image with root access and debug, similar to "user"
 
|-
 
! scope="row" | eng
 
| style="text-align: center" | Development image with debug tools
 
|}
 
 
 
Android build steps are as follows:
 
 
 
'''1.''' Change to the top level build directory.
 
<pre>
 
cd ${MY_ANDROID}
 
 
</pre>
 
</pre>
'''2.''' Set up the environment for building. This only configures the current terminal.
 
<pre>
 
source build/envsetup.sh
 
</pre>
 
'''3.''' Execute the Android lunch command. In this example, the setup is for the production image of i.MX 8MQuad EVK Board/Platform device with '''userdebug''' type.
 
<pre>
 
lunch evk_8mq-userdebug
 
</pre>
 
'''4.''' Execute the make command to generate the image.
 
<pre>
 
make 2>&1 | tee build-log.txt
 
</pre>
 
When the make command is complete, the '''build-log.txt''' file contains the execution output. Check for any errors.
 
  
====Running the Android Platform with a Prebuilt Image====
+
Where the '''<size_parameter>''' should be selected from the table below.
To test the Android platform before building any code, use the pre-built images from the following packages:
 
  
 
{| class="wikitable" style="margin-right: auto; margin-left: auto; border: none;"
 
{| class="wikitable" style="margin-right: auto; margin-left: auto; border: none;"
 
|-
 
|-
! style="background: black; color: white;" | Image Package!! style="background: black; color: white;" | Description
+
! style="background: black; color: white;" | SD Card Size!! style="background: black; color: white;" | Size Parameter
|-
 
! scope="row" | android_O8.1.0_1.3.0_8M_image_8mq.tar.gz 
 
| style="text-align: left" | Prebuilt-image for i.MX 8MQuad EVK board, which includes NXP extended features.
 
|}
 
 
 
The following tables list the detailed contents of '''android_O8.1.0_1.3.0_8M_image_8mq.tar.gz''' image package.
 
The table below shows the pre-built images to support the system boot from SD and eMMC on i.MX 8MQuad EVK boards.
 
 
 
{| class="wikitable" style="margin-right: auto; margin-left: auto; border: none;"
 
|-
 
! style="background: black; color: white;" | i.MX 8MQuad EVK Image!! style="background: black; color: white;" | Description
 
|-
 
! scope="row" | u-boot-imx8mq.imx
 
| style="text-align: left" | Bootloader (with padding) for i.MX 8MQuad EVK board.
 
|-
 
! scope="row" | partition-table.img
 
| style="text-align: left" | GPT table image for 16 GB SD card and eMMC.
 
|-
 
! scope="row" | partition-table-7GB.img
 
| style="text-align: left" | GPT table image for 8 GB SD card.
 
|-
 
! scope="row" | partition-table-28GB.img 
 
| style="text-align: left" | GPT table image for 32 GB SD card.
 
|-
 
! scope="row" | boot-imx8mq.img 
 
| style="text-align: left" | Boot image for i.MX 8MQuad EVK board to support HDMI output.
 
|-
 
! scope="row" | /boot-imx8mq-mipi.img
 
| style="text-align: left" | Boot image for i.MX 8MQuad EVK board to support MIPI-toHDMI output.
 
|-
 
! scope="row" | /boot-imx8mq-dual.img
 
| style="text-align: left" | Boot image for i.MX 8MQuad EVK board to support HDMI and MIPI-to-HDMI dual output.
 
|-
 
! scope="row" | /boot-imx8mq-mipi-panel.img
 
| style="text-align: left" | Boot image for i.MX 8MQuad EVK board to support MIPI panel output.
 
|-
 
! scope="row" | system.img
 
| style="text-align: left" | System Boot image.
 
|-
 
! scope="row" | vbmeta-imx8mq.img
 
| style="text-align: left" | Android Verify Boot metadata Image for i.MX 8MQuad EVK board to support HDMI output.
 
|-
 
! scope="row" | /vbmeta-imx8mq-mipi.img
 
| style="text-align: left" | Android Verify Boot metadata image for i.MX 8MQuad EVK board to support MIPI-to-HDMI output.
 
 
|-
 
|-
! scope="row" | /vbmeta-imx8mq-dual.img
+
! scope="row" | 8GB
| style="text-align: left" | Android Verify Boot metadata image for i.MX 8MQuad EVK board to support HDMI and MIPI-to-HDMI dual output.
+
| style="text-align: center" | 7
 
|-
 
|-
! scope="row" | /vbmeta-imx8mq-mipi-panel.img 
+
! scope="row" | 16GB
| style="text-align: left" | Android Verify Boot metadata image for i.MX 8MQuad EVK board to support MIPI panel output.
+
| style="text-align: center" | 14
 
|-
 
|-
! scope="row" | vendor.img
+
! scope="row" | 32GB
| style="text-align: left" | Vendor image for i.MX 8MQuad EVK board.
+
| style="text-align: center" | 28
 
|}
 
|}
  
There are two methods for the build of Android image.
+
Make sure you have the images required by the '''fsl-sdcard-partition.sh''' script are present inside the '''MY_ANDROID''' folder. The scripts could be the following: '''boot-loader''', '''boot image''', '''system image''', '''recovery image''', '''GPT table image''', and '''vendor image'''. This script requires to install the '''simg2img''' tool on the computer. '''simg2img''' is a tool that converts the sparse system image to raw system image on the Linux OS host computer. The '''android-toolsfsutils''' package includes the '''simg2img''' command for Ubuntu Linux OS. If you don't have '''simg2img''' in your host machine, install it as follows:
 
 
'''Method 1:''' Set the environment first and then issue the ''make'' command:
 
 
<pre>
 
<pre>
cd ${MY_ANDROID}
+
sudo apt install android-tools-fsutils
source build/envsetup.sh
 
make PRODUCT-XXX #XXX depends on different board, see table below:
 
 
</pre>
 
</pre>
  
{| class="wikitable" style="margin-right: auto; margin-left: auto; border: none;"
+
<noinclude>{{IMX8/Foot|iMX8MEVK/Getting Started/Software Support|iMX8EVK/Yocto}}</noinclude>
|-
 
! style="background: black; color: white;" | i.MX Development Tool !! style="background: black; color: white;" | Description !! style="background: black; color: white;" | Image Build Command
 
|-
 
! scope="row" | Evaluation Kit
 
| style="text-align: left" | i.MX 8MQuad EVK || style="text-align: left" | make PRODUCT-evk_8mq-userdebug>&1 | tee buildlog.txt
 
|}
 
 
 
'''Method 2:''' Set the environment and then use lunch command to configure argument. See table below. An example for the i.MX 8MQuad EVK board is as follows:
 
<pre>
 
cd ${MY_ANDROID}
 
source build/envsetup.sh
 
lunch evk_8mq-userdebug
 
make
 
</pre>
 
 
 
'''Note:''' '''evk_8mq-userdebug''' creates a debuggable version of Android. '''evk_8mq-eng''' creates an engineering version of Android. Development mode enable and development tools are available on target.
 
 
 
<noinclude>{{IMX8/Foot|<Replace with "previous" page>|<Replace with "next" page>}}</noinclude>
 

Latest revision as of 12:05, 9 March 2023


NXP Partner Program Registered Vertical.jpg NXP Partner Program Horizontal.jpg
Previous: iMX8MEVK/Getting Started/Software Support Index Next: iMX8EVK/Yocto





Yocto Images

Prebuilt images are .sdcard files, disk images that can be flashed directly to any SD card. These .sdcard files are the simplest way to evaluate the board and Linux features since they easily flash all the required components to boot the iMX8M EVK.

The .sdcard file includes the 4 elements required to boot the board:

  • Bootloader
  • Linux kernel image
  • Device tree
  • Root file system

You can get the prebuilt images from the latest Linux BSP. You need to decompress the BSP and decompress the bz2 image sdcard included in it.

For BSP L4.9.88_2.0.0 run:

##
## BSP and IMAGE_NAME in the example may not match exactly your BSP version. 
## Please make sure you set them accordingly.
##

 BSP=L4.9.88_2.0.0_images_MX8MQ
 tar -xvf $BSP.tar.gz
 cd $BSP

 IMAGE_NAME=fsl-image-qt5-validation-imx-xwayland-imx8mqevk
 bunzip2 -dk -f  $IMAGE_NAME.sdcard.bz2

Write the image to the SD Card

DEVICE=/dev/sdX # The device may change in your system
sudo dd if=$IMAGE_NAME.sdcard of=$DEVICE bs=4M && sync

Android Images

This section describes the boot process of loading the i.MX8MQuad EVK board with an Embedded Android system image and introduces how to build the software components that create your own system image. For more information refer to the Android User Guide.

Image Storage

The storage devices on the development system (MMC/SD or NAND) must be programmed with the U-Boot boot loader. The boot process determines which storage device to access based on the switch settings. When the boot loader is loaded and begins execution, the U-Boot environment space is then read to determine how to proceed with the boot process.

Get NXP Android BSP Image

The pre-built images from the package are categorized by the boot device and put in the directory with the device name. You can get the pre-built images from the latest Linux BSP. You need to decompress the BSP and decompress the bz2 image sdcard included in it.

Loading images onto an SD Card

Partition the SD card

The images are inside the downloaded BSP tarball called <package_name>. Let's consider the tarball content is uncompressed in a folder called MY_ANDROID by running the following command:

tar -xvf <package_name>

IMPORTANT: The minimum SD card size required is 8 GB.

NOTE: Unmount all the SD card partitions before running any script inside the aforementioned folder:

umount /dev/<device>

Where the device can be recognized as one of the following options by the host machine:

  • sdX
  • mmcblkX
  • Other

With X the disk index from 'a' to 'z'. We have modified the original script in order to support any name the host computer assign to the SD card device. Such modified script can be obtained from this page.

Once you have the pre-built images and the new version of the script, you are able to partition an SD card:

cd ${MY_ANDROID}/

sudo ./fsl-sdcard-partition-rr.sh -f imx8mq -c <size_parameter> /dev/<device>

Where the <size_parameter> should be selected from the table below.

SD Card Size Size Parameter
8GB 7
16GB 14
32GB 28

Make sure you have the images required by the fsl-sdcard-partition.sh script are present inside the MY_ANDROID folder. The scripts could be the following: boot-loader, boot image, system image, recovery image, GPT table image, and vendor image. This script requires to install the simg2img tool on the computer. simg2img is a tool that converts the sparse system image to raw system image on the Linux OS host computer. The android-toolsfsutils package includes the simg2img command for Ubuntu Linux OS. If you don't have simg2img in your host machine, install it as follows:

sudo apt install android-tools-fsutils


Previous: iMX8MEVK/Getting Started/Software Support Index Next: iMX8EVK/Yocto