背景:raspi os 的更新比较慢,使用ros不方便,于是想到用ubuntu20.04 server + raspi-config尝试
1. 关于dtparam 这里有比较详细的介绍
docs/0012_dtparam_dtoverlay_DTS动态设备树.md · LowLevelOfLogic/RaspberryPi - Gitee.com
2. 根本问题是缺少dtparm相关的程序
直接 git clone https://github.com/raspberrypi/userland
然后 ./buildme 就可以
然后会在 /opt/vc 下发现install的结果,也能在/opt/vc/bin下看到dtparam
3. 让sudo下dtparam能找到
sudo chmod +w /etc/sudoers
sudo vim /etc/sudoers
修改 secure_path ,增加 /opt/vc/bin
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/opt/vc/bin"
sudo chmod -w /etc/sudoers
4. 然后sudo raspi-config 正常
5. 用命令尝试也ok
sudo dtparam -v i2c_arm=on
DTOVERLAY[debug]: using platform 'bcm2711'
DTOVERLAY[debug]: overlay map loaded
run_cmd: which dtoverlay-pre >/dev/null 2>&1 && dtoverlay-pre
run_cmd: dtc -I fs -O dtb -o '/tmp/.dtoverlays/base.dtb' /proc/device-tree 1>/dev/null 2>&1
DTOVERLAY[debug]: loading file '/tmp/.dtoverlays/base.dtb'
DTOVERLAY[debug]: found override i2c_arm
DTOVERLAY[debug]: override i2c_arm: string target 'status'
DTOVERLAY[debug]: wrote 162 bytes to '/tmp/.dtoverlays/2_dtparam.dtbo'
DTOVERLAY[debug]: wrote 174 bytes to '/sys/kernel/config/device-tree/overlays/2_dtparam/dtbo'
run_cmd: which dtoverlay-post >/dev/null 2>&1 && dtoverlay-post