How to enable tc358743 on 36.3?

Slight correction on my ‘fix’ - when making modules - it will end up creating a kernel named 5.15.136-tegra-tegra

But - to the topic of this thread, I’m still unable to sort out how to get my tc358743.ko w/the correct kernel name in the new way Nvidia wants to do things.

I’ve figured out that after running

./source_sync.sh -k jetson_36.3

We can build a generic setup, but it’s based on arch/arm64/configs/defconfig and that doesn’t have the CONFIG_VIDEO_TC358743 line in it. So, if you try to make menuconfig, you get what I saw on May 19th - no option to enable the TC358743 (which started all of this).

I know I have a tendency to put several questions in a single post, so I’ll try labeling them to prevent confusion.

Q1 - From the documentation (linked above) - make is run from $JETPACK/source - so that it gets all the oot and other stuff. Is that correct?

In the past (JetPack 4, JetPack 5) I would run all of my make commands from $JETPACK/source/kernel/kernel-jammy-src (for Image, modules, modules_install, and dtb)

Q2 - Where should I be running the make command from $JETPACK/source or in the $JETPACK/source/kernel/kernel-jammy-src directory?

When I am in $JETPACK/source/kernel/kernel-jammy-src - I’ve run
make mrproper - to clean everything out

make tegra_prod_defconfig - to get the default production configuration ready (read from arch/arm64/configs/tegra_prod_defconfig)

This writes the .config to the current directory. I can change CONFIG_LOCALVERSION="-prod" to be -tegra and compile the original files just fine.

To enable the tc358743, I can run :
make ARCH=arm64 menuconfig and navigate to where I set tc358743 to ‘m’ so that it appears in the .config file as :

CONFIG_VIDEO_TC358743=m

Now, I need to use a working tc358743.c file that I’ve built and adapted over three different JetPack releases so I replace the one at drivers/media/i2c/tc358743.c

I should be able to run:
make -j8 ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE modules
and build it.

However, it sets the kernel release in include/config/kernel.release as:
5.15.136-tegra-dirty - and subsequently writes that in to all .ko files created (found by doing strings *ko | grep -i tegra and seeing they all had -dirty in the version.

Researching where the ‘-dirty’ came from, it appears it is b/c I have un-commited files in the kernel repository. But, if I do
git add . ; git commit -m "fix tc358743" and re-try my make command, it sets the kernel.release to '5.15.136-tegra-00001-g9a5d2195b8ad' (which I assume is derived from the git hash.

Q3 - How do I recompile these files with the correct kernel release name so that I can just copy my tc358743.ko file to my working image running on the Orin ?

After running my makes in source/kernel/kernel-jammy-src I tried running the make from source/ (see Q1 above) it errors out with:

make[1]: Entering directory '/home/parallels/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/source'
The Module.symvers file is missing, or does not contain any
symbols exported from the kernel. This could cause the NVIDIA
kernel modules to be built against a configuration that does
not accurately reflect the actual target kernel.
The Module.symvers file check can be disabled by setting the
environment variable IGNORE_MISSING_MODULE_SYMVERS to 1.
make[1]: *** [/home/parallels/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/source/out/nvidia-conftest/nvidia/Makefile:236: module_symvers_sanity_check] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/parallels/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra/source'
make: *** [Makefile:46: conftest] Error 2

To reiterate my questions :

Q1 - From the documentation (linked above) - make is run from $JETPACK/source - so that it gets all the oot and other stuff. Is that correct?

Q2 - Where should I be running the make command from $JETPACK/source or in the $JETPACK/source/kernel/kernel-jammy-src directory?

Q3 - How do I recompile these files with the correct kernel release name so that I can just copy my tc358743.ko file to my working image running on the Orin ?

Thank you for your time.

YES.

Or course the later one.
Please download the source code from our tarball so you are not messed up with those -dirty things. This is out of the scope of what we should support.

I have no idea what you are doing here.

This is not really that complicated.
Why doing so many unnecessary things?
Download the source code tarball, run:

  1. make ARCH=arm64 defconfig
  2. make ARCH=arm64 menuconfig
    Enable the kernel driver you need.
  3. make ARCH=arm64 savedefconfig
    Copy .config from kernel-jammy-src back into kernel-jammy-src/arch/arm64/configs/.

Then follow our document to build all the kernel image, in-tree modules and OOT modules.

I will try this. As mentioned above, I was running
./source_sync.sh -k jetson_36.3
instead of downloading the source code. That would explain -dirty. I’ll try that now.

Thank you.

I am trying something similar, just for enabling USB 2 Canbus device drivers which has been removed for some unknown reason.
The guide is super unclear, you go step by step, and just nothing.
What is <install-path> in export INSTALL_MOD_PATH=<install-path>/Linux_for_Tegra/rootfs/?

@omers
is where JetPack downloads everything in to.

I did the defaults on my install and it is:
~/nvidia/nvidia_sdk/JetPack_6.0_Linux_JETSON_ORIN_NANO_TARGETS/

Linux_forTegra/ is in that directory