1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-09-11 12:05:26 +03:00

qemu-x86_64: Delete device

It's being replaced by the generic uefi-x86_64 device.

Basically, replace the QEMU-specific system type by the totally standard
UEFI system type. This way we're dogfooding it way better!
This commit is contained in:
Samuel Dionne-Riel 2020-12-10 23:24:29 -05:00
parent a8f14efead
commit b2790d13d6
7 changed files with 3 additions and 144 deletions

View File

@ -1,63 +0,0 @@
{ config, lib, pkgs, ... }:
{
mobile.device.name = "qemu-x86_64";
mobile.device.identity = {
name = "(x86_64)";
manufacturer = "QEMU";
};
mobile.hardware = {
soc = "generic-x86_64";
# For the QEMU device, this *sets* the display size.
screen = {
width = 1080;
height = 1920;
};
ram = 1024 * 2;
};
boot.kernelParams = [
"console=tty1"
"console=ttyS0"
"vt.global_cursor_default=0"
"quiet"
];
mobile.system.type = "qemu-startscript";
mobile.boot.stage-1 = {
kernel = {
package = pkgs.linuxPackages_5_4.kernel;
modular = true;
modules = [
# Disk images
"ata_piix"
"sd_mod"
# Networking
"e1000"
# Keyboard
"hid_generic"
"pcips2" "atkbd" "i8042"
# Mouse
"mousedev"
# Input within X11
"uinput" "evdev"
# USB
"usbcore" "usbhid" "ehci_pci" "ehci_hcd"
# x86 RTC needed by the stage 2 init script.
"rtc_cmos"
# Video
"bochs_drm"
];
};
};
}

View File

@ -65,6 +65,6 @@ keys are held, it will instead show the recovery menu.
The simulator can be launched using the following commands:
....
$ nix-build --argstr device qemu-x86_64 -A pkgs.boot-recovery-menu-simulator
$ nix-build --argstr device uefi-x86_64 -A pkgs.boot-recovery-menu-simulator
$ result/bin/simulator --resolution 1080x1920
....

View File

@ -1,4 +1,4 @@
{ device ? "qemu-x86_64" }:
{ device ? "uefi-x86_64" }:
let
system-build = import ../../../. {
inherit device;

View File

@ -12,7 +12,6 @@ in
{
imports = [
./system-types/depthcharge
./system-types/qemu-startscript
./system-types/android
./system-types/u-boot
./system-types/uefi

View File

@ -1,63 +0,0 @@
{ config, pkgs, lib, ... }:
let
inherit (config.mobile) device hardware;
rootfs = config.system.build.rootfs;
enabled = config.mobile.system.type == "qemu-startscript";
qemu-startscript = pkgs.callPackage ./qemu-startscript-build.nix {
inherit (device) name;
inherit (hardware) ram;
initrd = config.system.build.initrd;
cmdline = lib.concatStringsSep " " config.boot.kernelParams;
kernel = config.mobile.boot.stage-1.kernel.package;
};
system = pkgs.linkFarm "${device.name}-build" [
{
name = "qemu-startscript";
path = "qemu-startscript";
}
{
name = "system";
path = rootfs;
}
];
xres = toString hardware.screen.width;
yres = toString hardware.screen.height;
in
{
config = lib.mkMerge [
{ mobile.system.types = [ "qemu-startscript" ]; }
(lib.mkIf enabled {
system.build = rec {
inherit system;
default = vm;
vm = pkgs.writeScript "run-vm-${device.name}" ''
#!${pkgs.runtimeShell}
PS4=" $ "
set -eux
cp -f ${rootfs}/*.img fs.img
chmod +rw fs.img
qemu-system-x86_64 \
-enable-kvm \
-kernel "${qemu-startscript}/kernel" \
-initrd "${qemu-startscript}/initrd" \
-append "$(cat "${qemu-startscript}/cmdline.txt")" \
-m "$(cat "${qemu-startscript}/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" \
-netdev "user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23,net=172.16.42.0/24,dhcpstart=172.16.42.1"
'';
};
})
];
}

View File

@ -1,14 +0,0 @@
{ runCommandNoCC
, name
, initrd
, ram
, cmdline
, kernel
}:
runCommandNoCC "mobile-nixos_${name}-qemu-startscript" {} ''
mkdir -p $out/
cp ${kernel}/*Image* $out/kernel
cp ${initrd} $out/initrd
echo -n "${cmdline}" > $out/cmdline.txt
echo -n "${toString ram}" > $out/ram.txt
''

View File

@ -142,7 +142,7 @@ in
constituents =
lib.optionals (hasSystem "x86_64-linux") [
device.qemu-x86_64.x86_64-linux # VM
device.uefi-x86_64.x86_64-linux # UEFI system
# Cross builds
device.asus-z00t.x86_64-linux # Android
device.asus-dumo.x86_64-linux # Depthcharge