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.

215 lines
6.8 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:=1
  13. PKG_VERSION:=2.7.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:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  19. PKG_SOURCE_URL:=http://openvswitch.org/releases/
  20. PKG_HASH:=e492cf08a929b4a2178b7f9b01dc4ff562f44138b547b4e942078187b2445d2e
  21. PKG_BUILD_PARALLEL:=1
  22. PKG_FIXUP:=autoreconf
  23. PKG_INSTALL:=1
  24. SUPPORTED_KERNELS:=LINUX_3_18||LINUX_4_1||LINUX_4_3||LINUX_4_4||LINUX_4_9
  25. include $(INCLUDE_DIR)/package.mk
  26. $(call include_mk, python-package.mk)
  27. define Package/openvswitch/Default
  28. SECTION:=net
  29. SUBMENU:=Open vSwitch
  30. CATEGORY:=Network
  31. URL:=http://openvswitch.org/
  32. MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
  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 @($(SUPPORTED_KERNELS))
  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-python
  54. $(call Package/openvswitch/Default)
  55. TITLE:=Open vSwitch Python Support
  56. DEPENDS:=+openvswitch +PACKAGE_openvswitch-python:python
  57. endef
  58. define Package/openvswitch-python/description
  59. Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
  60. endef
  61. define Package/openvswitch-ipsec
  62. $(call Package/openvswitch/Default)
  63. TITLE:=Open vSwitch GRE through IPsec tool
  64. DEPENDS:=+openvswitch-python
  65. endef
  66. define Package/openvswitch-ipsec/description
  67. The ovs-monitor-ipsec script provides support for encrypting GRE tunnels with
  68. IPsec.
  69. endef
  70. define Package/openvswitch-benchmark
  71. $(call Package/openvswitch/Default)
  72. TITLE:=Open vSwitch flow setup benchmark utility
  73. DEPENDS:=+openvswitch
  74. endef
  75. define Package/openvswitch-benchmark/description
  76. Utility for running OpenVSwitch benchmarking
  77. endef
  78. OVS_BIN_TOOLS:=ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovsdb-client
  79. define Package/openvswitch
  80. $(call Package/openvswitch/Default)
  81. TITLE:=Open vSwitch Userspace Package
  82. DEPENDS:=+openvswitch-base $(foreach t,$(OVS_BIN_TOOLS),+openvswitch-$(t))
  83. endef
  84. define Package/openvswitch/description
  85. Provides the main userspace components required for Open vSwitch to function.
  86. Includes also the main OVS utilities (ovs-appctl, ovs-vsctl, etc).
  87. endef
  88. define KernelPackage/openvswitch
  89. SECTION:=kernel
  90. CATEGORY:=Kernel modules
  91. SUBMENU:=Network Support
  92. TITLE:=Open vSwitch Kernel Package
  93. KCONFIG:= \
  94. CONFIG_BRIDGE \
  95. CONFIG_OPENVSWITCH \
  96. CONFIG_OPENVSWITCH_GRE=n \
  97. CONFIG_OPENVSWITCH_VXLAN=n \
  98. CONFIG_OPENVSWITCH_GENEVE=n
  99. DEPENDS:= \
  100. @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-mpls \
  101. +kmod-vxlan +kmod-nf-nat +kmod-nf-nat6 \
  102. @($(SUPPORTED_KERNELS))
  103. FILES:= $(LINUX_DIR)/net/openvswitch/openvswitch.ko
  104. AUTOLOAD:=$(call AutoLoad,21,openvswitch)
  105. endef
  106. define KernelPackage/openvswitch/description
  107. This package contains the Open vSwitch kernel moodule and bridge compat
  108. module. Furthermore, it supports OpenFlow.
  109. endef
  110. CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
  111. CONFIGURE_ARGS += --enable-ndebug
  112. CONFIGURE_ARGS += --disable-ssl
  113. CONFIGURE_ARGS += --enable-shared
  114. TARGET_CFLAGS += -flto -std=gnu99
  115. CONFIGURE_VARS += KARCH=$(LINUX_KARCH)
  116. MAKE_FLAGS += ARCH="$(LINUX_KARCH)"
  117. define OvsBinUtility
  118. define Package/openvswitch-$(1)
  119. $(call Package/openvswitch/Default)
  120. TITLE:=$(2)
  121. DEPENDS:=+openvswitch-base
  122. endef
  123. define Package/openvswitch-$(1)/description
  124. $(2)
  125. endef
  126. define Package/openvswitch-$(1)/install
  127. $(INSTALL_DIR) $$(1)/usr/bin/ ;\
  128. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/
  129. endef
  130. endef
  131. define Package/openvswitch-base/install
  132. $(INSTALL_DIR) $(1)/etc/openvswitch
  133. $(INSTALL_DIR) $(1)/etc/init.d
  134. $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
  135. $(INSTALL_DIR) $(1)/usr/lib/
  136. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto*.so* $(1)/usr/lib/
  137. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch*.so* $(1)/usr/lib/
  138. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb*.so* $(1)/usr/lib/
  139. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow*.so* $(1)/usr/lib/
  140. $(INSTALL_DIR) $(1)/usr/bin/
  141. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovsdb-tool $(1)/usr/bin/
  142. $(INSTALL_DIR) $(1)/usr/sbin/
  143. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/
  144. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/
  145. $(INSTALL_DIR) $(1)/usr/share/openvswitch/
  146. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema $(1)/usr/share/openvswitch/
  147. endef
  148. define Package/openvswitch-python/install
  149. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  150. $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  151. endef
  152. define Package/openvswitch-ipsec/install
  153. $(INSTALL_DIR) $(1)/usr/sbin/
  154. $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/
  155. endef
  156. define Package/openvswitch-benchmark/install
  157. $(INSTALL_DIR) $(1)/usr/bin/
  158. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovs-benchmark $(1)/usr/bin/
  159. endef
  160. define Package/openvswitch/install
  161. :
  162. endef
  163. $(eval $(call OvsBinUtility,ovs-appctl,Open vSwitch app control utility))
  164. $(eval $(call OvsBinUtility,ovs-ofctl,Open vSwitch OpenFlow control utility))
  165. $(eval $(call OvsBinUtility,ovs-dpctl,Open vSwitch datapath management utility))
  166. $(eval $(call OvsBinUtility,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
  167. $(eval $(call OvsBinUtility,ovsdb-client,Open vSwitch database JSON-RPC client))
  168. $(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
  169. $(eval $(call BuildPackage,openvswitch-base))
  170. $(eval $(call BuildPackage,openvswitch-python))
  171. $(eval $(call BuildPackage,openvswitch-ipsec))
  172. $(eval $(call BuildPackage,openvswitch-benchmark))
  173. $(eval $(call BuildPackage,openvswitch))
  174. $(eval $(call KernelPackage,openvswitch))