Merge branch 'kmod'
This is hopefully good enough for master now.
diff --git a/virtme/commands/configkernel.py b/virtme/commands/configkernel.py
index 0da6fab..bd3d42f 100644
--- a/virtme/commands/configkernel.py
+++ b/virtme/commands/configkernel.py
@@ -121,7 +121,14 @@
if maketarget:
subprocess.check_call(['make', 'ARCH=%s' % arch.linuxname, maketarget])
- with open('.config', 'ab') as conffile:
+ config = '.config'
+
+ # Check if KBUILD_OUTPUT is defined and if it's a directory
+ config_dir = os.environ.get('KBUILD_OUTPUT', '')
+ if config_dir and os.path.isdir(config_dir):
+ config = os.path.join(config_dir, config)
+
+ with open(config, 'ab') as conffile:
conffile.write('\n'.join(conf).encode('utf-8'))
subprocess.check_call(['make', 'ARCH=%s' % arch.linuxname, updatetarget])
diff --git a/virtme/commands/run.py b/virtme/commands/run.py
index 8bc353b..e0a00eb 100644
--- a/virtme/commands/run.py
+++ b/virtme/commands/run.py
@@ -353,7 +353,7 @@
name,fn = namefile
if '=' in fn or ',' in fn:
arg_fail("--disk filenames cannot contain '=' or ','")
- if '=' in fn or ',' in name:
+ if '=' in name or ',' in name:
arg_fail("--disk device names cannot contain '=' or ','")
driveid = 'disk%d' % i
qemuargs.extend(['-drive', 'if=none,id=%s,file=%s' % (driveid, fn),
diff --git a/virtme/mkinitramfs.py b/virtme/mkinitramfs.py
index baaefe9..dde504d 100644
--- a/virtme/mkinitramfs.py
+++ b/virtme/mkinitramfs.py
@@ -9,6 +9,7 @@
import io
import os.path
import shlex
+import itertools
from . import cpiowriter
from . import modfinder
from . import virtmods
@@ -40,6 +41,7 @@
cw.write_file(name=b'bin/modprobe', body=b'\n'.join([
b'#!/bin/sh',
b'echo "virtme: initramfs does not have module $3" >/dev/console',
+ b'exit 1',
]), mode=0o755)
_LOGFUNC = """log() {
@@ -165,12 +167,12 @@
cw.write_trailer()
def find_busybox(root, is_native):
- for path in ('usr/local/bin/busybox', 'usr/local/sbin/busybox',
- 'usr/bin/busybox-static',
- 'usr/bin/busybox', 'usr/sbin/busybox',
- 'bin/busybox', 'sbin/busybox'):
- if os.path.isfile(os.path.join(root, path)):
- return os.path.join(root, path)
+ for p in itertools.product(['usr/local', 'usr', ''],
+ ['bin', 'sbin'],
+ ['', '-static', '.static']):
+ path = os.path.join(root, p[0], p[1], 'busybox' + p[2])
+ if os.path.isfile(path):
+ return path
if is_native:
# Try the host's busybox, if any