This is perfect, thanks Bryan. On Fri, Dec 4, 2015 at 8:03 AM, Bryan Evenson <beven...@melinkcorp.com> wrote:
> Michael, > > > -----Original Message----- > > From: Michael Habibi [mailto:mikehab...@gmail.com] > > Sent: Thursday, December 03, 2015 5:54 PM > > To: Bryan Evenson <beven...@melinkcorp.com> > > Cc: yocto@yoctoproject.org > > Subject: Re: [yocto] Best practice for files copied directly into > sysroot? > > > > Bryan, > > > > I looked through the documentation and I'm a bit unclear on how to use > > bin_package, and haven't been able to find a good example. Where do I > > actually place my rootfs files/binaries to get copied to my image rootfs? > > Under ${THISDIR}/${PN} like other recipe artifacts? How does it copy > them to > > ${S}? Or is this something I need to do? > > > > 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, > > Michael > > > > On Tue, Dec 1, 2015 at 2:03 PM, Michael Habibi <mikehab...@gmail.com > > <mailto:mikehab...@gmail.com> > wrote: > > > > > > Thanks Bryan! > > > > On Tue, Dec 1, 2015 at 1:50 PM, Bryan Evenson > > <beven...@melinkcorp.com <mailto:beven...@melinkcorp.com> > wrote: > > > > > > Michael, > > > > > > > -----Original Message----- > > > From: yocto-boun...@yoctoproject.org <mailto:yocto- > > boun...@yoctoproject.org> [mailto:yocto- <mailto:yocto-> > > > boun...@yoctoproject.org > > <mailto:boun...@yoctoproject.org> ] On Behalf Of Michael Habibi > > > Sent: Tuesday, December 01, 2015 10:26 AM > > > To: yocto@yoctoproject.org > > <mailto:yocto@yoctoproject.org> > > > Subject: [yocto] Best practice for files copied directly > into > > sysroot? > > > > > > I am working on potentially migrating our distribution to > > Yocto (will be a long, > > > long process). We have an area of our filesystem where > > any file placed will go > > > directly into the rootfs of the target. This works well > with > > our product, as we > > > have certain binaries and scripts that need to be copied > > directly, and there's > > > no other real step involved (no compilation, etc). Is > there a > > best practice or > > > existing class that handles this? I saw mention of a > binary/ > > directory but I > > > wasn't sure if that was for this or something else. > > > > > > Thanks, > > > Michael > > > > > > I'm glad I decided to answer your question because I think > I > > found an easier way to do it than I have been doing this in the past. > If you > > want to be able to update the files on your system at a later date, you > will > > want to make your own recipe which installs the binaries and scripts > onto the > > rootfs. In general you create a recipe which does not have do_configure > or > > do_compile tasks. There is a class that does this already called > "bin_package" > > that does this for you. See the "Packaging Externally Produced Binaries" > > section of the manual here: http://www.yoctoproject.org/docs/2.0/mega- > > manual/mega-manual.html#new-recipe-testing-examples. So if you include > > the line "inherit bin_package" and follow the instructions in that > section of > > the manual, it should install all the files to the rootfs that are > included in the > > recipe. > > > > Regards, > > Bryan > > > > > > > > > >
-- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto