Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 527
h0ch5tr4355 Avatar asked Nov 25 '15 09:11

h0ch5tr4355


People also ask

What is BitBake file?

BitBake is a make-like build tool with the special focus of distributions and packages for embedded Linux cross compilation, although it is not limited to that. It is inspired by Portage, which is the package management system used by the Gentoo Linux distribution.

What is BB file in yocto?

BitBake Recipes, which are denoted by the file extension . bb , are the most basic metadata files. These recipe files provide BitBake with the following: Descriptive information about the package. The version of the recipe.

What is .BB file in Linux?

Source file written in Blitz, a game-programming language; compiled using a Blitz compiler included with BlitzMax, Blitz3D, or BlitzPlus development software. Blitz3D is used for creating 3D games. BlitzMax is based on BASIC and can create cross-platform games.


1 Answers

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.

like image 69
Anders Avatar answered Oct 24 '22 01:10

Anders