To configure Jetson Orin Linux kernel for GPIO device tree, follow these steps:
Download and install the latest version of JetPack SDK from the NVIDIA website.
Set up your development environment by opening a terminal window and navigating to the root directory of your Jetson Orin system.
Clone the Linux kernel source code repository by running the following command:
git clone https://github.com/NVIDIA/linux.git
- Configure the kernel build options by running the following command:
make ARCH=arm64 O=build/jetson_orin_defconfig tegra_defconfig
- Modify the device tree configuration file located at
linux/arch/arm64/boot/dts/tegra194-jetson-xavier-nx-devkit.dts
to add GPIO support. Add the following code snippet inside thegpio@2200000
node:
gpio-keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
button@8 {
label = "gpio-key";
gpios = <&gpio TEGRA194_MAIN_GPIO(O, 1) GPIO_ACTIVE_LOW>;
linux,code = <KEY_POWER>;
};
};
Save and close the device tree configuration file.
Build the Linux kernel by running the following command:
make ARCH=arm64 O=build Image tegra194-jetson-xavier-nx-devkit.dtb modules
- Install the new kernel by copying the generated image and device tree blob to the boot partition of your Jetson Orin system:
sudo cp build/Image /boot/Image
sudo cp build/tegra194-jetson-xavier-nx-devkit.dtb /boot/tegra194-jetson-xavier-nx-devkit.dtb
Reboot your Jetson Orin system and verify that GPIO support has been added by running the
ls /sys/class/gpio
command.You can now use the
echo
command and file system interface to control the GPIOs on your Jetson Orin board.