Merge pull request #41 from zevweiss/misc-fixes

Miscellaneous small fixes
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/mkinitramfs.py b/virtme/mkinitramfs.py
index 674afc1..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
@@ -166,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