summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hyperv-x86_64.config (renamed from hyperv.config)0
-rwxr-xr-xkconfig84
-rw-r--r--qemu-arm.config4
-rw-r--r--qemu-x86_64.config4
-rw-r--r--qemu.config3
5 files changed, 73 insertions, 22 deletions
diff --git a/hyperv.config b/hyperv-x86_64.config
index 8ff0c5a..8ff0c5a 100644
--- a/hyperv.config
+++ b/hyperv-x86_64.config
diff --git a/kconfig b/kconfig
index 6e32151..b507a38 100755
--- a/kconfig
+++ b/kconfig
@@ -4,25 +4,34 @@ tweak="${1-qemu hyperv}"
configs="init strip need $tweak"
base=$(dirname $0)
+make="make"
-# go!
+####################################################################################
+# helpers
-for config in $configs; do
- if test "$config" = "init"; then
- echo "# init"
- if test -f /proc/config.gz; then
- echo "from /proc/config.gz"
- zcat /proc/config.gz > .config
- else
- cp -v "/boot/config-$(uname -r)" .config || exit 1
- fi
- echo "# oldconfig"
- yes "" | make oldconfig >/dev/null
- echo "# localmodconfig"
- yes "" | make localmodconfig >/dev/null
- continue
+function do_init() {
+ echo "# init"
+ if test -f /proc/config.gz; then
+ echo "from /proc/config.gz"
+ zcat /proc/config.gz > .config
+ else
+ cp -v "/boot/config-$(uname -r)" .config || exit 1
fi
- echo "# apply $config"
+ echo "# oldconfig"
+ yes "" | $make oldconfig >/dev/null
+ echo "# localmodconfig"
+ yes "" | $make localmodconfig >/dev/null
+}
+
+function do_apply() {
+ local cfg="$1"
+ local cfgfile="$base/${cfg}.config"
+
+ if test ! -f "$cfgfile"; then
+ return
+ fi
+
+ echo "# apply $cfg [ $cfgfile }"
while read line; do
option="${line%=*}"
value="${line#*=}"
@@ -37,7 +46,7 @@ for config in $configs; do
else
echo "$option=$value" >> .config
fi
- yes "" | make oldconfig >/dev/null
+ yes "" | $make oldconfig >/dev/null
if grep -q "$option=$value" .config; then
echo "# $option - $value - applied"
else
@@ -54,7 +63,7 @@ for config in $configs; do
continue
fi
sed -i -e "s/.*${option}[= ].*/# $option is not set/" .config
- yes "" | make oldconfig >/dev/null
+ yes "" | $make oldconfig >/dev/null
if grep -q "$option is not set" .config; then
echo "# $option - $value - applied"
else
@@ -71,5 +80,42 @@ for config in $configs; do
exit 1
;;
esac
- done < "$base/$config.config"
+ done < "$cfgfile"
+}
+
+####################################################################################
+# go!
+
+if test -f .config; then
+ if grep -q "^CONFIG_X86_64=y" .config; then
+ arch="x86_64"
+ elif grep -q "^CONFIG_I386=y" .config; then
+ arch="i386"
+ elif grep -q "^CONFIG_ARM=y" .config; then
+ arch="arm"
+ fi
+ if test "$arch" != ""; then
+ echo "# config arch is $arch"
+ make="make ARCH=$arch"
+ case "$(uname -m)" in
+ i?86) harch="i386";;
+ *) harch="$(uname -m)";;
+ esac
+ echo "# host arch is $harch"
+ if test "$arch" != "$harch"; then
+ echo "# arch mismatch -> skip init"
+ configs="${configs//init //}"
+ fi
+ fi
+fi
+
+for config in $configs; do
+ if test "$config" = "init"; then
+ do_init
+ continue
+ fi
+ do_apply $config
+ if test "$arch" != ""; then
+ do_apply $config-$arch
+ fi
done
diff --git a/qemu-arm.config b/qemu-arm.config
new file mode 100644
index 0000000..6789500
--- /dev/null
+++ b/qemu-arm.config
@@ -0,0 +1,4 @@
+# virtio drivers
+CONFIG_VIRTIO_BLK=y
+CONFIG_VIRTIO_NET=y
+CONFIG_SCSI_VIRTIO=y
diff --git a/qemu-x86_64.config b/qemu-x86_64.config
new file mode 100644
index 0000000..5e4b440
--- /dev/null
+++ b/qemu-x86_64.config
@@ -0,0 +1,4 @@
+# virtio drivers
+CONFIG_VIRTIO_BLK=m
+CONFIG_VIRTIO_NET=m
+CONFIG_SCSI_VIRTIO=m
diff --git a/qemu.config b/qemu.config
index 78df9d4..1d9beec 100644
--- a/qemu.config
+++ b/qemu.config
@@ -21,9 +21,6 @@ CONFIG_VIRTIO_PCI=y
# virtio drivers
CONFIG_VIRTIO_CONSOLE=y
-CONFIG_VIRTIO_BLK=m
-CONFIG_VIRTIO_NET=m
-CONFIG_SCSI_VIRTIO=m
CONFIG_HW_RANDOM_VIRTIO=m
CONFIG_VIRTIO_BALLOON=m