2 # Copyright (C) 2016 OpenWrt.org
3 # Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
9 include $(TOPDIR
)/rules.mk
14 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
15 PKG_HASH
:=9a7ec64f147b9e1e570c410e00ebe271869b5d4c85392ba047db7617c297faa3
16 PKG_SOURCE_URL
:=http
://wiki.qemu-project.org
/download
/
18 PKG_LICENSE_FILES
:=LICENSE tcg
/LICENSE
19 PKG_MAINTAINER
:=Yousong Zhou
<yszhou4tech@gmail.com
>
24 include $(INCLUDE_DIR
)/uclibc
++.mk
25 include $(INCLUDE_DIR
)/package.mk
28 QEMU_DEPS_IN_GUEST
:= @
(TARGET_x86_64||TARGET_armvirt||TARGET_arm64||TARGET_malta
)
29 QEMU_DEPS_IN_HOST
:= @
(TARGET_x86_64||TARGET_sunxi
)
31 define Package
/virtio-console-helper
34 SUBMENU
:=Virtualization
35 TITLE
:=Helper script for vportNpn virtio-console devices
36 DEPENDS
:=$(QEMU_DEPS_IN_GUEST
)
39 define Package
/virtio-console-helper
/install
40 $(INSTALL_DIR
) $(1)/etc
/hotplug.d
/virtio-ports
41 $(INSTALL_BIN
) .
/files
/00-virtio-ports.hotplug
$(1)/etc
/hotplug.d
/virtio-ports
/00-virtio-ports
45 define Package
/qemu-ga
48 SUBMENU
:=Virtualization
49 TITLE
:=QEMU Guest Agent
50 URL
:=http
://www.qemu.org
51 DEPENDS
:= +glib2
+virtio-console-helper
$(CXX_DEPENDS
) $(QEMU_DEPS_IN_GUEST
)
54 define Package
/qemu-ga
/description
55 This package contains the QEMU Guest Agent daemon
58 define Package
/qemu-ga
/install
59 $(INSTALL_DIR
) $(1)/usr
/bin
60 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/qemu-ga
$(1)/usr
/bin
61 $(INSTALL_DIR
) $(1)/etc
/init.d
62 $(INSTALL_BIN
) .
/files
/qemu-ga.init
$(1)/etc
/init.d
/qemu-ga
63 $(INSTALL_DIR
) $(1)/etc
/hotplug.d
/virtio-ports
64 $(INSTALL_BIN
) .
/files
/10-qemu-ga.hotplug
$(1)/etc
/hotplug.d
/virtio-ports
/10-qemu-ga
68 define Package
/qemu-blobs
71 SUBMENU
:=Virtualization
72 TITLE
:=QEMU blobs of BIOS
, VGA BIOS and keymaps
73 URL
:=http
://www.qemu.org
74 DEPENDS
:=$(QEMU_DEPS_IN_HOST
)
77 define Package
/qemu-blobs
/install
78 $(INSTALL_DIR
) $(1)/usr
/share
/qemu
79 $(CP
) $(PKG_INSTALL_DIR
)/usr
/share
/qemu
/* $(1)/usr
/share
/qemu
82 define Package
/qemu-bridge-helper
85 SUBMENU
:=Virtualization
86 TITLE
:=QEMU bridge helper
87 URL
:=http
://www.qemu.org
88 DEPENDS
:=+glib2
$(CXX_DEPENDS
) $(QEMU_DEPS_IN_HOST
)
91 define Package
/qemu-bridge-helper
/install
92 $(INSTALL_DIR
) $(1)/usr
/lib
/
93 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/lib
/qemu-bridge-helper
$(1)/usr
/lib
94 $(INSTALL_DIR
) $(1)/etc
/qemu
95 $(INSTALL_DATA
) .
/files
/bridge.conf
$(1)/etc
/qemu
98 PKG_CONFIG_DEPENDS
+= CONFIG_PACKAGE_qemu-ga
100 # Naming rules used in qemu Makefile.target
102 $(if
$(filter %-softmmu
,$(1)), \
103 $(patsubst %-softmmu
,qemu-system-
%,$(1)), \
104 $(error unknown qemu target
$(1)) \
107 qemu-prog
= $(strip $(call qemu-prog_
,$(1)))
109 # Why libfdt was enabled for all softmmu targets: according to qemu's
110 # configure script, libfdt is only strictly required for the following targets
111 # and is optional for others. But libfdt support will be built into other
112 # targets when any single target enabled it.
114 # aarch64%-softmmu arm%-softmmu ppc%-softmmu microblaze%-softmmu
117 PKG_CONFIG_DEPENDS
+= CONFIG_PACKAGE_qemu-
$(1)
119 define Package
/qemu-
$(1)
122 SUBMENU
:=Virtualization
123 TITLE
:=QEMU target
$(1)
124 URL
:=http
://www.qemu.org
125 DEPENDS
:= +glib2
+libpthread
+zlib
$(CXX_DEPENDS
) $(QEMU_DEPS_IN_HOST
) \
126 $(if
$(filter %-softmmu
,$(1)),+libncurses
+libfdt
+qemu-blobs
)
129 define Package
/qemu-
$(1)/description
130 This package contains the QEMU target
$(1)
133 define Package
/qemu-
$(1)/install
134 $(INSTALL_DIR
) $$(1)/usr
/bin
135 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/$(call qemu-prog
,$(1)) $$(1)/usr
/bin
140 QEMU_TARGET_LIST
:= \
144 $(foreach target
,$(QEMU_TARGET_LIST
), \
145 $(eval
$(call qemu-target
,$(target
))) \
148 # QEMU configure script does not recognize these options
149 CONFIGURE_ARGS
:=$(filter-out \
159 # Tell build system of qemu to not add _FORTIFY_SOURCE options and let the base
160 # build system decide flavor of fortify_source to use
162 --cross-prefix
=$(TARGET_CROSS
) \
163 --host-cc
="$(HOSTCC)" \
164 --disable-fortify-source \
165 --disable-stack-protector \
168 --audio-drv-list
='' \
169 --disable-debug-info \
172 --disable-qom-cast-debug \
175 --disable-debug-tcg \
185 --disable-xen-pci-passthrough \
186 --disable-xen-pv-domain-build \
189 --disable-tcg-interpreter \
197 --disable-linux-aio \
203 --disable-smartcard \
205 --disable-usb-redir \
206 --disable-zlib-test \
210 --disable-guest-agent-msi \
213 --disable-glusterfs \
214 --disable-archipelago \
221 --disable-virglrenderer \
231 QEMU_CONFIGURE_TARGET_LIST
:= $(foreach target
,$(QEMU_TARGET_LIST
),$(if
$(CONFIG_PACKAGE_qemu-
$(target
)),$(target
)))
232 CONFIGURE_ARGS
+= --target-list
='$(QEMU_CONFIGURE_TARGET_LIST)'
234 ifneq ($(CONFIG_PACKAGE_qemu-ga
),)
235 CONFIGURE_ARGS
+= --enable-guest-agent
238 TARGET_LDFLAGS
+= -Wl
,--as-needed
240 # ARCH is special in qemu's build system, e.g. ARCH mips64 will be translated
241 # there to mips and stored in config-host.mak
242 MAKE_FLAGS
:=$(filter-out \
246 QEMU_MAKE_TARGETS
:= \
247 $(if
$(CONFIG_PACKAGE_qemu-ga
),qemu-ga
) \
248 $(if
$(CONFIG_PACKAGE_qemu-bridge-helper
),qemu-bridge-helper
) \
249 $(foreach target
,$(QEMU_TARGET_LIST
),$(if
$(CONFIG_PACKAGE_qemu-
$(target
)),subdir-
$(target
))) \
252 $(if
$(strip $(QEMU_MAKE_TARGETS
)),$(call Build
/Compile
/Default
,$(QEMU_MAKE_TARGETS
)))
255 $(eval
$(call BuildPackage
,virtio-console-helper
))
256 $(eval
$(call BuildPackage
,qemu-ga
))
257 $(eval
$(call BuildPackage
,qemu-bridge-helper
))
258 $(eval
$(call BuildPackage
,qemu-blobs
))
259 $(foreach target
,$(QEMU_TARGET_LIST
), \
260 $(eval
$(call BuildPackage
,qemu-
$(target
))) \