Commit Graph

112 Commits

Author SHA1 Message Date
Liav A
629eed3a4c Meta: Add option to run SerenityOS on a QEMU MicroVM machine
The microvm machine type is a modern tool for kernel and firmware
developers to test their software against features like FDTs, second
IOAPIC, lack of legacy devices by default, the ability of using PCIe
without using PCI x86 IO ports, etc.

We can boot into such machine but we are limited in the functionality we
support currently for this type of virtual machine.
2022-03-02 18:41:54 +01:00
Liav A
2dbbec66e4 Meta: Add option to run SerenityOS on a QEMU ISA-PC machine
The ISA-PC machine type provides no PCI bus support, no IOAPIC support
and other modern PC features of our generation.

This is mainly a good environment for testing abstractions in the kernel
space, and can help with improving on them for the sake of porting the
OS to other chipsets and CPU architectures.
2022-03-02 18:41:54 +01:00
Sviatoslav Peleshko
9399698aaa Meta: Add "vdagent" character device for both qemu-vdagent and spicevmc
Previously we added it only if spice was available, but it's possible to
build qemu with --disable-spice --enable-spice-protocol, which provides
qemu-vdagent but no spicevmc. In such case we still configured
qemu-vdagent to use "vdagent" device, but never actually defined it, so
the qemu-vdagent was never working.
2022-02-20 20:32:22 -08:00
czapek1337
64ff8af074 Meta: Add support for the Limine bootloader 2022-02-14 11:52:07 +01:00
serenityosrocks
7371d16b03 Meta: Fix "Meta/serenity.sh run x86_64 Clang" on M1 Macs
QEMU crashes on M1 Macs when using `--accel hvf` option.

To solve this, detect the host's architecture and only add the
`--accel hvf` parameter if we are running on a "x86_64" machine.
This will allow "arm64" machines like M1 Macs to work correctly.
2022-02-07 02:25:32 +00:00
Andrew Pietila
3758dffd16 Meta: Don't override SERENITY_QEMU_DISPLAY_DEVICE if it is already set 2022-02-06 18:29:25 +00:00
Idan Horowitz
fcdd56633b Meta: Set correct boot drive when running with SERENITY_NVME_ENABLE 2022-01-28 19:05:52 +02:00
Dmitry Petrov
1662213737 Userland: Add horizontal mouse scroll support 2022-01-20 10:37:52 +01:00
serenityosrocks
689fe7ddff Meta: Make "Meta/serenity.sh run aarch64" work on macOS 2022-01-09 12:25:23 +01:00
Liav A
168063819d Meta: Remove explicit IDE attached drive from q35 setup
Use $SERENITY_BOOT_DRIVE to determine it for us.
2022-01-07 12:35:25 +01:00
Tom
2bb32a87f9 Meta: Rename SERINITY_NVME_ENABLE variable to SERENITY_NVME_ENABLE 2022-01-01 21:05:44 +00:00
Pankaj Raghav
344cfa0db4 Meta: Enable attaching NVMe storage devices to qemu
Add an option to enable NVMe storage device as the boot
drive.

To enable NVMe support, run the following:

$ SERENITY_NVME_ENABLE=1 Meta/serenity.sh run i686 root=/dev/nvme0n1
2022-01-01 14:55:58 +01:00
Kelvium
dfb994f62d Meta: Don't override SERENITY_KVM_SUPPORT if it is already set
I've seen how @awesomekling changes the script to disable KVM, so
that's a useful thing to have.

An example how to use it:
  SERENITY_KVM_SUPPORT='0' ./Meta/serenity.sh run x86_64

My first commit btw :^)
2021-12-26 22:39:29 +03:30
Nathan Ell
7ca2315659 Meta: Conditionally run QEMU with QMP
QMP is currently used with UNIX sockets, which can't be created on
Windows hosts. Let's just not start QMP if using Windows QEMU.
2021-12-12 22:31:43 +01:00
Andreas Kling
ecccd511fa Meta: Run QEMU with QMP socket
This allows external connections to the QEMU monitor via QMP.
2021-12-11 20:13:36 +01:00
Jelle Raaijmakers
69a7ffa174 Meta: Increase PulseAudio timer period to 2ms
This seems to prevent crackling audio when starting up Qemu whenever
there is audio already playing.
2021-11-23 10:35:00 +01:00
Jelle Raaijmakers
9d8a566d83 Meta: Use 1ms timer period for Qemu Pulse Audio backend
The default seems to be 10ms and can result in a lot of crackling
noises in the output. A value of 1ms works well on my machine.
2021-11-23 10:06:24 +01:00
Jelle Raaijmakers
03329bbfa5 Meta: Use AC97 device in Qemu by default 2021-11-23 10:06:24 +01:00
Ben Wiederhake
542a88a7be Kernel: Separate framebuffers from bootmode
Bootmode used to control framebuffers, panic behavior, and SystemServer.
This patch factors framebuffer control into a separate flag.
Note that the combination 'bootmode=self-test fbdev=on' leads to
unexpected behavior, which can only be fixed in a later commit.
2021-10-25 23:38:28 +02:00
Nico Weber
5565db5aa1 Meta: Pass -serial stdio to qemu on aarch64
With this, `Meta/serenity.sh run aarch64` produces some output on
the terminal :^)
2021-09-26 23:14:01 +00:00
Andreas Kling
dd29abe4d6 Meta: Bump default VM memory size to 1 GiB 2021-09-19 22:34:43 +02:00
Nico Weber
f1d1418256 Meta: Unbreak serenity.sh run aarch64 after 918f7cb4a8 2021-09-06 21:57:59 +01:00
Tom
918f7cb4a8 Meta: Force legacy xAPIC when using 8 cores or less
This is merely so that we exercise the legacy xAPIC code when we don't
really need x2APIC.
2021-09-04 22:22:58 +02:00
Liav A
8cb4fcdbd8 Meta: Add q35grub option in run.sh
This option is similar to the qgrub option, but instead of starting a
QEMU PIIX4 machine, it starts a QEMU Q35 machine, booting a grub image
disk within it.
2021-09-04 12:54:00 +02:00
Nico Weber
ce98aa567c Meta: Don't pass net -device flags in aarch64 buils in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
ad480505af Meta: Introduce SERENITY_MACHINE variable in run.sh
Set it to all the `-m`, `-display`, `-device` flags for Intel,
and to just "-M raspi3" for aarch64 builds.
2021-08-28 21:51:30 +01:00
Nico Weber
4f3c0fa659 Meta: Disable spice in aarch64 buils in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
230ea3754d Meta: Run qemu-system-aarch64 in aarch64 builds in run.sh 2021-08-28 21:51:30 +01:00
Nico Weber
00c5e68b11 Meta: Disable kvm for aarch64 in run.sh 2021-08-28 21:51:30 +01:00
kleines Filmröllchen
2dc614127e Meta: Add System32 to the PATH so that reg.exe is always found
On my machine (c), /mnt/c/Windows/System32 is not on the PATH by
default. This causes reg.exe to fail, which is responsible for detecting
the presence of QEMU. By putting this path on the PATH on WSL, it will
always work regardless of the specific PATH configuration, and QEMU is
always detected.
2021-08-27 21:24:25 +01:00
Tom
e3e52a4e61 Meta: Add SERENITY_CPUS environment variable to control number of CPUs 2021-08-09 21:02:23 +02:00
Gunnar Beutner
45f2e9f3cf Meta: Don't use x86_64 QEMU for the i686 kernel
This seemed like a good idea at the time to avoid an unnecessary
dependency on qemu-system-i386. However this makes debugging the
kernel with GDB more difficult because GDB assumes that the QEMU
architectures matches the kernel architecture.
2021-08-08 01:46:41 +02:00
Liav A
02c72de090 Meta: Remove legacy hardware components from Q35 machine
As this is a test machine I use personally to test "modern" hardware
setups, it feels quite comfortable to not care too much about VGA with
this type of machine.
Also, we don't actively use the IDE controller on this machine type, so
let's just remove it :^)
2021-08-07 11:49:07 +02:00
sin-ack
bb609cee7f Meta: Add run-local.sh
This allows one to set their desired parameters for run.sh without the
need to set them in every terminal session or add it to the user account
shell files. If a run-local.sh file exists at the repository root and is
executable, it will be sourced. The file can contain any variables that
are expected to be set in run.sh.
2021-08-07 11:47:07 +02:00
Gunnar Beutner
d9d2287a11 Meta: Detect nested KVM support for WSL2 and use that when available
This allows running QEMU inside WSL2 for hosts which have nested KVM
and WSLg support (e.g. Windows 11).

Running QEMU inside the WSL2 VM is slightly slower than running QEMU
on Windows, probably because of how WSLg handles screen updates.
2021-08-04 21:15:41 +02:00
Gunnar Beutner
723c89af67 Meta: Automatically enable WHPX when possible 2021-08-04 21:15:41 +02:00
Gunnar Beutner
5445155dba Meta: Auto-detect where QEMU is installed on Windows 2021-08-04 21:15:41 +02:00
Liav A
cca1498e09 Meta: Make the Q35 machine more realistic
Although it is nice to test the system without too many devices, in
reality bare metal hardware is far more complex than the default skeleon
that QEMU provides. As a preparation of supporting more devices, we
need to ensure we are capable of at least booting on complex hardware
setups without easily-observable problems. Later on, this can be the
foundations of testing new drivers :^)
2021-08-03 21:08:01 +02:00
Gunnar Beutner
31655c9486 Meta: Prefer to use the 64-bit QEMU binary if that's available
Some users might not have qemu-system-i386 installed.
2021-08-03 13:59:57 +01:00
Gunnar Beutner
b082488e94 Meta: Prefer to use -machine pcspk-audiodev for QEMU >=5.1
This gets rid of the following warning message from QEMU on startup:

qemu-system-i386: warning: '-soundhw pcspk' is deprecated, please set a
backend using '-machine pcspk-audiodev=<name>' instead

Fixes #4093.
2021-08-03 13:59:57 +01:00
Gunnar Beutner
74af43ed97 Meta: Improve WSL detection for the run.sh script
For users who use a custom kernel with WSL our previous method of
detecting WSL doesn't work. This new check instead detects WSL by
checking if the wslpath utility is available.
2021-08-02 11:47:29 +01:00
x-yl
8e8b1c8333 Meta: Explicitly specify the disk format in the QEMU options
Otherwise we're getting this warning:

WARNING: Image format was not specified for '_disk_image' and probing
         guessed raw. Automatically detecting the format is dangerous
         for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
2021-08-02 00:35:22 +02:00
Gunnar Beutner
c73c40a21d Meta: Fix compatibility with QEMU 5.x
QEMU 5 doesn't support -machine pcspk-audiodev so we need to fall back
to using -soundhw for that.
2021-08-02 00:35:22 +02:00
Gunnar Beutner
8b2e76b838 Meta: Make audiodev detection more robust
This fixes audio on Windows as well as Linux systems which don't have
SDL.

Fixes #8903.
2021-07-30 23:51:26 +02:00
x-yl
4bdd62939a Meta: Set -audiodev explictly
Unfortunately seems like QEMU tries to use SPICE for audio so we need to
explicitly set -audiodev to use either SDL or coreaudio (depending on
platorm)
2021-07-27 19:15:37 +02:00
Ali Mohammad Pur
466e2a2fb7 Meta: Don't reboot on triple-fault in CI mode
Instead, just make QEMU quit immediately.
2021-07-26 02:29:25 +04:30
Thomas Wagenveld
2002b7e2e3 Meta/run.sh: Allow for overriding of QEMU ethernet device type
You can set the SERENITY_ETHERNET_DEVICE_TYPE environment variable to
pick another device type (i.e. ne2k_pci). Defaults to e1000 as before.
2021-07-24 21:28:22 +02:00
Gunnar Beutner
9031ed0b84 Meta: Add a new qextlinux target for the run.sh script
This allows testing the extlinux image with QEMU.
2021-07-20 15:12:19 +02:00
Gunnar Beutner
e3b7ae0c77 Meta: Remove unused bootloader_test target
Due to other changes this is now just a copy of the q35 target.
2021-07-18 22:08:03 +02:00
Gunnar Beutner
7e94b090fe Kernel: Introduce basic pre-kernel environment
This implements a simple bootloader that is capable of loading ELF64
kernel images. It does this by using QEMU/GRUB to load the kernel image
from disk and pass it to our bootloader as a Multiboot module.

The bootloader then parses the ELF image and sets it up appropriately.
The kernel's entry point is a C++ function with architecture-native
code.

Co-authored-by: Liav A <liavalb@gmail.com>
2021-07-18 17:31:13 +02:00