How to Add new receipe in Yocto

I am new to Yocto build I am trying to add new source files { .c and .cpp }to yocto build under one layer. The below mentioned code I tried initially. I placed code in different places and tried:: ERROR: bbexample-2.0-r0 do_fetch: Function failed: Fetcher failure for URL: 'file://home/Downloads/CPP/1.cpp'. Unable to fetch URL from any source.

How to invoke local source files ?

SUMMARY = "FIRSTTRY"
PRIORITY = "optional"
LICENSE = "No Licennse"

SRC_URI = "file://home/Downloads/CPP/1.cpp"


S = "${WORKDIR}"
do_compile() {
        ${CC} ${CFLAGS} ${LDFLAGS} -o 1 ${WORKDIR}/1.cpp
}

do_install() {
        install -d ${D} ${binder}
        install -m 0755 1 ${D}${binder}

Thanks,

Upvotes: 0

Views: 208

Answers (1)

LetoThe2nd
LetoThe2nd

Reputation: 1326

SRC_URI is not absolute, but relative to the recipe location. so you basically need this layout:

bbexample
|- bbexample_2.0.bb
|- files
   |- main.cpp

and

SRC_URI = "file://main.cpp"

The files subdirectory is expected by convention. (I renamed the file because "1.cpp" is extremely un-canonical)

Please be also sure to read Single .c File Package (Hello World!) as it is almost exactly the example you are trying to create.

Upvotes: 1

Related Questions