I apologize if this is the incorrect place to ask this but I am struggling to find where I should post this. I am a long time Linux fanboy, its all I use. For some time I have been putting together OS's on ARM devices but in a terribly junky way. Lets say for example I want Alpine OS on a device. I will look for the devices DTB and a prebuilt OS. I will take the boot sector from the prebuilt, and the DTB, then create an unholy union duct taping the DTB, boot and Alpine FS together to create a working OS. It does work, but I need a provided dtb and prebuilt os so someone has done everything difficult already.
So my question is, how is the first OS built? If you handed me an RPI (or any other device) how does one get a working kernel compiled and built? Or at the very least, how could I stop channeling my inner frnkenstien and stop creating these monsters?