|
修改的patch源代码如下:
diff --git a/config/Config-images.in b/config/Config-images.in
index a60dd50..f83317f 100644
--- a/config/Config-images.in
+++ b/config/Config-images.in
@@ -231,6 +231,16 @@ menu "Target Images"
select TARGET_IMAGES_PAD
select PACKAGE_kmod-e1000
+ config VHD_IMAGES
+ bool "Build Hyper-V image files (VHD)"
+ depends on TARGET_x86 || TARGET_x86_64
+ select GRUB_IMAGES
+ select TARGET_IMAGES_PAD
+ select PACKAGE_kmod-hyperv-balloon
+ select PACKAGE_kmod-hyperv-net-vsc
+ select PACKAGE_kmod-hyperv-util
+ select PACKAGE_kmod-hyperv-storage
+
config VMDK_IMAGES
bool "Build VMware image files (VMDK)"
depends on TARGET_x86 || TARGET_x86_64
复制代码diff --git a/package/kernel/linux/modules/virtual.mk b/package/kernel/linux/modules/virtual.mk
index 4464fe9..d4b55ae 100644
--- a/package/kernel/linux/modules/virtual.mk
+++ b/package/kernel/linux/modules/virtual.mk
@@ -186,3 +186,85 @@ define KernelPackage/xen-pcidev/description
endef
$(eval $(call KernelPackage,xen-pcidev))
+
+#
+# Hyper-V Drives depends on x86 or x86_64.
+#
+define KernelPackage/hyperv-balloon
+ SUBMENU:=$(VIRTUAL_MENU)
+ DEPENDS:=@(TARGET_x86||TARGET_x86_64)
+ TITLE:=Microsoft Hyper-V Balloon Driver
+ KCONFIG:= \
+ CONFIG_HYPERV_BALLOON \
+ CONFIG_HYPERVISOR_GUEST=y \
+ CONFIG_PARAVIRT=n \
+ CONFIG_HYPERV=y
+ FILES:=$(LINUX_DIR)/drivers/hv/hv_balloon.ko
+ AUTOLOAD:=$(call AutoLoad,06,hv_balloon)
+endef
+
+define KernelPackage/hyperv-balloon/description
+ Microsofot Hyper-V balloon driver.
+endef
+
+$(eval $(call KernelPackage,hyperv-balloon))
+
+define KernelPackage/hyperv-net-vsc
+ SUBMENU:=$(VIRTUAL_MENU)
+ DEPENDS:=@(TARGET_x86||TARGET_x86_64)
+ TITLE:=Microsoft Hyper-V Network Driver
+ KCONFIG:= \
+ CONFIG_HYPERV_NET \
+ CONFIG_HYPERVISOR_GUEST=y \
+ CONFIG_PARAVIRT=n \
+ CONFIG_HYPERV=y
+ FILES:=$(LINUX_DIR)/drivers/net/hyperv/hv_netvsc.ko
+ AUTOLOAD:=$(call AutoLoad,35,hv_netvsc)
+endef
+
+define KernelPackage/hyperv-net-vsc/description
+ Microsoft Hyper-V Network Driver
+endef
+
+$(eval $(call KernelPackage,hyperv-net-vsc))
+
+define KernelPackage/hyperv-util
+ SUBMENU:=$(VIRTUAL_MENU)
+ DEPENDS:=@(TARGET_x86||TARGET_x86_64)
+ TITLE:=Microsoft Hyper-V Utility Driver
+ KCONFIG:= \
+ CONFIG_HYPERV_UTILS \
+ CONFIG_HYPERVISOR_GUEST=y \
+ CONFIG_PARAVIRT=n \
+ CONFIG_HYPERV=y
+ FILES:=$(LINUX_DIR)/drivers/hv/hv_util.ko
+ AUTOLOAD:=$(call AutoLoad,10,hv_util)
+endef
+
+define KernelPackage/hyperv-util/description
+ Microsoft Hyper-V Utility Driver
+endef
+
+$(eval $(call KernelPackage,hyperv-util))
+
+#
+# Hyper-V Storage Drive needs to be in kernel rather than module to load the root fs.
+#
+define KernelPackage/hyperv-storage
+ SUBMENU:=$(VIRTUAL_MENU)
+ DEPENDS:=@(TARGET_x86||TARGET_x86_64) +kmod-scsi-core
+ TITLE:=Microsoft Hyper-V Storage Driver
+ KCONFIG:= \
+ CONFIG_HYPERV_STORAGE=y \
+ CONFIG_HYPERVISOR_GUEST=y \
+ CONFIG_PARAVIRT=n \
+ CONFIG_HYPERV=y
+ FILES:=$(LINUX_DIR)/drivers/scsi/hv_storvsc.ko
+ AUTOLOAD:=$(call AutoLoad,40,hv_storvsc)
+endef
+
+define KernelPackage/hyperv-storage/description
+ Microsoft Hyper-V Storage Driver
+endef
+
+$(eval $(call KernelPackage,hyperv-storage))
复制代码diff --git a/target/linux/x86/64/config-default b/target/linux/x86/64/config-default
index 1caad74..32c7648 100644
--- a/target/linux/x86/64/config-default
+++ b/target/linux/x86/64/config-default
@@ -99,6 +99,14 @@ CONFIG_HPET_MMAP=y
CONFIG_HW_RANDOM_INTEL=y
# CONFIG_HW_RANDOM_VIRTIO is not set
CONFIG_HYPERVISOR_GUEST=y
+# CONFIG_HYPERV is not set
+# CONFIG_HYPERV_BALLOON is not set
+# CONFIG_HYPERV_NET is not set
+# CONFIG_HYPERV_STORAGE is not set
+# CONFIG_HYPERV_UTILS is not set
+# CONFIG_FB_HYPERV is not set
+# CONFIG_HID_HYPERV_MOUSE is not set
+# CONFIG_HYPERV_KEYBOARD is not set
# CONFIG_I7300_IDLE is not set
# CONFIG_IA32_EMULATION is not set
CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000
复制代码diff --git a/target/linux/x86/config-3.18 b/target/linux/x86/config-3.18
index d7a2d61..6dfdfd7 100644
--- a/target/linux/x86/config-3.18
+++ b/target/linux/x86/config-3.18
@@ -203,6 +203,17 @@ CONFIG_HW_RANDOM=y
CONFIG_HW_RANDOM_GEODE=y
CONFIG_HW_RANDOM_VIA=y
# CONFIG_HYPERVISOR_GUEST is not set
+
+# CONFIG_HYPERV is not set
+# CONFIG_HYPERV_BALLOON is not set
+# CONFIG_HYPERV_NET is not set
+# CONFIG_HYPERV_STORAGE is not set
+# CONFIG_HYPERV_UTILS is not set
+# CONFIG_FB_HYPERV is not set
+# CONFIG_HID_HYPERV_MOUSE is not set
+# CONFIG_VMWARE_BALLOON is not set
+# CONFIG_HYPERV_KEYBOARD is not set
+
CONFIG_HZ_PERIODIC=y
CONFIG_I8253_LOCK=y
# CONFIG_I8K is not set
复制代码diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile
index e7e02f1..a52ec11 100644
--- a/target/linux/x86/image/Makefile
+++ b/target/linux/x86/image/Makefile
@@ -148,6 +148,15 @@ ifneq ($(CONFIG_VMDK_IMAGES),)
endef
endif
+ifneq ($(CONFIG_VHD_IMAGES),)
+ define Image/Build/vhd
+ rm $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vhd || true
+ qemu-img convert -f raw -O vpc \
+ $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img \
+ $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).vhd
+ endef
+endif
+
define Image/Build/gzip
gzip -f9 $(BIN_DIR)/$(IMG_PREFIX)-combined-$(1).img
gzip -f9 $(BIN_DIR)/$(IMG_PREFIX)-rootfs-$(1).img
@@ -219,6 +228,7 @@ define Image/Build
$(call Image/Build/grub2,$(1))
$(call Image/Build/vdi,$(1))
$(call Image/Build/vmdk,$(1))
+ $(call Image/Build/vhd,$(1))
$(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-rootfs-$(1).img
else
$(CP) $(KDIR)/root.iso $(BIN_DIR)/$(IMG_PREFIX).iso
复制代码
|
|