Makefile of compiling the driver source code of the onboard camera(OV5693)

Where can I find the complete Makefile to compile the driver source code (OV5693.c) of the onboard camera? Or how can I write it? Unfortunately, I am not familiar with the compilation logic of the whole project.

Where did you find the file? Is it part of the Linux kernel source tree? If it is already in the kernel source tree, then the Kconfig file is the human interface to kernel configuration, and the Kconfig in the same directory is for the files within that directory (Kconfig takes part in setting up the Makefile for you). In that case what you would do is go to the root of the kernel source (where the subdirectories include “Documentation/”, “drivers/”, so on), and configure from there.

Assuming you do have the full kernel source and this module is what you want to build, the gist is that you would need to start with some initial configuration, preferably with a match to the currently running system by using the gunzip decompressed copy of “/proc/config.gz”, then renaming it to “.config”. At that point you could use something like “make nconfig” (you may need to install package “libncurse5-dev”, e.g., “sudo apt-get install libncurses5-dev”) to find the symbol associated with that file (the Kconfig in the same directory as that file would name the symbol) and set it up as a “module” (the “m” key instead of “y” or “n”). After that it is a standard module build and that.

There are several variations, so before I add too much information which you are not interested in, do you have the full source? Do you want to compile natively on the Jetson? Are you cross-compiling on a Linux PC host? If you are cross-compiling have you installed the cross-architecture tools?

Hello,linuxdev.I downloaded the kernel source code in the download area of ​​the official website, which contains the kernel source code of the ubuntu system that I used Jetpack to install on TX1 and the driver codes of the camera supported by TX1 . However, since the storage space of the TX1 development board is only 16G, in order to avoid unnecessary troubles caused by insufficient storage space of the development board, I want to compile the camera source code on the linux pc first, and then transplant it to the TX1 development board. The path to the kernel source package I downloaded '/public_release/kernel_src/kernel/kernel4.4/media/i2c ’ is the directory where OV5693.c is located, as well as some other driver code for the TX1 supported camera. There’s also containing Makefile , but not complete, so I need to compile OV5693.c with the complete Makefile, and also have the Kconfig file you said, but I don’t know how to use it.

The Kconfig system will set up the Makefile for you. I just answered something similar, and although you are working on a different driver than this thread, the idea is the same:

Which itself mentions this TX2 thread (which is the same as TX1 in this case):

Basically you need to start with a configuration which matches your running system, set up CONFIG_LOCALVERSION, then use something like “make nconfig” to find your driver and enable it as a module.

FYI, a running Jetson will have a copy of its current config (other than CONFIG_LOCALVERSION) via a copy and then gunzip of “/proc/config.gz”. Renaming this copy as “.config” and putting it in your kernel source top level directory will allow you to start with this configuration (always save a copy of config.gz somewhere safe…you will want to know the original unmodified config at some future date).

Tip: If you have not done so already, then the command line config tools will want this package added:

sudo apt-get install libncurses5-dev

EDIT: Also forgot to say that if all configuration is complete you can name an individual module for a make target based on its path to the subdirectory where the Kconfig is. You are better off building everything as a sanity test even if you only want one module. Once you are doing it right you might consider just building the one module.