Prerequisites
QEMU 6.2 or later
Version 6.2 of QEMU is available in Ubuntu 22.04. On earlier versions of Ubuntu, you can build the recommended version of QEMU as provided by the toolchain.1
Install QEMU dependencies
Install the required development packages:
2
Build QEMU from toolchain
If your distribution’s QEMU version is older than 6.2:
Running SerenityOS
The simplest way to build and run SerenityOS in QEMU:- Compile all of SerenityOS
- Install built files into
Build/<architecture>/Root - Build a disk image
- Start SerenityOS using QEMU
The chosen architecture defaults to your host architecture. Supported architectures are x86_64, aarch64, and riscv64.
First Build
The first time you run the build command, it will:- Download required database files from the internet
- Build the SerenityOS cross-compiler toolchain
Subsequent builds will be much faster as these steps only need to be done once.
Default Credentials
By default, theanon user account’s password is: foo
Build Options
Selecting an Architecture
Force a build for a specific architecture:x86_64, aarch64, riscv64
Build Only (No VM)
To test compilation without running the VM:Kernel Command Line Parameters
Pass additional kernel parameters:QEMU Integration Features
SPICE Integration
SPICE provides enhanced clipboard and display integration.1
Build QEMU via toolchain
2
Install virt-viewer
On Ubuntu 23.04+:For earlier versions, you may need to build virt-viewer 8.0 from source.
3
Enable SPICE and run
File Transfer from QEMU
Method 1: WebServer
Serenity has a built-in web server accessible from your host:1
Start WebServer in SerenityOS
In the SerenityOS terminal:
2
Access from host browser
Open
localhost:8000 in your host machine’s browser.Some browsers download unrecognized files as plain text. Use
wget to download files as-is instead.Method 2: Mount the Disk Image
On *nix systems or inside WSL:Method 3: Archiving Tool
Some archiving tools like 7-Zip can directly open ext2 images like Serenity’s_disk_image.
For WSL users: Access the WSL drive in Windows Explorer via
\\wsl$\<distro name>\<path to serenity directory>.Method 4: OpenSSH and SFTP
1
Setup OpenSSH server on host
Configure OpenSSH server on your host system (Windows or Linux).
2
Build OpenSSH port in SerenityOS
3
Connect via SFTP
From within SerenityOS:Use commands like
ls, cd, put [filename], get [filename], and quit.Debugging
GDB Remote Session
Start SerenityOS with GDB attached:init() function in the Kernel.
Self-Test Mode
Run the built image in self-test mode:system_mode=self-test to the Kernel.
Advanced Configuration
Custom QEMU Arguments
Set additional QEMU arguments:Disk Image Types
Build different disk image formats:Troubleshooting
Toolchain Outdated
If prompted to rebuild the toolchain after updates:Filesystem Errors
If you seefusermount: failed to open /etc/mtab:
Performance on Windows
Consider copyingBuild/_disk_image and Build/Kernel/Kernel to a native Windows partition before running.