Add a KVM guest subtarget to the x86 target. Since VirtIO is the
preferred I/O virtualization platform for kvm, this target expects it's
root device to be /dev/vda.

Signed-off-by: Stijn Tintel <st...@linux-ipv6.be>
---
 target/linux/x86/Makefile                         |    2 +-
 target/linux/x86/image/Config.in                  |    7 ++++---
 target/linux/x86/kvm_guest/base-files/etc/inittab |    5 +++++
 target/linux/x86/kvm_guest/config-default         |   10 ++++++++++
 target/linux/x86/kvm_guest/target.mk              |    2 ++
 5 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/x86/kvm_guest/base-files/etc/inittab
 create mode 100644 target/linux/x86/kvm_guest/config-default
 create mode 100644 target/linux/x86/kvm_guest/target.mk

diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile
index e9b7cba..71e95cc 100644
--- a/target/linux/x86/Makefile
+++ b/target/linux/x86/Makefile
@@ -10,7 +10,7 @@ ARCH:=i386
 BOARD:=x86
 BOARDNAME:=x86
 FEATURES:=squashfs jffs2 ext2 vdi vmdk pcmcia tgz
-SUBTARGETS=generic olpc xen_domu
+SUBTARGETS=generic kvm_guest olpc xen_domu
 
 LINUX_VERSION:=2.6.32.9
 
diff --git a/target/linux/x86/image/Config.in b/target/linux/x86/image/Config.in
index 9d17f37..88bf040 100644
--- a/target/linux/x86/image/Config.in
+++ b/target/linux/x86/image/Config.in
@@ -20,8 +20,8 @@ config X86_GRUB_SERIAL
     string
     prompt "Serial port device"
     depends X86_GRUB_IMAGES
-    default "hvc0" if TARGET_x86_xen_domu
-    default "ttyS0" if ! TARGET_x86_xen_domu
+    default "hvc0" if (TARGET_x86_kvm_guest || TARGET_x86_xen_domu)
+    default "ttyS0" if ! (TARGET_x86_kvm_guest || TARGET_x86_xen_domu)
 
 config X86_GRUB_BAUDRATE
     int "Serial port baud rate"
@@ -37,8 +37,9 @@ config X86_GRUB_KERNELPART
 config X86_GRUB_ROOTPART
     string
     prompt "Root partition on target device" if X86_GRUB_IMAGES
+    default "/dev/vda2" if TARGET_x86_kvm_guest
     default "/dev/xvda2" if TARGET_x86_xen_domu
-    default "/dev/sda2" if ! TARGET_x86_xen_domu
+    default "/dev/sda2" if ! (TARGET_x86_kvm_guest || TARGET_x86_xen_domu)
     help
         The root partition on the final device.  If you don't know,
         you probably want the default (/dev/sda2).
diff --git a/target/linux/x86/kvm_guest/base-files/etc/inittab 
b/target/linux/x86/kvm_guest/base-files/etc/inittab
new file mode 100644
index 0000000..469b8a9
--- /dev/null
+++ b/target/linux/x86/kvm_guest/base-files/etc/inittab
@@ -0,0 +1,5 @@
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K stop
+tts/0::askfirst:/bin/ash --login
+hvc0::askfirst:/bin/ash --login
+tty1::askfirst:/bin/ash --login
diff --git a/target/linux/x86/kvm_guest/config-default 
b/target/linux/x86/kvm_guest/config-default
new file mode 100644
index 0000000..2231d2e
--- /dev/null
+++ b/target/linux/x86/kvm_guest/config-default
@@ -0,0 +1,10 @@
+CONFIG_HAVE_KVM=n
+CONFIG_MICROCODE=n
+CONFIG_NR_CPUS=4
+CONFIG_VIRTIO=y
+CONFIG_VIRTIO_BLK=y
+CONFIG_VIRTIO_CONSOLE=y
+CONFIG_VIRTIO_PCI=y
+CONFIG_VIRTIO_RING=y
+CONFIG_VIRTUALIZATION=y
+CONFIG_X86_PAT=n
diff --git a/target/linux/x86/kvm_guest/target.mk 
b/target/linux/x86/kvm_guest/target.mk
new file mode 100644
index 0000000..7e48f64
--- /dev/null
+++ b/target/linux/x86/kvm_guest/target.mk
@@ -0,0 +1,2 @@
+BOARDNAME:=KVM Guest
+DEFAULT_PACKAGES += kmod-virtio-balloon kmod-virtio-net kmod-virtio-random
-- 
1.6.4.4

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to