Browse Source

qemu: new package qemu-ga

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
lilik-openwrt-22.03
Yousong Zhou 9 years ago
parent
commit
3ea82eecb7
3 changed files with 96 additions and 0 deletions
  1. +62
    -0
      utils/qemu/Makefile
  2. +15
    -0
      utils/qemu/files/qemu-ga.init
  3. +19
    -0
      utils/qemu/files/virtio-ports.hotplug

+ 62
- 0
utils/qemu/Makefile View File

@ -0,0 +1,62 @@
#
# Copyright (C) 2016 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=qemu
PKG_VERSION:=2.4.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://wiki.qemu-project.org/download/
PKG_SOURCE_MD5SUM:=a895e93ec1dafc34bc64ed676f0d55a6
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE tcg/LICENSE
PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
include $(INCLUDE_DIR)/package.mk
define Package/qemu-ga
SECTION:=utils
CATEGORY:=Utilities
TITLE:=QEMU Guest Agent
URL:=http://www.qemu.org
DEPENDS:=+glib2 +libpthread +libstdcpp +librt
endef
define Package/qemu-ga/description
This package contains the QEMU Guest Agent daemon
endef
# QEMU configure script does not recognize these options
CONFIGURE_ARGS:=$(filter-out \
--target=% \
--host=% \
--build=% \
--program-prefix=% \
--program-suffix=% \
--exec-prefix=% \
--disable-nls \
, $(CONFIGURE_ARGS))
# Building qemu-ga alone does not require zlib
CONFIGURE_ARGS+= \
--cross-prefix=$(TARGET_CROSS) \
--host-cc=$(HOSTCC) \
--target-list='' \
--disable-zlib-test \
--enable-guest-agent
define Package/qemu-ga/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/qemu-ga $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/qemu-ga.init $(1)/etc/init.d/qemu-ga
$(INSTALL_DIR) $(1)/etc/hotplug.d/virtio-ports
$(INSTALL_BIN) ./files/virtio-ports.hotplug $(1)/etc/hotplug.d/virtio-ports/qemu-ga
endef
$(eval $(call BuildPackage,qemu-ga))

+ 15
- 0
utils/qemu/files/qemu-ga.init View File

@ -0,0 +1,15 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2016 OpenWrt.org
START=99
USE_PROCD=1
BIN=/usr/bin/qemu-ga
start_service() {
procd_open_instance
procd_set_param command $BIN
procd_set_param respawn
procd_set_param stderr 1
procd_close_instance
}

+ 19
- 0
utils/qemu/files/virtio-ports.hotplug View File

@ -0,0 +1,19 @@
#!/bin/sh
# Copyright (C) 2016 OpenWrt.org
[ "$SUBSYSTEM" = "virtio-ports" ] || exit 0
syspath="/sys/$DEVPATH"
name="$(cat "$syspath/name" 2>/dev/null)"
[ -n "$name" ] || exit 0
case "$ACTION" in
"add")
mkdir -p /dev/virtio-ports
ln -s "/dev/$DEVNAME" "/dev/virtio-ports/$name"
/etc/init.d/qemu-ga start
;;
"del")
rm -f "/dev/virtio-ports/$name"
;;
esac

Loading…
Cancel
Save