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-2018 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.11.1
  11. PKG_RELEASE:=1
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  13. PKG_HASH:=d9df2213ceed32e91dab7bc9dd19c1af83f91ba72c7aeef7605dfaaf81732ccb
  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_BUILD_PARALLEL:=1
  19. PKG_INSTALL:=1
  20. PKG_USE_MIPS16:=0
  21. include $(INCLUDE_DIR)/uclibc++.mk
  22. include $(INCLUDE_DIR)/package.mk
  23. QEMU_DEPS_IN_GUEST := @(TARGET_x86_64||TARGET_armvirt||TARGET_arm64||TARGET_malta)
  24. QEMU_DEPS_IN_HOST := @(TARGET_x86_64||TARGET_sunxi)
  25. define Package/virtio-console-helper
  26. SECTION:=utils
  27. CATEGORY:=Utilities
  28. SUBMENU:=Virtualization
  29. TITLE:=Helper script for vportNpn virtio-console devices
  30. DEPENDS:=$(QEMU_DEPS_IN_GUEST)
  31. endef
  32. define Package/virtio-console-helper/install
  33. $(INSTALL_DIR) $(1)/etc/hotplug.d/virtio-ports
  34. $(INSTALL_BIN) ./files/00-virtio-ports.hotplug $(1)/etc/hotplug.d/virtio-ports/00-virtio-ports
  35. endef
  36. define Package/qemu-ga
  37. SECTION:=utils
  38. CATEGORY:=Utilities
  39. SUBMENU:=Virtualization
  40. TITLE:=QEMU Guest Agent
  41. URL:=http://www.qemu.org
  42. DEPENDS:= +glib2 +virtio-console-helper $(CXX_DEPENDS) $(QEMU_DEPS_IN_GUEST)
  43. endef
  44. define Package/qemu-ga/description
  45. This package contains the QEMU Guest Agent daemon
  46. endef
  47. define Package/qemu-ga/install
  48. $(INSTALL_DIR) $(1)/usr/bin
  49. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qemu-ga $(1)/usr/bin
  50. $(INSTALL_DIR) $(1)/etc/init.d
  51. $(INSTALL_BIN) ./files/qemu-ga.init $(1)/etc/init.d/qemu-ga
  52. $(INSTALL_DIR) $(1)/etc/hotplug.d/virtio-ports
  53. $(INSTALL_BIN) ./files/10-qemu-ga.hotplug $(1)/etc/hotplug.d/virtio-ports/10-qemu-ga
  54. endef
  55. define Package/qemu-blobs
  56. SECTION:=utils
  57. CATEGORY:=Utilities
  58. SUBMENU:=Virtualization
  59. TITLE:=QEMU blobs of BIOS, VGA BIOS and keymaps
  60. URL:=http://www.qemu.org
  61. DEPENDS:=$(QEMU_DEPS_IN_HOST)
  62. endef
  63. define Package/qemu-blobs/install
  64. $(INSTALL_DIR) $(1)/usr/share/qemu
  65. $(CP) $(PKG_INSTALL_DIR)/usr/share/qemu/* $(1)/usr/share/qemu
  66. endef
  67. define Package/qemu-bridge-helper
  68. SECTION:=utils
  69. CATEGORY:=Utilities
  70. SUBMENU:=Virtualization
  71. TITLE:=QEMU bridge helper
  72. URL:=http://www.qemu.org
  73. DEPENDS:=+glib2 $(CXX_DEPENDS) $(QEMU_DEPS_IN_HOST)
  74. endef
  75. define Package/qemu-bridge-helper/install
  76. $(INSTALL_DIR) $(1)/usr/lib/
  77. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/qemu-bridge-helper $(1)/usr/lib
  78. $(INSTALL_DIR) $(1)/etc/qemu
  79. $(INSTALL_DATA) ./files/bridge.conf $(1)/etc/qemu
  80. endef
  81. PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_qemu-ga
  82. # Naming rules used in qemu Makefile.target
  83. define qemu-prog_
  84. $(if $(filter %-softmmu,$(1)), \
  85. $(patsubst %-softmmu,qemu-system-%,$(1)), \
  86. $(error unknown qemu target $(1)) \
  87. )
  88. endef
  89. qemu-prog = $(strip $(call qemu-prog_,$(1)))
  90. # Why libfdt was enabled for all softmmu targets: according to qemu's
  91. # configure script, libfdt is only strictly required for the following targets
  92. # and is optional for others. But libfdt support will be built into other
  93. # targets when any single target enabled it.
  94. #
  95. # aarch64%-softmmu arm%-softmmu ppc%-softmmu microblaze%-softmmu
  96. #
  97. define qemu-target
  98. PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_qemu-$(1)
  99. define Package/qemu-$(1)
  100. SECTION:=utils
  101. CATEGORY:=Utilities
  102. SUBMENU:=Virtualization
  103. TITLE:=QEMU target $(1)
  104. URL:=http://www.qemu.org
  105. DEPENDS:= +glib2 +libpthread +zlib $(CXX_DEPENDS) $(QEMU_DEPS_IN_HOST) \
  106. $(if $(filter %-softmmu,$(1)),+libncurses +libfdt +pixman +qemu-blobs)
  107. endef
  108. define Package/qemu-$(1)/description
  109. This package contains the QEMU target $(1)
  110. endef
  111. define Package/qemu-$(1)/install
  112. $(INSTALL_DIR) $$(1)/usr/bin
  113. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(call qemu-prog,$(1)) $$(1)/usr/bin
  114. endef
  115. endef
  116. QEMU_TARGET_LIST := \
  117. x86_64-softmmu \
  118. arm-softmmu \
  119. $(foreach target,$(QEMU_TARGET_LIST), \
  120. $(eval $(call qemu-target,$(target))) \
  121. )
  122. # QEMU configure script does not recognize these options
  123. CONFIGURE_ARGS:=$(filter-out \
  124. --target=% \
  125. --host=% \
  126. --build=% \
  127. --program-prefix=% \
  128. --program-suffix=% \
  129. --exec-prefix=% \
  130. --disable-nls \
  131. , $(CONFIGURE_ARGS))
  132. # Tell build system of qemu to not add _FORTIFY_SOURCE options and let the base
  133. # build system decide flavor of fortify_source to use
  134. CONFIGURE_ARGS += \
  135. --cross-prefix=$(TARGET_CROSS) \
  136. --host-cc="$(HOSTCC)" \
  137. --disable-fortify-source \
  138. --disable-stack-protector \
  139. CONFIGURE_ARGS += \
  140. --audio-drv-list='' \
  141. --disable-debug-info \
  142. --disable-modules \
  143. --disable-sdl \
  144. --disable-qom-cast-debug \
  145. --disable-virtfs \
  146. --disable-vnc \
  147. --disable-debug-tcg \
  148. --disable-sparse \
  149. --disable-strip \
  150. --disable-vnc-sasl \
  151. --disable-vnc-jpeg \
  152. --disable-vnc-png \
  153. --disable-uuid \
  154. --disable-vde \
  155. --disable-netmap \
  156. --disable-xen \
  157. --disable-xen-pci-passthrough \
  158. --disable-xen-pv-domain-build \
  159. --disable-brlapi \
  160. --disable-bluez \
  161. --disable-tcg-interpreter \
  162. --disable-cap-ng \
  163. --disable-spice \
  164. --disable-libiscsi \
  165. --disable-libnfs \
  166. --disable-cocoa \
  167. --disable-bsd-user \
  168. --disable-curl \
  169. --disable-linux-aio \
  170. --disable-attr \
  171. --disable-docs \
  172. --disable-opengl \
  173. --disable-rbd \
  174. --disable-xfsctl \
  175. --disable-smartcard \
  176. --disable-libusb \
  177. --disable-usb-redir \
  178. --disable-zlib-test \
  179. --disable-lzo \
  180. --disable-snappy \
  181. --disable-bzip2 \
  182. --disable-guest-agent-msi \
  183. --disable-tools \
  184. --disable-seccomp \
  185. --disable-glusterfs \
  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. )