Skip to content

Commit

Permalink
add Hyper-V vhd image in x86/x64
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsnowwolf committed Mar 31, 2018
1 parent 80ce76a commit 5115233
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions config/Config-images.in
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ menu "Target Images"
depends on GRUB_IMAGES || EFI_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
default n
depends on GRUB_IMAGES || EFI_IMAGES
select TARGET_IMAGES_PAD
select PACKAGE_kmod-tulip

config TARGET_IMAGES_PAD
bool "Pad images to filesystem size (for JFFS2)"
Expand Down
2 changes: 1 addition & 1 deletion target/linux/x86/64/config-default
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ CONFIG_ARCH_MMAP_RND_BITS_MAX=32
CONFIG_ARCH_MMAP_RND_BITS_MIN=28
CONFIG_VMAP_STACK=y
CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS=y
CONFIG_PCI_HYPERV=y
# CONFIG_PCI_HYPERV is not set
CONFIG_VMD=n
CONFIG_VIRTIO_VSOCKETS=n
CONFIG_SATA_ZPODD=n
Expand Down
17 changes: 17 additions & 0 deletions target/linux/x86/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,21 @@ 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
define Image/Build/vhd_efi
rm $(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).vmdk || true
qemu-img convert -f raw -O vpc \
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).img \
$(BIN_DIR)/$(IMG_PREFIX)-uefi-gpt-$(1).vhd
endef
endif

define Image/Build/gzip
gzip -f9n $(BIN_DIR)/$(IMG_PREFIX)-rootfs-$(1).img
ifneq ($(CONFIG_GRUB_IMAGES),)
Expand Down Expand Up @@ -288,10 +303,12 @@ define Image/Build
ifneq ($(CONFIG_GRUB_IMAGES),)
$(call Image/Build/vdi,$(1))
$(call Image/Build/vmdk,$(1))
$(call Image/Build/vhd,$(1))
endif
ifneq ($(CONFIG_EFI_IMAGES),)
$(call Image/Build/vdi_efi,$(1))
$(call Image/Build/vmdk_efi,$(1))
$(call Image/Build/vhd_efi,$(1))
endif
$(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-rootfs-$(1).img
else
Expand Down

0 comments on commit 5115233

Please sign in to comment.