NXP

基于imx8qm yocto新建recipes

2019-07-12 11:31发布

1)创建 adan-cluster wugn@ubuntu:/fsl-release-bsp/sources$ yocto-layer create adan-cluster Please enter the layer priority you'd like to use for the layer: [default: 6] Would you like to have an example recipe created? (y/n) [default: n] n Would you like to have an example bbappend file created? (y/n) [default: n] n
New layer created in meta-adan-cluster. 2)创建bb文件 vi sources/meta-adan-cluster/recipes-example/example/adan-cluster_0.1.bb DESCRIPTION = "Hello World and Zlib test"
DEPENDS = "zlib"
SECTION = "libs"
LICENSE = "MIT" SRC_URI = "
 file://helloworld.c
 file://Makefile
"
LIC_FILES_CHKSUM = "file://helloworld.c;md5=15fce3e2afe76e621d0bc4efc3433a3c"
S = "${WORKDIR}"
do_compile () {
 make
} do_install () {
install -d ${D}${bindir}/
install -m 0755 ${S}/helloworld ${D}${bindir}/
}
do_deploy () { } FILES_${PN} = "${bindir}/helloworld"
INSANE_SKIP_${PN} = "ldflags"
#For dev packages only
INSANE_SKIP_${PN}-dev = "ldflags" 3)创建源码目录adan-cluster-0.1,源文件helloworld.c, Makefile
Makefile:
TARGET=helloworld #LDFLAGS= -lz
all: $(TARGET) helloYocto: helloworld.o
 $(CC) $(CFLAGS) -o $@ $^ clean:
 rm -f $(OBJS) $(TARGET)
 
helloworld.c:
#include int main(int argc, char **argv)
{
    printf("Hello World! ");     return 0;
} 4) 修改bblayers.conf,增加bitbake编译选项,支持编译brcm-88335_0.1.bb
vi imx8-build-fb/conf/bblayers.conf
+ BBLAYERS += " ${BSPDIR}/sources/adan-helloworld "
5)将新建的层添加到工程中
vi ./fsl-setup-release.sh
META_FSL_BSP_RELEASE="${CWD}/sources/meta-fsl-bsp-release/imx/meta-bsp"
echo "##Freescale Yocto Project Release layer" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += " ${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-bsp "" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += " ${BSPDIR}/sources/meta-fsl-bsp-release/imx/meta-sdk "" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += " ${BSPDIR}/sources/meta-browser "" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-gnome "" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-networking "" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-python "" >> $BUILD_DIR/conf/bblayers.conf
echo "BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-filesystems "" >> $BUILD_DIR/conf/bblayers.conf
+ echo "BBLAYERS += " ${BSPDIR}/sources/adan-cluster "" >> $BUILD_DIR/conf/bblayers.conf 6)编译
DISTRO=fsl-imx-fb MACHINE=imx8qmmek source ./fsl-setup-release.sh -b imx8-build-fb
bitbake -c compile adan-cluster -v -f
bitbake -c install adan-cluster -v -f