如何在yocto中建立你好世界食谱

问题描述 投票:0回答:1
  1. C文件

    int main() {
    printf("Hello, World!\n");
    return 0;
    } 
  1. helloworld.bb
DESCRIPTION = "Recipe created by bitbake-layers"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"


SRC_URI = "file://${BSPDIR}/poky/build-microchip/my_layer/recipes-example/helloworld/helloworld/helloworld.c"

S = "/home/user/my_dir/poky/build-microchip/conf"

do_compile() {
        ${CC} helloworld.c  -o helloworld
}

do_install() {
        install -d ${D}${bindir}
        install -m 0755 helloworld ${D}${bindir}
} 
  1. 运行命令

bitbake helloworld

ERRORdo_compile()块中的错误helloworld.c文件未找到

c cross-compiling yocto bitbake openembedded
1个回答
0
投票

您可以将.c文件放在您的食谱的子文件夹中,例如

sources/your_layer
└── myhello
    ├── files
    │   └── helloworld.c
    └── helloworld.bb

并修改配方

SRC_URI = "file://helloworld.c"
© www.soinside.com 2019 - 2024. All rights reserved.