Skip to content

ReturnInfinity/kbm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This port was created by Jack Andrews

k on BareMetal

This repo is a port of k edu to the BareMetal operating system. At this stage, it is just a proof of concept and doesn't integrate the BareMetal file system.

why k on BareMetal-OS?

The BareMetal-OS philosophy aligns with k - it's only 16KB and does just enough. It provides raw access to ethernet and disk and everything runs in ring 0.

If you proceed to the following section, you will be building the OS and k and running it on the bochs emulator or booting k from a hard disk.

how to boot k

make a directory to play in

mkdir sandbox; cd sandbox

The following instructions assume you're on a Debian based system. apt-get install means install package, so you can translate that to your system.

build BareMetal-OS

sudo apt-get install nasm gcc git mtools
git clone https://github.com/ReturnInfinity/BareMetal-OS.git
cd BareMetal-OS && ./baremetal.sh setup && cd ..

If you want to copy k to hard disk and boot that disk, skip to build k. But you probably want to emulate hardware, so build bochs, a pc emulator that supports avx512.

build bochs 2.8

# optionally,  sudo apt-get install libgtk-3-dev  for bochs gui debugger
wget https://sourceforge.net/projects/bochs/files/bochs/2.8/bochs-2.8.tar.gz
tar xf bochs-2.8.tar.gz
cd bochs-2.8
./configure --enable-smp --enable-cpu-level=6 --enable-all-optimizations --enable-x86-64 --enable-pci --enable-usb --enable-vmx --enable-debugger --enable-disasm --enable-debugger-gui --enable-logging --enable-fpu --enable-3dnow --enable-sb16=dummy --enable-cdrom --enable-x86-debugger --enable-iodebug --disable-plugins --disable-docbook --with-x --with-x11 --with-term --enable-avx --enable-evex
make
sudo make install
cd ..

build k

sudo apt-get install clang nasm
git clone https://github.com/ReturnInfinity/kbm.git
cd kbm
make

If you want to copy k to hard disk and boot that disk, skip to if you want to run it on hardware

run k in bochs

now make bochs will start the bochs emulator.

  • after a few seconds, a window will appear and the emulator will boot
  • you should be able to interact with k
  • to quit, exit k with \\

if you want to run it on hardware

Caution

Doublecheck that you are writing the disk image to the correct disk

dd if=../sandbox/BareMetal-OS/sys/baremetal_os.img of=/dev/sdc

and boot from that disk