yocto_app - zivku/MPU GitHub Wiki

Yocto將app放入rootfs並建立燒錄映像

前言

在進行本教學前,請先確認您已建立自己的 Yocto Layer。
若尚未建立,建議先參考以下相關教學,以便順利進行後續整合與開發:

如果您尚未熟悉如何將應用程式進行交叉編譯,請參考下列教學:

教學

  1. 建立放入app的recipe :
cd ~/git/sam9x60_yocto/meta-mycustom
mkdir -p recipes-myapps/spitest/files
  1. 加入需要包在rootfs中的檔案 :
cp ~/Desktop/spitest recipes-myapps/spitest/files/
  1. 建立.bb打包app :
gedit recipes-myapps/spitest/myapp.bb

加入以下內容(以spitest檔案為例) :

SUMMARY = "Test file copy to rootfs"
LICENSE = "CLOSED"
SRC_URI = "file://spitest"

ROOT_HOME = "/root"

do_install() {
    install -D -m 0755 --target-directory=${D}${ROOT_HOME} ${WORKDIR}/spitest
}

FILES:${PN} += "${ROOT_HOME}"

COMPATIBLE_MACHINE = "(at91sam9|sama5)"
  1. 建立 .bbappend將 myapp 加入映像 :
gedit recipes-myapps/spites/microchip-graphics-image.bbappend

加入以下內容 :

IMAGE_INSTALL:append:sam9x60-curiosity = " myapp"
  1. 編譯燒錄映像檔 :
cd ~/git/sam9x60_yocto/poky
source oe-init-build-env build-microchip 
MACHINE=sam9x60-curiosity bitbake -c clean myapp
MACHINE=sam9x60-curiosity bitbake myapp
MACHINE=sam9x60-curiosity bitbake microchip-graphics-image