You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

261 lines
6.9 KiB

  1. #
  2. # Copyright (C) 2016 OpenWrt.org
  3. # Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=qemu
  10. PKG_VERSION:=2.6.2
  11. PKG_RELEASE:=3
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  13. PKG_HASH:=9a7ec64f147b9e1e570c410e00ebe271869b5d4c85392ba047db7617c297faa3
  14. PKG_SOURCE_URL:=http://wiki.qemu-project.org/download/
  15. PKG_LICENSE:=GPL-2.0
  16. PKG_LICENSE_FILES:=LICENSE tcg/LICENSE
  17. PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
  18. PKG_INSTALL:=1
  19. PKG_USE_MIPS16:=0
  20. include $(INCLUDE_DIR)/uclibc++.mk
  21. include $(INCLUDE_DIR)/package.mk
  22. QEMU_DEPS_IN_GUEST := @(TARGET_x86_64||TARGET_armvirt||TARGET_arm64||TARGET_malta)
  23. QEMU_DEPS_IN_HOST := @(TARGET_x86_64||TARGET_sunxi)
  24. define Package/virtio-console-helper
  25. SECTION:=utils
  26. CATEGORY:=Utilities
  27. SUBMENU:=Virtualization
  28. TITLE:=Helper script for vportNpn virtio-console devices
  29. DEPENDS:=$(QEMU_DEPS_IN_GUEST)
  30. endef
  31. define Package/virtio-console-helper/install
  32. $(INSTALL_DIR) $(1)/etc/hotplug.d/virtio-ports
  33. $(INSTALL_BIN) ./files/00-virtio-ports.hotplug $(1)/etc/hotplug.d/virtio-ports/00-virtio-ports
  34. endef
  35. define Package/qemu-ga
  36. SECTION:=utils
  37. CATEGORY:=Utilities
  38. SUBMENU:=Virtualization
  39. TITLE:=QEMU Guest Agent
  40. URL:=http://www.qemu.org
  41. DEPENDS:= +glib2 +virtio-console-helper $(CXX_DEPENDS) $(QEMU_DEPS_IN_GUEST)
  42. endef
  43. define Package/qemu-ga/description
  44. This package contains the QEMU Guest Agent daemon
  45. endef
  46. define Package/qemu-ga/install
  47. $(INSTALL_DIR) $(1)/usr/bin
  48. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qemu-ga $(1)/usr/bin
  49. $(INSTALL_DIR) $(1)/etc/init.d
  50. $(INSTALL_BIN) ./files/qemu-ga.init $(1)/etc/init.d/qemu-ga
  51. $(INSTALL_DIR) $(1)/etc/hotplug.d/virtio-ports
  52. $(INSTALL_BIN) ./files/10-qemu-ga.hotplug $(1)/etc/hotplug.d/virtio-ports/10-qemu-ga
  53. endef
  54. define Package/qemu-blobs
  55. SECTION:=utils
  56. CATEGORY:=Utilities
  57. SUBMENU:=Virtualization
  58. TITLE:=QEMU blobs of BIOS, VGA BIOS and keymaps
  59. URL:=http://www.qemu.org
  60. DEPENDS:=$(QEMU_DEPS_IN_HOST)
  61. endef
  62. define Package/qemu-blobs/install
  63. $(INSTALL_DIR) $(1)/usr/share/qemu
  64. $(CP) $(PKG_INSTALL_DIR)/usr/share/qemu/* $(1)/usr/share/qemu
  65. endef
  66. define Package/qemu-bridge-helper
  67. SECTION:=utils
  68. CATEGORY:=Utilities
  69. SUBMENU:=Virtualization
  70. TITLE:=QEMU bridge helper
  71. URL:=http://www.qemu.org
  72. DEPENDS:=+glib2 $(CXX_DEPENDS) $(QEMU_DEPS_IN_HOST)
  73. endef
  74. define Package/qemu-bridge-helper/install
  75. $(INSTALL_DIR) $(1)/usr/lib/
  76. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/qemu-bridge-helper $(1)/usr/lib
  77. $(INSTALL_DIR) $(1)/etc/qemu
  78. $(INSTALL_DATA) ./files/bridge.conf $(1)/etc/qemu
  79. endef
  80. PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_qemu-ga
  81. # Naming rules used in qemu Makefile.target
  82. define qemu-prog_
  83. $(if $(filter %-softmmu,$(1)), \
  84. $(patsubst %-softmmu,qemu-system-%,$(1)), \
  85. $(error unknown qemu target $(1)) \
  86. )
  87. endef
  88. qemu-prog = $(strip $(call qemu-prog_,$(1)))
  89. # Why libfdt was enabled for all softmmu targets: according to qemu's
  90. # configure script, libfdt is only strictly required for the following targets
  91. # and is optional for others. But libfdt support will be built into other
  92. # targets when any single target enabled it.
  93. #
  94. # aarch64%-softmmu arm%-softmmu ppc%-softmmu microblaze%-softmmu
  95. #
  96. define qemu-target
  97. PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_qemu-$(1)
  98. define Package/qemu-$(1)
  99. SECTION:=utils
  100. CATEGORY:=Utilities
  101. SUBMENU:=Virtualization
  102. TITLE:=QEMU target $(1)
  103. URL:=http://www.qemu.org
  104. DEPENDS:= +glib2 +libpthread +zlib $(CXX_DEPENDS) $(QEMU_DEPS_IN_HOST) \
  105. $(if $(filter %-softmmu,$(1)),+libncurses +libfdt +qemu-blobs)
  106. endef
  107. define Package/qemu-$(1)/description
  108. This package contains the QEMU target $(1)
  109. endef
  110. define Package/qemu-$(1)/install
  111. $(INSTALL_DIR) $$(1)/usr/bin
  112. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(call qemu-prog,$(1)) $$(1)/usr/bin
  113. endef
  114. endef
  115. QEMU_TARGET_LIST := \
  116. x86_64-softmmu \
  117. arm-softmmu \
  118. $(foreach target,$(QEMU_TARGET_LIST), \
  119. $(eval $(call qemu-target,$(target))) \
  120. )
  121. # QEMU configure script does not recognize these options
  122. CONFIGURE_ARGS:=$(filter-out \
  123. --target=% \
  124. --host=% \
  125. --build=% \
  126. --program-prefix=% \
  127. --program-suffix=% \
  128. --exec-prefix=% \
  129. --disable-nls \
  130. , $(CONFIGURE_ARGS))
  131. # Tell build system of qemu to not add _FORTIFY_SOURCE options and let the base
  132. # build system decide flavor of fortify_source to use
  133. CONFIGURE_ARGS += \
  134. --cross-prefix=$(TARGET_CROSS) \
  135. --host-cc="$(HOSTCC)" \
  136. --disable-fortify-source \
  137. --disable-stack-protector \
  138. CONFIGURE_ARGS += \
  139. --audio-drv-list='' \
  140. --disable-debug-info \
  141. --disable-modules \
  142. --disable-sdl \
  143. --disable-qom-cast-debug \
  144. --disable-virtfs \
  145. --disable-vnc \
  146. --disable-debug-tcg \
  147. --disable-sparse \
  148. --disable-strip \
  149. --disable-vnc-sasl \
  150. --disable-vnc-jpeg \
  151. --disable-vnc-png \
  152. --disable-uuid \
  153. --disable-vde \
  154. --disable-netmap \
  155. --disable-xen \
  156. --disable-xen-pci-passthrough \
  157. --disable-xen-pv-domain-build \
  158. --disable-brlapi \
  159. --disable-bluez \
  160. --disable-tcg-interpreter \
  161. --disable-cap-ng \
  162. --disable-spice \
  163. --disable-libiscsi \
  164. --disable-libnfs \
  165. --disable-cocoa \
  166. --disable-bsd-user \
  167. --disable-curl \
  168. --disable-linux-aio \
  169. --disable-attr \
  170. --disable-docs \
  171. --disable-opengl \
  172. --disable-rbd \
  173. --disable-xfsctl \
  174. --disable-smartcard \
  175. --disable-libusb \
  176. --disable-usb-redir \
  177. --disable-zlib-test \
  178. --disable-lzo \
  179. --disable-snappy \
  180. --disable-bzip2 \
  181. --disable-guest-agent-msi \
  182. --disable-tools \
  183. --disable-seccomp \
  184. --disable-glusterfs \
  185. --disable-archipelago \
  186. --disable-gtk \
  187. --disable-gnutls \
  188. --disable-nettle \
  189. --disable-gcrypt \
  190. --disable-rdma \
  191. --disable-vte \
  192. --disable-virglrenderer \
  193. --disable-tpm \
  194. --disable-libssh2 \
  195. --disable-vhdx \
  196. --disable-numa \
  197. --disable-tcmalloc \
  198. --disable-jemalloc \
  199. --disable-strip \
  200. --disable-werror \
  201. QEMU_CONFIGURE_TARGET_LIST := $(foreach target,$(QEMU_TARGET_LIST),$(if $(CONFIG_PACKAGE_qemu-$(target)),$(target)))
  202. CONFIGURE_ARGS += --target-list='$(QEMU_CONFIGURE_TARGET_LIST)'
  203. ifneq ($(CONFIG_PACKAGE_qemu-ga),)
  204. CONFIGURE_ARGS += --enable-guest-agent
  205. endif
  206. TARGET_LDFLAGS += -Wl,--as-needed
  207. MAKE_VARS += V=s
  208. # ARCH is special in qemu's build system, e.g. ARCH mips64 will be translated
  209. # there to mips and stored in config-host.mak
  210. MAKE_FLAGS:=$(filter-out \
  211. ARCH=% \
  212. ,$(MAKE_FLAGS))
  213. QEMU_MAKE_TARGETS := \
  214. $(if $(CONFIG_PACKAGE_qemu-ga),qemu-ga) \
  215. $(if $(CONFIG_PACKAGE_qemu-bridge-helper),qemu-bridge-helper) \
  216. $(foreach target,$(QEMU_TARGET_LIST),$(if $(CONFIG_PACKAGE_qemu-$(target)),subdir-$(target))) \
  217. define Build/Compile
  218. $(if $(strip $(QEMU_MAKE_TARGETS)),$(call Build/Compile/Default,$(QEMU_MAKE_TARGETS)))
  219. endef
  220. $(eval $(call BuildPackage,virtio-console-helper))
  221. $(eval $(call BuildPackage,qemu-ga))
  222. $(eval $(call BuildPackage,qemu-bridge-helper))
  223. $(eval $(call BuildPackage,qemu-blobs))
  224. $(foreach target,$(QEMU_TARGET_LIST), \
  225. $(eval $(call BuildPackage,qemu-$(target))) \
  226. )