qemu: virtio-console-helper as a separate package
authorYousong Zhou <yszhou4tech@gmail.com>
Tue, 29 Nov 2016 04:18:26 +0000 (12:18 +0800)
committerYousong Zhou <yszhou4tech@gmail.com>
Mon, 12 Dec 2016 03:32:22 +0000 (21:32 -0600)
While at it, update copyright header.

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
utils/qemu/Makefile
utils/qemu/files/00-virtio-ports.hotplug [new file with mode: 0755]
utils/qemu/files/10-qemu-ga.hotplug [new file with mode: 0755]
utils/qemu/files/virtio-ports.hotplug [deleted file]

index c512dec32d89a2e61e2e4f045d292bc2701e469e..5990f38a205cac42a94fd7418abfc76b6d8b8eb9 100644 (file)
@@ -1,5 +1,6 @@
 #
 # Copyright (C) 2016 OpenWrt.org
+# Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=qemu
 PKG_VERSION:=2.6.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://wiki.qemu-project.org/download/
 PKG_SOURCE_MD5SUM:=bdf1f3d0c177ebeb35a079a4bc3fc74e
@@ -23,12 +24,25 @@ PKG_USE_MIPS16:=0
 include $(INCLUDE_DIR)/uclibc++.mk
 include $(INCLUDE_DIR)/package.mk
 
+
+define Package/virtio-console-helper
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Helper script for vportNpn virtio-console devices
+endef
+
+define Package/virtio-console-helper/install
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/virtio-ports
+       $(INSTALL_BIN) ./files/00-virtio-ports.hotplug $(1)/etc/hotplug.d/virtio-ports/00-virtio-ports
+endef
+
+
 define Package/qemu-ga
   SECTION:=utils
   CATEGORY:=Utilities
   TITLE:=QEMU Guest Agent
   URL:=http://www.qemu.org
-  DEPENDS:= +glib2 $(CXX_DEPENDS)
+  DEPENDS:= +glib2 +virtio-console-helper $(CXX_DEPENDS)
 endef
 
 define Package/qemu-ga/description
@@ -41,9 +55,10 @@ define Package/qemu-ga/install
        $(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
+       $(INSTALL_BIN) ./files/10-qemu-ga.hotplug $(1)/etc/hotplug.d/virtio-ports/10-qemu-ga
 endef
 
+
 define Package/qemu-blobs
   SECTION:=utils
   CATEGORY:=Utilities
@@ -229,6 +244,7 @@ define Build/Compile
        $(if $(strip $(QEMU_MAKE_TARGETS)),$(call Build/Compile/Default,$(QEMU_MAKE_TARGETS)))
 endef
 
+$(eval $(call BuildPackage,virtio-console-helper))
 $(eval $(call BuildPackage,qemu-ga))
 $(eval $(call BuildPackage,qemu-bridge-helper))
 $(eval $(call BuildPackage,qemu-blobs))
diff --git a/utils/qemu/files/00-virtio-ports.hotplug b/utils/qemu/files/00-virtio-ports.hotplug
new file mode 100755 (executable)
index 0000000..1edea39
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Copyright (C) 2016 OpenWrt.org
+# Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
+
+[ "$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"
+               ;;
+       "del")
+               rm -f "/dev/virtio-ports/$name"
+               ;;
+esac
diff --git a/utils/qemu/files/10-qemu-ga.hotplug b/utils/qemu/files/10-qemu-ga.hotplug
new file mode 100755 (executable)
index 0000000..56256ca
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+# Copyright (C) 2016 OpenWrt.org
+# Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
+
+[ "$SUBSYSTEM" = "virtio-ports" ] || exit 0
+
+syspath="/sys/$DEVPATH"
+name="$(cat "$syspath/name" 2>/dev/null)"
+[ -n "$name" ] || exit 0
+
+case "$ACTION" in
+       "add")
+               /etc/init.d/qemu-ga start
+               ;;
+esac
diff --git a/utils/qemu/files/virtio-ports.hotplug b/utils/qemu/files/virtio-ports.hotplug
deleted file mode 100755 (executable)
index 35919a5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/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