I have a directory of 'binary' (i.e. not to be compiled) files and just want them to be installed onto my target root file system.
I have looked at several articles, none of which seem to work for me.
The desired functionality of this recipe is:
myRecipe/myFiles/ --> myRootFs/dir/to/install
My current attempt is:
SRC_URI += "file://myDir"
do_install() {
install -d ${D}/path/to/dir/on/fs
install -m ${WORKDIR}/myDir ${D}/path/to/dir/on/fs
}
I can't complain about the Yocto documentation overall, it's really good! Just can't find an example of something like this!
Adding new recipes to the build system One way is to simply create a new recipe_version.bb file in a recipe-foo/recipe folder within one of the existing layers used by Yocto.
The default value of ${WORKDIR} is defined in bitbake variables. But you can change it in the recipe. It points toward the directory where bitbake unpacks the package. You can get the value of ${WORKDIR} from the bitbake environment bitbake -e <recipe-name> | grep ^WORKDIR=
FILES_${PN} The base package, this includes everything needed to actually run the application on the target system.
You just have to copy these files into your target rootfs. Do not forget to pakage them if they are not installed in standard locations.
SRC_URI += "file://myDir"
do_install() {
install -d ${D}/path/to/dir/on/fs
cp -r ${WORKDIR}/myDir ${D}/path/to/dir/on/fs
}
FILES_${PN} += "/path/to/dir/on/fs"
Take care that with a simple recursive copy, you will end up having host contamination warnings so you would need to copy with the following parameters:
do_install() {
[...]
cp --preserve=mode,timestamps -R ${S}${anydir}/Data/* ${D}${anyotherdir}/Data
[...]
}
As other recipes in poky do, or just follow the official recommendations to avoid problems with ownership and permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With