NXP i.MX8M Plus EVK Linux (Yocto)機器學習環境建置

  1. i.MX8M Plus簡介
      1.1 EVK 平台
      i.MX8M Plus EVK 為 NXP 提供給開發者進行 i.MX8M Plus 處理器全方位評估發展之平台。是以一片主板加上一片基板(Baseband)所組成。主板包含 i.MX 8M Plus 應用處理器為i.MX8M系列的最新成員,是一顆包含4核Cortex A53 + 1 核Cortex M7應用處理器及搭載內含2.3TOPS運算能力的神經網路處理器(NPU),另外搭配 6GB LPDDR4 和 32GB eMMC;基板則包含各種影、音、網路等周邊之連接介面如下圖所示。使平台在機器學習,視覺,高級多媒體和工業物聯網應用方面表現出色。因i.MX 8M Plus處理器提升了邊緣智能,也是智能家居,智能城市,工業4.0及更高版本的堅實基礎。


i.MX8M Plus EVK(
8MPLUSLPD4- EVK)

  1. Linux 環境建置(使用 Yocto)
    此文件採用範例為NXP發行版本L5.4.70_2.3.0適用於Yocto Project 3.0(Zeus)詳細步驟如下描述。
       2.1 主機設定

       建置機器學習環境,主機建議的 OS 為 ubuntu 18.04 或更新的版本。另外主機建議至少保留 250GB 的硬碟空間。以及需要安裝的工具如下,

  • 安裝主機工具包

$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \

build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \

xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \

pylint3 xterm

  •  安裝 repo,並加入 PATH 中

$ mkdir ~/bin (this step may not be needed if the bin folder already exists)

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

$ chmod a+x ~/bin/repo

$ echo "export PATH=~/bin:\$PATH" >> .bashrc


    2.2 Yocto Project 建立
   
利用 repo 先取得 Yocto Project。詳細步驟如下:

  • 首先設定 git 參數,

$ git config --global user.name "Your Name"

$ git config --global user.email "Your Email"

$ git config --list

  • 接下來以 repo command 取得 Yocto Project,

$ mkdir L5.4.70

$ cd L5.4.70

$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-zeus -m imx-5.4.70-2.3.0.xml
$ repo sync

   完成這個步驟之後,Yocto Project 就建立好了。源代碼的目錄會位於L5.4.70/sources,接下來進行 build image 的動作。



    2.3 
構建配置
          i.MX 為了簡化 machine 的建立流程,提供了一個 script,名為〝fsl-setup-release.sh〞。利用這個 script,並賦予特定待 build 的 machine 名稱,即可快速建立出待 build 的 machine 資料夾以及其相關    環境;
  •  Imx-setup-release.sh script 使用指令如下:

 $ DISTRO= MACHINE= source imx-setup-release.sh -b

  •  DISTRO 為配置構建環境,以 i.MX 系列DISTRO配置如下:
    •  fsl-imx-wayland :Wayland weston graphics.
    • fsl-imx-xwayland:Wayland graphics and X11. X11 applications using EGL are not supported.
    • fsl-imx-fb :Frame Buffer graphics - no X11 or Wayland. Frame Buffer is not supported on i.MX 8.
  • MACHINE= :  選擇為 meta-imx/imx-bsp中conf/machine 資料夾,為i.mx 平台的machine name
   

  • -b 參數 : 可自行定義參數,將會是產生出來的資料夾名稱。

 以 i.MX8M Plus 採用 xwayland 為例,建立 machine資料夾的指令如下,

 $ DISTRO=fsl-imx-xwayland MACHINE=imx8mpevk source fsl-setup-release.sh  -b imx8mp_build_xwayland

同意 EULA 之後,會自動產生並進入 build dir 中,machine folder 就產生了。在 build dir 內,還包含一個conf 的資料夾,裡面放有 local.conf 和 bblayers.conf 等 Yocto 設定檔,之後 bitbake 執行會依照這些設定檔進行後續動作。local.conf 包含了 MACHINE、DISTRO 等資訊。而 bblayers.conf 則列出了 i.MX Yocto Project 所有可能用到的 metalayer。


 2.3 
選擇一個 i.MX Yocto Project 的 image
    設定好 Machine 之後,接下來要選擇待 build 的 image。Yocto Project 可提供多種 image 讓 user 選擇。如下圖,Poky 提供了〝core-image-minimal〞、〝core-image-base〞以及〝core-image-sato〞。依需求做選擇。因我們想要有機器學習的功能,所以選擇”imx-image-full”作為我們的範例。

   2.4 Build image

在前一章節所建立的環境下,Yocto Project 利用 bitbake command 可以 build 出 image,指令如下,

$ bitbake imx-image-full

完成之後,產生出來的 image 可以在下面的資料夾找到,其中檔案〝imx-boot-imx8mpevk-sd.bin-flash_evk 〞及” imx-image-full-imx8mpevk.wic.bz2”可搭配 uuuu command 做完整的 eMMC/SD Card 燒錄。

 $ ../imx8mp_build-xwayland/tmp/deploy/imx8mpevk/ 資料夾為產生出來的image.


  •  2.5重啟環境
        若是開發環境的終端機視窗關閉之後,我們可以使用以下指令重啟。

$ source setup-environment

例如:

$ source setup-environment imx8mp_build_xwayland/


  1. Image 燒錄
  •   設定i.MX8M Plus EVK Boot Mode (SW4[3:0) 到Serial Download.SW[3:0]為0001,進入燒錄模式。並透過uuu燒錄工具,執行如下的命令燒錄image 到emmc。
  • uuu -b emmc_all imx-boot-imx8mpevk-sd.bin-flash_evk imx-image-full-imx8mpevk.wic.bz2
  • 燒錄完畢後,切換Boot Mode (SW4[3:0) 到eMMC/SDHC3[3:0] 為0001 , EVK 板的終端機Logo可開到 command line。


  1. 參考文獻
  • MX Yocto Project User's Guide.pdf (Rev. L5.4.70_2.3.0 — 31 December 2020) 

★博文內容均由個人提供,與平台無關,如有違法或侵權,請與網站管理員聯繫。

★文明上網,請理性發言。內容一周內被舉報5次,發文人進小黑屋喔~

評論

tzeng015

tzeng015

2022年8月2日
你好 ...本篇說的 i.MX 為了簡化 machine 的建立流程,提供了一個 script,名為〝fsl-setup-release.sh〞。根據 user manual 說明如下 i.MX provides a script, imx-setup-release.sh, that simplifies the setup for i.MX machines. To use the script, the name of the specific machine to be built for needs to be specified as well as the desired graphical backend. The script sets up a directory and the configuration files for the specified machine and backend. In the meta-imx layer, i.MX provides new or updated machine configurations that overlay the meta-freescale machine configurations. These files are copied into the meta-freescale/conf/machine directory by the imx-setup-release.sh script. The following are i.MX machine configuration files that can be selected. Check either the release notes or the machine directory for the latest additions. 根本沒有 fsl-setup-release.sh 這個檔案...再請 check 一下