Skip to content

AArch64OS - an operating system for the Arm A-profile instruction set architecture AArch64 execution state

License

Notifications You must be signed in to change notification settings

dsmcfarl/aarch64os

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AArch64OS

AArch64OS - an operating system for the Arm A-profile instruction set architecture AArch64 execution state.

This is a hobby project that scratches a particular itch of mine to learn about:

  • Operating system development.
  • Arm AArch64 architecture.
  • Raspberry Pi 4 Model B hardware.
  • Assembly language programming.
  • Bootstrapping a system.
  • Tradeoffs in simplicity, performance, and complexity.

Some goals:

  • Bootstrap as early as possible. Build a simple kernel and assembler in assembly that builds itself, then use that to build the rest of the operating system (we'll see...).
  • Minimize dependencies for building and running the operating system (related to bootstrap goal).
  • Learn and have fun!

Non-goals:

  • A practical system for daily use.

The project is largely a reaction to the extreme complexity of most modern development environments. The goals will likely evolve, and when the 'fun' stops, so will the project.

Quick Start

Assumes a Debian-based system, but should work on other systems with minor modifications.

The bin/get-tools script has been tested on a base install of Debian bookworm to ensure all required system dependencies are listed. If you are using a different system, you may need to install additional packages and/or adjust the script.

To run in QEMU do the following: (press ctrl-a c when you see "you pressed: ..." to halt QEMU and get to the monitor)

$ git clone [email protected]:dsmcfarl/aarch64os.git
$ cd aarch64os
$ source .envrc  # adds bin/ to PATH and sets some environment variables
$ get-tools      # installs system dependencies then downloads and builds tools to tools/ directory
...
$ qemu           # runs the operating system in QEMU using bin/qemu script
qemu-system-aarch64: warning: bcm2711 dtc: brcm,bcm2711-pcie has been disabled!
qemu-system-aarch64: warning: bcm2711 dtc: brcm,bcm2711-rng200 has been disabled!
qemu-system-aarch64: warning: bcm2711 dtc: brcm,bcm2711-thermal has been disabled!
qemu-system-aarch64: warning: bcm2711 dtc: brcm,bcm2711-genet-v5 has been disabled!
INFO: initlizing EL3...
INFO: EL3 initialization complete
INFO: initlizing EL2...
INFO: EL2 initialization complete
INFO: initlizing EL1...
INFO: found valid device tree
INFO: EL1 initialization complete
INFO: initializing userspace...
press any key to continue...
you pressed: xQEMU 9.1.0 monitor - type 'help' for more information
(qemu) info registers

CPU#0
 PC=0000000020000084 X00=0000000000000003 X01=0000000000000004
X02=0000000000000002 X03=0000000000000000 X04=0000000000000000
X05=0000000000000000 X06=0000000000000000 X07=0000000000000000
X08=00000000000000d6 X09=0000000020201000 X10=0000000020200000
X11=0000000020400000 X12=00000000fe201000 X13=0000000000000000
X14=0000000000000000 X15=0000000000000000 X16=0000000000000000
X17=0000000000000000 X18=0000000000000000 X19=0000000000000001
X20=0000000000000000 X21=0000000000000000 X22=0000000000000000
X23=0000000000000000 X24=0000000000000000 X25=0000000000000000
X26=0000000000000000 X27=0000000000000000 X28=0000000000000000
X29=0000000000000000 X30=0000000020000078  SP=000000003b400000
PSTATE=20000000 --C- NS EL0t    FPU disabled
(qemu) q
$

If everything was successful X00 should equal 3 and X01 should equal 4 and X09 should equal 20201000.

Organization

The project is organized as follows:

  • bin/ Scripts for building, running, and debugging the operating system.
  • config/ Configuration files for build tools and bootloader, etc.
  • include/ Header files for the operating system.
  • src/ Source code for the operating system. Separate sub-directories for different components.
  • build/ Build artifacts (not committed).
  • tools/ Third party tools for building and debugging the operating system. (not committed generated by bin/get-tools)
  • .envrc Environment variables for development (can be loaded with direnv or source manually).

Hardware

The project uses a Raspberry Pi 4 Model B (RPi4B). It is not using the Raspberry Pi 5 Model B (RPi5B) because QEMU does not support the RPi5B yet and documentation for the RPi4B is better currently (2024). Also, the Raspberry Pi Compute Module 4 (RPiCM4) could be an interesting target for this project but has not been tested yet.

Remote debugging is supported with a JTAG probe and openocd. The Segger J-Link Base has been tested with this project but other probes should also work.

A USB to TTL (3.3V) serial cable is required for viewing logs and input/output.

Tools

About

AArch64OS - an operating system for the Arm A-profile instruction set architecture AArch64 execution state

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published