summaryrefslogtreecommitdiffstats
path: root/qemu_control
blob: bae9dff26b36f31e70e28bc425811cad8e3aa4f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env perl

use strict;

my $command = shift;

if ("start" eq $command)
{
    system "make all > /dev/null";
    system "qemu-system-ppc64 -bios ./img/kernel.bin -cpu 620 -M prep -m 8mb ".
	   "-nographic -monitor telnet:localhost:4444,server,nowait -daemonize";
}
elsif (("stop" eq $command) || ("quit" eq $command))
{
    system "echo 'quit' | nc6 localhost 4444 2> /dev/null > /dev/null";
}
elsif (("command" eq $command) || ("control" eq $command))
{
    system "telnet localhost 4444";
}
elsif ("trace" eq $command)
{
    system "rm -f /tmp/qemu.trace";
    system "echo memsave `grep kernel_printk_buffer ./img/kernel.bin.map | sed 's/kernel_printk_buffer//' | sed 's/ *//g'` 4096 \\\"/tmp/qemu.trace\\\" | nc6 -x localhost 4444 2> /dev/null > /dev/null";
    while (not -e "/tmp/qemu.trace") {};
    system "cat /tmp/qemu.trace";
}
OpenPOWER on IntegriCloud