The file “/proc/config.gz” is a gzip compressed pseudo file. This isn’t really on the disk, it is the kernel pretending this is a file and reflecting what its running configuration is. If the kernel changes, so does the config.gz here. If you copy it somewhere else, then use “gunzip config.gz”, and then rename the resulting “config” file to “.config”, then the kernel build can use that as its configuration.
There is an exception, but other than the one exception, the “/proc/config.gz” is an exact match of that running kernel. The exception is that the “CONFIG_LOCALVERSION” of config.gz is not filled in. You need to do that yourself, e.g., through one of the kernel config editors after the file is set up as “.config” in the right place, or directly with a text editor.
The significance of CONFIG_LOCALVERSION is that it helps determine where the kernel searches for modules. If the kernel version is 4.4.38, and if the CONFIG_LOCALVERSION is “-tegra”, then the command “uname -r” will respond “4.4.38-tegra”. Without CONFIG_LOCALVERSION “uname -r” would just respond “4.4.38”. Modules are searched for here:
/lib/modules/$(uname -r)/
If your original kernel is “4.4.38-tegra”, and if your new kernel is also “4.4.38-tegra”, then the new kernel will use the module directory which already exists. If the “uname -r” changes, then you have to create a complete new set of kernel modules at “/lib/modules/$(uname -r)/”.
When you get the kernel source and unpack it somewhere, the top level directory of the source (where you see the “Makefile”, “README”, and “MAINTAINERS” file) is where you place “.config”. Be sure to save a copy somewhere else as well where it is safe…you may want to refer to this again later when running a different kernel.
I can’t help with realsense, someone else need to reply. Generally speaking though, if this is a kernel patch, then it patches some file within the kernel source…one or more subdirectories to where you put the .config file will have files which the patch can modify. Depending on what you are doing, then this eventually reaches the Jetson regardless of where you build the kernel. Patches might modify a module, or they might modify the base kernel Image. If only a module changes, then you only need to install a new module. If only the Image changes, then possibly only the Image file needs replacement when “uname -r” is not modified (but if Image itself changes it could possibly invalidate modules and require you to rebuild those as well…which is when you would purposely change “uname -r” so you can keep both old and new module directories).