Buildroot sysfs cpufreq 和 thermal 文件夹

Buildroot sysfs cpufreq and thermal folder

您好,我正在尝试使用 sysfs 界面访问运行 Buildroot 的橙色 pi 零板的频率和热统计信息。我在 linux-menuconfig 中启用了 freq scaling 和 Thermal sysfs 驱动程序,但我根本没有看到文件夹 cpufreq 被创建并且 thermal 文件夹是空的。

他们的路径应该是

/sys/devices/system/cpu/cpu0/cpufreq
/sys/class/thermal/

我不确定是否需要在初始化脚本中做任何事情来创建这些文件。我还查看了 armbian(在 orange pi 零上运行一个版本作为参考),我可以看到正确创建的文件夹和文件。我认为 armbian 在后台下载 cpufrequtils 来获取频率统计信息。

我认为 busy box 的 powertop 是一个选项,但我仍然想使用 sysfs 接口,powertop 不会给我热量统计数据。任何帮助将不胜感激

编辑:刚刚尝试使用 root 权限的 powertop,但失败并出现错误

 no stats available; run as root or enable the timer_stats module
 C-state information is not available

以下是从 linux-menuconfig 启用的选项

此问题与Buildroot无关。 Buildroot 在启动时在 /sys 中安装 sysfs 文件系统。 sysfs 文件系统的内容仅取决于 Linux 内核及其配置。如果 sysfs 中没有 thermalcpufreq,那是因为您的内核配置 and/or 平台不支持这些功能。

查看源代码后,我发现橙色 pi 零板的设备树在 Buildroot 中不是最新的。 Armbian 设备树在设备树中添加了 thermal_zones 和频率缩放。我想我会尝试更新设备树并检查它是否有效。

因此,一旦您更新了设备树,即使驱动程序也已过时。奇怪的是,Buildroot 的内核版本是 4.15,而 Armbian 是 4.14。更新驱动后一切正常。