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.

299 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-nbctl ovn-sbctl ovn-trace
  64. define Package/openvswitch-ovn
  65. $(call Package/openvswitch/Default)
  66. TITLE:=Open Virtual Networking (base)
  67. DEPENDS:=+openvswitch-ovn-base $(foreach t,$(OVN_BIN_TOOLS),+openvswitch-$(t))
  68. endef
  69. define Package/openvswitch-ovn/description
  70. Provides all the components required for Open Virtual Networking
  71. (including the tools)
  72. endef
  73. define Package/openvswitch-vtep
  74. $(call Package/openvswitch/Default)
  75. TITLE:=Open vSwitch VXLAN Tunnel End Point
  76. DEPENDS:=+openvswitch-base
  77. endef
  78. define Package/openvswitch-vtep/description
  79. This schema specifies relations that a VTEP can use to integrate physi‐
  80. cal ports into logical switches maintained by a network virtualization
  81. controller such as NSX.
  82. endef
  83. define Package/openvswitch-python
  84. $(call Package/openvswitch/Default)
  85. TITLE:=Open vSwitch Python Support
  86. DEPENDS:=+PACKAGE_openvswitch-python:python +PACKAGE_openvswitch-python:python-six
  87. endef
  88. define Package/openvswitch-python/description
  89. Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
  90. endef
  91. OVS_BIN_TOOLS:= \
  92. ovsdb-client ovs-l3ping ovs-dpctl-top \
  93. ovs-tcpdump ovs-tcpundump ovs-pcap
  94. define Package/openvswitch
  95. $(call Package/openvswitch/Default)
  96. TITLE:=Open vSwitch Userspace Package
  97. DEPENDS:=+openvswitch-base $(foreach t,$(OVS_BIN_TOOLS),+openvswitch-$(t))
  98. endef
  99. define Package/openvswitch/description
  100. Provides the main userspace components required for Open vSwitch to function.
  101. Includes also most of OVS utilities.
  102. endef
  103. define KernelPackage/openvswitch
  104. SECTION:=kernel
  105. CATEGORY:=Kernel modules
  106. SUBMENU:=Network Support
  107. TITLE:=Open vSwitch kernel datapath
  108. KCONFIG:=CONFIG_OPENVSWITCH
  109. DEPENDS:= \
  110. +kmod-lib-crc32c +kmod-mpls \
  111. +kmod-nf-nat +IPV6:kmod-nf-nat6
  112. FILES:= $(LINUX_DIR)/net/openvswitch/openvswitch.ko
  113. AUTOLOAD:=$(call AutoProbe,openvswitch)
  114. endef
  115. define KernelPackage/openvswitch-gre
  116. SECTION:=kernel
  117. CATEGORY:=Kernel modules
  118. SUBMENU:=Network Support
  119. TITLE:=Open vSwitch GRE tunneling support
  120. KCONFIG:= CONFIG_OPENVSWITCH_GRE
  121. DEPENDS:= +kmod-openvswitch +kmod-gre
  122. FILES:= $(LINUX_DIR)/net/openvswitch/vport-gre.ko
  123. AUTOLOAD:=$(call AutoProbe,vport-gre)
  124. endef
  125. define KernelPackage/openvswitch-vxlan
  126. SECTION:=kernel
  127. CATEGORY:=Kernel modules
  128. SUBMENU:=Network Support
  129. TITLE:=Open vSwitch VXLAN tunneling support
  130. KCONFIG:= CONFIG_OPENVSWITCH_VXLAN
  131. DEPENDS:= +kmod-openvswitch +kmod-vxlan
  132. FILES:= $(LINUX_DIR)/net/openvswitch/vport-vxlan.ko
  133. AUTOLOAD:=$(call AutoProbe,vport-vxlan)
  134. endef
  135. define KernelPackage/openvswitch-geneve
  136. SECTION:=kernel
  137. CATEGORY:=Kernel modules
  138. SUBMENU:=Network Support
  139. TITLE:=Open vSwitch Geneve tunneling support
  140. KCONFIG:= CONFIG_OPENVSWITCH_GENEVE
  141. DEPENDS:= +kmod-openvswitch +kmod-geneve
  142. FILES:= $(LINUX_DIR)/net/openvswitch/vport-geneve.ko
  143. AUTOLOAD:=$(call AutoProbe,vport-geneve)
  144. endef
  145. CONFIGURE_ARGS += --enable-ndebug
  146. CONFIGURE_ARGS += --enable-shared
  147. TARGET_CFLAGS += -flto -std=gnu99
  148. CONFIGURE_VARS += \
  149. ovs_cv_flake8=no \
  150. ovs_cv_python3=no \
  151. ovs_cv_sphinx=no \
  152. ovs_cv_python=$(PYTHON) \
  153. ovs_cv_python_host=$(HOST_PYTHON_BIN) \
  154. KARCH=$(LINUX_KARCH)
  155. MAKE_VARS += PYTHONPATH="$(HOST_PYTHONPATH)"
  156. MAKE_FLAGS += ARCH="$(LINUX_KARCH)"
  157. define OvsBinUtility
  158. define Package/openvswitch-$(2)
  159. $(call Package/openvswitch/Default)
  160. TITLE:=$(3)
  161. DEPENDS:=+$(1) $(4)
  162. endef
  163. define Package/openvswitch-$(2)/description
  164. $(3)
  165. endef
  166. define Package/openvswitch-$(2)/install
  167. $(INSTALL_DIR) $$(1)/usr/bin/ ;\
  168. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/
  169. endef
  170. endef
  171. define Package/openvswitch-base/install
  172. $(INSTALL_DIR) $(1)/etc/openvswitch
  173. $(INSTALL_DIR) $(1)/etc/init.d
  174. $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
  175. $(INSTALL_DIR) $(1)/usr/lib/
  176. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto*.so* $(1)/usr/lib/
  177. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch*.so* $(1)/usr/lib/
  178. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb*.so* $(1)/usr/lib/
  179. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow*.so* $(1)/usr/lib/
  180. $(INSTALL_DIR) $(1)/usr/bin/
  181. $(foreach bin,ovsdb-tool ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovs-pki, \
  182. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(bin) $(1)/usr/bin/ ; )
  183. $(INSTALL_DIR) $(1)/usr/sbin/
  184. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/
  185. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/
  186. $(INSTALL_DIR) $(1)/usr/share/openvswitch/scripts
  187. $(INSTALL_CONF) \
  188. $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema \
  189. $(1)/usr/share/openvswitch/
  190. $(INSTALL_DATA) \
  191. $(PKG_INSTALL_DIR)/usr/share/openvswitch/scripts/ovs-lib \
  192. $(1)/usr/share/openvswitch/scripts
  193. $(INSTALL_BIN) \
  194. $(PKG_INSTALL_DIR)/usr/share/openvswitch/scripts/ovs-ctl \
  195. $(1)/usr/share/openvswitch/scripts
  196. endef
  197. define Package/openvswitch-ovn-base/install
  198. $(INSTALL_DIR) $(1)/usr/lib/ $(1)/usr/bin/ $(1)/usr/share/openvswitch/
  199. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovn*.so* $(1)/usr/lib/
  200. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovn-northd $(1)/usr/bin/
  201. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/ovn-nb.ovsschema $(1)/usr/share/openvswitch/
  202. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/ovn-sb.ovsschema $(1)/usr/share/openvswitch/
  203. endef
  204. define Package/openvswitch-vtep/install
  205. $(INSTALL_DIR) $(1)/usr/lib/ $(1)/usr/bin/ $(1)/usr/share/openvswitch/
  206. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/vtep-ctl $(1)/usr/bin/
  207. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libvtep*.so* $(1)/usr/lib/
  208. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vtep.ovsschema $(1)/usr/share/openvswitch/
  209. endef
  210. define Package/openvswitch-python/install
  211. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  212. $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  213. endef
  214. define Package/openvswitch-ovn/install
  215. :
  216. endef
  217. define Package/openvswitch/install
  218. :
  219. endef
  220. $(eval $(call OvsBinUtility,openvswitch-base,ovs-appctl,Open vSwitch app control utility))
  221. $(eval $(call OvsBinUtility,openvswitch-base,ovs-ofctl,Open vSwitch OpenFlow control utility))
  222. $(eval $(call OvsBinUtility,openvswitch-base,ovs-dpctl,Open vSwitch datapath management utility))
  223. $(eval $(call OvsBinUtility,openvswitch-base,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
  224. $(eval $(call OvsBinUtility,openvswitch-base,ovsdb-client,Open vSwitch database JSON-RPC client))
  225. $(eval $(call OvsBinUtility,openvswitch-base,ovs-l3ping,Check network deployment for L3 tunneling problems))
  226. $(eval $(call OvsBinUtility,openvswitch-base,ovs-dpctl-top,Top like behavior for ovs-dpctl dump-flows))
  227. $(eval $(call OvsBinUtility,openvswitch-base,ovs-pki,OpenFlow public key infrastructure management utility))
  228. $(eval $(call OvsBinUtility,openvswitch-base,ovs-tcpdump,Dump traffic from an Open vSwitch port using tcpdump))
  229. $(eval $(call OvsBinUtility,openvswitch-base,ovs-tcpundump,Convert ``tcpdump -xx`` output to hex strings))
  230. $(eval $(call OvsBinUtility,openvswitch-base,ovs-pcap,Print packets from a pcap file as hex))
  231. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-controller,Open Virtual Network local controller))
  232. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-controller-vtep,Open Virtual Network local controller for vtep enabled physical switches,+openvswitch-vtep))
  233. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-detrace,Convert ``ovs-appctl ofproto/trace`` output to combine OVN logical flow information))
  234. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-nbctl,Open Virtual Network northbound db management utility))
  235. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-sbctl,Utility for querying and configuring OVN_Southbound database))
  236. $(eval $(call OvsBinUtility,openvswitch-ovn-base,ovn-trace,Open Virtual Network logical network tracing utility))
  237. $(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
  238. $(foreach t,$(OVN_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
  239. $(eval $(call BuildPackage,openvswitch-base))
  240. $(eval $(call BuildPackage,openvswitch-ovn-base))
  241. $(eval $(call BuildPackage,openvswitch-ovn))
  242. $(eval $(call BuildPackage,openvswitch-vtep))
  243. $(eval $(call BuildPackage,openvswitch-python))
  244. $(eval $(call BuildPackage,openvswitch))
  245. $(eval $(call KernelPackage,openvswitch))
  246. $(eval $(call KernelPackage,openvswitch-gre))
  247. $(eval $(call KernelPackage,openvswitch-vxlan))
  248. $(eval $(call KernelPackage,openvswitch-geneve))