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.

282 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. include ../../lang/python/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. ovs_cv_sphinx=no \
  136. KARCH=$(LINUX_KARCH)
  137. MAKE_FLAGS += \
  138. ARCH="$(LINUX_KARCH)" \
  139. PYTHONPATH="$(HOST_PYTHONPATH)" \
  140. PYTHON="$(HOST_PYTHON_BIN)"
  141. define OvsBinUtility
  142. define Package/openvswitch-$(2)
  143. $(call Package/openvswitch/Default)
  144. TITLE:=$(3)
  145. DEPENDS:=+$(1) $(4)
  146. endef
  147. define Package/openvswitch-$(2)/description
  148. $(3)
  149. endef
  150. define Package/openvswitch-$(2)/install
  151. $(INSTALL_DIR) $$(1)/usr/bin/ ;\
  152. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/
  153. endef
  154. endef
  155. define Package/openvswitch-base/install
  156. $(INSTALL_DIR) $(1)/etc/openvswitch
  157. $(INSTALL_DIR) $(1)/etc/init.d
  158. $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
  159. $(INSTALL_DIR) $(1)/usr/lib/
  160. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto*.so* $(1)/usr/lib/
  161. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch*.so* $(1)/usr/lib/
  162. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb*.so* $(1)/usr/lib/
  163. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow*.so* $(1)/usr/lib/
  164. $(INSTALL_DIR) $(1)/usr/bin/
  165. $(foreach bin,ovsdb-tool ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovs-pki, \
  166. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(bin) $(1)/usr/bin/ ; )
  167. $(INSTALL_DIR) $(1)/usr/sbin/
  168. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/
  169. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/
  170. $(INSTALL_DIR) $(1)/usr/share/openvswitch/scripts
  171. $(INSTALL_CONF) \
  172. $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema \
  173. $(1)/usr/share/openvswitch/
  174. $(INSTALL_DATA) \
  175. $(PKG_INSTALL_DIR)/usr/share/openvswitch/scripts/ovs-lib \
  176. $(1)/usr/share/openvswitch/scripts
  177. $(INSTALL_BIN) \
  178. $(PKG_INSTALL_DIR)/usr/share/openvswitch/scripts/ovs-ctl \
  179. $(1)/usr/share/openvswitch/scripts
  180. endef
  181. define Package/openvswitch-ovn-base/install
  182. $(INSTALL_DIR) $(1)/usr/lib/ $(1)/usr/bin/ $(1)/usr/share/openvswitch/
  183. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovn*.so* $(1)/usr/lib/
  184. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovn-northd $(1)/usr/bin/
  185. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/ovn-nb.ovsschema $(1)/usr/share/openvswitch/
  186. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/ovn-sb.ovsschema $(1)/usr/share/openvswitch/
  187. endef
  188. define Package/openvswitch-vtep/install
  189. $(INSTALL_DIR) $(1)/usr/lib/ $(1)/usr/bin/ $(1)/usr/share/openvswitch/
  190. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtep-ctl $(1)/usr/bin/
  191. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libvtep*.so* $(1)/usr/lib/
  192. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vtep.ovsschema $(1)/usr/share/openvswitch/
  193. endef
  194. define Package/openvswitch-python/install
  195. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  196. $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  197. endef
  198. define Package/openvswitch-ovn/install
  199. :
  200. endef
  201. define Package/openvswitch/install
  202. :
  203. endef
  204. $(eval $(call OvsBinUtility,openvswitch-base,ovs-appctl,Open vSwitch app control utility))
  205. $(eval $(call OvsBinUtility,openvswitch-base,ovs-ofctl,Open vSwitch OpenFlow control utility))
  206. $(eval $(call OvsBinUtility,openvswitch-base,ovs-dpctl,Open vSwitch datapath management utility))
  207. $(eval $(call OvsBinUtility,openvswitch-base,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
  208. $(eval $(call OvsBinUtility,openvswitch-base,ovsdb-client,Open vSwitch database JSON-RPC client))
  209. $(eval $(call OvsBinUtility,openvswitch-base,ovs-l3ping,Check network deployment for L3 tunneling problems))
  210. $(eval $(call OvsBinUtility,openvswitch-base,ovs-docker,Open vSwitch docker tool))
  211. $(eval $(call OvsBinUtility,openvswitch-base,ovs-dpctl-top,Top like behavior for ovs-dpctl dump-flows))
  212. $(eval $(call OvsBinUtility,openvswitch-base,ovs-pki,OpenFlow public key infrastructure management utility))
  213. $(eval $(call OvsBinUtility,openvswitch-base,ovs-tcpdump,Dump traffic from an Open vSwitch port using tcpdump))
  214. $(eval $(call OvsBinUtility,openvswitch-base,ovs-tcpundump,Convert ``tcpdump -xx`` output to hex strings))
  215. $(eval $(call OvsBinUtility,openvswitch-base,ovs-pcap,Print packets from a pcap file as hex))
  216. $(eval $(call OvsBinUtility,openvswitch-base,ovs-parse-backtrace,parses ovs-appctl backtrace output))
  217. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-controller,Open Virtual Network local controller))
  218. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-controller-vtep,Open Virtual Network local controller for vtep enabled physical switches,+openvswitch-vtep))
  219. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-detrace,Convert ``ovs-appctl ofproto/trace`` output to combine OVN logical flow information))
  220. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-docker-overlay-driver,OVN Docker overlay driver utility))
  221. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-docker-underlay-driver,OVN Docker underlay driver utility))
  222. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-nbctl,Open Virtual Network northbound db management utility))
  223. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-sbctl,Utility for querying and configuring OVN_Southbound database))
  224. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-trace,Open Virtual Network logical network tracing utility))
  225. $(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
  226. $(foreach t,$(OVN_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
  227. $(eval $(call BuildPackage,openvswitch-base))
  228. $(eval $(call BuildPackage,openvswitch-ovn-base))
  229. $(eval $(call BuildPackage,openvswitch-ovn))
  230. $(eval $(call BuildPackage,openvswitch-vtep))
  231. $(eval $(call BuildPackage,openvswitch-python))
  232. $(eval $(call BuildPackage,openvswitch))
  233. $(eval $(call KernelPackage,openvswitch))