An operating system written in Swift.
Boot— Minimal boot code before entering Swift.Kernel— Kernel executable and system entry point.KernelCore— Architecture- and platform-independent kernel logic (scheduler, memory management, core services).Hardware— Hardware abstraction layer defining device interfaces independent of CPU architecture and platform (console, timer, framebuffer, etc.).- CPU architecture support
ArchAArch64- AArch64 CPU support (exceptions, MMU, vector tables, system registers).ArchX8664- (planned) x86_64 CPU support (IDT, paging, interrupts).
- Platform support
RaspberryPi— Raspberry Pi platform implementation (UART, mailbox, framebuffer, interrupt controller).
KernLibc— Minimal libc for kernel space.AppLibc— Minimal libc for user space.AsmSupport— Assembly helper functions.LinkerSupport— Swift bindings for linker-defined symbols.
- QEMU 9.0 or later
- Arch Linux:
sudo pacman -S qemu-system-aarch64 - Fedora 41 or later:
sudo dnf install qemu-system-aarch64-core - Fedora 40: Build from source
- Ubuntu 24.04/22.04: Build from source
- Debian 13 or later:
run0 apt install qemu-system-arm - Debian 12:
sudo apt install -t bookwarm-backports qemu-system-arm(you need to add backports tosources.list) - macOS 14 or later:
brew install qemu
- Arch Linux:
- Swiftly
- Swift toolchain: Just run
swiftly installafter installing Swiftly
swift build --triple aarch64-none-none-elf --toolset toolset.json --build-system native.build/debug/Kernel is the kernel binary.
swift run --triple aarch64-none-none-elf --toolset toolset.json --build-system nativeDebug build (recommended for development):
swift build --triple aarch64-none-none-elf --toolset toolset.json --build-system native
llvm-objcopy .build/debug/Kernel -O binary .build/kernel8.imgWarning
Known issue: #167
Release build (recommended for deployment):
swift build -c release -Xswiftc -Osize --triple aarch64-none-none-elf --toolset toolset.json --build-system native
llvm-objcopy .build/release/Kernel -O binary .build/kernel8.imgHow to boot:
- Build
.build/kernel8.imgfollowing the above instructions - Read this article and prepare a bootable SD card
- Replace
kernel8.imgon the SD card with.build/kernel8.imgyou built - Insert the SD card to your Raspberry Pi 4
- Turn the power on
swift package cleanThis project is using swift-format for formatting and linting.
Format:
swift format format -rip .Lint:
swift format lint -rsp .