I would like to create a Linux-based OS for a VR headset that I'm developing. From what I understand, the Linux kernel uses the GPL-2 license which allows for commercial use but it also requires you to publish your source code. How is Tesla able to sell a physical product that runs on a Linux OS while also being able to keep their source code private and how can I do the same?
First, the GPLv2 doesn't require you to publish the source code, it requires that you provide a written offer to provide the source code, valid for 3 years.
Then, I am not a lawyer but some will says that publishing source code is not complying with the GPLv2 because it states that this has to be done "on a medium customarily used for software interchange" which, at the time of the GPLv2 was a CD.
Finally, Tesla is distributing their source code, here: https://github.com/teslamotors