h0ch5tr4355
h0ch5tr4355

Reputation: 2192

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 (e.g. 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.

Upvotes: 7

Views: 9395

Answers (1)

Anders
Anders

Reputation: 9011

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.

Upvotes: 11

Related Questions