Search code examples
google-coralmendel-os

Building Mendel-Linux with code-changes in camera driver


I want to build Mendel Linux for the Coral Dev Board to use some changes I have made to the camera driver (ov5645_mipi_v2.c).
The problem is:
After reflashing the board, my code changes did not make it to the newly flashed board at all.

What I did:
I experimented with some changes on the camera driver (ov5645_mipi_v2.c) to introduce a new camera mode working with a higher frame rate (based on a bunch of register settings I found elsewhere, e.g. raspiraw). I followed the build instructions for the Mendel Linux distribution as stated here https://coral.googlesource.com/docs/+/refs/heads/master/GettingStarted.md and just copied my code changes into the checked out sources. I continued with the build instructions and used the m docker-dist option for the build. The build definitively did compile my changed file, as I first made a syntax mistake which lead to an aboard of the build. After the succesful build, I got the flashcard image (flashcard_arm64.img) and flashed the board. Board got reflashed and started up blank and with a new name. Although, issuing the command v4l2-ctl --list-formats-ext did not give me the results I put into the code (I changed the ov5645_mode_info within that file which should be the base for the reported available frame sizes).

I already tried the following approaches:

  • running m clean and completely prune all docker images and build again
  • first build with the 'all' option and then use the 'flashcard' option to build a flashcard

I think I just missed a basic step for making the build using my code changes at all, e.g. increasing some version number? or setting up a Git branch? or alike...


Solution

  • Found the solution myself:

    I used the build option m docker-linux-imx which was already mentioned somewhere else to build a new kernel. For me, this option threw some dependency errors from within the docker image, but I was able to fix them by adding the dependencies to the 'Dockerfile' in the 'build' directory.
    I used the following line in the 'Dockerfile':
    apt-get install -y sudo make kmod libssl-dev bc git && \
    instead of
    apt-get install -y sudo make && \.
    The kernel got built and I copied the resulting '.deb' file to the Coral board.
    scp linux-image-4.14.98-imx_12-4_arm64.deb mendel@BYBOARDSNAME:.
    And installed in on the board with
    sudo dpkg -i linux-image-4.14.98-imx_12-4_arm64.deb
    The changes I made to the driver are now correctly represented when calling
    sudo v4l2-ctl --list-formats-ext

    Hope it will save someone else some time...