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

Downloading the source code cleared up the -dirty issue when I was making changes to tc358743.c. Things appear to be compiling now.

My next step is getting a working .dtbo for the dual tc358743 I’m working on (and had working in previous boards and JetPacks - re: Orin Nano and tc358743 capture issue )

In the past I followed posts in the forum and try to emulate where and how imx219-dual files were implemented. For the current JetPack they’re now dtb overlays and that’s a new concept for me. I believe I’ve converted my old file to the correct format but I don’t see my changes in the .dtb

I tried the example from NVIDIA Jetson Device Tree Overlay | Device Tree Overlay | RidgeRun Developer - but do not see “My Jetson Overlay example” when running sudo /opt/nvidia/jetson-io/config-by-hardware.py -l

Are there other steps that need to be taken to complete the example and have the test overlay actually applied ?

Thank you

Please give more detail on this.

Sure.

I look for where imx219-dual is configured and/or included and put my files in the same directory. For our current attempt I see tegra234-p3767-camera-p3768-imx219-dual.dts in source/hardware/nvidia/t23x/nv-public/overlay - so I modified my working tc358743.dtsi to look like the imx219-dual.dts file. The .dts file also includes tegra234-camera-rbpcv2-imx219.dtsi so I make a tc358743 version of that as well.

I see it also listed in hardware/nvidia/t23x/nv-public/overlay/Makefile so I add a line for my tc358743 so it can get a .dtbo generated as well. Thank kind of thing.

But - without even getting the basic example done, I’m not worried about those right now, just trying to understand how all the pieces work.

If I make dtbs on my development machine, can I just copy the .dtbo to /boot/. on my Orin and attempt to load it w/the above procedure?

Thank you.

Did you put the file in the right place? (/boot/)
Please also check our official document in case RidgeRun’s document is not aligned with ours:
https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/HR/ConfiguringTheJetsonExpansionHeaders.html#creating-a-simple-device-tree-overlay

Ideally YES.
Or you can specify your new DTBO files in the board config if you want to re-flash the board.

Everything was in the correct place, but the link you provided reminded me to verify the ‘compatible’ line and that was my issue. I changed it to
compatible = "nvidia,p3509-0000+p3767-0005";
and it appeared when I ran config-by-hardware.py so small success.

I will now see about getting my dtbo appearing in the ‘Jetson 24pin CSI Connector’ menu.

1 Like

Update on compatible variable - the p3509- did work when I manually created the example, but when I updated my tc358743.dts file w/that variable and did make dtbs - it did not appear in config-by-hardware.py. I did some digging and used

compatible = "nvidia,p3768-0000+p3767-0005";

and it’s ready to be applied.

Hello, I received a strange error on my first try at applying the overlay :

/opt/nvidia/jetson-io/config-by-hardware.py -l
<Jetson.board.Board object at 0xffffaae1f8b0>
Header 1 [default]: Jetson 40pin Header
  Available hardware modules:
  1. Adafruit SPH0645LM4H
  2. Adafruit UDA1334A
  3. FE-PI Audio V1 and Z V2
  4. ReSpeaker 4 Mic Array
  5. ReSpeaker 4 Mic Linear Array
Header 2: Jetson 24pin CSI Connector
  Available hardware modules:
  1. Camera IMX219 Dual
  2. Camera IMX219-A
  3. Camera IMX219-A and IMX477-C
  4. Camera IMX219-C
  5. Camera IMX477 Dual
  6. Camera IMX477 Dual 4 lane
  7. Camera IMX477-A
  8. Camera IMX477-A and IMX219-C
  9. Camera IMX477-C
  10. ET tc358743 Dual
Header 3: Jetson M.2 Key E Slot
  Available hardware modules:
  1. User Custom [2024-06-18-234208]

That me at 10. ET tc358743 Dual

root@sthd-6:/boot# sudo /opt/nvidia/jetson-io/config-by-hardware.py -n "ET tc358743 Dual"
<Jetson.board.Board object at 0xffff8d3eb7f0>
Traceback (most recent call last):
  File "/opt/nvidia/jetson-io/config-by-hardware.py", line 127, in <module>
    main()
  File "/opt/nvidia/jetson-io/config-by-hardware.py", line 119, in main
    dtbo = configure_jetson(jetson, header, hw)
  File "/opt/nvidia/jetson-io/config-by-hardware.py", line 55, in configure_jetson
    raise NameError("No configuration found for %s on %s!" \
NameError: No configuration found for ET tc358743 Dual on Jetson 40pin Header!

I used dtc to convert the dtbo to dts - first few lines :

/ {
        overlay-name = "ET tc358743 Dual";
        jetson-header-name = "Jetson 24pin CSI Connector";
        compatible = "nvidia,p3768-0000+p3767-0005";

        fragment-camera@0 {
                target-path = "/";

Why does config-by-hardware.py -l see the correct group but -n only looks in Jetson 40pin Header ?

You need to specify the header number, which is 1 for 40pin, 2 for 24pin CSI.
So it should be:

sudo /opt/nvidia/jetson-io/config-by-hardware.py -n 2=“ET tc358743 Dual”

If no header number is specified then it by default uses 1.

Ok - that makes sense now thatI see an example. I did not understand what the help information was trying to say.

Being impatient, I tried changing the jetson-header-name to ‘Jetson 40pin Header’ and was able to make the tc358743.dtbo.
Q1 - should I change jetson-header-name back to 24pin CSI Connector or does it matter?

However, I discovered that config-by-hardware.py -n doesn’t report errors as this output gave me the impression that everything was correct:

root@sthd-6:/boot# sudo /opt/nvidia/jetson-io/config-by-hardware.py -n "ET tc358743 Dual"
<Jetson.board.Board object at 0xffffa2bcf7f0>
Modified /boot/extlinux/extlinux.conf to add following DTBO entries:
/boot/tegra234-p3767-camera-p3768-tc358743.dtbo
Reboot system to reconfigure.

After the first failed restart, I discovered config-by-hardware.py did not add the line APPEND ${cbootargs} root=PARTUUID=6c05e10b-6c14-4a77-84ec-337c0cdaa5dd rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb video=efifb:off console=tty to the new stanza it added to extlinux.conf

I corrected that but it still wasn’t working. I ultimately had to compile ‘dtmerge’ to track down a typo in the dtbo and could then merge the dtbs correctly. I re-ran config-by-hardware.py with the new dtbo file and rebooted. They new option would boot until kernel crash, then reboot only to hang with this as the final line:

[ 10.034251] sysfs: cannot create duplicate filename '/class/misc/tegra_camera_ctrl'

I have restarted my full build process (from above) and successfully made/compiled each step successfully. However, I have just re-flashed the Orin and my console is hung on this:

  Jetson System firmware version 36.3.0-gcid-36191598 date 2024-05-06T16:58:59+00:
00
ESC   to enter Setup.
F11   to enter Boot Manager Menu.
Enter to continue boot.
......EFI stub: Booting Linux Kernel...
EFI stub: ERROR: Invalid header detected on UEFI supplied FDT, ignoring ...
EFI stub: Generating empty DTB
EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path
EFI stub: Exiting boot services...

So, I need to figure out what happened here before I can move forward.

Thank you for you help

YES, you should.

I don’t get what the current situation is.
What exactly have you done so far?

Current situation is the Orin was having issues with my dtbo file on boot so I wanted to rebuild from scratch with all the knowledge I received from this thread. Everything compiled without errors and I tried to re-flash my Orin and it’s not able to start up and finish the install.

Exactly what I’ve done? How did I know you would ask that ? :)

.../Linux_for_Tegra/source$ grep -i tc358743 kernel/kernel-jammy-src/.config
CONFIG_VIDEO_TC358743=m
# CONFIG_VIDEO_TC358743_CEC is not set

make  -j8 ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE -C kernel
sudo -E make -j8 ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE install -C kernel
cp kernel/kernel-jammy-src/arch/arm64/boot/Image $JETPACK/kernel/Image


make  -j8 ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE modules 
cd ..
sudo ./apply_binaries.sh
cd source/
sudo make ARCH=arm64 INSTALL_MOD_PATH=$KERNEL_MODULES_OUT  -j8 modules_install

make  -j8 ARCH=arm64 CROSS_COMPILE=$CROSS_COMPILE  dtbs
cp nvidia-oot/device-tree/platform/generic-dts/dtbs/*  ../kernel/dtb/


cd ../tools
sudo ./l4t_create_default_user.sh -u user -p password -n name --accept-license --autologin


. orin in ready state - powered off, jumper set, connected to USB, power on:

cd ..
sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device sda1 -c tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/generic/cfg/flash_t234_qspi.xml"   --showlogs --network usb0 jetson-orin-nano-devkit internal

from the console:

  Jetson System firmware version 36.3.0-gcid-36191598 date 2024-05-06T16:58:59+00:
00
ESC   to enter Setup.
F11   to enter Boot Manager Menu.
Enter to continue boot.
......EFI stub: Booting Linux Kernel...
EFI stub: ERROR: Invalid header detected on UEFI supplied FDT, ignoring ...
EFI stub: Generating empty DTB
EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path
EFI stub: Exiting boot services...

Thank you.

OK, so currently there are no custom DTBO things involved?
I don’t see it get applied from your log.

No, there are not DTBO files being used at this point. The file source/nvidia-oot/device-tree/platform/generic-dts/dtbs/tegra234-p3767-camera-p3768-tc358743.dtbo has been created, but the failure here is that the Orin is unable to finish being flashed. I am unable to log in to the Orin and attempt to apply the dtbo

Did you change anything else in the device tree sources?
Will the same error happen if you go with the default DTB?