Personal tools

Difference between revisions of "Recipe for building Android9 for NX8MM-35"

From ICOP tech wiki

Jump to: navigation, search
(Created page with "=Recipe for building Yocto Linux for NX8MM-35= <br /> '''Recipe for building Yocto Linux for NX8MM-35:''' *Display: HDMI **https://ftp.icop.com.tw/share/vembVpzv '''Check t...")
 
Line 1: Line 1:
=Recipe for building Yocto Linux for NX8MM-35=
+
=Recipe for building Android 9 for NX8MM-35=
 
<br />
 
<br />
'''Recipe for building Yocto Linux for NX8MM-35:'''
+
'''Download the Android p9.0.0_2.0.0_GA document on NXP website.'''
  
*Display: HDMI
+
*https://www.nxp.com/docs/en/supporting-information/android_p9.0.0_2.0.0-ga_docs.zip
**https://ftp.icop.com.tw/share/vembVpzv
 
  
 +
'''<br />
 +
Download the Android P9.0.0_2.0.0_GA Android release package:'''
  
'''Check the compiling method on the open document form NXP:'''
+
* https://www.nxp.com/webapp/sps/download/license.jsp?colCode=P9.0.0_2.0.0_GA_ANDROID_SOURCE&appType=file2&location=null&DOWNLOAD_ID=null'''<br />'''
  
https://www.nxp.com/docs/en/user-guide/IMXLXYOCTOUG.pdf
+
<big>'''Suggest O/S''': Ubuntu 18.04 or later.</big>
<br />
 
<br />
 
  
<big>'''Suggest O/S''':Ubuntu 18.04 or later.</big>
+
<big>'''Storage:''' Please make sure the capacity of your storage has 300GB or bigger space.</big>
  
Please comment out content to the local.conf to avoid the error during building the SDL.
 
<pre>
 
#PACKAGECONFIG_append_pn-qemu-native = " sdl"
 
#PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
 
</pre><big>'''Storage:''' Please make sure the capacity of your storage has 300GB or bigger space.</big>
 
 
<big>'''RAM:''' Please make sure the physical memory + swap has 16GB or bigger capacity.</big><br />
 
<big>'''RAM:''' Please make sure the physical memory + swap has 16GB or bigger capacity.</big><br />
 
==<big>Procedure</big>==
 
==<big>Procedure</big>==
'''Step 1.''' Install Host packages:
+
'''Step 1.''' After downloaded the imx-p9.0.0_2.0.0.tar.gz file, put it under /opt.
  
Essential Yocto Project host packages:
+
The vendor/nxp file is the source code provided by NXP, and we will copy the content in this file to vendor/nxp in Android BSP.
 +
 
 +
 
 +
The software package that need to be downloaded first:
 
<pre>
 
<pre>
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \  
+
$ sudo apt-get install gnupg flex bison gperf build-essential zip zlib1g-dev libc6-dev \
build-essential chrpath socat libsdl1.2-dev
+
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev tofrodos \
 +
python-markdown libxml2-utils xsltproc uuid-dev:i386 liblzo2-dev:i386 gcc-multilib \
 +
g++-multilib subversion openssh-server openssh-client uuid uuid-dev zlib1g-dev liblz-dev \
 +
liblzo2-2 liblzo2-dev lzop git-core curl u-boot-tools mtd-utils android-tools-fsutils \
 +
openjdk-8-jdk device-tree-compiler gdisk liblz4-tool m4 libz-dev phablet-tools
 
</pre>
 
</pre>
 
   
 
   
i.MX layers host packages for a Ubuntu 12.04 or 14.04 host setup are:<pre>
+
Develop a director for evk BSP to develop the construction for Android 9.  
$ sudo apt-get install libsdl1.2-dev xterm sed cvs subversion coreutils texi2html \
 
docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils \
 
libgl1-mesa-dev libglu1-mesa-dev mercurial autoconf automake groff curl lzop asciidoc
 
</pre>
 
  
  
'''Step 2.''' Insalling the repo utility:
+
'''Step 2.''' Downloading Android 9.0.0-2.0.0 source code:
  
 
Create the bin folder in the home directory:
 
Create the bin folder in the home directory:
 
<pre>
 
<pre>
$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
+
mkdir ~/bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo  
+
curl curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
+
chmod a+x ~/bin/repo
 +
export PATH=${PATH}:~/bin
 
</pre>
 
</pre>
  
 +
Modifying repo file:
 +
<pre>
 +
Open ~/bin/repo file with 'gedit' and Change google address
 +
From
 +
REPO_URL = 'https://gerrit.googlesource.com/git-repo'
 +
To
 +
REPO_URL = ' https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ '
 +
</pre>
  
'''Step 3.''' Add the following line to the .bashrc file to make sure the ~/bin folder is in the PATH.
+
Setting email address:
 
<pre>
 
<pre>
export PATH=~/bin:$PATH
+
git config —global user.name “xxxx”
 +
git config —global user.email “xxxx@xxx”
 +
</pre>Download the source code:<pre>
 +
mkdir ~/imx-android
 +
cd ~/imx-android
 +
repo init -u https://source.codeaurora.org/external/imx/imx-manifest.git -b imx-android-pie -m imx-p9.0.0_2.0.0-ga.xml
 +
repo sync
 
</pre>
 
</pre>
  
  
'''Step 4.''' Ensure the git is properly set up by commands below:
+
'''Step 3.''' Making the Android image:
<pre>
 
$ git config --global user.name "Your Name"
 
$ git config --global user.email "Your Email"
 
$ git config --list
 
</pre>
 
  
 +
Before starting to make the Android image, please be reminded to move the /vendor/nxp directory in imx-p9.0.0_2.0.0.tar.gz to /vendor/nxp in the BSP. Since there are a directory under /vendor/nxp in the BSP, there will have 10 directories in /vendor/nxp in the BSP.
  
'''Step 5.''' Download the i.MX Yocto Project Community BSP recipe layers:
+
Switch to the directory under BSP, and execute:
 
<pre>
 
<pre>
$ mkdir imx-yocto-bsp
+
export MY_ANDROID=~/imx-android
$ cd imx-yocto-bsp
+
export ARCH=arm64
$ repo init -u <nowiki>https://source.codeaurora.org/external/imx/imx-manifest</nowiki> -b \
+
export CROSS_COMPLOE=${MY_ANDROID}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
imx-linux-sumo -m imx-4.14.98-2.0.0_ga.xml
+
source build/envsetup.sh
$ repo sync
+
lunch evk_8mm-userdebug
 +
make -j8
 
</pre>
 
</pre>
  
 +
After the process is done, the image for EVK has been made.
  
'''Step 6.''' Unzip the Recipe for building Yocto Linux for EBOX-IMX8MM to the file ‘imx-yocto-bsp”
 
  
 +
'''Step 4.''' Install the patch for NX8MM-35
  
'''Step 7.''' Create the setup environment by command below (You could change the file name as you want)
+
The patch could be used under:
 
<pre>
 
<pre>
$ DISTRO=fsl-imx-xwayland MACHINE=dm446 source fsl-setup-release.sh -b \
+
cd ~/imx-android
build-dmp
 
 
</pre>
 
</pre>
  
Please input “y” when the EULA confirmation pop out.
+
Apply command:  
 
 
 
 
'''Step 8.''' Edit conf/local.conf file and add the content below at the bottom:
 
 
<pre>
 
<pre>
CORE_IMAGE_EXTRA_INSTALL += "chromium-ozone-wayland"
+
git apply --whitespace=nowarn <patch filename>
  
IMAGE_INSTALL_append += " \
+
dm446_full_patch.patch
    openssh-sftp-server \
 
    ppp \
 
    rng-tools \
 
    glibc-gconv-utf-16 \
 
    expand-rootfs \
 
    opkg \
 
    cifs-utils \
 
    gdbserver \
 
"
 
 
</pre>
 
</pre>
  
 
+
Remake the image, and the Android image for NX8MM-35 will be made.
'''Step 9.''' Edit conf/bblayers.conf file and add the content below at the bottom:
 
 
<pre>
 
<pre>
BBLAYERS += " ${BSPDIR}/sources/meta-custom-dmp "
+
make -j8
 
</pre>
 
</pre>
 +
[[File:MAKE.png|left|frameless|622x622px]]
  
 +
\
  
'''Step 10.''' Run the command below.
+
Copy the files in ~/imx-android/out/target/product/evk_8mm and the uuu utility to your PC for restoring the image to NX8MM-35.
 
<pre>
 
<pre>
$ bitbake fsl-image-qt5-validation-imx
+
boot.img
 +
u-boot-imx8mm.imx
 +
u-boot-imx8mm-evk-uuu.imx
 +
dtbo-imx8mm.img
 +
partition-table.img
 +
system.img
 +
vbmeta-imx8mm.img
 +
vendor.img
 +
uuu_imx_android_flash.sh
 +
UUU Utility
 
</pre>
 
</pre>
  
 
+
Apply command:
The system will start to download and install source code, patch file, and compilation
+
<pre>
 
+
./uuu_imx_android_flash.sh -f imx8mm -a -c
 
+
</pre>After restore the image to NX8MM-35, the Android could be bootable.
 
 
If there is a imx-gpu-sdk compiling error:<pre>
 
Copy /imx-yocto-bsp/build-dmp/tmp/work/dm446-poky-linux/devil/1.8.0-r0/package/usr/lib/*
 
 
 
to imx-yocto-bsp/build-dmp/tmp/work/aarch64-mx8mm-poky-linux/imx-gpu-sdk/5.3.0-r0/recipe-sysroot/lib64
 
</pre><br />
 
=How to install the image file by UUU.=
 
After implemented bitbake fsl-image-qt5-validation-imx, it will generate an image file and be stored in the file under build-dmp/tmp/deploy/images/dm446.
 
 
 
In the build-dmp/tmp/deploy/images/dm446 file, we’ll need the file below for the image restoration.<pre>
 
1. fsl-mage-qt5-validation-imx-dm446.sdcard.bz2
 
2. imx-boot-dm446-sd.bin-flash_evk
 
</pre>↵Input command to get the image file - fsl-mage-qt5-validation-imx-dm446.sdcard
 
 
 
(In this file, there are packaged kernel and rootfs):<pre>
 
$ bzip2 -d fsl-mage-qt5-validation-imx-dm446.sdcard.bz2
 
</pre>Download the UUU.auto sample:https://ftp.icop.com.tw/share/Qpz7dMcP
 
 
 
 
 
 
 
If you have requirement to change the file name, please follow the steps below to change your file name (You could choose not changing the file name.)<pre>
 
SDP: boot -f XXX.bin-flash_evk
 
SDPU: write -f XXX.bin-flash_evk -offset 0x57c00
 
SDPS: boot -f XXX.bin-flash_evk
 
SDPV write -f XXX.bin-flash_evk -skipspl
 
FB: flash bootloader XXX.bin-flash_evk
 
XXX.bin-flash_evk = imx-boot-dm446-sd.bin-flash_evk 
 
 
 
FB: flash -raw2sparse all XXX.image 
 
XXX.image = fsl-mage-qt5-validation-imx-dm446.sdcard
 
</pre>After you have set your own file name, you could input the command below to install the Yocto Linux<pre>
 
uuu uuu.auto
 
</pre>
 

Revision as of 17:03, 8 April 2022

Recipe for building Android 9 for NX8MM-35


Download the Android p9.0.0_2.0.0_GA document on NXP website.


Download the Android P9.0.0_2.0.0_GA Android release package:

Suggest O/S: Ubuntu 18.04 or later.

Storage: Please make sure the capacity of your storage has 300GB or bigger space.

RAM: Please make sure the physical memory + swap has 16GB or bigger capacity.

Procedure

Step 1. After downloaded the imx-p9.0.0_2.0.0.tar.gz file, put it under /opt.

The vendor/nxp file is the source code provided by NXP, and we will copy the content in this file to vendor/nxp in Android BSP.


The software package that need to be downloaded first:

$ sudo apt-get install gnupg flex bison gperf build-essential zip zlib1g-dev libc6-dev \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev tofrodos \
python-markdown libxml2-utils xsltproc uuid-dev:i386 liblzo2-dev:i386 gcc-multilib \
g++-multilib subversion openssh-server openssh-client uuid uuid-dev zlib1g-dev liblz-dev \
liblzo2-2 liblzo2-dev lzop git-core curl u-boot-tools mtd-utils android-tools-fsutils \
openjdk-8-jdk device-tree-compiler gdisk liblz4-tool m4 libz-dev phablet-tools

Develop a director for evk BSP to develop the construction for Android 9.


Step 2. Downloading Android 9.0.0-2.0.0 source code:

Create the bin folder in the home directory:

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

Modifying repo file:

Open ~/bin/repo file with 'gedit' and Change google address
From
REPO_URL = 'https://gerrit.googlesource.com/git-repo'
To
REPO_URL = ' https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ '

Setting email address:

git config —global user.name “xxxx”
git config —global user.email “xxxx@xxx”

Download the source code:

mkdir ~/imx-android cd ~/imx-android repo init -u https://source.codeaurora.org/external/imx/imx-manifest.git -b imx-android-pie -m imx-p9.0.0_2.0.0-ga.xml repo sync


Step 3. Making the Android image:

Before starting to make the Android image, please be reminded to move the /vendor/nxp directory in imx-p9.0.0_2.0.0.tar.gz to /vendor/nxp in the BSP. Since there are a directory under /vendor/nxp in the BSP, there will have 10 directories in /vendor/nxp in the BSP.

Switch to the directory under BSP, and execute:

export MY_ANDROID=~/imx-android
export ARCH=arm64
export CROSS_COMPLOE=${MY_ANDROID}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
source build/envsetup.sh
lunch evk_8mm-userdebug
make -j8

After the process is done, the image for EVK has been made.


Step 4. Install the patch for NX8MM-35

The patch could be used under:

cd ~/imx-android

Apply command:

git apply --whitespace=nowarn <patch filename>

dm446_full_patch.patch

Remake the image, and the Android image for NX8MM-35 will be made.

make -j8
MAKE.png

\

Copy the files in ~/imx-android/out/target/product/evk_8mm and the uuu utility to your PC for restoring the image to NX8MM-35.

boot.img
u-boot-imx8mm.imx
u-boot-imx8mm-evk-uuu.imx
dtbo-imx8mm.img
partition-table.img
system.img
vbmeta-imx8mm.img
vendor.img
uuu_imx_android_flash.sh
UUU Utility

Apply command:

./uuu_imx_android_flash.sh -f imx8mm -a -c

After restore the image to NX8MM-35, the Android could be bootable.