Kernel build for librealsense patch fails

Hi,

I am trying to configure, patch and build the kernel to enable certain modules required for librealsense. The patches were obtained from this repository https://github.com/IntelRealSense/librealsense

and .config modifications were done using configurekernel.sh script from this repo https://github.com/jetsonhacks/buildLibrealsense2TX

specifically these were the modules that were enabled in the script (excerpt from configurekernel.sh)

bash scripts/config --file .config \
	--set-str LOCALVERSION $LOCAL_VERSION \
	--enable IIO_BUFFER \
        --module IIO_KFIFO_BUF \
        --module IIO_TRIGGERED_BUFFER \
        --enable IIO_TRIGGER \
        --set-val IIO_CONSUMERS_PER_TRIGGER 2 \
        --module HID_SENSOR_IIO_COMMON \
        --module HID_SENSOR_IIO_TRIGGER \
        --module HID_SENSOR_HUB \
        --module HID_SENSOR_ACCEL_3D \
	--module HID_SENSOR_GYRO_3D

yes "" | make olddefconfig

I extracted the .config file from a freshly flashed TX2 and applied the modifications.

I am cross-compiling the kernel on a host machine running Ubunut 16.04. Kernel version is 4.4.38-tegra and L4T 28.2.1. The kernel build fails with following errors

LD      init/built-in.o
drivers/built-in.o: In function `nvs_remove':
/home/user/tegra-build/kernel/kernel-4.4/drivers/misc/nvs/nvs_iio.c:1804: undefined reference to `devm_iio_kfifo_free'
drivers/built-in.o: In function `nvs_init':
/home/user/tegra-build/kernel/kernel-4.4/drivers/misc/nvs/nvs_iio.c:1846: undefined reference to `devm_iio_kfifo_allocate'
/home/user/tegra-build/kernel/kernel-4.4/Makefile:959: recipe for target 'vmlinux' failed
make[1]: *** [vmlinux] Error 1
make[1]: Leaving directory '/home/user/tegra/kernel'
Makefile:150: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

As you can see the errors are directly related to the modules enabled in .config file. I am new to Linux and Jetson platform. I would really appreciate if someone can explain what might be the issue here?

Thanks

I don’t know what your old configuration was, nor do I know anything about the patches or new configuration edits. Generally speaking though, it seems something in your configuration is requesting a feature which doesn’t exist. An example would be that some modules depend on other modules, and the dependency is missing.

When you directly edit a configuration file the mechanism which guarantees dependencies will also be enabled no longer exists. This is ok for features you know of which have no dependencies (e.g., I directly edit “CONFIG_LOCALVERSION”), but I would tend to suggest not doing that. One reason to not do direct edits is that even if the feature has no dependencies in the release it was originally added to there may be a dependency in the next release you are using it with. You won’t know if you directly edit.

I suggest start with your running and working Jetson’s “/proc/config.gz” (on your running Jetson this is not a real file…it is a reflection in RAM of the kernel’s config…save a copy somewhere for reference). Then add the new dependencies with your favorite config tool instead of by script. I suggest “make nconfig” because of the ability of nconfig to search for symbols and show symbols which are not enabled.

Thanks for your response. The config edits were made through a config utility in /scripts. I thought this way it would take care of the dependencies.

I will look at nconfig to see how to use it. I am new to Linux so there are lot of things that I come across first time.

Thanks for the help, this at least gives me something to investigate.

This centers around compiling directly on the TX2. You might look at this for notes:
[url]https://devtalk.nvidia.com/default/topic/1038175/jetson-tx2/tx2i-wifi-support/post/5274619/#5274619[/url]

Thanks linuxdev. This is a very detailed walkthrough. I am sure I will learn a lot. cheers!

I will be attempting more builds to see how I can get the kernel in a state that it can support both the D435 camera and Auvidea J120 board.

I will post results here as I progress.

Thanks for all the help.