1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-14 18:21:41 +03:00

qemu-x86_64: Use qemu EDID support

This removes the need for the gnarly hack we were using to get a custom
resolution.
This commit is contained in:
Samuel Dionne-Riel 2020-04-22 21:58:00 -04:00
parent 168d7bc11c
commit fd66311f9f
2 changed files with 13 additions and 32 deletions

View File

@ -7,20 +7,9 @@ let
# Enabling the splash changes some settings.
splash = config.mobile.boot.stage-1.splash.enable;
kernel = pkgs.linuxPackages_4_19.kernel;
kernel = pkgs.linuxPackages_5_4.kernel;
device_info = {
name = "QEMU (x86_64)";
# format_version = "0";
# manufacturer = "Qemu";
# date = "";
# keyboard = true;
# nonfree = "????";
# dtb = "";
# modules_initfs = "qxl drm_bochs";
# external_storage = true;
# flash_method = "none";
# generate_legacy_uboot_initfs = false;
# arch = "x86_64";
};
modules = [
@ -46,24 +35,10 @@ let
# x86 RTC needed by the stage 2 init script.
"rtc_cmos"
# Video
"bochs_drm"
];
MODES = {
"800x600x16" = { vga = "788"; width = 800; height = 600; depth = 16; };
"1024x786x16" = { vga = "791"; width = 1024; height = 768; depth = 16; };
"1024x786x32" = { vga = "0x344"; width = 1024; height = 768; depth = 32; };
"1280x1024x16" = { vga = "794"; width = 1280; height = 1024; depth = 16; };
"1280x720x16" = { vga = "0x38d"; width = 1280; height = 720; depth = 16; };
"1280x720x24" = { vga = "0x38e"; width = 1280; height = 720; depth = 24; };
"1280x720x32" = { vga = "0x38f"; width = 1280; height = 720; depth = 32; };
"1920x1080x16" = { vga = "0x390"; width = 1920; height = 1080; depth = 16; };
"1920x1080x24" = { vga = "0x391"; width = 1920; height = 1080; depth = 24; };
"1920x1080x32" = { vga = "0x392"; width = 1920; height = 1080; depth = 32; };
"720x1280x32" = { vga = "0x393"; width = 720; height = 1280; depth = 32; };
"1080x1920x32" = { vga = "0x394"; width = 1080; height = 1920; depth = 32; };
};
MODE = MODES."1080x1920x32";
in
{
mobile.device.name = "qemu-x86_64";
@ -73,15 +48,18 @@ in
kernel_cmdline = lib.concatStringsSep " " ([
"console=tty1"
"console=ttyS0"
"vga=${MODE.vga}"
"vt.global_cursor_default=0"
"quiet"
]);
};
mobile.hardware = {
soc = "generic-x86_64";
# For the QEMU device, this *sets* the display size.
screen = {
inherit (MODE) height width;
width = 1080;
height = 1920;
};
ram = 1024 * 2;
};

View File

@ -22,6 +22,9 @@ let
path = rootfs;
}
];
xres = toString hardware_config.screen.width;
yres = toString hardware_config.screen.height;
in
{
config = lib.mkMerge [
@ -42,13 +45,13 @@ in
qemu-system-x86_64 \
-enable-kvm \
-L ${pkgs.mobile-nixos.virtualization.bios} \
-kernel "${kernel-initrd}/kernel" \
-initrd "${kernel-initrd}/initrd" \
-append "$(cat "${kernel-initrd}/cmdline.txt")" \
-m "$(cat "${kernel-initrd}/ram.txt")M" \
-serial "mon:stdio" \
-drive "file=fs.img,format=raw" \
-device VGA,edid=on,xres=${xres},yres=${yres} \
-device "e1000,netdev=net0" \
-device usb-ehci -device usb-kbd \
-device "usb-tablet" \