Skip to content

yet another crystal kernel, inspired by ffwff/lilith

Notifications You must be signed in to change notification settings

stakach/crystal-kernel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crystal Kernel

Extending on the work started with https://github.com/ffwff/lilith/

Usage

  • this kernel is designed to work with BOOTBOOT to keep the boot process simple

Building

The kernel is expected to be a standard ELF executable

  • BOOTBOOT expects a single loadable segment
  • Internally virtual segments are maintained and 4kb aligned - for paging protection
  • the entry point takes no params and returns void
  • boot and machine information is provided at a specific location by BOOTBOOT

to build run ./build.sh

Development on macOS

Install some base tools

brew install crystal
brew install qemu
brew install gdb

Download the UEFI BIOS, extract using something like 7zip to get

  • OVMF-pure-efi.fd for x64
  • QEMU_EFI-pflash.raw for aarch64

Running the kernel using QEMU

build the kernel

./build.sh

Can run the VM in a few different ways

  • View the VM using VNC
    • qemu-system-x86_64 -cpu qemu64 -bios ../OVMF-pure-x64-efi.fd -drive file=./disk.cdr,if=ide -display vnc=127.0.0.1:0
    • connect to it using localhost (uses default port)
  • With GDB debugging support:
    • qemu-system-x86_64 -cpu qemu64 -bios ../OVMF-pure-x64-efi.fd -drive file=./disk.cdr,if=ide -display vnc=127.0.0.1:0 -s -S
    • it waits for GDB to connect before starting
  • Mutli-core:
    • qemu-system-x86_64 -cpu qemu64 -m 128M -bios ../OVMF-pure-x64-efi.fd -drive file=./disk.cdr,if=ide -display vnc=127.0.0.1:0 -smp "sockets=1,cores=2"
gdb
file ./bin/bootboot/X86_64
target remote tcp::1234
continue

Inspecting the ELF file output

To check for bootboot compatibility

  • ./mkbootimg check bin/bootboot/X86_64

About

yet another crystal kernel, inspired by ffwff/lilith

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published