Make sure you the following softwares are installed:
- Rust toolchain (nightly) - Use rustup to install
- cargo-binutils and rustfilt crates
- Make sure
docker run hello-worldworks without sudo.
- Make sure
- Python 3
$ brew install qemu gdb python3 $ brew install --cask docker
$ sudo apt install qemu-system gdb python3
$ git clone https://github.com/nuta/kerla && cd kerla $ rustup override set nightly $ rustup component add llvm-tools-preview rust-src $ cargo install cargo-watch cargo-binutils rustfilt $ make
$ make # Build OS (debug build) $ make RELEASE=1 # Build OS (release build) $ make run # Run on QEMU $ make run LOG=trace # Run on QEMU w/ trace messages enabled $ make run GDB=1 # Run on QEMU with GDB connection enabled (listens on localhost:7789)
Once you boot the OS by
make run, a Busybox shell shows up in your terminal.
The terminal running QEMU emulates a serial port connected to Kerla. What you type on the terminal will be sent to the Kerla and the foreground process.
Type Ctrl + A then C to switch the terminal into the QEMU monitor mode. The useful commands are:
q: Quit the emulator.
info registers: Dump the CPU registers.
info qtree: List peripherals connected to the VM.
initramfs/inittab.py to run shell scripts automatically.
You can run a Docker image as a root file system (not as a container!) on Kerla Kernel instead of our initramfs built from
To run nuta/helloworld, type:
$ make IMAGE=nuta/helloworld run
This feature is in a very early stage and I guess almost all images out there won't work because:
- They tend to be too large to be embedded into the kernel image.
- They might use unimplemented features (e.g. position-independent executables used in Alpine Linux).