Original question didn't specify which OS, most answers assume a cut-down Linux distribution.
My first response would be a question - what do you need it to do? And then how much are you prepared to do yourself?
If you don't need multi-tasking, standard packages, etc. you could build something very simple on some of the bare metal examples. I have made my own simple modular OS from scratch with writable FAT file system, keyboard, serial comms and command shell in around 200k but that's taken 2 years on and (mostly) off
Others have similar hobby OS's.
Otherwise you may find the right set of functionality in one of the distros mentioned above, or create your own. I'm not sure how much effort that would be relative to a bare metal approach, again depends on what you need.