请问我如何在UEFI阶段的时候,让扩展管脚PWM5(33) 输出来控制LED灯。

这个我不太清楚。设备树编译操作:
我直接通过反编译方式修改设备树。
操作:1.cp /boot/kernel_tegra234-p3767-0004-p3768-0000-a0-user-custom.dtb ~/tegra234-p3767-0004-p3768-0000-a0.dtb
2.dtc -I dtb -O dts tegra234-p3767-0004-p3768-0000-a0.dtb > aaaa.dts
3.修改aaaa.dts

4.反编译设备树:
dtc -I dts -O dtb -o aaaa.dtb aaaa.dts
5.sudo cp aaaa.dts /boot/kernel_tegra234-p3767-0004-p3768-0000-a0-user-custom.dtb

我的extlinux.conf设置:

ys@tegra-ubuntu:~$ cat /boot/extlinux/extlinux.conf
TIMEOUT 30
DEFAULT JetsonIO

MENU TITLE L4T boot options

LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
FDT /boot/dtb/kernel_tegra234-p3767-0004-p3768-0000-a0.dtb
INITRD /boot/initrd
APPEND quiet pcie_aspm=off quiet pcie_aspm=off quiet pcie_aspm=off ${cbootargs} root=PARTUUID=2f87cd33-5c3e-4aef-836f-b9b8f761175b rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 tegra_firewall=0

When testing a custom kernel, it is recommended that you create a backup of

the original kernel and add a new entry to this file so that the device can

fallback to the original kernel. To do this:



1, Make a backup of the original kernel

sudo cp /boot/Image /boot/Image.backup



2, Copy your custom kernel into /boot/Image



3, Uncomment below menu setting lines for the original kernel



4, Reboot

LABEL backup

MENU LABEL backup kernel

LINUX /boot/Image.backup

FDT /boot/dtb/kernel_tegra234-p3767-0004-p3768-0000-a0.dtb

INITRD /boot/initrd

APPEND quiet pcie_aspm=off quiet pcie_aspm=off quiet pcie_aspm=off ${cbootargs}

LABEL JetsonIO
MENU LABEL Custom Header Config: <HDR40 User Custom [2025-10-29-020911]>
LINUX /boot/Image
FDT /boot/kernel_tegra234-p3767-0004-p3768-0000-a0-user-custom.dtb
INITRD /boot/initrd
APPEND quiet pcie_aspm=off quiet pcie_aspm=off quiet pcie_aspm=off ${cbootargs} root=PARTUUID=2f87cd33-5c3e-4aef-836f-b9b8f761175b rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 tegra_firewall=0
ys@tegra-ubuntu:~$

您好!请问有时间能帮我看看?这是哪里 操作有问题?

Okay, your operation would only take effect for kernel DTB.
Please refer to DTB Support for the workflow of DTB loading.
DTB will be built into UEFI binary during flash(i.e. uefi_jetson_with_dtb).
As a result, please update the DTB under <Linux_for_Tegra>/kernel/dtb/tegra234-p3767-0004-p3768-0000-a0.dtb instead before flash.

非常非常感谢您的帮助。
目前按照您说的方式操作了。我提供下列操作步骤。
操作步骤:

1.进入~/nvidia/35.3/Linux_for_Tegra/source/public/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb
2.修改

ys@ubuntu:~/nvidia/35.3/Linux_for_Tegra/source/public/hardware/nvidia/platform/t23x/p3768/kernel-dts/cvb (master)$ cat tegra234-p3768-0000-a0-pwm-fan.dtsi


/ {

pwm-fan {

compatible = "pwm-fan";

status = "okay";

pwms = <&tegra_pwm5 0 45334>;

#cooling-cells = <2>;

cooling-levels = <128 135 178 200 255 255 255 255 255 255>;

};

};

3.配置编译环境:

export DEVDIR=/home/ys/nvidia/35.3/Linux_for_Tegra

export CROSS_COMPILE_AARCH64_PATH=/home/ys/nvidia/35.3/l4t-gcc

export CROSS_COMPILE_AARCH64=/home/ys/nvidia/35.3/l4t-gcc/bin/aarch64-buildroot-linux-gnu-

export ARCH=arm64

export CROSS_COMPILE=$CROSS_COMPILE_AARCH64

export KERNEL_HEADERS=$DEVDIR/source/public/kernel_out

export INSTALL_MOD_PATH=$DEVDIR/rootfs

export TEGRA_KERNEL_OUT=/home/ys/nvidia/35.3/Linux_for_Tegra/source/public/kernel_out

export LOCALVERSION="-tegra"

cd /home/ys/nvidia/35.3/Linux_for_Tegra/source/public/kernel/kernel-5.10

4.编译

make ARCH=arm64 O=$TEGRA_KERNEL_OUT dtbs

5.进入

~/nvidia/35.3/Linux_for_Tegra/source/public/kernel_out/arch/arm64/boot/dts/nvidia

6.反编译设备树查看配置情况

dtc -I dtb -O dts tegra234-p3767-0004-p3768-0000-a0.dtb > aaaa.dts

7.将tegra234-p3767-0004-p3768-0000-a0.dtb文件拷贝到

/home/ys/nvidia/35.3/Linux_for_Tegra/kernel/dtb

8.将tegra234-p3767-0004-p3768-0000-a0.dtb替换orin nano套件开发板

/boot/kernel_tegra234-p3767-0004-p3768-0000-a0-user-custom.dtb

9.使用刷机指令:

sudo ./flash.sh -k A_cpu-bootloader -c bootloader/t186ref/cfg/flash_t234_qspi.xml jetson-orin-nano-devkit nvme0n1p1

疑问:1.为什么我修改tegra234-p3768-0000-a0-pwm-fan.dtsi ,改成了tegra_pwm5,为什么我反编译查看pwms = <0x2c3 0x00 0xb116>, 0x2c3与默认配置的pwm3 是一样的。
2.UEFI阶段和进入系统后风扇都在运行。

ys@tegra-ubuntu:~$ cat /etc/nv_tegra_release
# R35 (release), REVISION: 3.1, GCID: 32827747, BOARD: t186ref, EABI: aarch64, DATE: Sun Mar 19 15:19:21 UTC 2023
ys@tegra-ubuntu:~$
ys@tegra-ubuntu:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
ys@tegra-ubuntu:~$ cat /boot/extlinux/extlinux.conf
TIMEOUT 30
DEFAULT JetsonIO

MENU TITLE L4T boot options

LABEL primary
      MENU LABEL primary kernel
      LINUX /boot/Image
      FDT /boot/dtb/kernel_tegra234-p3767-0004-p3768-0000-a0.dtb
      INITRD /boot/initrd
      APPEND quiet pcie_aspm=off quiet pcie_aspm=off quiet pcie_aspm=off ${cbootargs} root=PARTUUID=2f87cd33-5c3e-4aef-836f-b9b8f761175b rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 tegra_firewall=0

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
#      sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
#    MENU LABEL backup kernel
#    LINUX /boot/Image.backup
#    FDT /boot/dtb/kernel_tegra234-p3767-0004-p3768-0000-a0.dtb
#    INITRD /boot/initrd
#    APPEND quiet pcie_aspm=off quiet pcie_aspm=off quiet pcie_aspm=off ${cbootargs}

LABEL JetsonIO
        MENU LABEL Custom Header Config: <HDR40 User Custom [2025-10-29-020911]>
        LINUX /boot/Image
        FDT /boot/kernel_tegra234-p3767-0004-p3768-0000-a0-user-custom.dtb
        INITRD /boot/initrd
        APPEND quiet pcie_aspm=off quiet pcie_aspm=off quiet pcie_aspm=off ${cbootargs} root=PARTUUID=2f87cd33-5c3e-4aef-836f-b9b8f761175b rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 tegra_firewall=0
ys@tegra-ubuntu:~$

这是我按照你要求运行的debug信息。

[com COM13] (2025-10-30_173709) COM13 (USB-SERIAL CH340 (COM13)).log (145.1 KB)

Do you confirm that tegra234-p3768-0000-a0-pwm-fan.dtsi has been included in your case?

025-10-30 17:37:22]  ~~~~DeviceDiscoveryNotify: Unable to locate address range for Tegra PWM

From the log your shared, it seems TegraPwmDxe.c can not recognize the pwm3.

Please run the following command on your board and provide extracted_proc.dts again.

$ sudo dtc -I fs -O dts -o extracted_proc.dts /proc/device-tree

感谢您的回复!
请在帮我看看。

extracted_proc.dts.txt (414.1 KB)

而且我确定我修改的是这个文件。

From the device tree you shared, it seems the pwm-fan has been configured to get PWM signal from pwm5.

		tegra_pwm5 = "/pwm@32c0000";

	pwm@32c0000 {
		clock-names = "pwm\0parent\0slow-parent";
		resets = <0x02 0x48>;
		clocks = <0x02 0x6d 0x02 0x66 0x02 0x0e>;
		nvidia,hw-instance-id = <0x04>;
		#pwm-cells = <0x02>;
		compatible = "nvidia,tegra194-pwm";
		status = "okay";
		reg = <0x00 0x32c0000 0x00 0x10000>;
		phandle = <0x2c3>;
		reset-names = "pwm";
	};
	
	pwm-fan {
		cooling-levels = <0x80 0x87 0xb2 0xc8 0xff 0xff 0xff 0xff 0xff 0xff>;
		compatible = "pwm-fan";
		status = "okay";
		pwms = <0x2c3 0x00 0xb116>;
		#cooling-cells = <0x02>;
	};

Do you mean the fan is still working now?

是的,风扇还是在工作。

It should not work as it is not connected from pwm5 from HW..
Could you also get a scope to check where’s the PWM input coming for FAN now?

您好!能在帮我看看吗?这个处理了好长时间了。

Please check the pinmux configuration first.