The second most-asked question after How to Install Latest Kodi 17.1 Krypton on Raspberry Pi is “How to make Kodi Autostart when i boot my Raspberry Pi?”.
Most people have a dedicated Raspberry Pi sitting behind a TV to act as a media center, and so they don’t want the hassle of having to connect via SSH or wireless keyboard to start Kodi whenever the Raspberry Pi is rebooted for any reason.
There are a lot of answers and solutions to this question, while some solutions work, they are neither easy nor straight-forward and most probably you will have to try a lot of solutions to find one that’s working for you.
But now i found how to make this happen with only ONE command, this is possible because basically Raspbian is running LXDE window manger, and thanks to ArchWiki i found out how to autostart an application in a safe and easy way.
All you have to do is to login to your Raspberry Pi, open a terminal, and paste the below line:
echo "@kodi" >> ~/.config/lxsession/LXDE-pi/autostart
Basically we are instructing LXDE to run Kodi after launching the window manager, that’s it, as simple as that.
If you want to know more or make Kodi autostart for any and all users, you can read more at ArchWiki’s page about LXDE