3/15/2020

Raspberry Pi3 에 Yocto 와 Qt 적용한 Image (정리못함)

1. Raspberry Pi 와 Qt5 관련정보사항 


Yocto Recipe 작성방법 


기본적으로 Raspberry Pi 기반으로 나만의 Qt를 이용하여 나만의 Yocto로 구성하고자하는 마음으로 이것을 시작했다. 

  • Raspberry Pi용 Image 생성 (Yocto 기반)
Raspberry Pi에 적용할 Yocto 기반으로 구성된 Qt를 포함 Image를 생성하는 방법 
  1. 이미 구성된 Yocto Layer들과 Recipe들을 직접 Download 
  2. Yocto의 각 Layer들 별로 Download 후 별도의 Image Recipe를 구성하여 빌드 

간단하게만 Build 테스트 만 했지만, 실제로 Image를 Write해서 다 확인하지는 않았으며, 틀린부분은 추후 시간이 있을 때 수정하여 보완하도록 하자.

  • 상위 진행결과   
완벽히는 구성을 못했지만, Qt기반으로 실행가능한 정도로만 구성하여 동작확인을 하였다. 
아래와 같이 Laptop이 아래와 같이 Ubuntu Laptop 지워져서 정리 포기함  

상위 부분은 앞으로 진행못할 거 같으며, 추후 기회가 있다면 그때 다시 하도록 하자. 
그리고, 아래의 내용은 이전에 정리해둔 것이므로 나중에 참조만 하도록하자.
이후 변경된 내용은 백업을 못한 내 잘못이 더 크다. 

그리고, 칩제조사 TI/NXP에서 제공하는 Yocto가 아닌 Poky 와 OpenEmbedded 기반으로 간단하게 구성하여 누구나 할 수 있다. 


1.1  이미 구성된 Yocto 기반으로 Image 생성 

Yocto를 별도로 구성할 필요 없이 repo를 이용하여 Yocto를 전체 Layer들을 직접 Download 한 후 Manual 대로 설정 한 후 bitbake로 실행하여 Image 생성 


QT 관련설치
  https://doc.qt.io/QtForDeviceCreation/qtee-custom-embedded-linux-image.html
  https://code.qt.io/cgit/yocto/boot2qt-manifest.git/tree/

  • 기존에 존재하는 Yocto (QT 테스트)
아래와 같이 처음 Qt 테스트 진행 
$ sudo apt-get install gawk curl git-core git-lfs diffstat unzip texinfo build-essential \
chrpath libsdl1.2-dev xterm gperf bison gcc-multilib g++-multilib repo

$ cd rasp-qt

$ repo init -u git://code.qt.io/yocto/boot2qt-manifest -m warrior.xml  // ok

$ repo init -u git://code.qt.io/yocto/boot2qt-manifest -m zeus.xml // not work 

$ repo sync

$ MACHINE=raspberrypi3 source ./setup-environment.sh

$ bitbake b2qt-embedded-qt5-image

$ bitbake meta-toolchain-b2qt-embedded-qt5-sdk


2. Yocto 의 Layer를 직접 구성 후 Image 생성 

본인이 Yocto의 Main인 Poky 부터 필요한 Layer들을 각 모아서 구성한 후, 필요한 Image recipe 역시 직접 만들어서 구성한 후, 
이 기반으로 최종 Raspberry Pi Image 생성 

  • 이전에 구성한 Raspberry Pi Yocto 

  • Yocto에서 먼저확인 해봐야할 것
Yocto의 Version 정보와 Dependencies 이 될 것 같다. 
항상 최신버전만을 받았지만, 이번에는 다양한 Version을 받아보기 위해서 일단 아래에서 branch 정보를 파악해서 원하는 것으로 받기로 했다.

  • QT 설치방법 
현재 Image가 안되며, layer를 추가한 후 아래 medium을 똑같이 해보자
  https://makersweb.net/embedded/12540
  https://medium.com/@shigmas/yocto-pi-and-qt-e9f2df38a610
  https://jumpnowtek.com/rpi/Raspberry-Pi-Systems-with-Yocto.html

  • Yocto Version(Branch) 정보확인 
Yocto에 Version에 부여된 이름이 각각 존재 (zeus로 version(branch) 결정)

  • 본인 설치할 Layer 선택
  1. ref -> Branch 및 Tag  확인 
  2. about->Dependencies 확인 
  http://git.yoctoproject.org/cgit.cgi/
  https://www.yoctoproject.org/software-overview/layers/
  http://layers.openembedded.org/layerindex/branch/master/layers/


  • meta-raspberrypi 의 branch 파악
Yocto version: zeus 파악
  http://git.yoctoproject.org/cgit.cgi/meta-raspberrypi/refs/
  https://js94.tistory.com/entry/Yocto-Project-Reference-manual-chap3-35

  • Yocto 의 Layer를 각 구성 방법  
  1. 상위와는 다르게 각각의 Layer들을 별도로 다운받아 본인 직접구성 (poky, openembedded)
  2. 별도의 Layer들을 추가하는 방식으로 구성
  3. 추후 더 필요하다면 확장하는 방식으로 구성 
$ mkdir -p works/raspberrypi/sources

$ cd works/raspberrypi/source

$ pwd
/home/jhlee/works/raspberrypi/sources

$ git clone -b zeus  git://git.yoctoproject.org/poky
$ git clone -b zeus  git://git.openembedded.org/meta-openembedded
$ git clone -b zeus  https://github.com/agherzan/meta-raspberrypi
$ git clone -b zeus  git://github.com/meta-qt5/meta-qt5.git       // 처음에 못찾다가 상위 Layer에서 찾음 


  • 기본구성 후 conf/machine 확인 
우선 machine Layer 의 설정을 알기 위해서 검색 
물론 QEMU도 확인가능 
$ find . -name machine | xargs ls   // conf/machine 관련된 부분 전부 검색 
./meta-raspberrypi/conf/machine:
include     raspberrypi0-wifi.conf  raspberrypi3-64.conf  raspberrypi4-64.conf  raspberrypi-cm3.conf  raspberrypi.conf
raspberrypi0.conf  raspberrypi2.conf    raspberrypi3.conf  raspberrypi4.conf     raspberrypi-cm.conf

./poky/meta/conf/machine:
include  qemuarm.conf qemumips64.conf  qemuppc.conf    qemux86-64.conf
qemuarm64.conf qemuarmv5.conf qemumips.conf  qemuriscv64.conf  qemux86.conf

./poky/meta-selftest/conf/machine:
qemux86copy.conf

./poky/meta-yocto-bsp/conf/machine:
beaglebone-yocto.conf  edgerouter.conf genericx86-64.conf  genericx86.conf  include  mpc8315e-rdb.conf 

MACHINE 설정부터 BBLAYERS 확인  
$ find . -name local.conf*  // conf/local.conf 부분 검색 
./poky/meta-poky/conf/local.conf.sample
./poky/meta-poky/conf/local.conf.sample.extended


$ vi ./poky/meta-poky/conf/local.conf.sample  // 추후 build에 이 파일 기준으로 적용됨 
....
MACHINE ?= "raspberrypi3-64"
# This sets the default machine to be qemux86-64 if no other machine is selected:
#MACHINE ??= "qemux86-64"


$ vi ./poky/meta-poky/conf/bblayers.conf.sample // 추후 build에 이 파일 기준으로 적용됨, Build 설정 이후로 수정하기로 결정  

BBLAYERS ?= " \
  ##OEROOT##/meta \
  ##OEROOT##/meta-poky \
  ##OEROOT##/meta-yocto-bsp \
  "

  • 현재 구성된 Yocto 구성도 

$ pwd
/home/jhlee/works/raspberrypi/sources

$ tree -t -L 2   // Yocto 전체 Layer와 각 구성확인 
.
├── meta-openembedded
│   ├── contrib
│   ├── COPYING.MIT
│   ├── meta-filesystems
│   ├── meta-gnome
│   ├── meta-initramfs
│   ├── meta-multimedia
│   ├── meta-networking
│   ├── meta-oe
│   ├── meta-perl
│   ├── meta-python
│   ├── meta-webserver
│   ├── meta-xfce
│   └── README
├── meta-raspberrypi
│   ├── classes
│   ├── conf
│   ├── COPYING.MIT
│   ├── docs
│   ├── dynamic-layers
│   ├── files
│   ├── README.md
│   ├── recipes-bsp
│   ├── recipes-connectivity
│   ├── recipes-core
│   ├── recipes-devtools
│   ├── recipes-graphics
│   ├── recipes-kernel
│   ├── recipes-multimedia
│   └── wic
├── poky
│   ├── bitbake
│   ├── contrib
│   ├── documentation
│   ├── LICENSE
│   ├── LICENSE.GPL-2.0-only
│   ├── LICENSE.MIT
│   ├── meta
│   ├── meta-poky
│   ├── meta-selftest
│   ├── meta-skeleton
│   ├── meta-yocto-bsp
│   ├── oe-init-build-env
│   ├── README.hardware -> meta-yocto-bsp/README.hardware
│   ├── README.OE-Core
│   ├── README.poky -> meta-poky/README.poky
│   ├── README.qemu
│   └── scripts
└── meta-qt5
    ├── classes
    ├── conf
    ├── COPYING.MIT
    ├── files
    ├── lib
    ├── licenses
    ├── README.md
    ├── recipes-connectivity
    ├── recipes-devtools
    ├── recipes-multimedia
    ├── recipes-python
    └── recipes-qt

  • Build 환경구성 
기본 Build 환경구성 확인 과 Build 
$ cd ..

$ pwd
/home/jhlee/works/raspberrypi

$ source sources/poky/oe-init-build-env rpi-build  // Yocto Poky 기반으로 Build 환경설정 
or
$ . sources/poky/oe-init-build-env rpi-build

### Shell environment set up for builds. ###

You can now run 'bitbake <target>'

Common targets are:
    core-image-minimal
    core-image-sato
    meta-toolchain
    meta-ide-support

You can also run generated qemu images with a command like 'runqemu qemux86'


Other commonly useful commands are:
 - 'devtool' and 'recipetool' handle common recipe tasks
 - 'bitbake-layers' handles common layer tasks
 - 'oe-pkgdata-util' handles common target package task

$ pwd
/home/jhlee/works/raspberrypi/rpi-build

  • Build 환경구성 확장  
BBLAYERS에 추가된 Layer들을 추가하여 확장하여 이를 확장 
$ cd .. 

$ pwd
/home/jhlee/works/raspberrypi

$ tree -t -L 2  // Yocto 전체 Layer 와 Build 관련부분 파악 
.
├── sources
│   ├── meta-openembedded
│   ├── meta-raspberrypi
│   ├── meta-qt5
│   └── poky
└── rpi-build
    └── conf

$ cd ./rpi-build  // Build 환경으로 다시  

$ JHLEE=$HOME/works/raspberrypi/sources

$ echo $JHLEE
/home/jhlee/raspberrypi/sources

$ cat conf/bblayers.conf 
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /home/jhlee/works/raspberrypi/sources/poky/meta \
  /home/jhlee/works/raspberrypi/sources/poky/meta-poky \
  /home/jhlee/works/raspberrypi/sources/poky/meta-yocto-bsp \
  "

//meta-raspberrypi 필요한 Layer들 별도로 추가 (dependecies)
$ echo "BBLAYERS += \"$JHLEE/meta-openembedded/meta-oe\"" >> conf/bblayers.conf
$ echo "BBLAYERS += \"$JHLEE/meta-openembedded/meta-multimedia\"" >> conf/bblayers.conf
$ echo "BBLAYERS += \"$JHLEE/meta-openembedded/meta-networking\"" >> conf/bblayers.conf
$ echo "BBLAYERS += \"$JHLEE/meta-openembedded/meta-python\"" >> conf/bblayers.conf

$ echo "BBLAYERS += \"$JHLEE/meta-raspberrypi\"" >> conf/bblayers.conf
$ echo "BBLAYERS += \"$JHLEE/meta-qt5\"" >> conf/bblayers.conf

$ cat conf/bblayers.conf    // 최종 bitbake Layer 관련설정 확인  
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \
  /home/jhlee/works/raspberrypi/sources/poky/meta \
  /home/jhlee/works/raspberrypi/sources/poky/meta-poky \
  /home/jhlee/works/raspberrypi/sources/poky/meta-yocto-bsp \
  "
BBLAYERS += "/home/jhlee/works/raspberrypi/sources/meta-openembedded/meta-oe"
BBLAYERS += "/home/jhlee/works/raspberrypi/sources/meta-openembedded/meta-multimedia"
BBLAYERS += "/home/jhlee/works/raspberrypi/sources/meta-openembedded/meta-networking"
BBLAYERS += "/home/jhlee/works/raspberrypi/sources/meta-openembedded/meta-python"
BBLAYERS += "/home/jhlee/works/raspberrypi/sources/meta-raspberrypi"
BBLAYERS += "/home/jhlee/works/raspberrypi/sources/meta-qt5"

// priority 의 경우 어떻게 측정되는 지 추후 더 파악 (만약 Package가 제대로 설치되어있지 않으면 실행이 안됨) 
$ bitbake-layers show-layers  
NOTE: Starting bitbake server...
layer                 path                                      priority
==========================================================================
meta                  /home/jhlee/works/raspberrypi/sources/poky/meta  5
meta-poky             /home/jhlee/works/raspberrypi/sources/poky/meta-poky  5
meta-yocto-bsp        /home/jhlee/works/raspberrypi/sources/poky/meta-yocto-bsp  5
meta-oe               /home/jhlee/works/raspberrypi/sources/meta-openembedded/meta-oe  6
meta-multimedia       /home/jhlee/works/raspberrypi/sources/meta-openembedded/meta-multimedia  6
meta-networking       /home/jhlee/works/raspberrypi/sources/meta-openembedded/meta-networking  5
meta-python           /home/jhlee/works/raspberrypi/sources/meta-openembedded/meta-python  7
meta-raspberrypi      /home/jhlee/works/raspberrypi/sources/meta-raspberrypi  9
meta-qt5              /home/jhlee/works/raspberrypi/sources/meta-qt5  7


  • 전체 Image Recipe 찾기 
현재 사용중인 Image Recipe를 찾아 역으로 분석하여 기본구조를 파악하자 
$ find ../sources -name *image*.bb   // bitbake 의 image bb recipe 파일 전부 검색  
../sources/meta-openembedded/meta-filesystems/recipes-filesystems/images/meta-filesystems-image-base.bb
../sources/meta-openembedded/meta-filesystems/recipes-filesystems/images/meta-filesystems-image.bb
../sources/meta-openembedded/meta-webserver/recipes-core/images/meta-webserver-image-base.bb
../sources/meta-openembedded/meta-webserver/recipes-core/images/meta-webserver-image.bb
../sources/meta-openembedded/meta-multimedia/recipes-multimedia/images/meta-multimedia-image-base.bb
../sources/meta-openembedded/meta-multimedia/recipes-multimedia/images/meta-multimedia-image.bb
../sources/meta-openembedded/meta-initramfs/recipes-bsp/images/initramfs-debug-image.bb
../sources/meta-openembedded/meta-initramfs/recipes-bsp/images/initramfs-kexecboot-klibc-image.bb
../sources/meta-openembedded/meta-initramfs/recipes-bsp/images/initramfs-kexecboot-image.bb
../sources/meta-openembedded/meta-initramfs/recipes-core/images/meta-initramfs-image.bb
../sources/meta-openembedded/meta-networking/recipes-core/images/meta-networking-image.bb
../sources/meta-openembedded/meta-networking/recipes-core/images/meta-networking-image-base.bb
../sources/meta-openembedded/meta-xfce/recipes-core/images/core-image-minimal-xfce.bb
../sources/meta-openembedded/meta-python/recipes-core/images/meta-python-image-base.bb
../sources/meta-openembedded/meta-python/recipes-core/images/meta-python-ptest-image.bb
../sources/meta-openembedded/meta-python/recipes-core/images/meta-python-image.bb
../sources/meta-openembedded/meta-oe/recipes-core/images/meta-oe-image-base.bb
../sources/meta-openembedded/meta-oe/recipes-core/images/meta-oe-ptest-image.bb
../sources/meta-openembedded/meta-oe/recipes-core/images/meta-oe-image.bb
../sources/meta-openembedded/meta-oe/recipes-graphics/libsdl/libsdl-image_1.2.12.bb
../sources/meta-openembedded/meta-oe/recipes-graphics/libsdl/libsdl2-image_2.0.3.bb
../sources/meta-openembedded/meta-oe/recipes-support/imagemagick/imagemagick_7.0.8.bb
../sources/meta-openembedded/meta-perl/recipes-perl/images/meta-perl-ptest-image.bb
../sources/meta-openembedded/meta-perl/recipes-perl/images/meta-perl-image.bb
../sources/meta-raspberrypi/recipes-core/images/rpi-hwup-image.bb
../sources/meta-raspberrypi/recipes-core/images/rpi-basic-image.bb
../sources/meta-raspberrypi/recipes-core/images/rpi-test-image.bb
../sources/poky/meta-skeleton/recipes-multilib/images/core-image-multilib-example.bb
../sources/poky/meta-selftest/recipes-test/container-image/container-image-testpkg.bb
../sources/poky/meta-selftest/recipes-test/container-image/container-test-image.bb
../sources/poky/meta-selftest/recipes-test/images/wic-image-minimal.bb
../sources/poky/meta-selftest/recipes-test/images/test-empty-image.bb
../sources/poky/meta-selftest/recipes-test/images/error-image.bb
../sources/poky/meta-selftest/recipes-test/images/oe-selftest-image.bb
../sources/poky/meta-selftest/recipes-test/multiconfig/multiconfig-image-packager_0.1.bb
../sources/poky/meta/recipes-extended/images/core-image-kernel-dev.bb
../sources/poky/meta/recipes-extended/images/core-image-testmaster.bb
../sources/poky/meta/recipes-extended/images/core-image-full-cmdline.bb
../sources/poky/meta/recipes-extended/images/core-image-testmaster-initramfs.bb
../sources/poky/meta/recipes-rt/images/core-image-rt.bb
../sources/poky/meta/recipes-rt/images/core-image-rt-sdk.bb
../sources/poky/meta/recipes-core/images/core-image-minimal.bb
../sources/poky/meta/recipes-core/images/core-image-tiny-initramfs.bb
../sources/poky/meta/recipes-core/images/core-image-minimal-dev.bb
../sources/poky/meta/recipes-core/images/build-appliance-image_15.0.0.bb
../sources/poky/meta/recipes-core/images/core-image-minimal-mtdutils.bb
../sources/poky/meta/recipes-core/images/core-image-minimal-initramfs.bb
../sources/poky/meta/recipes-core/images/core-image-base.bb
../sources/poky/meta/recipes-core/ovmf/ovmf-shell-image.bb
../sources/poky/meta/recipes-sato/images/core-image-sato-dev.bb
../sources/poky/meta/recipes-sato/images/core-image-sato-ptest-fast.bb
../sources/poky/meta/recipes-sato/images/core-image-sato-sdk.bb
../sources/poky/meta/recipes-sato/images/core-image-sato-sdk-ptest.bb
../sources/poky/meta/recipes-sato/images/core-image-sato.bb
../sources/poky/meta/recipes-graphics/images/core-image-weston.bb
../sources/poky/meta/recipes-graphics/images/core-image-clutter.bb
../sources/poky/meta/recipes-graphics/images/core-image-x11.bb
../sources/poky/meta/recipes-graphics/xorg-lib/xcb-util-image_0.4.0.bb
../sources/meta-qt5/recipes-qt/qt5/qtimageformats_git.bb

$ cd ../sources/meta-qt5
$ mkdir -p recipes-core/images
$ cd recipes-core/images

$ vi core-image-qt5.bb     // Qt기반으로 Image Recipe 파일 직접구성 (기본은 core-image-base) 
$ cat core-image-qt5.bb 
SUMMARY = "Qt5 image that fully supports the target device hardware."
LICENSE="MIT"

include recipe-core/images/core-image-base.bb

QT_BASE = " \
    qtbase \
    qtbase-dev \
    qtbase-mkspecs \
    qtbase-plugins \
    qtbase-tools \
"
 
QT_PKGS = " \
    qt3d \
    qt3d-dev \
    qt3d-mkspecs \
    qtcharts \
    qtcharts-dev \
    qtcharts-mkspecs \
    qtconnectivity-dev \
    qtconnectivity-mkspecs \
    qtquickcontrols2 \
    qtquickcontrols2-dev \
    qtquickcontrols2-mkspecs \
    qtdeclarative \
    qtdeclarative-dev \
    qtdeclarative-mkspecs \
    qtgraphicaleffects \
    qtgraphicaleffects-dev \
"

IMAGE_INSTALL += " \
    ${QT_BASE} \
    ${QT_PKGS} \
"

export IMAGE_BASENAME = "core-image-qt5"

$ bitbake core-image-qt5

$ devtool build core-image-qt5 source 

$ bitbake -e |grep IMAGE_FSTYPE

$ find .. -name bitbake.conf
../sources/poky/bitbake/lib/bb/tests/runqueue-tests/conf/bitbake.conf
../sources/poky/meta/conf/bitbake.conf

Build는 되지만, Image가 생성이 안되었으며,  간단하게 따라한 것이니, 추후에 시간이 있을 경우, QT Package 와 함께 
그때 세부적 분석한 후 관련 Recipe들을 수정하여 구성하자. 
너무 대충 구성한 것 같음. 


  • 아래는 Image Recipe를 만들때, 너무 좋은 예제인 것 같아, 추후에 참조 
LoRa 작업을 하면서 아래 Recipe를 각각 다 만들었는데,  괜찮게 만든 것 같아 추후에 다시 참조하며, Raspberry Pi3에 넣도록 하자 
Raspberry Pi3 와 LoRa Gateway 검색해보면 관련자료는 많이 나온다. 

LoRa Gateway 와 Packet Forwarder 

더불어 QT에도 추후에 추가도 가능하며, 이 부분은 Background로 돌리수도 있다. 

$ vi ../sources/meta-lora-net/recipes-core/images/core-lora-image.bb
SUMMARY = "Lora Gateway Image dev image"

include recipes-core/images/core-image-base.bb

IMAGE_INSTALL += "lora-gateway lora-pkt-fwd"

export IMAGE_BASENAME = "core-lora-image"

my_postprocess_function() {
   echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}

ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "


$ sample ROOTFS_POSTPROCESS_COMMAND
#
# Copyright (C) 2010 Intel Corporation.
#
require recipes-core/images/poky-image-minimal.bb

SRC_URI = "file://interfaces"

IMAGE_INSTALL += "dropbear mediatomb task-poky-nfs-server"

LICENSE = "MIT"

ROOTFS_POSTPROCESS_COMMAND += "setup_target_image ; "

# Manual workaround for lack of auto eth0 (see bug #875)
setup_target_image() {
       install -m 0644 ${WORKDIR}/interfaces ${IMAGE_ROOTFS}/etc/network/interfaces
}

$ gateway.bb

SUMMARY = "LoRa Gateway project"
SECTION = "libs/network"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=a2bdef95625509f821ba00460e3ae0eb"

SRC_URI = "https://github.com/Lora-net/lora_gateway/archive/v${PV}.tar.gz"

SRC_URI[md5sum] = "5d07f8471e1a67920787e3879afe0cb6"
SRC_URI[sha256sum] = "1a0447d5e8183d08e6dce5f739f6872b9c57824b98f4078830d5ee21b15782c1"

S = "${WORKDIR}/lora_gateway-${PV}"

CFLAGS_append = "-I ${S}/libloragw/inc -I ${S}/libloragw -I ${S}/util_pkt_logger/inc "

do_install() {
 bbplain "--------    Lora Gateway Install -----------------"
 install -d ${D}${bindir}
 install -d ${D}${docdir}
 install -d ${D}${libdir}/libloragw/inc
 install -d ${D}${includedir}/libloragw
 
 install -D -m 0644 ${B}/libloragw/inc/* ${D}${includedir}/libloragw
 
 install -D -m 0644 ${B}/libloragw/inc/* ${D}${libdir}/libloragw/inc
 install -D -m 0644 ${B}/libloragw/libloragw.a ${D}${libdir}/libloragw/libloragw.a
 install -D -m 0644 ${S}/libloragw/library.cfg ${D}${libdir}/libloragw/library.cfg
 
 install ${B}/libloragw/test_* ${D}${bindir}
 install ${B}/util_*/util_* ${D}${bindir}
 install ${S}/*.sh ${D}${bindir}
 
 install -D -m 0644 ${S}/readme.md ${D}${docdir}/libloragw/changelog.md
 install -D -m 0644 ${S}/libloragw/readme.md ${D}${docdir}/libloragw/README.md
 install -D -m 0644 ${S}/util_lbt_test/readme.md ${D}${docdir}/libloragw/util_lbt_test.md
 install -D -m 0644 ${S}/util_pkt_logger/readme.md ${D}${docdir}/libloragw/util_pkt_logger.md
 install -D -m 0644 ${S}/util_spectral_scan/readme.md ${D}${docdir}/libloragw/util_spectral_scan.md
 install -D -m 0644 ${S}/util_spi_stress/readme.md ${D}${docdir}/libloragw/util_spi_stress.md
 install -D -m 0644 ${S}/util_tx_continuous/readme.md ${D}${docdir}/libloragw/util_tx_continuous.md
 install -D -m 0644 ${S}/util_tx_test/readme.md ${D}${docdir}/libloragw/util_tx_test.md
 
 install -D -m 0644 ${S}/util_pkt_logger/global_conf.json ${D}${docdir}/libloragw/global_conf.json
 install -D -m 0644 ${S}/util_pkt_logger/local_conf.json ${D}${docdir}/libloragw/local_conf.json
}

PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"

PACKAGES = "${PN}-dbg ${PN} ${PN}-doc ${PN}-dev ${PN}-staticdev"

# Avoid QA Issue: No GNU_HASH in the elf binary
INSANE_SKIP_${PN} = "ldflags"

FILES_${PN}-dbg = " \
 ${bindir}/.debug \
 ${libdir}/libloragw/.debug \
"
FILES_${PN} = " \
 ${bindir}/* \
 ${docdir}/* \
"
FILES_${PN}-dev = " \
 ${includedir}/libloragw/* \
"
FILES_${PN}-staticdev = " \
 ${libdir}/libloragw/inc/*.h \
 ${libdir}/libloragw/*.a \
 ${libdir}/libloragw/*.cfg \
"
FILES_${PN}-doc = " \
 ${docdir} \
"




$ packet.bb
SUMMARY = "LoRa network packet forwarder project"
SECTION = "libs/network"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=22af7693d7b76ef0fc76161c4be76c45"

SRC_URI = "https://github.com/Lora-net/packet_forwarder/archive/v${PV}.tar.gz"

SRC_URI[md5sum] = "a1f942e0cc7b02d604b11c8cb5f2a029"
SRC_URI[sha256sum] = "e68fadf6f1d2e5e7b601e504d5efb48b0a8f374c2c29c0476ab2fe9db68d33ae"

DEPENDS += "lora-gateway" 

S = "${WORKDIR}/packet_forwarder-${PV}"

CFLAGS_append = "-I ${includedir}/libloragw -I ${S}/lora_pkt_fwd/inc -I ${S}/util_tx_test/inc "

do_configure_prepend() {
 export LGW_PATH="${STAGING_LIBDIR}/libloragw"
}

do_compile_prepend() {
 export LGW_PATH="${STAGING_LIBDIR}/libloragw"
}

do_install() {
        bbplain "--------    Lora Packet Forward Install -----------------"
 install -d ${D}${bindir}
 install -d ${D}${docdir}/lora-pkt-fwd/conf
 
 install ${B}/lora_pkt_fwd/lora_pkt_fwd ${D}${bindir}
 install ${B}/util_*/util_* ${D}${bindir}
 
 install -D -m 0644 ${S}/PROTOCOL.TXT ${D}${docdir}/lora-pkt-fwd/PROTOCOL.TXT
 install -D -m 0644 ${S}/lora_pkt_fwd/readme.md ${D}${docdir}/lora-pkt-fwd/readme.md
 install -D -m 0644 ${S}/lora_pkt_fwd/global_conf.json ${D}${docdir}/lora-pkt-fwd/global_conf.json
 install -D -m 0644 ${S}/lora_pkt_fwd/local_conf.json ${D}${docdir}/lora-pkt-fwd/local_conf.json
 install -D -m 0755 ${S}/lora_pkt_fwd/update_gwid.sh ${D}${docdir}/lora-pkt-fwd
 install -D -m 0644 ${S}/lora_pkt_fwd/cfg/*.json.* ${D}${docdir}/lora-pkt-fwd/conf
 
 rm -f ${D}${bindir}/util_tx_test
 rm -f ${D}${bindir}/.debug/util_tx_test
}

PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"

PACKAGES = "${PN}-dbg ${PN} ${PN}-doc"

# 상위에서 설명한 QA관련에러 
# Avoid QA Issue: No GNU_HASH in the elf binary
INSANE_SKIP_${PN} = "ldflags"

FILES_${PN}-dbg = " \
 ${bindir}/.debug \
"
FILES_${PN} = " \
 ${bindir}/* \
 ${docdir}/* \
"
FILES_${PN}-doc = " \
 ${docdir} \
"

$ packet.bbappend

## files로 만들경우, 기본 FILEPATH에 포함이 되어있으므로, 간단히 관리되며, Package 와 Version 별로 관리시 다음과 같이 관리  
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
#FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
#FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}"
SRC_URI += "file://001_packet_forwarder_lora_pkt_fwd.c.patch"
SRC_URI += "file://002_packet_forwarder_global_conf.json.patch"



ROOTFS_PREPROCESS_COMMAND
ROOTFS_POSTPROCESS_COMMAND
SDK_POSTPROCESS_COMMAND
POPULATE_SDK_POST_TARGET_COMMAND
POPULATE_SDK_POST_HOST_COMMAND
IMAGE_POSTPROCESS_COMMAND
IMAGE_PREPROCESS_COMMAND

ROOTFS_POSTINSTALL_COMMAND
           
  https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#migration-1.6-variable-changes-variable-entry-behavior

Yocto PTEST
  https://wiki.yoctoproject.org/wiki/Ptest
  https://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#testing-packages-with-ptest


Image BB File 예제
  https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-core/images/build-appliance-image_15.0.0.bb

Image BB File 예제와 PATCH
  https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842475/PetaLinux+Yocto+Tips

MD5 Checksum
  https://docs.windriver.com/bundle/Wind_River_Linux_Toolchain_and_Build_System_Users_Guide_8.0_1/page/tan1478821620236.html

  http://variwiki.com/index.php?title=Yocto_Build_Release

댓글 없음 :