Creating new DTS file

It creates the “.dtb” binary format after using the different “.dts” and “.dtsi” files in combination. If the dtb file is missing, then perhaps configuration was not valid before starting. If the dtb file is present, but you want a dts, then you’ll have to reverse compile the dtb file.

I want a new dtb file, based on the ‘top level’ one that nVidia refers to in the documentation tegra194-p2888-0001-p2822-0000.dtb

This file is located here - along with every other ‘stock’ dtb for the family it looks like:

/nvidia/nvidia_sdk/JetPack_4.2_Linux_P2888/Linux_for_Tegra/kernel/dtb

The reverse compile of that is 14000 lines - that’s not really something anyone wants to manually edit, which I assume is why they nested everything with includes - makes plenty of sense.

The ‘top level’ DTS file according to the notes in the code at least is, tegra194-p2888-0001-p2822-0000.dts:

/*
 * Top level DTS file for CVM:P2888-0001 and CVB:P2822-0000.
 *
 * Copyright (c) 2017-2019, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */
#include "common/tegra194-p2888-0001-p2822-0000-common.dtsi"
#include "common/tegra194-p2822-camera-modules.dtsi"
#include "t19x-common-modules/tegra194-camera-plugin-manager.dtsi"

This file is located here which seems to be again, the place where the stock DTS top level files live

nvidia/nvidia_sdk/JetPack_4.2_Linux_P2888/Linux_for_Tegra/sources/hardware/nvidia/platform/t19x/galen/kernel-dts

This is where I put the new modified ‘top level’ DTS file that i changed the first line to include the new common.dtsi file for our platform…

/*
 * Top level DTS file for uSWAP VAL9K.
 *
 * Copyright (c) 2017-2019, NVIDIA CORPORATION.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 */
#include "common/tegra194-p2888-0001-uswap_val9k-0000-common.dtsi"
#include "common/tegra194-p2822-camera-modules.dtsi"
#include "t19x-common-modules/tegra194-camera-plugin-manager.dtsi"

I will try the make dtbs commands again and see what happens.

I literally traced files using the include statements, made copies and renamed references…

In the same location as the ‘top level DTS’ files is a Makefile, which i even added an entry to just changing the output name:

old-dtb := $(dtb-y)
dtb-y :=
makefile-path := platform/t19x/galen/kernel-dts

dtb-$(CONFIG_ARCH_TEGRA_19x_SOC) += tegra194-p2888-0001-uswap_val9k-0000.dtb
dtb-$(CONFIG_ARCH_TEGRA_19x_SOC) += tegra194-p2888-0001-p2822-0000.dtb
dtb-$(CONFIG_ARCH_TEGRA_19x_SOC) += tegra194-p2888-0001-p2822-0000-imx274-hdmi.dtb
dtb-$(CONFIG_ARCH_TEGRA_19x_SOC) += tegra194-p2888-0001-p2822-0000-imx185_v1.dtb
dtb-$(CONFIG_ARCH_TEGRA_19x_SOC) += tegra194-p2888-0001-p2822-0000-maxn.dtb
dtb-$(CONFIG_ARCH_TEGRA_19x_SOC) += tegra194-p2888-0001-e3366-1199.dtb

ifneq ($(dtb-y),)
dtb-y := $(addprefix $(makefile-path)/,$(dtb-y))
endif

dtb-y += $(old-dtb)

I am running this from /sources/kernel, I have done a source_sync…

make: *** No rule to make target 'dtbs'.  Stop.

If I try from the makefile-path where all of the DTS files are:

makefile-path := platform/t19x/galen/kernel-dts

Same error

make: *** No rule to make target 'dtbs'.  Stop.

You need to be in “sources/kernel/kernel-4.9/” not “sources/kernel/”. Also you need the source configured to match your system prior to starting.

Can you explain what you mean by the source has to be configured to match your system?

Kernel source is just a huge database of source code. Not all of it gets used on every system, e.g., you wouldn’t want to build x86_64-only drivers or BIOS support drivers on an arm64 system without a BIOS. You also wouldn’t care about firmware or device tree for some WiFi hardware you don’t have. Some features have dependencies on other features. When loose source code is configured to match your system it means the options chosen in the source code is the same as chosen for the kernel you run. The file “/proc/config.gz”, once it has CONFIG_LOCALVERSION set, is an exact match.

Device trees are not actually kernel source. The reason they arrive with kernel source is because bits and pieces apply depending on which drivers are built. That same configuration to tell source which drivers to build also chooses which bits and pieces of device tree are included in the dtbs build target. Building the wrong pieces together is essentially like randomly picking code blocks for all kinds of unrelated projects. Some of those projects may even be mutually exclusive and having both together an error.

If your system has a “uname -r” of “4.4.38-tegra”, then the base kernel version is “4.4.38”, and the CONFIG_LOCALVERSION is “-tegra”. This defines where modules are searched for. So for this example the “.config” you get from saving a copy of “/proc/config.gz” and changing the name to “.config” (be sure to save a pristine copy of the original, don’t ever lose that) would result in:

CONFIG_LOCALVERSION="-tegra"

If you have this in place at the output location of the build (the “O=/some/where/for/output”…“/some/where/for/output/.config”), and then build the kernel, that configuration will alter what is built. You don’t need to build the kernel, but as a sanity check you should build the whole kernel once. If you were to only build modules, then skipping kernel build would still require “make modules_prepare” to propagate the “.config”. Building the kernel automatically does that prepare so you don’t need to “make modules_prepare” if you’ve built the kernel itself. Once that configuration is added to the kernel your “make dtbs” will be applied correctly to just the features which are related to this configuration.

If you still get an error with the correct configuration, then there is a bug which can be worked on. Prior to configuration any build error might be completely unrelated to your hardware.

Hi, dan

Pls keep the directory structure unchanged under the sources. tegra_nano_defconfig should be replace by your config from xavier(/proc/config.gz).

#!/bin/bash
 set x
 make mrproper
 CONFIG_LOCALVERSION="-tegra"
 export KERNEL_DIR=/home/alan/nvidia/source/nano/sources/kernel/kernel-4.9
 export LC_ALL=C
 export ARCH=arm64 
 export TOOLCHAIN_ROOT=gcc-linaro-6.4.1-2017.08-x86_64_aarch64-linux-gnu
 export PATH=/home/alan/toolchain/$TOOLCHAIN_ROOT/bin:$PATH
 export CROSS_COMPILE=/home/alan/toolchain/$TOOLCHAIN_ROOT/bin/aarch64-linux-gnu-
 export CROSS32CC=/opt/linaro/bin/arm-linux-gnueabihf-gcc
 export TEGRA_KERNEL_OUT=/home/alan/nvidia/source/nano/sources/output
 make ARCH=arm64 O=$TEGRA_KERNEL_OUT -C $KERNEL_DIR tegra_nano_defconfig modules_prepare Image dtbs -j8

thanks guys, will try this tomorrow and report any issues.

As a sanity check on my new Linux laptop (instead of VM) I just downloaded the sources manually, extracted, and was able to build the nvidia kernel and modules from the CLI.

I’ll copy over my modified dts/dtsi/cfg files and try to rebuild again

After pulling in all the modified files, and changing the p2972-0000.conf file (the sym link for jetson-xavier, looks like this is what gets built by the recipe) i finally saw the build TRY to make the new DTB for me

I got this error:

make[2]: *** No rule to make target
 'arch/arm64/boot/dts/../../../../../../hardware/nvidia/platform/t19x/galen/kernel-dts/tegra194-
p2888-0001-uswap_val9k-0000.dts', needed by 'arch/arm64/boot/dts/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/_ddot_/hardware/nvidia/platform/t19x/galen/k
ernel-dts/tegra194-p2888-0001-uswap_val9k-0000.dtb'.  Stop.

Any ideas here?

From your compile location, do you see the requested directory:

cd arch/arm64/boot/dts/../../../../../../hardware/nvidia/platform/t19x/galen/kernel-dts/

From there do you see “ls tegra194-p2888-0001-uswap_val9k-0000.dts”? I don’t see this file. I can even

sudo updatedb
locate tegra194-p2888-0001-uswap_val9k-0000

…and do not see this on my system. I have a lot of L4T versions on my system.

What was your exact make command? I’m not sure if some obscure configuration change turned that into a dependency, but maybe.

I thought I had that in there, but perhaps it is named incorrectly.

It is for our custom carrier, that is the whole reason for all of the questions.

I will check on Monday - i’ll also post the series of commands I used to kick-off the make, but it was the same set as what build the nvidia source successfully.

If that file is found, then likely it will work. The command is only needed if there is still a failure after the file is found. Looks like you are getting close!

So adding that missing file in allowed the whole build process to run

Now to see if it pulled all the files in…

Success on the compilation!

Pulled in all the source files I modified and made a shiny new .dtb file in the same spot as the normal distro .dtb files…

Good lord what a PITA.