Difference between revisions of "IoTGateway/BSP/Linux/iMX8/Yocto LBVC User Guide"

From ESS-WIKI
Jump to: navigation, search
(Conventions)
 
(27 intermediate revisions by 5 users not shown)
Line 1: Line 1:
  
{{DISPLAYTITLE:Yocto Linux BSP Ver.C User Guide for iMX8 series}} <!--
+
{{DISPLAYTITLE:Yocto Linux BSP Ver.C User Guide for iMX8 series -Yocto 4.0}} <!--
 
{| align="right"
 
{| align="right"
 
  | <span class="fck_mw_magic" _fck_mw_customtag="true" _fck_mw_tagname="TOC" _fck_mw_tagtype="c">_</span>
 
  | <span class="fck_mw_magic" _fck_mw_customtag="true" _fck_mw_tagname="TOC" _fck_mw_tagtype="c">_</span>
Line 27: Line 27:
 
:mx8qm for iMX8QM  
 
:mx8qm for iMX8QM  
 
:mx8qxp for iMX8QXP  
 
:mx8qxp for iMX8QXP  
 +
:mx8ulp for iMX8ULP
 
:&nbsp;  
 
:&nbsp;  
  
 
<span style="color:purple">'''${IMX8PROC}'''</span>&nbsp;: i.MX8 Processor
 
<span style="color:purple">'''${IMX8PROC}'''</span>&nbsp;: i.MX8 Processor
  
:imx8mq / imx8mm / imx8qm /imx8qxp /imx8mp  
+
:imx8mq / imx8mm / imx8qm /imx8qxp /imx8mp /imx8ulp
  
 
<span style="color:purple">'''${BOARD}'''</span>&nbsp;: available target boards list below
 
<span style="color:purple">'''${BOARD}'''</span>&nbsp;: available target boards list below
Line 42: Line 43:
 
:rom5722  
 
:rom5722  
 
:rsb3720  
 
:rsb3720  
 +
:rom2620
 +
:epcr5710
  
 
<span style="color:purple">'''${BOARD_REV}'''</span>&nbsp;: board revision
 
<span style="color:purple">'''${BOARD_REV}'''</span>&nbsp;: board revision
Line 58: Line 61:
 
::<tt>imx8mmrom5721a1 for ROM-5721 A1</tt>  
 
::<tt>imx8mmrom5721a1 for ROM-5721 A1</tt>  
 
::<tt>imx8mprom5722a1 for ROM-5722 A1</tt>  
 
::<tt>imx8mprom5722a1 for ROM-5722 A1</tt>  
::<tt>imx8mprsb3720a1 for RSB-3720 A1</tt>   
+
::<tt>imx8mprsb3720a1 for RSB-3720 A1</tt>
 +
::<tt>imx8ulprom2620a1 for ROM-2620 A1</tt>   
 +
::<tt>imx8mpepcr5710a1 for EPC-R5710 A1</tt>
  
 
:You can also use the command below to check supported machines on BSP  
 
:You can also use the command below to check supported machines on BSP  
Line 77: Line 82:
 
<span style="color:purple">'''${WORKSPACE}'''</span>&nbsp;:&nbsp;host workspace folders
 
<span style="color:purple">'''${WORKSPACE}'''</span>&nbsp;:&nbsp;host workspace folders
  
<span style="color:purple">'''${UBOOT}'''</span>&nbsp;:u-boot version(e.g. 2016.03)
+
<span style="color:purple">'''${UBOOT}'''</span>&nbsp;:u-boot version(e.g. v2022.04_5.15.52_2.1.0)
  
<span style="color:purple">'''${KERNEL}'''</span>&nbsp;: linux kernel version(e.g. 4.14.98)
+
<span style="color:purple">'''${KERNEL}'''</span>&nbsp;: linux kernel version(e.g. 5.15.52_2.1.0)
  
<span style="color:purple">'''${TOOLCHAIN}'''</span>&nbsp;: toolchain installed directory(e.g. /opt/fsl-imx-x11/4.1.15-2.0.0)
+
<span style="color:purple">'''${TOOLCHAIN}'''</span>&nbsp;: toolchain installed directory(e.g. opt/fsl-imx-wayland/5-15-kirkstone/environment)
  
 
debug console / serial console
 
debug console / serial console
Line 89: Line 94:
 
terminal console
 
terminal console
  
:terminal program (e.g. gnome-terminal, xfce4-terminal ...)
+
:terminal program (e.g. gnome-terminal, xfce4-terminal ...)  
  
 
== <font color="#0070c0">Docker install and setting</font> ==
 
== <font color="#0070c0">Docker install and setting</font> ==
Line 117: Line 122:
 
:For this example, a directory called '''adv-release-bsp''' is created for the project.  
 
:For this example, a directory called '''adv-release-bsp''' is created for the project.  
  
:Refer to&nbsp;[[IoTGateway/BSP/Linux/iMX8/OS_Support_List|IoTGateway/BSP/Linux/iMX8/OS_Support_List]] , Official version "'''imx8LBVB0209"&nbsp;'''is taken as&nbsp;an example&nbsp;:  
+
:Refer to[http://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX8/OS_Support_List_4.0_releasehttp://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX8/OS_Support_List_4.0_release &nbsp;IoTGateway/BSP/Linux/iMX8/OS_Support_List] , Official version "'''imx8LBVC0XXX"&nbsp;'''is taken as&nbsp;an example&nbsp;:  
 
<pre>$ git config --global user.name "Your Name"
 
<pre>$ git config --global user.name "Your Name"
 
$ git config --global user.email you@example.com
 
$ git config --global user.email you@example.com
 
$ sudo chown adv:adv adv-release-bsp
 
$ sudo chown adv:adv adv-release-bsp
 
$ cd adv-release-bsp
 
$ cd adv-release-bsp
$ repo init -u git://github.com/ADVANTECH-Corp/adv-arm-yocto-bsp.git -b refs/tags/imx8LBVB0209 -m imx8LBVB0209.xml  
+
$ repo init -u git://github.com/ADVANTECH-Corp/adv-arm-yocto-bsp.git -b imx-linux-kirkstone -m adv-5.15.52-2.1.0.xml  
 
$ repo sync</pre>
 
$ repo sync</pre>
  
:If you want to get 5.10.35-2.0.0 bsp
+
:After repo sync and finished. Please modify the "meta-freescale/recipes-bsp/u-boot/u-boot-imx-common_2022.04.inc"
 +
:Please Reference the commit [https://github.com/Freescale/meta-freescale/commit/f851708484206263aecee032288d27c948745ce8 https://github.com/Freescale/meta-freescale/commit/f851708484206263aecee032288d27c948745ce8]
  
$ repo init -u git://github.com/ADVANTECH-Corp/adv-arm-yocto-bsp.git -b imx-linux-hardknott -m imx-5.10.35-2.0.0.xml
+
[[File:U-boot-imx-common.png|1300px|U-boot-imx-common.png]]
$ repo sync
 
 
 
:If you want to get 5.10.72-2.2.0 bsp
 
 
 
$ repo init -u git://github.com/ADVANTECH-Corp/adv-arm-yocto-bsp.git -b imx-linux-hardknott -m imx-5.10.72-2.2.0.xml
 
$ repo sync
 
  
 
:If you suffer "server certificate verification failed", you can use the following command to disable SSL verification in git repositories with self-signed certificates.  
 
:If you suffer "server certificate verification failed", you can use the following command to disable SSL verification in git repositories with self-signed certificates.  
Line 146: Line 146:
  
 
  $ git config --global url."https://".insteadOf git://
 
  $ git config --global url."https://".insteadOf git://
 +
 +
&nbsp;
  
 
=== <span style="color:#0070c0">Copy BSP tarball to Container</span> ===
 
=== <span style="color:#0070c0">Copy BSP tarball to Container</span> ===
Line 177: Line 179:
 
:During building &nbsp;Yocto image , it will generate downloads folder which includes all packages we need , but it usually can't fetch normally, so we keep this downloads folder. Then we can reduce some fetch failed issue.  
 
:During building &nbsp;Yocto image , it will generate downloads folder which includes all packages we need , but it usually can't fetch normally, so we keep this downloads folder. Then we can reduce some fetch failed issue.  
  
:You can get Downloads tarball (downloads_imx8_5.10.35.tar.gz) from following URL:  
+
:You can get Downloads tarball (downloads_imx8_5.15.52_2.1.0.tar.gz) from following URL:  
  
:[https://www.dropbox.com/sh/3z9hh9zht98mzil/AACYhzJkMQq_om6cru9mM-wha/officialbuild/imx8_yocto_bsp_3.3?dl=0&preview=downloads_imx8_5.10.35.tar.gz [downloads_imx8_5.10.35.tar.gz]], <span style="color:#FF0000">'''md5 checksum:'''</span> <span style="color:#FF0000">'''912999faf861bf413cef4cf7a9f18dfa'''</span>
+
:[https://www.dropbox.com/s/2rgwquwitvt6ihw/downloads_imx8_5.15.52_2.1.0.tar.gz?dl=0 [downloads_imx8_5.15.52_2.1.0.tar.gz]]  
  
 
:If you get downloads tarball, you can copy to your '''${WORKSPACE}'''  
 
:If you get downloads tarball, you can copy to your '''${WORKSPACE}'''  
Line 191: Line 193:
 
2.Copy Downloads tarball to ${WORKSPACE} , and change owner
 
2.Copy Downloads tarball to ${WORKSPACE} , and change owner
  
  $ cp downloads_imx8_5.10.35.tar.gz '''${WORKSPACE}'''
+
  $ cp downloads_imx8_5.15.52_2.1.0.tar.gzz '''${WORKSPACE}'''
  $ sudo chown adv:adv ${WORKSPACE}/downloads_imx8_5.10.35.tar.gz&nbsp;
+
  $ sudo chown adv:adv ${WORKSPACE}/downloads_imx8_5.15.52_2.1.0.tar.gz&nbsp;
  
 
3.Back to container
 
3.Back to container
Line 201: Line 203:
 
4.Unpack Downloads tarball
 
4.Unpack Downloads tarball
  
  $ tar zxvf downloads_imx8_5.10.35.tar.gz
+
  $ tar zxvf downloads_imx8_5.15.52_2.1.0.tar.gzz
  
 
5.make link to downloads folder
 
5.make link to downloads folder
  
 
  $ cd adv-release-bsp
 
  $ cd adv-release-bsp
  $ ln -s ${WORKSPACE}/downloads_imx8_5.10.35 downloads
+
  $ ln -s ${WORKSPACE}/downloads_imx8_5.15.52_2.1.0 downloads
  
 
== <span style="color:#0070c0">Introducing BSP</span> ==
 
== <span style="color:#0070c0">Introducing BSP</span> ==
Line 223: Line 225:
 
:The tarball/prebuilt image name is consist of the model name followed by "LB" or "LI" plus version number and released date.  
 
:The tarball/prebuilt image name is consist of the model name followed by "LB" or "LI" plus version number and released date.  
  
:For example, '''BSP file name: imx8LBVA0010_2019-08-27.tgz'''  
+
:For example, '''BSP file name: imx8LBVC0010_2019-08-27.tgz'''  
 
:which , "LB" is acronym of <span style="color:#ff0000">'''L'''</span>inux <span style="color:#ff0000">'''B'''</span>SP,  
 
:which , "LB" is acronym of <span style="color:#ff0000">'''L'''</span>inux <span style="color:#ff0000">'''B'''</span>SP,  
:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"VA0010" stands for <span style="color:#ff0000">'''V'''</span>ersion <font color="#ff0000">'''A'''</font>.<span style="color:#ff0000">'''0010'''</span> <nowiki>.</nowiki>
+
:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;"VC0010" stands for <span style="color:#ff0000">'''V'''</span>ersion <font color="#ff0000">'''C'''</font>.<span style="color:#ff0000">'''0010'''</span> <nowiki>.
 
+
</nowiki>
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
  
&nbsp;
 
  
 
&nbsp;
 
&nbsp;
  
&nbsp;
+
:For example, '''Yocto image name: ''''''5720A1AIM20LIVC0010_iMX8M_2G_2020-08-27.img.gz'''  
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
&nbsp;
 
 
 
:For example, '''Yocto image name: ''''''5720A1AIM20LIVA0010_iMX8M_2G_2020-08-27.img.gz'''  
 
 
:which "5720A1" stands for <span style="color:#ff0000">'''ROM-5720 A1'''</span>  
 
:which "5720A1" stands for <span style="color:#ff0000">'''ROM-5720 A1'''</span>  
 
:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "LI" is acronym for prebuilt <span style="color:#ff0000">'''L'''</span>inux <span style="color:#ff0000">'''I'''</span>mage  
 
:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "LI" is acronym for prebuilt <span style="color:#ff0000">'''L'''</span>inux <span style="color:#ff0000">'''I'''</span>mage  
Line 299: Line 258:
 
::<code>$ source setup-environment <span style="color:#7030a0">'''${BDIR}'''</span></code>   
 
::<code>$ source setup-environment <span style="color:#7030a0">'''${BDIR}'''</span></code>   
  
 +
&nbsp;
  
 
=== <span style="color:#0070c0">To build sdcard image</span> ===
 
=== <span style="color:#0070c0">To build sdcard image</span> ===
Line 305: Line 265:
 
:Perform the following command in terminal console  
 
:Perform the following command in terminal console  
 
::<code>$ bitbake imx-image-full</code>   
 
::<code>$ bitbake imx-image-full</code>   
:The file, imx-image-full-<span style="color:#7030a0">'''${MC}'''</span>.wic.bz2, will be located in directory, ./tmp/deploy/images/<span style="color:#7030a0">'''${MC}'''</span>, while building process finished successfully.
+
:The file, imx-image-full-<span style="color:#7030a0">'''${MC}'''</span>.wic.bz2, will be located in directory, ./tmp/deploy/images/<span style="color:#7030a0">'''${MC}'''</span>, while building process finished successfully.  
  
 
=== <span style="color:#0070c0">To build toolchain installer</span> ===
 
=== <span style="color:#0070c0">To build toolchain installer</span> ===
Line 395: Line 355:
  
 
Then refer to [http://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX8/Yocto_LBVA_User_Guide#Creating_boot-up_on-board_flash_from_built_sdcard_image Creating_boot-up_on-board_flash_from_built_sdcard_image] to build SD card.
 
Then refer to [http://ess-wiki.advantech.com.tw/view/IoTGateway/BSP/Linux/iMX8/Yocto_LBVA_User_Guide#Creating_boot-up_on-board_flash_from_built_sdcard_image Creating_boot-up_on-board_flash_from_built_sdcard_image] to build SD card.
 
= Customization =
 
 
== <span style="color:#0070c0">Package addition</span> ==
 
 
=== <span style="color:#0070c0">To add tcf-agent & openssh-sftp-server</span> ===
 
 
:Navigate to the directory where fsl-image-adv.inc located
 
::<code>$ cd <span style="color:#7030a0">'''${BSP_HOME}'''</span>/sources/meta-advantech/meta-fsl-imx/recipes-fsl/images</code> 
 
:Add following line to fsl-image-adv.inc
 
::<code>IMAGE_INSTALL += " tcf-agent openssh-sftp-server "</code> 
 
:[[IoTGateway/BSP/Linux/iMX8/Yocto_LBV9_User_Guide#To_continue_an_exist_build_environment|Continue an exist build environment]] and [[IoTGateway/BSP/Linux/iMX8/Yocto_LBV9_User_Guide#To_build_sdcard_image|build sdcard image]]
 
 
=== <span style="color:#0070c0">To add chromium browser</span> ===
 
 
:Navigate to the directory where local.conf located
 
::<code>$ cd <span style="color:#7030a0">'''${BSP_HOME}'''</span>/<span style="color:#7030a0">'''${BDIR'''</span>'''<span style="color:#7030a0">}</span>'''/conf</code> 
 
 
*Method 1(Suggest): Add following one line&nbsp;to local.conf
 
 
CORE_IMAGE_EXTRA_INSTALL += "chromium-ozone-wayland"
 
 
*Method 2: Add following two lines to local.conf
 
 
IMAGE_INSTALL_append = \
 
    "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', ' chromium-ozone-wayland libexif', \
 
        bb.utils.contains('DISTRO_FEATURES',    'x11', ' chromium-x11 libexif', \
 
                                                        '', d), d)}"''
 
LICENSE_FLAGS_WHITELIST = \
 
    "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'commercial', \
 
        bb.utils.contains('DISTRO_FEATURES',    'x11', 'commercial', \
 
                                                        '', d),"''
 
 
:[[IoTGateway/BSP/Linux/iMX8/Yocto_LBV9_User_Guide#To_continue_an_exist_build_environment|Continue an exist build environment]] and [[IoTGateway/BSP/Linux/iMX8/Yocto_LBV9_User_Guide#To_build_sdcard_image|build sdcard image]]
 
  
 
&nbsp;
 
&nbsp;
  
=== <span style="color:#0070c0">To add QtWebEngine</span> ===
+
= Customization =
 
 
:Put the following in <span style="color:#7030a0">'''${BSP_HOME}'''</span>/<span style="color:#7030a0">'''${BDIR'''</span>'''<span style="color:#7030a0">}</span>'''/conf/local.conf
 
 
 
:
 
::<code>IMAGE_INSTALL_append += "packagegroup-qt5-webengine"</code> 
 
 
 
:[[IoTGateway/BSP/Linux/iMX8/Yocto_LBV9_User_Guide#To_continue_an_exist_build_environment|Continue an exist build environment]] and [[IoTGateway/BSP/Linux/iMX8/Yocto_LBV9_User_Guide#To_build_sdcard_image|build sdcard image]]
 
  
 
== <span style="color:#0070c0">Setting up SDK</span> ==
 
== <span style="color:#0070c0">Setting up SDK</span> ==
Line 446: Line 365:
 
:Perform the following command in terminal console  
 
:Perform the following command in terminal console  
 
::<code>$ cd <span style="color:#7030a0">'''${BSP_HOME}'''</span>/<span style="color:#7030a0">'''${BDIR}'''</span>/tmp/deploy/sdk</code>  
 
::<code>$ cd <span style="color:#7030a0">'''${BSP_HOME}'''</span>/<span style="color:#7030a0">'''${BDIR}'''</span>/tmp/deploy/sdk</code>  
::<code>$ sudo ./fsl-imx-xwayland-glibc-x86_64-meta-toolchain-aarch64-toolchain-5.4-zeus.sh</code>   
+
::<code>$ sudo ./fsl-imx-wayland-glibc-x86_64-meta-toolchain-armv8a-imx8mp-lpddr4-evk-toolchain-5.15-kirkstone.sh</code>   
 
:Enter new installed directory or just press <code>Enter</code> to use default directory.  
 
:Enter new installed directory or just press <code>Enter</code> to use default directory.  
 
:While <code>Proceed[y/n]?</code> shows up, please enter the correct one.  
 
:While <code>Proceed[y/n]?</code> shows up, please enter the correct one.  
 
:Waiting for the SDK installed (while the following messages show up completely)  
 
:Waiting for the SDK installed (while the following messages show up completely)  
 +
:Download SDK Link (Just Only reference), [https://www.dropbox.com/s/35y6s96l3gwh4kz/fsl-imx-wayland-glibc-x86_64-meta-toolchain-armv8a-imx8mp-lpddr4-evk-toolchain-5.15-kirkstone.sh?dl=0 [downloads_SDK]]
 +
 +
&nbsp;
 +
 +
:
 
::[[File:Setting up sdk 3.png|RTENOTITLE]]   
 
::[[File:Setting up sdk 3.png|RTENOTITLE]]   
  
Line 489: Line 413:
 
eg.
 
eg.
  
  ./cp_uboot.sh ../uboot-imx6 '''imx8m'''
+
  ./cp_uboot.sh ../uboot-imx '''imx8m'''
 
  ./mk_imx-boot.sh '''imx8mm'''
 
  ./mk_imx-boot.sh '''imx8mm'''
  
Line 500: Line 424:
 
:Where offset is:  
 
:Where offset is:  
 
::33 - for i.MAX 8QuadMax A0, i.Mx 8QuadXPlus A0, i.MX 8M Quad, and i.MX 8M Mini  
 
::33 - for i.MAX 8QuadMax A0, i.Mx 8QuadXPlus A0, i.MX 8M Quad, and i.MX 8M Mini  
::32 - for iMX 8M PLUS, i.MAX 8QuadXPlus B0/C0 and i.Mx 8QuadMax B0  
+
::32 - for iMX 8M PLUS, i.MAX 8QuadXPlus B0/C0 and i.Mx 8QuadMax B0
  
 
== <span style="color:#0070c0">Building & updating kernel/modules/dtb manually</span> ==
 
== <span style="color:#0070c0">Building & updating kernel/modules/dtb manually</span> ==
Line 512: Line 436:
 
change owner & unpack tarball
 
change owner & unpack tarball
  
  $ sudo chown adv:adv imx8LBVA0029_2019-10-23_linux-imx.tgz
+
  $ sudo chown adv:adv imx8LBVC0029_2019-10-23_linux-imx.tgz
  $ tar zxvf imx8LBVA0029_2019-10-23_linux-imx.tgz
+
  $ tar zxvf imx8LBVC0029_2019-10-23_linux-imx.tgz
  
 
=== <span style="color:#0070c0">Config kernel</span> ===
 
=== <span style="color:#0070c0">Config kernel</span> ===
Line 552: Line 476:
 
  $ make -j4 freescale/<span style="color:#7030a0">'''${IMX8PROC}'''</span>-<span style="color:#7030a0">'''${BOARD}'''</span>-<span style="color:#7030a0">'''${BOARD_REV}'''</span>.dtb
 
  $ make -j4 freescale/<span style="color:#7030a0">'''${IMX8PROC}'''</span>-<span style="color:#7030a0">'''${BOARD}'''</span>-<span style="color:#7030a0">'''${BOARD_REV}'''</span>.dtb
 
  eg.
 
  eg.
  $ make -j4 freescale/imx8mq-rom5720-a1.dtb
+
  $ make -j4 freescale/imx8mq-rom5721-a1.dtb
  
 
:The device tree blob, <span style="color:#7030a0">'''${IMX8PROC}'''</span>-<span style="color:#7030a0">'''${BOARD}'''</span>-<span style="color:#7030a0">'''${BOARD_REV}'''</span>.dtb, is located in the directory "./arch/arm64/boot/dts/freescale/".  
 
:The device tree blob, <span style="color:#7030a0">'''${IMX8PROC}'''</span>-<span style="color:#7030a0">'''${BOARD}'''</span>-<span style="color:#7030a0">'''${BOARD_REV}'''</span>.dtb, is located in the directory "./arch/arm64/boot/dts/freescale/".  
Line 606: Line 530:
  
 
  systemctl disable boottimes
 
  systemctl disable boottimes
 +
 +
&nbsp;
  
 
= System Recovery =
 
= System Recovery =
Line 611: Line 537:
 
This section provides detail procedures of restoring the eMMC image.
 
This section provides detail procedures of restoring the eMMC image.
  
If you destroy the onboard flash image by accident, you can recover a system following these steps.
+
For more usage ([https://github.com/NXPmicro/mfgtools/wiki https://github.com/NXPmicro/mfgtools/wiki])
  
*Recovery by SD card
+
&nbsp;
 
 
1.Copy 5720A1AIM20LIVA0022_iMX8M_flash_tool.tgz package to your desktop.
 
  
2.Insert SD card to PC
+
= Reflash EMMC from Boot SD CARD =
  
3.Make a bootable sd card
+
Download mksd-linux.sh in https://github.com/ADVANTECH-Corp/RISC_tools_scripts/blob/kirkstone/imx8/mksd-linux.sh
  
# tar zxvf 5720A1AIM20LIVA0022_iMX8M_2G_flash_tool.tgz
+
Download "Product_AIM_Release_version"_flash_tool.tgz
# cd 5720A1AIM20LIVA0022_iMX8M_2G_flash_tool/mk_inand/
 
# sudo ./mksd-linux.sh /dev/sdg
 
  
4.Insert SD card and copy 5720A1AIM20LIVA0022_iMX8M_flash_tool to USB disk
+
Unzip the "Product_AIM_Release_version"_flash_tool.tgz
  
5.Insert USB disk and SD card then Boot from SD
+
Copy the mksd-linux.sh to mk_inand folder.
  
6.Enter usb disk folder, make a bootable emmc
+
Run mksd-linux.sh
 
 
# cd /run/media/sda1/
 
# cd 5720A1AIM20LIVA0022_iMX8M_2G_flash_tool/mk_inand/
 
# sudo ./mksd-linux.sh /dev/mmcblk0
 
  
 
&nbsp;
 
&nbsp;
 
*Recovery by UUU tool
 
 
1.Download uuu tool from ([https://github.com/ADVANTECH-Corp/uuu/releases/tag/v20200619 https://github.com/ADVANTECH-Corp/uuu/releases/tag/v20200619])
 
 
2.burn command
 
 
*For Linux
 
 
  sudo ./uuu
 
 
*For Windows
 
 
  uuu.exe
 
 
2.Create a folder with files as below:
 
 
1.uuu
 
2.imx-boot-imx8mqrom5720a1-sd.bin-flash_evk
 
3.fsl-image-validation-imx-imx8mqrom5720a1-20190917152605.rootfs.sdcard
 
4.Image_dtb.uuu
 
5.rootfs.uuu
 
 
3.Connect otg cable from PC to device
 
 
4.Set the correct boot mode(ROM5720/ROM5721/ROM5620: 1,2,3-off 4-on, ROM7720: 1,2,3,4,5,6-off or 1,2,4,5,6-off 3-on), then power on
 
 
5.Perform the following command:
 
 
'''PS.If you want to burn uboot to mmcblk0 instead of mmcblk0boot0, u-boot must be updated to version 20191101,'''
 
 
1.Burn uboot to emmc
 
    a)replace uboot in mmcblk0boot0
 
        sudo ./uuu -b '''emmc''' imx-boot-imx8mqrom5720a1-sd.bin-flash_evk
 
    b)replace uboot in mmcblk0
 
        sudo ./uuu -b '''emmc_adv''' imx-boot-imx8mqrom5720a1-sd.bin-flash_evk
 
2.Burn rootfs image to emmc
 
    a)replace uboot in mmcblk0boot0
 
        sudo ./uuu -b '''emmc_all''' imx-boot-imx8mqrom5720a1-sd.bin-flash_evk fsl-image-validation-imx-imx8mqrom5720a1-20190917152605.rootfs.sdcard
 
    b)replace uboot in mmcblk0
 
        sudo ./uuu -b '''emmc_all_adv''' imx-boot-imx8mqrom5720a1-sd.bin-flash_evk fsl-image-validation-imx-imx8mqrom5720a1-20190917152605.rootfs.sdcard
 
 
6.uuu tool will start recovery image to emmc.
 
 
7.If we want to burn separately into emmc
 
 
    a)replace Image and dtb
 
        Step 1: rename Image and dtb
 
                  _Image
 
                  _board.dtb
 
        Step 2:
 
                  sudo ./uuu Image_dtb.uuu
 
    b)replace rootfs
 
        Step 1: rename rootfs tarball
 
                  _rootfs.tar.bz2
 
        Step 2:
 
                  sudo ./uuu rootfs.uuu
 
 
8.Another method for update Kernel and DTB by UUU
 
 
    # The version of UUU must be '''<span style="background-color:#f1c40f;">1.4.139</span>''' up
 
    <span style="background-color:#dddddd;"># On U-boot enter fastboot mode</span>
 
        u-boot > fastboot 0
 
    <span style="background-color:#dddddd;"># Download Kernel and DTB using UUU</span>
 
        sudo uuu -b fat_write Image mmc 0:1
 
        sudo uuu -b fat_write xxx.dtb mmc 0:1
 
 
9.For more usage ([https://github.com/NXPmicro/mfgtools/wiki https://github.com/NXPmicro/mfgtools/wiki])
 
  
 
= Package List =
 
= Package List =
  
'''In BSP''', list all packages which will be built in the image
+
= How to get the MAC, Serial Number, and Manufacture Date in the QSPI flash=
 
 
bitbake -g fsl-image-qt5-validation-imx && cat recipe-depends.dot | grep -v -e '-native' | grep -v digraph | grep -v -e '-image' | awk '{print $1}' | sort | uniq
 
 
 
:[[:File:20191025.txt|20191025 Package List]]
 
 
 
Show all recipes (include non-installed packages)
 
 
 
bitbake -s
 
 
 
:[[:File:package_version_20191025.txt|20191025 Package Version List]]
 
 
 
You can also check <span style="color:purple">'''${BDIR}'''</span>/tmp/deploy/images/<span style="color:purple">'''${MC}'''</span>/fsl-image-qt5-validation-imx-<span style="color:purple">'''${MC}'''</span>.manifest
 
  
It will show the same content with checking by rpm tool on target board.
+
MAC 0:
 +
<syntaxhighlight lang="c">
 +
READ_DATA=`dd if=/dev/mtdblock0 bs=1 skip=$((0xd0000)) count=6 2> /dev/null | hexdump -e '16/1 "%02x " "\n"' | sed 's/ /:/g' | cut -c 1-17`
 +
echo $READ_DATA
 +
</syntaxhighlight>
  
'''On target board''', list all packages by rpm tool
+
MAC 1:
 +
<syntaxhighlight lang="c">
 +
READ_DATA=`dd if=/dev/mtdblock0 bs=1 skip=$((0xd0400)) count=6 2> /dev/null | hexdump -e '16/1 "%02x " "\n"' | sed 's/ /:/g' | cut -c 1-17`
 +
echo $READ_DATA
 +
</syntaxhighlight>
  
rpm -qa --root / --dbpath /var/lib/rpm | sort
+
Serial Number:
 +
<syntaxhighlight lang="c">
 +
READ_DATA=`dd if=/dev/mtdblock0 bs=1 skip=$((0xd0006)) count=10 2> /dev/null | cut -c 1-10`
 +
echo $READ_DATA
 +
</syntaxhighlight>
  
:[[:File:rpm_board_20191025.txt|20191025 RPM on Board List]]
+
Manufacture Date:
 +
<syntaxhighlight lang="c">
 +
READ_DATA=`dd if=/dev/mtdblock0 bs=1 skip=$((0xd0010)) count=14 2> /dev/null | cut -c 1-14`
 +
READ_DATA=`echo $READ_DATA | cut -c 1-4`-`echo $READ_DATA | cut -c 5-6`-`echo $READ_DATA | cut -c 7-8`_`echo $READ_DATA | cut -c 9-10`-`echo $READ_DATA | cut -c 11-12`-`echo $READ_DATA | cut -c 13-14`
 +
echo $READ_DATA
 +
</syntaxhighlight>

Latest revision as of 02:26, 18 June 2024


Getting Started

Conventions

${PREBUILT_IMAGE} : compressed prebuilt image (*.img.gz)

${CONTAINER_NAME} : container name (e.g. imx8LBVC0016)

${BSP_TARBALL} : BSP tarball (*.tgz)

${BSP_HOME} : home directory of the BSP

${BDIR} : build directory (e.g. build_x11)

${MX8PROC} : i.MX8 Processor

mx8mq for iMX8M Dual Core
mx8mm for iMX8MM
mx8mp for iMX8MP
mx8qm for iMX8QM
mx8qxp for iMX8QXP
mx8ulp for iMX8ULP
 

${IMX8PROC} : i.MX8 Processor

imx8mq / imx8mm / imx8qm /imx8qxp /imx8mp /imx8ulp

${BOARD} : available target boards list below

rom5720
rom5721
rom7720
rom5620
rom3620
rom5722
rsb3720
rom2620
epcr5710

${BOARD_REV} : board revision

a1

${MC} : machine code combined with ${IMX8PROC}${BOARD}${BOARD_REV}

for example,
imx8mqrom5720a1 for ROM-5720 A1
imx8qmrom7720a1 for ROM-7720 A1
imx8qxprom5620a1 for ROM-5620 A1
imx8qxprom3620a1 for ROM-3620 A1
imx8mmrom5721a1 for ROM-5721 A1
imx8mprom5722a1 for ROM-5722 A1
imx8mprsb3720a1 for RSB-3720 A1
imx8ulprom2620a1 for ROM-2620 A1
imx8mpepcr5710a1 for EPC-R5710 A1
You can also use the command below to check supported machines on BSP
$ source setup-environment

${MEM_SIZE} : memory size

 2G/4G

${UC} : u-boot config

 1G/2G/4G/FSPI_1G/FSPI_2G...

${SD_DEVICE} : device name of SD card in Linux (e.g. /dev/sdf)

${SDCARD_IMAGE} : sdcard image built by bitbake (*.wic.bz2)

${WORKSPACE} : host workspace folders

${UBOOT} :u-boot version(e.g. v2022.04_5.15.52_2.1.0)

${KERNEL} : linux kernel version(e.g. 5.15.52_2.1.0)

${TOOLCHAIN} : toolchain installed directory(e.g. opt/fsl-imx-wayland/5-15-kirkstone/environment)

debug console / serial console

serial terminal program (e.g. minicom, putty, teraterm ...) that serial port is configured to 115200 8N1

terminal console

terminal program (e.g. gnome-terminal, xfce4-terminal ...)

Docker install and setting

If you don't have docker in your system, then you can follow the below  steps to install docker and run it first.

To install Docker Engine on your platform

Please refer to Docker Installation Guide for details

To pull ubuntu 20.04 image from Docker Hub 

$ docker pull advrisc/u20.04-imx8lbv1

To create container

$ docker run --privileged -it --name ${CONTAINER_NAME} -v ${WORKSPACE}:/home/adv/adv-release-bsp -v /dev:/dev advrisc/u20.04-imx8lbv1 /bin/bash

Get BSP

You have two methods to put BSP into container created above

Download_BSP_From_GitHub

The following example shows how to download the Advantech Yocto BSP from GitHub.
For this example, a directory called adv-release-bsp is created for the project.
Refer to IoTGateway/BSP/Linux/iMX8/OS_Support_List , Official version "imx8LBVC0XXX" is taken as an example :
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ sudo chown adv:adv adv-release-bsp
$ cd adv-release-bsp
$ repo init -u git://github.com/ADVANTECH-Corp/adv-arm-yocto-bsp.git -b imx-linux-kirkstone -m adv-5.15.52-2.1.0.xml 
$ repo sync
After repo sync and finished. Please modify the "meta-freescale/recipes-bsp/u-boot/u-boot-imx-common_2022.04.inc"
Please Reference the commit https://github.com/Freescale/meta-freescale/commit/f851708484206263aecee032288d27c948745ce8

U-boot-imx-common.png

If you suffer "server certificate verification failed", you can use the following command to disable SSL verification in git repositories with self-signed certificates.
$ export GIT_SSL_NO_VERIFY=1

or

$ git config --global http.sslverify false
If you get "The unauthenticated git protocol on port 9418 is no longer supported.", you can try it.
$ git config --global url."https://".insteadOf git://

 

Copy BSP tarball to Container

If you have BSP tarball (eg. imx8LBVB0029_2019-10-23.tgz), then you have to copy it into container.

Follow the steps below:

1.Exit container and back to local machine

$ exit

2.Copy BSP tarball to ${WORKSPACE} , and change owner

$ cp imx8LBVB0029_2021-10-23.tgz ${WORKSPACE}
$ sudo chown adv:adv ${WORKSPACE}/imx8LBVB0029_2021-10-23.tgz 

3.Back to container

$ docker start ${CONTAINER_NAME}
$ docker attach ${CONTAINER_NAME}

4.Unpack BSP tarball

$ tar zxvf imx8LBVB0029_2021-10-23.tgz

Downloads tarball

Not necessarily step
During building  Yocto image , it will generate downloads folder which includes all packages we need , but it usually can't fetch normally, so we keep this downloads folder. Then we can reduce some fetch failed issue.
You can get Downloads tarball (downloads_imx8_5.15.52_2.1.0.tar.gz) from following URL:
[downloads_imx8_5.15.52_2.1.0.tar.gz]
If you get downloads tarball, you can copy to your ${WORKSPACE}

Follow the steps below:

1.Exit container and back to local machine

$ exit

2.Copy Downloads tarball to ${WORKSPACE} , and change owner

$ cp downloads_imx8_5.15.52_2.1.0.tar.gzz ${WORKSPACE}
$ sudo chown adv:adv ${WORKSPACE}/downloads_imx8_5.15.52_2.1.0.tar.gz 

3.Back to container

$ docker start ${CONTAINER_NAME}
$ docker attach ${CONTAINER_NAME}

4.Unpack Downloads tarball

$ tar zxvf downloads_imx8_5.15.52_2.1.0.tar.gzz

5.make link to downloads folder

$ cd adv-release-bsp
$ ln -s ${WORKSPACE}/downloads_imx8_5.15.52_2.1.0 downloads

Introducing BSP

The BSP is based on Yocto Project with Freescale enhanced features for i.MX8, plus specific target board features from Advantech Inc..
The Advantech Yocto Project BSP Release directory contains a "sources" directory, which contains the recipes used to build,

one or more build directories, and a set of scripts used to set up the environment.

The recipes used to build the project come from both the community and Advantech. The Yocto Project layers are downloaded

to the sources directory. This sets up the recipes that are used to build the project.

Naming Rule

The tarball/prebuilt image name is consist of the model name followed by "LB" or "LI" plus version number and released date.
For example, BSP file name: imx8LBVC0010_2019-08-27.tgz
which , "LB" is acronym of Linux BSP,
           "VC0010" stands for Version C.0010 .


 

For example, Yocto image name: '5720A1AIM20LIVC0010_iMX8M_2G_2020-08-27.img.gz'
which "5720A1" stands for ROM-5720 A1
          "LI" is acronym for prebuilt Linux Image
          "2G" is DDR size

BSP Content

The description of some important folders list below:
sources/
meta-advantech/ : meta layer by Advantech
meta-fsl-*/ : meta layer by Freescale
fsl-setup-release.sh : to create one new build environment
setup-environment : to continue an exist build environment

Build Instructions

To create one new build environment

Perform the following commands in terminal console
$ cd ${BSP_HOME}
$ MACHINE=${MC} DISTRO=fsl-imx-xwayland source imx-setup-release.sh -b ${BDIR}
We can specify u-boot default config like below
$ MACHINE=${MC} UBOOT_CONFIG=${UC} DISTRO=fsl-imx-xwayland source imx-setup-release.sh -b ${BDIR}
You need to read and accept the EULA.
RTENOTITLE

To continue an exist build environment

Perform the following commands in terminal console
$ cd ${BSP_HOME}
$ source setup-environment ${BDIR}

 

To build sdcard image

To create/continue a build environment
Perform the following command in terminal console
$ bitbake imx-image-full
The file, imx-image-full-${MC}.wic.bz2, will be located in directory, ./tmp/deploy/images/${MC}, while building process finished successfully.

To build toolchain installer

To create/continue a build environment
Perform the following command in terminal console
$ bitbake meta-toolchain
The below installer will be located in the directory "./tmp/deploy/sdk".
fsl-imx-xwayland-glibc-x86_64-meta-toolchain-aarch64-toolchain-${KERNEL}-zeus.sh

To build bootloader

To create/continue a build environment
Perform the following command in terminal console
$ bitbake imx-boot

 

To build linux kernel

To create/continue a build environment
If you operate on docker images, please install tmux application before running this command
$ sudo apt-get install tmux
Type following command to enter tmux
$ tmux
Perform the following command in terminal console to show up menuconfig
$ bitbake linux-imx -c menuconfig
After edit menuconfig, type following command to exit tmux windows
$ exit
to build kernel image
$ bitbake linux-imx
The two files, Image & Image-${IMX8PROC}-${BOARD}-${BOARD_REV}.dtb, will be located in the directory, ./tmp/deploy/images/${MC}.

Creating boot-up on-board flash from prebuilt image

To create one boot-up SD card

Perform the following command in terminal console
# gunzip -c ${PREBUILT_IMAGE} | dd of=${SD_DEVICE} bs=1M
# sync

Creating boot-up on-board flash from built sdcard image

To create one boot-up SD card

Perform the following commands in terminal console
$ pushd ${BSP_HOME}/${BDIR}/tmp/deploy/images/${MC}
$ sudo bzcat ${SDCARD_IMAGE} | sudo dd of=${SD_DEVICE} bs=1M
$ sync
$ popd

Debug console information

If you want to see debug message from device, you need to prepare for hardware device and software tool.

Preparing for hardware device

  • The following URL provides information about the debug port slot and the debug port line for each device

Debug Port Information

Preparing for software tool

  • You need to prepare the debug console tool. For example: "minicom" tool or "putty" tool.
  • Baud rate: 115200

One step build image

Our machine must be pre-installed docker

Download the following script can quickly build our image.

$ wget https://raw.githubusercontent.com/ADVANTECH-Corp/RISC_tools_scripts/hardknott/imx8/adv_imx8_build.sh
$ sudo chmod a+x adv_imx8_build.sh

Build image

$ sudo ./adv_imx8_build.sh ${BOARD}
$ sudo ./adv_imx8_build.sh rom5720

Our image will be in workspace folder.

workspace/${BDIR}/tmp/deploy/images/${MC}

Then refer to Creating_boot-up_on-board_flash_from_built_sdcard_image to build SD card.

 

Customization

Setting up SDK

Please follow the section,To build toolchain installer, to build one toolchain installer
Perform the following command in terminal console
$ cd ${BSP_HOME}/${BDIR}/tmp/deploy/sdk
$ sudo ./fsl-imx-wayland-glibc-x86_64-meta-toolchain-armv8a-imx8mp-lpddr4-evk-toolchain-5.15-kirkstone.sh
Enter new installed directory or just press Enter to use default directory.
While Proceed[y/n]? shows up, please enter the correct one.
Waiting for the SDK installed (while the following messages show up completely)
Download SDK Link (Just Only reference), [downloads_SDK]

 

RTENOTITLE

Setting up cross compiling environment

SDK has been set up (ref.Setting up SDK)
Perform the following command in terminal console
$ source ${TOOLCHAIN}/environment-setup-aarch64-poky-linux

Build U-Boot in standalone environment

Config u-boot

make ${IMX8PROC}_${BOARD}${BOARD_REV}_${MEM_SIZE}_defconfig

eg.

make imx8mm_rom5721a1_2G_defconfig

Build u-boot

make -j4

Build imx-boot image by using imx-mkimage

Get imx-boot tarball from our server Here we take rom5721 as an example:

tar zxvf 5721A1AIM20LIVA0118_iMX8MM_imx-boot.tgz 
cd 5721A1AIM20LIVA0118_iMX8MM_imx-boot/ 

In this folder , we have two script as below: Copy necessary files to imx-mkimage folder

./cp_uboot.sh ${uboot path} ${IMX8PROC}

Make imx-boot image

./mk_imx-boot.sh ${IMX8PROC}

eg.

./cp_uboot.sh ../uboot-imx imx8m
./mk_imx-boot.sh imx8mm

Replace imx-boot

Perform the following command to transfer to on-board flash
$ dd if=flash.bin of=/dev/mmcblk0 bs=1K seek=<offset> conv=fsync
Where offset is:
33 - for i.MAX 8QuadMax A0, i.Mx 8QuadXPlus A0, i.MX 8M Quad, and i.MX 8M Mini
32 - for iMX 8M PLUS, i.MAX 8QuadXPlus B0/C0 and i.Mx 8QuadMax B0

Building & updating kernel/modules/dtb manually

The cross compiling environment has been set up. (ref. Setting up cross compiling environment)

Copy BSP tarball to Container

Refer to Copy_BSP_tarball_to_Container , copy kernel tarball to ${WORKSPACE} and back to container

change owner & unpack tarball

$ sudo chown adv:adv imx8LBVC0029_2019-10-23_linux-imx.tgz
$ tar zxvf imx8LBVC0029_2019-10-23_linux-imx.tgz

Config kernel

Configure linux kernel
$ cd linux-imx
$ make distclean
$ make imx_v8_adv_defconfig
$ make menuconfig
Start building linux kernel
$ make -j4 Image
When you get error like below

RTENOTITLE

run command then rebuild
$ unset LDFLAGS 

 

The kernel image file, Image, is located in the directory "./arch/arm64/boot/".
Start building kernel modules
$ make -j4 modules
Copy all modules to a temporary rootfs directory, "~/temp/rootfs"
$ make modules_install INSTALL_MOD_PATH=~/temp/rootfs
Building device tree blob
$ make -j4 freescale/${IMX8PROC}-${BOARD}-${BOARD_REV}.dtb
eg.
$ make -j4 freescale/imx8mq-rom5721-a1.dtb
The device tree blob, ${IMX8PROC}-${BOARD}-${BOARD_REV}.dtb, is located in the directory "./arch/arm64/boot/dts/freescale/".

Replace kernel & dts

Replace kernel
copy Image to SDcard or emmc
Replace dtb file
copy dtb file to SDcard or emmc

Improve boot speed

  • Bootloader

1.bootdelay time

We can cancel the bootdelay time by setting bootloader environment value.
setenv bootdelay 0
env save
reset

2.Disable console

Disable debug message output can also improve boot speed

Disable kernel message

setenv mmcargs setenv bootargs ${jh_clk} console=${console} modprobe.blacklist=${modprobe.blacklist} root=${mmcroot} video=HDMI-A-1:${videores} quiet
env save
reset

Or

Disable debug port
setenv console
env save
reset
  • Rootfs
TBD
  • Services

1. Using systemctl disable remove ,we can remove unnecessary services.

systemctl disable <services>

eg.

systemctl disable boottimes

 

System Recovery

This section provides detail procedures of restoring the eMMC image.

For more usage (https://github.com/NXPmicro/mfgtools/wiki)

 

Reflash EMMC from Boot SD CARD

Download mksd-linux.sh in https://github.com/ADVANTECH-Corp/RISC_tools_scripts/blob/kirkstone/imx8/mksd-linux.sh

Download "Product_AIM_Release_version"_flash_tool.tgz

Unzip the "Product_AIM_Release_version"_flash_tool.tgz

Copy the mksd-linux.sh to mk_inand folder.

Run mksd-linux.sh

 

Package List

How to get the MAC, Serial Number, and Manufacture Date in the QSPI flash

MAC 0:

READ_DATA=`dd if=/dev/mtdblock0 bs=1 skip=$((0xd0000)) count=6 2> /dev/null | hexdump -e '16/1 "%02x " "\n"' | sed 's/ /:/g' | cut -c 1-17`
echo $READ_DATA

MAC 1:

READ_DATA=`dd if=/dev/mtdblock0 bs=1 skip=$((0xd0400)) count=6 2> /dev/null | hexdump -e '16/1 "%02x " "\n"' | sed 's/ /:/g' | cut -c 1-17`
echo $READ_DATA

Serial Number:

READ_DATA=`dd if=/dev/mtdblock0 bs=1 skip=$((0xd0006)) count=10 2> /dev/null | cut -c 1-10`
echo $READ_DATA

Manufacture Date:

READ_DATA=`dd if=/dev/mtdblock0 bs=1 skip=$((0xd0010)) count=14 2> /dev/null | cut -c 1-14`
READ_DATA=`echo $READ_DATA | cut -c 1-4`-`echo $READ_DATA | cut -c 5-6`-`echo $READ_DATA | cut -c 7-8`_`echo $READ_DATA | cut -c 9-10`-`echo $READ_DATA | cut -c 11-12`-`echo $READ_DATA | cut -c 13-14`
echo $READ_DATA