Enable 1-wire

I want to use ds18b20 sensor via 1-wire and need to configure CONFIG_W1_SLAVE_THERM CONFIG_W1 but do not know how to configure CONFIG_W1_SLAVE_THERM CONFIG_W1.
please help me. I’m a beginner at Jetson Nano.

I know nothing about the feature, and cannot give a complete answer, but that config is a kernel feature. This means you could build and replace the kernel (not recommended since it isn’t necessary to do that much work), or else to build a kernel module (simple and install is just a file copy).

FYI, the kernel is just a set of features compiled to work together. These are “CONFIG_...” configs. A module is part of the kernel, but it has the ability to be loaded or unloaded from a running kernel. Not all features can be built as a module, and not all features can be built directly into the kernel. The uncompressed kernel (as a whole, not a module) is the file “/boot/Image” (which can be customized), and a module would be any “*.ko” file in “/lib/modules/$(uname -r)/kernel” (the “uname -r” is a result of the running Image).

Note that there is more than one way to install the main kernel, and you will see flash instructions since it is possible to install it to a partition, but often this is not needed.

The official documentation for your release has instructions for cross compiling a kernel and/or modules from an Ubuntu host PC. Alternatively, it is possible to build a kernel and/or modules directly from the Jetsons. To see your current L4T release version look at the command “head -n 1 /etc/nv_tegra_release”. Then cross reference to here (FYI, JetPack/SDKM is the front end to flashing L4T):

Or, if you know the release of JetPack/SDK Manager which was used to flash, then look here to find your release (ends up at the same documentation):

For the sake of argument, pretend your release is R32.7.2 (the most recent release, although this won’t be your release unless you flashed it yourself). On that URL you would find " Jetson Linux Developer Guide". Note that if nothing has changed since a few releases back, then this document might have a label to an earlier release.

Within that document you’ll be interested in the “Kernel Customization” section.

Before you start building a module write down what you see on the Jetson from the command “uname -r”. The result will be the base kernel release version prefix with a custom suffix, e.g., usually the suffix is “-tegra”. Details will be added below, but in the configuration, to match this, the kernel and modules you build will require this for interoperabilty:

  • Use the same kernel source code release.
  • Configure the software you build to match the running kernel (usually most of this is a step to “make tegra_defconfig”, or else to copy the config directly from the Jetson’s file “/proc/config.gz”). The “CONFIG_LOCALVERSION” would need to be set (probably it is “CONFIG_LOCALVERSION=-tegra”).
  • The configuration must be propagated into the source code. If you build the base kernel “Image”, then this is automatic. Even if you don’t want to install an Image when a module will work it is a good idea to build this once as a sanity check.
  • If you build only modules, then propagating the configuration before build would require the step “make modules_prepare”.
  • If the configuration is an exact match to the running system, then you can use a menu-based config editor to enable “CONFIG_W1_SLAVE_THERM” or any other feature. Example to get the menu-based editor is either “make menuconfig” or “make nconfig” (this is my favorite because you can search for symbols, e.g., you could search for “W1_SLAVE_THERM”). If a module is allowed, then the “m” key would enable this, and you’d save the change and exit the config editor, followed by building the parts you are interested in (don’t forget to propagate the config first with either the Image target or modules_prepare target). Similar for any other “CONFIG_...” feature.
  • Each feature you build as a module will produce a file with the suffix “.ko, which is the kernel module for that CONFIG_ feature. These get copied to a subdirectory of what you see from “/lib/modules/$(uname -r)/kernel”. Try this:
cd /lib/modules/$(uname -r)/kernel
sudo apt-get install tree
tree -d

If the docs plus the above leave questions just ask.

1 Like

Have reference to below topic.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.