include vs require in yocto
Bitbake allows sharing metadata using include files (.inc) and class files(.bbclass)
The include files contains:
1. Definition of Paths
2. Custom tasks used by multiple recipes
Whenever bitbake parses the 'include' directive, it will include the file you specified in that location. It is similar to #include of C. When the path you specified is relative, then Bitbake loads the first file it finds in the BBPATH
'require' is another directive which is similar to 'include', but the major difference is that 'require' will throw an error when it doesn't find that file.
You can see in the above screenshot:
1. I created a simple C Code
2. Used recipetool to create a base recipe for that code
3. Copied that recipe in the meta folder
4. Added 'include test.inc' in the test recipe and bitbake test did not gave any error
5. When adding 'require test.inc' in the test recipe, bitbake fails with error.
The include files contains:
1. Definition of Paths
2. Custom tasks used by multiple recipes
Whenever bitbake parses the 'include' directive, it will include the file you specified in that location. It is similar to #include of C. When the path you specified is relative, then Bitbake loads the first file it finds in the BBPATH
'require' is another directive which is similar to 'include', but the major difference is that 'require' will throw an error when it doesn't find that file.
You can see in the above screenshot:
1. I created a simple C Code
2. Used recipetool to create a base recipe for that code
3. Copied that recipe in the meta folder
4. Added 'include test.inc' in the test recipe and bitbake test did not gave any error
5. When adding 'require test.inc' in the test recipe, bitbake fails with error.
Comments
Post a Comment