We can use DT overlays to enable/disable or change the configuration of peripherals without recompiling the kernel source code.
Android Version | DT overlays folder | DT overlays list variable | DT overlays config file | |
---|---|---|---|---|
Edge2 | 14 | /vendor/custom/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlays | fdt_overlays | /vendor/custom/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env |
VIM4 | 11,14 | /mnt/vendor/odm_ext/custom/overlays/kvim4.dtb.overlays | fdt_overlays | /mnt/vendor/odm_ext/custom/overlays/kvim4.dtb.overlays/kvim4.dtb.overlay.env |
DT-overlays dtbo
directory: /vendor/custom/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlays
khadas@Khadas:~$ ls vendor/custom/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlays
edge2-io-spi.dtbo
DT-overlays configuration file: /mnt/vendor/odm_ext/custom/overlays/kvim4.dtb.overlays/kvim4.dtb.overlay.env
Enable:
$ echo fdt_overlays=edge2-io-spi > /vendor/custom/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env
$ cat rk3588s-khadas-edge2.dtb.overlay.env
fdt_overlays=edge2-io-spi
Disable:
$ echo fdt_overlays= > /vendor/custom/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env
$ cat rk3588s-khadas-edge2.dtb.overlay.env
fdt_overlays=
DT-overlays dtbo
directory: /mnt/vendor/odm_ext/custom/overlays/kvim4.dtb.overlays
.
khadas@Khadas:~$ ls -1 /mnt/vendor/odm_ext/custom/overlays/kvim4.dtb.overlays
i2s.dtbo
pwm_f.dtbo
spdifout.dtbo
uart_e.dtbo
DT-overlays configuration file: /mnt/vendor/odm_ext/custom/overlays/kvim4.dtb.overlay.env
Enable:
$ echo fdt_overlays=i2s > /mnt/vendor/odm_ext/custom/overlays/kvim4.dtb.overlay.env
$ cat kvim4.dtb.overlay.env
fdt_overlays=i2s
Disable:
$ echo fdt_overlays= > /mnt/vendor/odm_ext/custom/overlays/kvim4.dtb.overlay.env
$ cat kvim4.dtb.overlay.env
fdt_overlays=
You need to edit the DT overlays configuration file and add custom DT overlays dtbo files to a special folder.
There are some preparation steps for DT overlays dtbo files, you can also add custom DT overlays.
Basic DT overlay source example:
/dts-v1/; /plugin/; / { fragment@0 { target = <&i2c3>; __overlay__ { status = "disabled"; }; }; };
dtc -I dts -O dtb -o example.dtbo example.dts
Need reboot board to take effect.