0

I saw a thread here discussing how to compile sources in yocto. I am using its first method as follows:

yocto-layer create Mylayer

I have the helloworld example created. The location of source file helloworld.c is in a subfolder of the location of the .bb file. I am using makefile with this.

My aim is to add 3 folders(1. build, 2. Include and 3. source) in the location where helloworld.c is located. The build directory will contain the make file, the source diectory contains all .c/.cpp files, and the include folder conatins the include files.

When I add everything at the location of helloworld.c it compiles succesfully but When I arrange the sources as I mentioned above it doesn't compile.

How do I arrange these directories in yocto? Will there be changes in the .bb or .bbalyer files?

Graham
  • 7,431
  • 18
  • 59
  • 84
Newbie_SW
  • 51
  • 1
  • 6
  • HI, could You provide recipe - it's will be easier to find what data's are fetched by __SRC_URI__ ? Secondly what do want to really store in this third directory - if this is possible create directory structure. – lukaszgard Feb 19 '18 at 13:23
  • SRC_URI = "file://makefile \ file://appl_menu.cpp \ file://appl_menu.hpp \ file://crc_calc.cpp \ file://crc_calc.h \ .................... All at one place. I would like to have it in 3 separate folders as mentioned above. – Newbie_SW Feb 19 '18 at 13:45
  • I don't understand. You tag as C++, but you describe using C language? BTW, they are two distinct languages. For example, C++ has `std::string` for text, like file and folder names. – Thomas Matthews Feb 19 '18 at 16:11

2 Answers2

1

In my opinion storing source code next to recipes is not a good idea - unless it is some kind of example for learning purposes.

Please see recipes from meta/ layer - also this is good approach to base on recipes from this main layer. You will not find there source code commited with recipes, and in my opinion while You are starting understanding Yocto/Bitbake I recommend You to store source code in dedicated repository and You recipe should point to this repository with using fetcher library - SRC_URI.

lukaszgard
  • 891
  • 8
  • 16
0

add below line in your recipe

FILESEXTRAPATHS_prepend := "${THISDIR}:"
SRC_URI += "file://hello/* "

Also create a directory hello where the .bb present thenafter copy all your data to this hello directory. now your hello dir should be like below
hello
|_build
|_include
|_source

yoctotutor.com
  • 5,145
  • 4
  • 26
  • 36
  • can i use FILESEXTRAPATHS_prepend := "${THISDIR}/patches:" or any other dirs after the ${THISDIR} –  Feb 21 '18 at 04:00
  • yes you can use but make sure that dir you need to create in same dir where the .bb file present – yoctotutor.com Feb 21 '18 at 04:01