summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-emulation/kvm/files/kvm-kvm.patch')
-rw-r--r--app-emulation/kvm/files/kvm-kvm.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/app-emulation/kvm/files/kvm-kvm.patch b/app-emulation/kvm/files/kvm-kvm.patch
new file mode 100644
index 0000000..1fd8420
--- /dev/null
+++ b/app-emulation/kvm/files/kvm-kvm.patch
@@ -0,0 +1,114 @@
+--- kvm.orig 2007-07-25 09:22:14.042411511 -0500
++++ kvm 2007-07-25 09:24:54.087531962 -0500
+@@ -17,18 +17,10 @@
+ config = ShellConfigParser()
+ config.read('config.mak')
+
+-external_module = config.get('shell', 'want_module')
+ privileged = os.getuid() == 0
+
+ optparser = optparse.OptionParser()
+
+-optparser.add_option('--no-reload-module',
+- help = 'do not reload kvm module',
+- action = 'store_false',
+- dest = 'reload',
+- default = privileged,
+- )
+-
+ optparser.add_option('--install',
+ help = 'start up guest in installer boot cd',
+ action = 'store_true',
+@@ -67,12 +59,6 @@
+ default = None,
+ )
+
+-optparser.add_option('--no-kvm',
+- help = 'use standard qemu, without kvm',
+- action = 'store_false',
+- dest = 'kvm',
+- default = True,
+- )
+ optparser.add_option('--image',
+ help = 'select disk image',
+ dest = 'image',
+@@ -124,52 +110,14 @@
+ if len(args) > 1:
+ options.cdrom = args[1]
+
+-def remove_module(module):
+- module = module.replace('-', '_')
+- lines = commands.getoutput('/sbin/lsmod').split('\n')
+- for x in lines:
+- if x.startswith(module + ' '):
+- if os.spawnl(os.P_WAIT, '/sbin/rmmod', 'rmmod', module) != 0:
+- raise Exception('failed to remove %s module' % (module,))
+-
+-def insert_module(module):
+- if os.spawnl(os.P_WAIT, '/sbin/insmod', 'insmod',
+- 'kernel/%s.ko' % (module,)) != 0:
+- raise Exception('failed to load kvm module')
+-
+-def probe_module(module):
+- if os.spawnl(os.P_WAIT, '/sbin/modprobe', 'modprobe', module) != 0:
+- raise Exception('failed to load kvm module')
+-
+-def vendor():
+- for x in file('/proc/cpuinfo').readlines():
+- m = re.match(r'vendor_id[ \t]*: *([a-zA-Z]+),*', x)
+- if m:
+- return m.group(1)
+- return unknown
+-
+-vendor_module = {
+- 'GenuineIntel': 'kvm-intel',
+- 'AuthenticAMD': 'kvm-amd',
+- }[vendor()]
+-
+-if options.kvm and options.reload:
+- for module in [vendor_module, 'kvm']:
+- remove_module(module)
+- if external_module:
+- insmod = insert_module
+- else:
+- insmod = probe_module
+- for module in ['kvm', vendor_module]:
+- insmod(module)
+- commands.getstatusoutput('/sbin/udevsettle')
+- if not os.access('/dev/kvm', os.F_OK):
+- print '/dev/kvm not present'
++commands.getstatusoutput('/sbin/udevsettle')
++if not os.access('/dev/kvm', os.F_OK):
++ print '/dev/kvm not present'
+
+ disk = options.image
+ if options.install:
+ (status, output) = commands.getstatusoutput(
+- 'qemu/qemu-img create -f qcow2 "%s" 10G' % disk)
++ 'qemu-img create -f qcow2 "%s" 10G' % disk)
+ if status:
+ raise Exception, output
+
+@@ -184,12 +132,6 @@
+ else:
+ cmd = 'qemu'
+
+-local_cmd = 'qemu/' + arch + '-softmmu/' + cmd
+-if os.access(local_cmd, os.F_OK):
+- cmd = local_cmd
+-else:
+- cmd = '/usr/bin/kvm'
+-
+ qemu_args = (cmd, '-boot', bootdisk,
+ '-hda', disk, '-m', str(options.memory),
+ '-serial', 'file:/tmp/serial.log',
+@@ -200,9 +142,6 @@
+ if options.cdrom:
+ qemu_args += ('-cdrom', options.cdrom,)
+
+-if not options.kvm:
+- qemu_args += ('-no-kvm',)
+-
+ if options.debugger:
+ qemu_args += ('-s',)
+