A minimal baremetal kernel that demonstrates basic hardware initialization and UART output on multiple architectures. This project supports both ARM64 (AArch64) and SPARC v8 (AJIT) platforms, providing a foundation for bare-metal systems programming and hardware experimentation.
- Run
./download_toolchain_arm64.shto download the ARM64 baremetal toolchain. - Run
makeormake ARCH=arm64to build the kernel for ARM64.
- Make sure you have
qemu-system-aarch64on your machine. If not, install withsudo apt install qemu-system-arm - Once qemu is installed, run
./run_qemu_arm64.sh - For debugging, run
./run_qemu_arm64.sh debugto start QEMU with GDB server enabled - Tested on qemu version v10.1.0
- Arm64 virt board boots fine & printing stuff through PL011 UART works.
- Download the custom AJIT QEMU model from here
- Run
./download_toolchain_sparcv8.shto download the SPARCv8 baremetal toolchain. - Run
make ARCH=sparcto build the kernel for SPARCv8.
- Ensure the custom
qemu-system-sparcbinary is in your PATH - Once qemu is installed, run
./run_qemu_ajit.sh. Entercat the qemu monitor. - For debugging, run
./run_qemu_ajit.sh debugto start QEMU with GDB server enabled - Note: The AJIT machine uses a remote serial connection (PTY). The serial device path will be displayed when QEMU starts.
The AJIT QEMU model uses a PTY (pseudo-terminal) for serial communication. To view the output:
- Start QEMU with
./run_qemu_ajit.sh- note the PTY device path in the output (e.g.,/dev/pts/X) - In a separate terminal, connect using minicom:
Replace
minicom -D /dev/pts/X
Xwith the actual PTY number from QEMU's output - If minicom is not installed, install it with:
sudo apt install minicom - To exit minicom, press
Ctrl-Afollowed byX
- SPARC v8 AJIT model with UART, Timer, & Interrupt controller works.
- The dummy kernel code just tests the UART TX though by printing stuff.
GDB debugging is available for both architectures. The process is the same:
- Start QEMU in debug mode:
- For ARM64:
./run_qemu_arm64.sh debug - For SPARCv8:
./run_qemu_ajit.sh debug
- For ARM64:
- In a separate terminal, start GDB and connect using:
gdb-multiarch -x connect.gdb
- Set breakpoints and debug as needed.