crystal-kernel
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
objdump -s bin/bootboot/X86_64
x86_64-elf-readelf -hls bin/bootboot/X86_64
x86_64-linux-gnu-readelf -hls bin/bootboot/X86_64
- http://www.sunshine2k.de/coding/javascript/onlineelfviewer/onlineelfviewer.html
To check for bootboot compatibility
./mkbootimg check bin/bootboot/X86_64
Repository
crystal-kernel
Owner
Statistic
- 24
- 1
- 0
- 0
- 0
- over 1 year ago
- October 23, 2021
License
Links
Synced at
Thu, 21 Nov 2024 23:17:26 GMT
Languages