4

How can I add a lot of files to an image with a BitBake recipe?

The pattern that I follow to add files to an image is the following:

SRC_URI += "file://bar"
do_install () {   
    install -m 0775 ${S}/bar/baz/foo.txt ${D}${prefix}/test 
}
FILES_${PN} += "${prefix}"
FILES_${PN} += "${prefix}test"
FILES_${PN} += "${prefix}test/foo.txt"

Which works great for a few files. However, this can be really tedious for large amounts of files. The problem seems to be that I need to specify each file that I want to package. Is there some way to avoid this?

karobar
  • 1,250
  • 8
  • 30
  • 61

1 Answers1

5

If all the files are in a single directory you can just put the directory in FILES and it will recurse for you. So if you had another 100 files in ${prefix}/test then FILES_${PN} = "${prefix}/test" would package them all in $PN.

Florian Berndl
  • 1,136
  • 8
  • 27
Ross Burton
  • 3,516
  • 13
  • 12
  • Thanks! While your method really speeds things up, it runs into errors for directories that are required to be placed in separate packages; for example, I have a `.debug` directory which BitBake requires placed in the `${PN}-dbg` package. I'm still manually packaging all these different directories. Is this a necessary step? – karobar Jan 12 '16 at 18:54
  • 1
    If you set the ordering properly then this isn't a problem: PN-dbg should be before PN in PACKAGES. Then you can do FILES_PN = "/foo/bar" FILES_PN-dbg = "/foo/bar/.debug" – Ross Burton Jan 13 '16 at 20:12