Install KODI and addon

sudo apt install kodi kodi-peripheral-joystick kodi-inputstream-rtmp kodi-inputstream-adaptive kodi-visualization-shadertoy kodi-visualization-waveform -y

Set the display memory to 256MB

raspi-config
//Advanced Options->Memory Split

Create a systemd service

vim /lib/systemd/system/kodi.service

[Unit]
Description = Kodi Media Center
After = remote-fs.target network-online.target
Wants = network-online.target

[Service]
User = pi
Group = pi
Type = simple
ExecStart = /usr/bin/kodi
Restart = on-abort
RestartSec = 5

[Install]
WantedBy = multi-user.target

Enable KODI autostart

sudo systemctl enable kodi.service