How does Ocaml run on bare-metal?

I don’t quite understand, how do people from MirageOS say that they run pure Ocaml code on bare-metal. As far as I understood by looking at Ocaml sourses on Github, Ocaml uses some C code as a runtime system (stuff in asmrun folder, some other C code in other folders). Is this correct? How is it possible to use Ocaml without this runtime system written in C?

Yes. Running OCaml bare metal means running the OCaml runtime written in C on bare metal. This also means that you need to provide the libc and libm C functions that are used by the runtime system (some of these can simply be stubbed to return ENOSYS though).

So to run OCaml on bare metal you need to first initialize the C runtime system so that you can call the C function caml_startup and then you are in OCaml. You can have a look at rpi-boot-ocaml and in particular this directory to see what it means exactly.