The kernel is written in mainly JHC Haskell, with fallbacks to C where necessary (biggest one being the garbage collector and rts). JHC was chosen because it produces ANSI C code which is easy to compile with a cross-compiler.
There are some bugs with monad transformers in JHC which make the compiler crash. You may see a funny idiom where we bind monadic calls to variables x1, x2, etc. and then seq them together before returning. This prevents an over-eager optimization from running which messes up the compile. At some point, I will spend time to patch JHC, but until then, the code compiles and seems to run.
The regular JHC make system is useless to us, because it wasn't designed to compile operating systems (duh!). Instead, we use the JHC -C flag to create ANSI C sources from the kernel and user-space haskell sources. We then compile these sources using a clang cross-compiler, and finally link them together to produce the output.
If you have everything necessary to build, modify build.opts to make sure everything points to the right locations, and type make at the top-level. Get a cup of tea, because JHC takes its time.
The easiest way to run Hos for testing is to use the supplied ISO. Hos has been tested only on VirtualBox. Currently, it only produces output via the serial port, which isn't very exciting, but it is what it is. If someone would like to write a text or graphics subsystem, we're looking for volunteers!
Steps to set it up with VirtualBox:
Voilà, you've run a Haskell kernel!
11 commits
C
61.1%
Haskell
32.7%
Assembly
4.7%
Makefile
1.4%
The kernel is written in mainly JHC Haskell, with fallbacks to C where necessary (biggest one being the garbage collector and rts). JHC was chosen because it produces ANSI C code which is easy to compile with a cross-compiler.
There are some bugs with monad transformers in JHC which make the compiler crash. You may see a funny idiom where we bind monadic calls to variables x1, x2, etc. and then seq them together before returning. This prevents an over-eager optimization from running which messes up the compile. At some point, I will spend time to patch JHC, but until then, the code compiles and seems to run.
The regular JHC make system is useless to us, because it wasn't designed to compile operating systems (duh!). Instead, we use the JHC -C flag to create ANSI C sources from the kernel and user-space haskell sources. We then compile these sources using a clang cross-compiler, and finally link them together to produce the output.
If you have everything necessary to build, modify build.opts to make sure everything points to the right locations, and type make at the top-level. Get a cup of tea, because JHC takes its time.
The easiest way to run Hos for testing is to use the supplied ISO. Hos has been tested only on VirtualBox. Currently, it only produces output via the serial port, which isn't very exciting, but it is what it is. If someone would like to write a text or graphics subsystem, we're looking for volunteers!
Steps to set it up with VirtualBox:
Voilà, you've run a Haskell kernel!
11 commits
C
61.1%
Haskell
32.7%
Assembly
4.7%
Makefile
1.4%