Skip to content

Another attempt at a kernel to learn low level x86_64

Notifications You must be signed in to change notification settings

quackitsquinn/novos

Repository files navigation

novos: A little kernel written in rust. (so I can learn osdev)

Running the kernel

To run the kernel, you need to have the following dependencies installed:

  • qemu
  • xorriso
  • rustc and cargo
    • You need to have the x86_64-unknown-none target installed, and nightly rust.
      rustup override set nightly
      rustup target add x86_64-unknown-none
      # This isn't strictly necessary, but it's a good idea to update installed toolchains
      rustup update

Then, you can run the kernel with the following command from the root of the repository:

cargo run --bin bios_boot

Project structure

The project is split into several crates:

  • kbuild: A library for building the kernel. Used in build.rs and the test runner.
  • kernel: The main kernel crate.
  • kproc: Various procedural macros used in the kernel. Currently only contains the test macro.
  • kerial: A qemu serial driver for the kernel. Used for debugging.

Some other folders that appear in the root of the repository:

  • boot_cfg: Configuration files for limine.
  • boot_images: ISO images generated by the build process.
  • output: Files generated by kserial commands.
  • tools: Various python scripts used for debugging. Both scripts are currently old and unused.

Debugging the kernel

All debugging is done through environment variables. The following environment variables are supported:

Runtime options

  • DEBUG: If set, QEMU will wait for a debugger to attach on port 1234.
  • QEMU_FLAGS: Additional flags to pass to QEMU.
  • VERBOSE: Shows QEMU's invocation command.
  • NO_DISPLAY: Disables the graphical display in QEMU.
  • KERNEL_MEM: Sets the amount of memory to allocate for the kernel in QEMU.
  • ISO: Override the iso file to boot from.
  • NO_EXIT: Prevents QEMU from exiting after the kernel exits.
  • REBUILD: Forces a rebuild of the test binary. This will have no effect on the kernel itself, as the kernel is not build at runtime.

Build-time options

  • ALLOC_DEBUG: If set, will print out information about memory allocations and deallocations.
  • REINSTALL_LIMINE: If set, limine will be re-downloaded from it's git repository and reinstalled.
  • ARTIFACT_DIR: The directory to store build artifacts in.
    • TODO: Rename this to BUILD_DIR or something.
  • LIMINE_CONFIG: The path to the limine configuration file.
  • ISO_NAME: The name of the ISO file to generate.
  • ISO_ROOT: The directory to store ISO files in.

About

Another attempt at a kernel to learn low level x86_64

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published