We can use DT overlays to enable/disable or change configuration for peripherals without recompiling the DT kernel source code.
Kernel Version | DT overlays folder | DT overlays list variable | DT overlays config file | |
---|---|---|---|---|
VIM1 | 4.9/mainline | /boot/dtb/overlays/kvim | overlays | /boot/env.txt |
VIM2 | 4.9/mainline | /boot/dtb/overlays/kvim2 | ||
VIM3 | 4.9/mainline | /boot/dtb/overlays/kvim3 | ||
5.15 | /boot/dtb/amlogic/kvim3.dtb.overlays | fdt_overlays | /boot/dtb/amlogic/kvim3l.dtb.overlay.env | |
VIM3L | 4.9/mainline | /boot/dtb/overlays/kvim3l | overlays | /boot/env.txt |
5.15 | /boot/dtb/amlogic/kvim3l.dtb.overlays | fdt_overlays | /boot/dtb/amlogic/kvim3l.dtb.overlay.env | |
VIM1S | 5.4/5.15 | /boot/dtb/amlogic/kvim1s.dtb.overlays | /boot/dtb/amlogic/kvim1s.dtb.overlay.env | |
VIM4 | 5.4/5.15 | /boot/dtb/amlogic/kvim4.dtb.overlays | /boot/dtb/amlogic/kvim4.dtb.overlay.env | |
Edge2 | 5.10 | /boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlays | /boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env | |
Edge1 | 4.4 | /boot/dtb/rockchip/overlays/captain | overlays | /boot/env.txt |
/boot/dtb/rockchip/overlays/edgev |
DT-overlays dtbo
directory: /boot/dtb/overlays/BOARD
BOARD should be kvim1
, kvim2
, kvim3
, kvim3l
or edgev
.
Next example for VIM3 device, which can be different for other device, but the structure is the same.
khadas@Khadas:~$ ls -1 /boot/dtb/overlays/kvim3/
disable-ts050.dtbo
i2c3.dtbo
m2x-eth.dtbo
onewire.dtbo
os08a10.dtbo
pwm_f.dtbo
spi1.dtbo
uart3.dtbo
DT-overlays configuration file:
# Device Tree Overlays # uart3 -- Enable UART3 (uart_C, GPIO Header PIN15 & PIN16) # pwm_f -- Enable PWM_F (GPIO Header PIN35) # i2c3 -- Enable i2c3 (GPIO Header PIN22 & PIN23) # spi1 -- Enable SPI1 (GPIO Header PIN15 & PIN16 & PIN35 & PIN37), pwm_f need to be removed # os08a10 -- Enable OS08A10 Camera # onewire -- Enable onewire bus (PIO Header PIN15) # disable-ts050 -- Disable TS050 LCD # m2x-eth -- Enable M2X 100M ethernet. Note: 1G ethernet will be disabled. # otg-device -- Enable USB OTG Device overlays=uart3 pwm_f i2c3 os08a10
overlays
list variable value: uart3 pwm_f i2c3 os08a10
pwm_f
you can remove pwm_f
from overlays
list variableonewire
, you can add onewire
to overlays
list variable
DT-overlays dtbo
directory: /boot/dtb/amlogic/kvim3.dtb.overlays
.
khadas@Khadas:~$ ls -1 /boot/dtb/amlogic/kvim3.dtb.overlays/
uart3.dtbo
pwm_f.dtbo
i2c3.dtbo
spi1.dtbo
os08a10.dtbo
onewire.dtbo
disable-ts050.dtbo
m2x-eth.dtbo
otg-device.dtbo
DT-overlays configuration file: /boot/dtb/amlogic/kvim3.dtb.overlay.env
.
DT-overlays dtbo
directory: /boot/dtb/amlogic/kvim3l.dtb.overlays
.
khadas@Khadas:~$ ls -1 /boot/dtb/amlogic/kvim3.dtb.overlays/
uart3.dtbo
pwm_f.dtbo
i2c3.dtbo
spi1.dtbo
os08a10.dtbo
onewire.dtbo
disable-ts050.dtbo
m2x-eth.dtbo
otg-device.dtbo
DT-overlays configuration file: /boot/dtb/amlogic/kvim3l.dtb.overlay.env
.
DT-overlays dtbo
directory: /boot/dtb/amlogic/kvim4.dtb.overlays
.
khadas@Khadas:~$ ls -1 /boot/dtb/amlogic/kvim4.dtb.overlays/
ext_board.dtbo
i2cm_a.dtbo
i2cm_f.dtbo
pwm_f.dtbo
uart_e.dtbo
DT-overlays configuration file: /boot/dtb/amlogic/kvim4.dtb.overlay.env
.
DT-overlays dtbo
directory: /boot/dtb/amlogic/kvim1s.dtb.overlays
khadas@Khadas:~$ ls -1 /boot/dtb/amlogic/kvim1s.dtb.overlays/
i2cm_b.dtbo
i2cm_e.dtbo
pwm_f.dtbo
uart_c.dtbo
DT-overlays configuration file is /boot/dtb/amlogic/kvim1s.dtb.overlay.env
.
DT-overlays dtbo
directory: /boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlays
khadas@Khadas:~$ ls /boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlays
mipi-panel.dtbo
DT-overlays configuration file: /boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env
You need to edit the DT overlays configuration file and add custom DT overlays dtbo
files to special folder.
There are some preparations 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 = "okay"; }; }; };
dtc -I dts -O dtb -o example.dtbo example.dts
/boot/dtb/amlogic/kvim3.dtb.overlays
/boot/dtb/amlogic/kvim3l.dtb.overlays
/boot/dtb/amlogic/kvim4.dtb.overlays
/boot/dtb/amlogic/kvim1s.dtb.overlays
/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlays
/boot/dtb/overlays/**BOARD**
BOARD should be kvim1
, kvim2
, kvim3
, kvim3l
or edgev
.
Edit list variable value inside DT overlay configuration file:
/boot/env.txt
/boot/dtb/amlogic/kvim3.dtb.overlay.env
/boot/dtb/amlogic/kvim3l.dtb.overlay.env
/boot/dtb/amlogic/kvim4.dtb.overlay.env
/boot/dtb/amlogic/kvim4.dtb.overlay.env
/boot/dtb/rockchip/rk3588s-khadas-edge2.dtb.overlay.env
Need reboot board to take effect.