简体   繁体   中英

How can I add a folder or file to the root in a recipe with bitbake?

I am trying to put a folder into the root of the filesystem. In the documentation (eg here ) they use mostly variables and so the files and folders from SRC_URI result in being stored under /usr/bin or something but never in / .

So here is my recipe:

DESCRIPTION = "Example for adding files and folders to rootfs"

SRC_URI += "file://example_folder"
SRC_URI += "file://example_file"

LICENSE = [...]

do_install() {
    install -d ${D}/rootfolder
    cp -r ${WORKDIR}/example_folder ${D]/rootfolder/
    install -m 0755 ${WORKDIR}/example_file ${D}/rootfolder
}

This is just one of very many do_install variants that I tried.Every of them resulted in either Error: example not found in the base feeds [...] or that the files and folders haven't been placed in the root but in /usr/bin as explained above.

In the cases were you get the error "Error: example not found in the base feeds [...]" it's quite likely that you actually have succeeded in building your recipe example.bb. Assuming of course, that you get that error when building your image, which has IMAGE_INSTALL += "example" in it.

If you install your files into /rootfolder , there's nothing in OE itself that knows how to package those files into an rpm , ipk , or deb package. You need to add that yourself to your recipe by adding a line like:
FILES_${PN} += "/rootfolder"

Doing that, your example above should work.

Depending on what files you install, you might want to add some of them to other packages like ${PN}-dbg , ${PN}-dev , etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM