A recreational attempt to build a very basic kernel in Swift
  • Swift 58.6%
  • Linker Script 29.8%
  • Assembly 11.6%
Find a file
2026-10-01 21:25:57 +02:00
.vscode Prints 'hello, embedded swift' 2026-09-28 09:28:20 +02:00
Sources gitkeep 2026-10-01 21:25:23 +02:00
.gitignore Prints 'hello, embedded swift' 2026-09-28 09:28:20 +02:00
.swift-version Added .swift-version 2026-10-01 21:25:57 +02:00
linker.ld Prints 'hello, embedded swift' 2026-09-28 09:28:20 +02:00
Package.swift Prints 'hello, embedded swift' 2026-09-28 09:28:20 +02:00
README.md Updated README 2026-09-28 09:49:54 +02:00
toolset.json Prints 'hello, embedded swift' 2026-09-28 09:28:20 +02:00

Swift Kernel

A recreational attempt to build a very basic kernel.
This project uses embedded Swift, which is a subset of the Swift language.

The associated blog post article is here.

Dependencies for the compiler

Build

First, verify you are on main-snapshot version of Swift.
This should list XX-dev

swift --version

If not, install it and use it for this project:

swiftly install main-snapshot
swiftly use main-snapshotw

Now, you can build the kernel

# debug
swift build --triple aarch64-none-none-elf --toolset toolset.json --build-system native
# release
swift build -c release --triple aarch64-none-none-elf --toolset toolset.json --build-system native

and use QEMU to run it

# debug
qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -kernel .build/aarch64-none-none-elf/debug/kernel
# release
qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -kernel .build/aarch64-none-none-elf/release/kernel

To kill QEMU: Ctrl+A, then X.