The k project

Introduction

Table of contents

  1. Checkout out
    1. The tarball
    2. Dependencies
    3. Source tree
    4. Intel Manuals
  2. Build System
  3. Booting your kernel
  4. Debugging your kernel

Checking out

The tarball

A readonly git repository given by the LSE can be cloned:

git clone https://github.com/lse/k.git

Dependencies for building

Source tree

Here is the description of some important files:

Makefile              # top-level Makefile
config.mk             # build-system configuration
k                     # kernel source folder
k/crt0.S              # crt0 for the kernel
k/elf.h               # ELF header
k/include/k/iso9660.h # ISO filesystem definitions
k/include/k/kfs.h     # KFS structures definitions (deprecated)
k/include/k/kstd.h    # k standard definitions
k/include/k/types.h   # kernel types definitions
k/k.c                 # kernel entry point
k/k.lds               # LD script for the kernel binary
k/memory.*            # kernel allocator
k/multiboot.h         # Multiboot Specification header
libs                  # SDK folder
libs/libc             # a basic libc available everywhere
libs/libk             # userland functions
roms                  # rom folder
roms/chichepong       # chichepong folder
roms/roms.lds         # LD script for rom binaries
tools                 # Tools folder
tools/create-iso.sh   # small tool to generate the iso image
tools/mkkfs           # small program to create kfs roms
tools/mkksf           # small program to generate your own sounds

Intel Manuals

You will find the essential Intel Manuals describing the processor, all the instructions as well as the programming guide on the intel website.

The most interesting one is probably the “Volume 3A: System Programming Guide” which describe everything that is needed to develop an operating system.

Build System

The build system uses information stored in config.mk. Feel free to modify this file, but your project must work with the original one.

Here are make rules you need to know:

make | make k.iso  # create an ISO with all the roms
make k             # compile your kernel
make rom/GAME      # compile the rom in the folder rom/$(GAME)
make clean         # clean the tree

Booting your kernel in qemu

qemu-system-i386 -cdrom k.iso [ -enable-kvm ]

Debugging your kernel

Build your kernel with debug flags.

qemu-system-i386 -cdrom k.iso -s -S
gdb k/k
target remote localhost:1234
b my_symbol
continue