The provided scripts assume a Debian-style Linux system with, among others, following packages installed:
- build-essential
- libgmp3-dev
- libmpfr-dev
- libmpc-dev
- texinfo
- bison
- flex
- nasm
The kernel expects the following features on the target system:
- x86 architecture with 64-bit long mode
- PCI Express
- AVX, including XSAVE/XRSTOR instructions
The kernel requires a special GCC-based cross-compiler.
Navigate into the compiler
sub directory and run the buildcompiler.sh
script. This will download binutils and GCC and perform all necessary build steps. The generated binaries x86_64-elf-
name
are stored in the compiler/bin
sub directory, and can subsequently be used for compiling the kernel.
The entire source tree is contained in the code
sub directory. The directory has a central Makefile that allows to compile each of the components, by invoking make
target
. Supported targets:
kernel
: Builds the kernel itself.lib
: Builds the user-space standard library.net
: Builds the user-space network library (only for use by the UI process).ui
: Builds the UI application.all
: Builds all of the above.clean
: Removes all compiler outputs, temporary files and binaries.
After compiling all components these have to be combined into a disk image, to copy to an USB stick or load in a VM. This is done by executing create_image.sh
from the image
sub directory (sudo permission needed). To flash the image to an USB stick mounted at /dev/sdb
invoke sudo dd if=disk.img of=/dev/sdb
(be careful with this command).
Other user-space applications are stored in the code/apps/
sub directory; this directory already contains a "Hello World" program called test
(which might be used as a template), and some apps written for research purposes.
The preferred way to load a user-space binary is using the network; otherwise, this can be achieved by adding the app to the OS image:
- In
image/grub.cfg
, add a linemodule2 /bin/appname.elf appname
(the first argument specifies the path in the boot image, the second determines the application as shown in the OS file system) - In
image/create_image.sh
, add a linesudo cp ../code/apps/appname/appname.elf mnt/bin
Then the application binary will be automatically mounted at/apps/appname
during system startup.
The directory image/vm/
provides a pre-configured virtual machine file itskernel.vmx
and a GDB input file gdb.in
. The former configures VMware to open a debug port 1234, the latter attaches a GDB process to the running VM.
It is important to attach the debugger after GRUB has completed; this can be achieved automatically by adding the line
monitor.debugOnStartGuest64 = "TRUE"
to the virtual machine configuration file, which causes the VM to automatically pause when hitting the kernel's start
function.
The GDB input file automatically loads the kernel symbols and sets a break point at init
; to debug user-space programs instead, set the respective executable as symbol file, and change the break point to e.g. main
.
The kernel itself is based on the Arc Operating System by Graham Edgecombe and licensed under the permissive ISC license.
Other components: