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.

213 lines
6.9 KiB

  1. #
  2. # Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
  3. # Copyright (C) 2014 OpenWrt.org
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. # $Id: Makefile $
  9. include $(TOPDIR)/rules.mk
  10. include $(INCLUDE_DIR)/kernel.mk
  11. PKG_NAME:=openvswitch
  12. PKG_RELEASE:=5
  13. PKG_VERSION:=2.5.0
  14. PKG_RELEASE=$(PKG_SOURCE_VERSION)
  15. PKG_LICENSE:=Apache-2.0
  16. PKG_LICENSE_FILES:=COPYING
  17. PKG_USE_MIPS16:=0
  18. PKG_SOURCE_PROTO:=git
  19. PKG_SOURCE_URL:=https://github.com/openvswitch/ovs
  20. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  21. PKG_SOURCE_VERSION:=22d4614ddf83988a3771fb379ea029e663b4455a
  22. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  23. PKG_BUILD_PARALLEL:=1
  24. PKG_FIXUP:=autoreconf
  25. PKG_INSTALL:=1
  26. # Upstream package supports kernels between 2.6.32 and 4.3
  27. # see https://github.com/openvswitch/ovs/blob/master/FAQ.md
  28. # This list is pruned to only those kernels used in OpenWRT
  29. SUPPORTED_KERNELS:=LINUX_3_18||LINUX_4_1||LINUX_4_3
  30. include $(INCLUDE_DIR)/package.mk
  31. $(call include_mk, python-package.mk)
  32. define Package/openvswitch/Default
  33. SECTION:=net
  34. SUBMENU:=Open vSwitch
  35. CATEGORY:=Network
  36. URL:=http://openvswitch.org/
  37. MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
  38. endef
  39. define Package/openvswitch/Default/description
  40. Open vSwitch is a production quality, multilayer, software-based, Ethernet
  41. virtual switch. It is designed to enable massive network automation through
  42. programmatic extension, while still supporting standard management interfaces
  43. and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In
  44. addition, it is designed to support distribution across multiple physical
  45. servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus
  46. 1000V.
  47. endef
  48. define Package/openvswitch-base
  49. $(call Package/openvswitch/Default)
  50. TITLE:=Open vSwitch Userspace Package (base)
  51. DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch @($(SUPPORTED_KERNELS))
  52. endef
  53. define Package/openvswitch-base/description
  54. Provides the main userspace components required for Open vSwitch to function.
  55. The main OVS tools (ovs-vsctl, ovs-ofctl, etc) are packaged separately
  56. to conserve some room and allow more configurability.
  57. endef
  58. define Package/openvswitch-python
  59. $(call Package/openvswitch/Default)
  60. TITLE:=Open vSwitch Python Support
  61. DEPENDS:=+openvswitch +python
  62. endef
  63. define Package/openvswitch-python/description
  64. Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
  65. endef
  66. define Package/openvswitch-ipsec
  67. $(call Package/openvswitch/Default)
  68. TITLE:=Open vSwitch GRE through IPsec tool
  69. DEPENDS:=+openvswitch-python
  70. endef
  71. define Package/openvswitch-ipsec/description
  72. The ovs-monitor-ipsec script provides support for encrypting GRE tunnels with
  73. IPsec.
  74. endef
  75. define Package/openvswitch-benchmark
  76. $(call Package/openvswitch/Default)
  77. TITLE:=Open vSwitch flow setup benchmark utility
  78. DEPENDS:=+openvswitch
  79. endef
  80. define Package/openvswitch-benchmark/description
  81. Utility for running OpenVSwitch benchmarking
  82. endef
  83. OVS_BIN_TOOLS:=ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovsdb-client
  84. define Package/openvswitch
  85. $(call Package/openvswitch/Default)
  86. TITLE:=Open vSwitch Userspace Package
  87. DEPENDS:=+openvswitch-base $(foreach t,$(OVS_BIN_TOOLS),+openvswitch-$(t))
  88. endef
  89. define Package/openvswitch/description
  90. Provides the main userspace components required for Open vSwitch to function.
  91. Includes also the main OVS utilities (ovs-appctl, ovs-vsctl, etc).
  92. endef
  93. define KernelPackage/openvswitch
  94. SECTION:=kernel
  95. CATEGORY:=Kernel modules
  96. SUBMENU:=Network Support
  97. TITLE:=Open vSwitch Kernel Package
  98. KCONFIG:=CONFIG_BRIDGE
  99. DEPENDS:=+kmod-stp @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan +kmod-nf-conntrack +kmod-nf-conntrack6 @($(SUPPORTED_KERNELS))
  100. FILES:= \
  101. $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
  102. AUTOLOAD:=$(call AutoLoad,21,openvswitch)
  103. endef
  104. define KernelPackage/openvswitch/description
  105. This package contains the Open vSwitch kernel moodule and bridge compat
  106. module. Furthermore, it supports OpenFlow.
  107. endef
  108. CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
  109. CONFIGURE_ARGS += --enable-ndebug
  110. CONFIGURE_ARGS += --disable-ssl
  111. CONFIGURE_ARGS += --enable-shared
  112. TARGET_CFLAGS += -flto -std=gnu99
  113. CONFIGURE_VARS += KARCH=$(LINUX_KARCH)
  114. MAKE_FLAGS += ARCH="$(LINUX_KARCH)"
  115. define OvsBinUtility
  116. define Package/openvswitch-$(1)
  117. $(call Package/openvswitch/Default)
  118. TITLE:=$(2)
  119. DEPENDS:=+openvswitch-base
  120. endef
  121. define Package/openvswitch-$(1)/description
  122. $(2)
  123. endef
  124. define Package/openvswitch-$(1)/install
  125. $(INSTALL_DIR) $$(1)/usr/bin/ ;\
  126. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/
  127. endef
  128. endef
  129. define Package/openvswitch-base/install
  130. $(INSTALL_DIR) $(1)/etc/openvswitch
  131. $(INSTALL_DIR) $(1)/etc/init.d
  132. $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
  133. $(INSTALL_DIR) $(1)/usr/lib/
  134. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto.so* $(1)/usr/lib/
  135. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch.so* $(1)/usr/lib/
  136. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb.so* $(1)/usr/lib/
  137. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow.so* $(1)/usr/lib/
  138. $(INSTALL_DIR) $(1)/usr/bin/
  139. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovsdb-tool $(1)/usr/bin/
  140. $(INSTALL_DIR) $(1)/usr/sbin/
  141. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/
  142. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/
  143. $(INSTALL_DIR) $(1)/usr/share/openvswitch/
  144. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema $(1)/usr/share/openvswitch/
  145. endef
  146. define Package/openvswitch-python/install
  147. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  148. $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  149. endef
  150. define Package/openvswitch-ipsec/install
  151. $(INSTALL_DIR) $(1)/usr/sbin/
  152. $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/
  153. endef
  154. define Package/openvswitch-benchmark/install
  155. $(INSTALL_DIR) $(1)/usr/bin/
  156. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovs-benchmark $(1)/usr/bin/
  157. endef
  158. define Package/openvswitch/install
  159. :
  160. endef
  161. $(eval $(call OvsBinUtility,ovs-appctl,Open vSwitch app control utility))
  162. $(eval $(call OvsBinUtility,ovs-ofctl,Open vSwitch OpenFlow control utility))
  163. $(eval $(call OvsBinUtility,ovs-dpctl,Open vSwitch datapath management utility))
  164. $(eval $(call OvsBinUtility,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
  165. $(eval $(call OvsBinUtility,ovsdb-client,Open vSwitch database JSON-RPC client))
  166. $(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
  167. $(eval $(call BuildPackage,openvswitch-base))
  168. $(eval $(call BuildPackage,openvswitch-python))
  169. $(eval $(call BuildPackage,openvswitch-ipsec))
  170. $(eval $(call BuildPackage,openvswitch-benchmark))
  171. $(eval $(call BuildPackage,openvswitch))
  172. $(eval $(call KernelPackage,openvswitch))