Re: Best practice for files copied directly into sysroot?
Bryan Evenson
Michael,
toggle quoted message
Show quoted text
-----Original Message-----I just modified one of my recipes yesterday to use bin_package yesterday and found out a few nuances that make it easier to use. Proper setup of the files to copy is key. The manual states " The bin_package class works well when the files extracted into ${S} are already laid out in the way they should be laid out on the target." By default, any files listed as "file://" in SRC_URI are copied to ${WORKDIR}, and if they are a compressed archive (.tar.gz, .zip) they are uncompressed under ${WORKDIR}. If you create a tarball with the files in the locations (and permissions!) that you want on the final image, then the bin_package class will do the rest of the work. However, you need the files in the tarball to be one directory level down so that they are installed on the image properly. Let's assume you have a recipe under meta-mylayer/recipes-mine/my-app/ called my-app_1.0.0.bb. You have an executable called my-app that you want to install in /usr/bin/, a configuration file called my-app.conf that you want to install at /usr/share/my-app/ and documentation called my-app.pdf you want to install at /usr/share/info/. You want all this to be under a directory so that when the tarball gets unpacked under ${WORKDIR} the files and directories you want on the final image are under ${S}. ${S} defaults to ${WORKDIR}/${BP}, which in this case would be ${WORKDIR}/my-app-1.0.0. So if you created the following directory structure: my-app-1.0.0/ usr/ bin/ my-app info/ my-app.pdf my-app/ my-app.conf Again, remember to set the directory and file permissions as you want on the final image. Then create a tarball from the directory you laid out called my-app-1.0.0.tar.gz and place it under meta-mylayer/recipes-mine/my-app/files/. Then create your recipe as: SUMMARY = "summary here" SECTION = "proper section name here" LICENSE = "license name here" LIC_FILES_CHKSUM = "license path and MD5sum here" SRC_URI = "file://${BP}.tar.gz" inherit bin_package The system will then package your files and install them onto the image where they belong. These are the only lines you need in your recipe other than the standard header variables. In the future, if you have a new version then just recreate the tarball with the updated files and rename the tarball to match the new version. Although I am having issues with the license; I haven't figured out where to put it and what to set LIC_FILES_CHKSUM to in the recipe so that bitbake can find the license. If anyone has a good answer for that, let me know. Regards, Bryan Thanks, |
|