/osdev

OS development

Primary LanguageC

OSDev

My OS development

Development Environment

The following dependencies need to be installed for building and development:

  • x86 Assembler: NASM
  • Disk writer: dd
  • C cross-compiler: i386-elf-binutils, i386-elf-gcc, i386-elf-gdb
  • x86 PC enumerator: QEMU, bochs

NewLib

The directory newlib contains the Newlib source code which is used to port a standard C lib for building OS applications. It is also used to generate no-host version of the lib which is used by the kernel for some OS independent standard string and memory manipulation functions.

Building and Running

Once all prerequisites have been installed, the make utility can be used to build and run project.

  • To run OS on Emulator. This will auto-builds the kernel image and load it on Emulator:
    $ make run
  • To build kernel image only:
    $ make build
  • To cleanup project builds:
    $ make clean

The build process creates a build\<target> directory where all header files, libraries and kernel image are placed appropriately. Thus this directory acts as our OS root using which an OS image is created. The <target> here refers to the CPU arch for which the kernel is being built.

Debugging

There are couple of ways to debug the kernel. One is using the cross-compiled gdb utility (e.g. i386-elf-gdb), the other is using the internal debugger of Bochs emulator.

Development Tasks