美文网首页
基于yocto 添加自己应用程序

基于yocto 添加自己应用程序

作者: jackniu_ae28 | 来源:发表于2022-07-08 16:37 被阅读0次
  1. 在_linux/develop/poky/meta-poky目录创建recipes-test 目录

2.目录结构如下:

recipes-test/
recipes-test/
└── hello
    ├── hello
    │   ├── hello.c
    │   └── Makefile
    └── hello.bb

3.编写 hello.bb 文件如下

CRIPTION = "Hello World Test"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://hello.c;md5=337c3657fbaf1381ff87f1cfbcd0389e"
PV = "1"
PR = "r0"


SRC_URI = "file://hello.c \
           file://Makefile \
          "

S = "${WORKDIR}"

do_compile () {
    make
}

do_install() {
        install -d ${D}${bindir}/
        install -m 0755 ${S}/hello ${D}${bindir}/
}

FILES_${PN} = "${bindir}/hello"

INSANE_SKIP_${PN} = "ldflags"
#For dev packages only
INSANE_SKIP_${PN}-dev = "ldflags"

4.编写Makefile 文件

hello:hello.o
        $(CC) -o hello hello.o

hello.o: hello.c
        $(CC) -c hello.c

.PHONY : clean
clearn:
        -rm -rf *.o

5.编写 hello.c

#include "stdio.h"
#include "stdlib.h"

int main()
{
        while(1)
        {
                fprintf(stderr, "HelloWorld");
                sleep(1);
        }
        return 0;
}

6.编译 hello

 source poky/oe-init-build-env
bitbake hello

相关文章

网友评论

      本文标题:基于yocto 添加自己应用程序

      本文链接:https://www.haomeiwen.com/subject/vesvbrtx.html