Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
We have moved to a new forum at http://jevois.usc.edu, please check it out. The forum at jevois.org/qa will not allow new user registrations but is maintained alive for its useful past questions and answers.

Faster Rebuild

0 votes
Hi, Are there plans to modify the make process so that only modified files are rebuilt? Right now when I execute jevoisbase rebuild it rebuilds all modules from scratch.
asked Mar 21, 2017 in Programmer Questions by alsaibie (740 points)

1 Answer

0 votes
 
Best answer

yes, after you have run rebuild-platform.sh and rebuild-host.sh at least once, you can just cd to the proper build directory (hbuild for host, pbuild for platform) and type make (have a look at what is inside rebuild-host.sh and others to get an idea), for example:

cd hbuild

make -j 4

sudo make install

(sudo not needed for platform build)

answered Mar 21, 2017 by JeVois (46,580 points)
selected Mar 21, 2017 by alsaibie
Thanks. Now, is there a faster way to add new or edited modules to the camera, either by dumping new/edited files into the SD Card, or via the USB-Serial Connection? It would be nice to be able to program changes without reflashing the whole sd card.
But of course. Sorry, been so busy with shipping logistics that we are behind on the programmer doc. Just added some info, this is not thoroughly validated yet but the scripts to handle installing new modules on the camera have been in there for a while:

http://jevois.org/doc/ProgrammerSDK.html
Just what I'm looking for. Many thanks. I didn't see this page as I was reading through the docs.
I added it 1 minute ago ;-)
Two questions:
1. I managed to build the sample for host, but how do I register it? Do I just register (echo) the mapping somewhere?
2. Getting an error compiling the sample for platform, it's looking for jevois/Config/Config.H but what exists there is a bash script Config.H.in instead. Any ideas?
yes, this is not documented yet, soming soon.
1. there is a script called postinstall in the directory where the .C source is, it will be run after the package is unpacked, and you can use it to add video mappings. In the sample module, we also provide a local videomapping.cfg for that module only, along with the source, and the default postinstall script adds that one to the main one.
2. You need to rebuild-host and rebuild-platform on jevois before you can build modules, as this will create config.H from config.H.in, stuffing in some configuration values (e.g., jevois version, compiler flags, etc) that are defined in the CMakeLists.txt of jevois.
1. I will try it out on the host sometime later, thanks.
2. The file existed in /usr/local/include/jevois/.. I just copied it over to the jevois's working directory and it compiled just fine. Am I meant to link to the /usr/local/include path instead?

Thanks a lot for your patience and help.
1. Registering the module to run on the host worked just fine. There were some typos in the template videomapping.cfg (extra word at the begginning of the line) and postinstall (videomapping mispelled).

I just had to chmod postinstall and execute it.
I still can't get my own module to work on the platform. It compiled for both host and platform, it ran fine on the host with the proper mapping, I put it in a jvpkg and placed in it under /packages in the SD card. But the camera would not boot up then. The jvpkg is extracted and files are placed under modules/. If I removed the files manually, the camera will then run. I also tried to manually place the module files and edit the videomapping.cfg, I get the same problem where the camera would not boot. Any idea?

Now if I modify one of the existing modules as an interim solution, and then make changes to it. Is it enough to replace the *.so file for it to work?
hum, looks like you are getting very far along with this. I would say maybe a version or format issue with the .so, if a module is declared in videomappings.cfg but fails to load, that would abort jevois-daemon. At this point, I think you should get an FTDI or other USB-to-UART cable or adapter, as you will then be able to turn on verbose boot to the serial port of JeVois and get standard error messages when errors happen. A few pointers though:

1. the package unpacking happens in bin/jevois.sh of repo jevois, it has not been thoroughly tested yet and may have issues

2. if you get an FTDI cable or similar, then edit uEnv.txt in the BOOT partition of your SD to enable console to serial. If you touch a file called 'login' in that BOOT partition, you will drop to a shell. You can then edit /usr/bin/jevois.sh to run jevois-daemon inside gdb, etc

3. replacing the .so of an existing module is unlikely to work, as the class name must match the module .so name, this is so that we can infer the class name from the .so name when loading the .so at runtime without needing some aux file telling us the class name. Is that your case, btw, module class name an exact match of the .C file name and also of the directory where that .C file is? Can you share your modified module somewhere so we can check it out (the whole source tree, like that of samplemodule), maybe we will see something in there to help you.
1 & 2. Sounds like a plan, will test out with an FTDI adapter. Thanks for pointing out the uEnv.txt, that was going to be my next question. This should help a lot.

3. What I meant was that, after adding a module or editing an existing one and rebuilding all jevoisbase correctly, if then I only edit some parameters within "process" method and recompile that file only, is it then only sufficient to replace the specific *.so file, given that the class names already match and were compiled correctly prior to that. I'm not very familiar with the dependency of *.so files on incremental edits within the methods, includes, etc. I'm asking only to avoid having to rebuild everything every time.
yes, 3. is a great idea, just edit some module in jevoisbase, recompile the whole jevoisbase (just 'make' and 'make install' inside pbuild of jevoisbase should be fine), and then copy the modified .so and see whether that works for you. Double-check that the .so was indeed updated (look at the date, size, etc). If you do not make install I believe the recompiled .so will be somewhere deep under pbuild, you can look for it using the find command.
...