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.

281 lines
10 KiB

  1. #
  2. # Copyright (C) 2013 Julius Schulz-Zander <julius@net.t-labs.tu-berlin.de>
  3. # Copyright (C) 2014-2017 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:=1
  13. PKG_VERSION:=2.8.1
  14. PKG_LICENSE:=Apache-2.0
  15. PKG_LICENSE_FILES:=COPYING
  16. PKG_USE_MIPS16:=0
  17. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  18. PKG_SOURCE_URL:=http://openvswitch.org/releases/
  19. PKG_HASH:=8d1c439e26d7044f0ec823c7fef1b00b7c6465da0b83a7d0cf3191ed1dc43893
  20. PKG_BUILD_DEPENDS:=python/host python-six/host
  21. PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_openvswitch-python
  22. PKG_BUILD_PARALLEL:=1
  23. PKG_FIXUP:=autoreconf
  24. PKG_INSTALL:=1
  25. SUPPORTED_KERNELS:=LINUX_3_18||LINUX_4_1||LINUX_4_3||LINUX_4_4||LINUX_4_9
  26. include $(INCLUDE_DIR)/package.mk
  27. $(call include_mk, python-package.mk)
  28. define Package/openvswitch/Default
  29. SECTION:=net
  30. SUBMENU:=Open vSwitch
  31. CATEGORY:=Network
  32. URL:=http://openvswitch.org/
  33. MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
  34. endef
  35. define Package/openvswitch/Default/description
  36. Open vSwitch is a production quality, multilayer, software-based, Ethernet
  37. virtual switch. It is designed to enable massive network automation through
  38. programmatic extension, while still supporting standard management interfaces
  39. and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In
  40. addition, it is designed to support distribution across multiple physical
  41. servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus
  42. 1000V.
  43. endef
  44. define Package/openvswitch-base
  45. $(call Package/openvswitch/Default)
  46. TITLE:=Open vSwitch Userspace Package (base)
  47. DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch @($(SUPPORTED_KERNELS))
  48. endef
  49. define Package/openvswitch-base/description
  50. Provides the main userspace components required for Open vSwitch to function.
  51. The main OVS tools (ovs-vsctl, ovs-ofctl, etc) are packaged separately
  52. to conserve some room and allow more configurability.
  53. endef
  54. define Package/openvswitch-ovn-base
  55. $(call Package/openvswitch/Default)
  56. TITLE:=Open Virtual Networking (base)
  57. DEPENDS:=+openvswitch-base
  58. endef
  59. define Package/openvswitch-ovn-base/description
  60. Provides the main userspace components required for Open Virtual Networking
  61. over Open vSwitch.
  62. endef
  63. OVN_BIN_TOOLS:=ovn-controller ovn-controller-vtep ovn-detrace \
  64. ovn-docker-overlay-driver ovn-docker-underlay-driver \
  65. ovn-nbctl ovn-sbctl ovn-trace
  66. define Package/openvswitch-ovn
  67. $(call Package/openvswitch/Default)
  68. TITLE:=Open Virtual Networking (base)
  69. DEPENDS:=+openvswitch-ovn-base $(foreach t,$(OVN_BIN_TOOLS),+openvswitch-$(t))
  70. endef
  71. define Package/openvswitch-ovn/description
  72. Provides all the components required for Open Virtual Networking
  73. (including the tools)
  74. endef
  75. define Package/openvswitch-vtep
  76. $(call Package/openvswitch/Default)
  77. TITLE:=Open vSwitch VXLAN Tunnel End Point
  78. DEPENDS:=+openvswitch-base
  79. endef
  80. define Package/openvswitch-vtep/description
  81. This schema specifies relations that a VTEP can use to integrate physi‐
  82. cal ports into logical switches maintained by a network virtualization
  83. controller such as NSX.
  84. endef
  85. define Package/openvswitch-python
  86. $(call Package/openvswitch/Default)
  87. TITLE:=Open vSwitch Python Support
  88. DEPENDS:=+openvswitch +PACKAGE_openvswitch-python:python +PACKAGE_openvswitch-python:python-six
  89. endef
  90. define Package/openvswitch-python/description
  91. Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
  92. endef
  93. OVS_BIN_TOOLS:= \
  94. ovsdb-client ovs-l3ping ovs-dpctl-top \
  95. ovs-tcpdump ovs-tcpundump ovs-pcap ovs-parse-backtrace
  96. define Package/openvswitch
  97. $(call Package/openvswitch/Default)
  98. TITLE:=Open vSwitch Userspace Package
  99. DEPENDS:=+openvswitch-base $(foreach t,$(OVS_BIN_TOOLS),+openvswitch-$(t))
  100. endef
  101. define Package/openvswitch/description
  102. Provides the main userspace components required for Open vSwitch to function.
  103. Includes also most of OVS utilities.
  104. endef
  105. define KernelPackage/openvswitch
  106. SECTION:=kernel
  107. CATEGORY:=Kernel modules
  108. SUBMENU:=Network Support
  109. TITLE:=Open vSwitch Kernel Package
  110. KCONFIG:= \
  111. CONFIG_BRIDGE \
  112. CONFIG_OPENVSWITCH \
  113. CONFIG_OPENVSWITCH_GRE=n \
  114. CONFIG_OPENVSWITCH_VXLAN=n \
  115. CONFIG_OPENVSWITCH_GENEVE=n
  116. DEPENDS:= \
  117. @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-mpls \
  118. +kmod-vxlan +kmod-nf-nat +kmod-nf-nat6 \
  119. @($(SUPPORTED_KERNELS))
  120. FILES:= $(LINUX_DIR)/net/openvswitch/openvswitch.ko
  121. AUTOLOAD:=$(call AutoLoad,21,openvswitch)
  122. endef
  123. define KernelPackage/openvswitch/description
  124. This package contains the Open vSwitch kernel moodule and bridge compat
  125. module. Furthermore, it supports OpenFlow.
  126. endef
  127. CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
  128. CONFIGURE_ARGS += --enable-ndebug
  129. CONFIGURE_ARGS += --disable-ssl
  130. CONFIGURE_ARGS += --enable-shared
  131. TARGET_CFLAGS += -flto -std=gnu99
  132. CONFIGURE_VARS += \
  133. ovs_cv_flake8=no \
  134. ovs_cv_python3=no \
  135. KARCH=$(LINUX_KARCH)
  136. MAKE_FLAGS += \
  137. ARCH="$(LINUX_KARCH)" \
  138. PYTHONPATH="$(HOST_PYTHONPATH)" \
  139. PYTHON="$(HOST_PYTHON_BIN)"
  140. define OvsBinUtility
  141. define Package/openvswitch-$(2)
  142. $(call Package/openvswitch/Default)
  143. TITLE:=$(3)
  144. DEPENDS:=+$(1) $(4)
  145. endef
  146. define Package/openvswitch-$(2)/description
  147. $(3)
  148. endef
  149. define Package/openvswitch-$(2)/install
  150. $(INSTALL_DIR) $$(1)/usr/bin/ ;\
  151. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/
  152. endef
  153. endef
  154. define Package/openvswitch-base/install
  155. $(INSTALL_DIR) $(1)/etc/openvswitch
  156. $(INSTALL_DIR) $(1)/etc/init.d
  157. $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
  158. $(INSTALL_DIR) $(1)/usr/lib/
  159. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto*.so* $(1)/usr/lib/
  160. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch*.so* $(1)/usr/lib/
  161. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb*.so* $(1)/usr/lib/
  162. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow*.so* $(1)/usr/lib/
  163. $(INSTALL_DIR) $(1)/usr/bin/
  164. $(foreach bin,ovsdb-tool ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovs-pki, \
  165. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(bin) $(1)/usr/bin/ ; )
  166. $(INSTALL_DIR) $(1)/usr/sbin/
  167. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/
  168. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/
  169. $(INSTALL_DIR) $(1)/usr/share/openvswitch/scripts
  170. $(INSTALL_CONF) \
  171. $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema \
  172. $(1)/usr/share/openvswitch/
  173. $(INSTALL_DATA) \
  174. $(PKG_INSTALL_DIR)/usr/share/openvswitch/scripts/ovs-lib \
  175. $(1)/usr/share/openvswitch/scripts
  176. $(INSTALL_BIN) \
  177. $(PKG_INSTALL_DIR)/usr/share/openvswitch/scripts/ovs-ctl \
  178. $(1)/usr/share/openvswitch/scripts
  179. endef
  180. define Package/openvswitch-ovn-base/install
  181. $(INSTALL_DIR) $(1)/usr/lib/ $(1)/usr/bin/ $(1)/usr/share/openvswitch/
  182. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovn*.so* $(1)/usr/lib/
  183. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovn-northd $(1)/usr/bin/
  184. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/ovn-nb.ovsschema $(1)/usr/share/openvswitch/
  185. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/ovn-sb.ovsschema $(1)/usr/share/openvswitch/
  186. endef
  187. define Package/openvswitch-vtep/install
  188. $(INSTALL_DIR) $(1)/usr/lib/ $(1)/usr/bin/ $(1)/usr/share/openvswitch/
  189. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtep-ctl $(1)/usr/bin/
  190. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libvtep*.so* $(1)/usr/lib/
  191. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vtep.ovsschema $(1)/usr/share/openvswitch/
  192. endef
  193. define Package/openvswitch-python/install
  194. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  195. $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  196. endef
  197. define Package/openvswitch-ovn/install
  198. :
  199. endef
  200. define Package/openvswitch/install
  201. :
  202. endef
  203. $(eval $(call OvsBinUtility,openvswitch-base,ovs-appctl,Open vSwitch app control utility))
  204. $(eval $(call OvsBinUtility,openvswitch-base,ovs-ofctl,Open vSwitch OpenFlow control utility))
  205. $(eval $(call OvsBinUtility,openvswitch-base,ovs-dpctl,Open vSwitch datapath management utility))
  206. $(eval $(call OvsBinUtility,openvswitch-base,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
  207. $(eval $(call OvsBinUtility,openvswitch-base,ovsdb-client,Open vSwitch database JSON-RPC client))
  208. $(eval $(call OvsBinUtility,openvswitch-base,ovs-l3ping,Check network deployment for L3 tunneling problems))
  209. $(eval $(call OvsBinUtility,openvswitch-base,ovs-docker,Open vSwitch docker tool))
  210. $(eval $(call OvsBinUtility,openvswitch-base,ovs-dpctl-top,Top like behavior for ovs-dpctl dump-flows))
  211. $(eval $(call OvsBinUtility,openvswitch-base,ovs-pki,OpenFlow public key infrastructure management utility))
  212. $(eval $(call OvsBinUtility,openvswitch-base,ovs-tcpdump,Dump traffic from an Open vSwitch port using tcpdump))
  213. $(eval $(call OvsBinUtility,openvswitch-base,ovs-tcpundump,Convert ``tcpdump -xx`` output to hex strings))
  214. $(eval $(call OvsBinUtility,openvswitch-base,ovs-pcap,Print packets from a pcap file as hex))
  215. $(eval $(call OvsBinUtility,openvswitch-base,ovs-parse-backtrace,parses ovs-appctl backtrace output))
  216. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-controller,Open Virtual Network local controller))
  217. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-controller-vtep,Open Virtual Network local controller for vtep enabled physical switches,+openvswitch-vtep))
  218. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-detrace,Convert ``ovs-appctl ofproto/trace`` output to combine OVN logical flow information))
  219. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-docker-overlay-driver,OVN Docker overlay driver utility))
  220. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-docker-underlay-driver,OVN Docker underlay driver utility))
  221. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-nbctl,Open Virtual Network northbound db management utility))
  222. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-sbctl,Utility for querying and configuring OVN_Southbound database))
  223. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-trace,Open Virtual Network logical network tracing utility))
  224. $(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
  225. $(foreach t,$(OVN_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
  226. $(eval $(call BuildPackage,openvswitch-base))
  227. $(eval $(call BuildPackage,openvswitch-ovn-base))
  228. $(eval $(call BuildPackage,openvswitch-ovn))
  229. $(eval $(call BuildPackage,openvswitch-vtep))
  230. $(eval $(call BuildPackage,openvswitch-python))
  231. $(eval $(call BuildPackage,openvswitch))
  232. $(eval $(call KernelPackage,openvswitch))