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.

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