If it must not be linux, I would recommend going for something embedded, like FreeRTOS or similar. The advantages:
- Linux + Real Time has become a buzz word, and you will find lots of bad information
- If you want to learn HW, nothing better as embedded, where you interact with the hardware.
- The FreeRTOS is so small you can really understand it pretty fast. You can see how it is made, much easier than Linux.
- The essentials you learn with that, will work with Linux later.