How have they coded the first operating system without an operating system?

am really curious about the computer topic in general,and am still wondering

how do they made an operating system. without an operating system in the first place?
how do they compile a compiler. without a first compiler?