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.

214 lines
6.9 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:=7
  13. PKG_VERSION:=2.5.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_PROTO:=git
  19. PKG_SOURCE_URL:=https://github.com/openvswitch/ovs
  20. PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
  21. PKG_SOURCE_VERSION:=22d4614ddf83988a3771fb379ea029e663b4455a
  22. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
  23. PKG_BUILD_PARALLEL:=1
  24. PKG_FIXUP:=autoreconf
  25. PKG_INSTALL:=1
  26. # Upstream package supports kernels between 2.6.32 and 4.3
  27. # see https://github.com/openvswitch/ovs/blob/master/FAQ.md
  28. # This list is pruned to only those kernels used in OpenWRT
  29. # Support for kernel 4.4 is backported
  30. SUPPORTED_KERNELS:=LINUX_3_18||LINUX_4_1||LINUX_4_3||LINUX_4_4
  31. include $(INCLUDE_DIR)/package.mk
  32. $(call include_mk, python-package.mk)
  33. define Package/openvswitch/Default
  34. SECTION:=net
  35. SUBMENU:=Open vSwitch
  36. CATEGORY:=Network
  37. URL:=http://openvswitch.org/
  38. MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
  39. endef
  40. define Package/openvswitch/Default/description
  41. Open vSwitch is a production quality, multilayer, software-based, Ethernet
  42. virtual switch. It is designed to enable massive network automation through
  43. programmatic extension, while still supporting standard management interfaces
  44. and protocols (e.g. NetFlow, sFlow, SPAN, RSPAN, CLI, LACP, 802.1ag). In
  45. addition, it is designed to support distribution across multiple physical
  46. servers similar to VMware's vNetwork distributed vswitch or Cisco's Nexus
  47. 1000V.
  48. endef
  49. define Package/openvswitch-base
  50. $(call Package/openvswitch/Default)
  51. TITLE:=Open vSwitch Userspace Package (base)
  52. DEPENDS:=+libpcap +libopenssl +librt +kmod-openvswitch @($(SUPPORTED_KERNELS))
  53. endef
  54. define Package/openvswitch-base/description
  55. Provides the main userspace components required for Open vSwitch to function.
  56. The main OVS tools (ovs-vsctl, ovs-ofctl, etc) are packaged separately
  57. to conserve some room and allow more configurability.
  58. endef
  59. define Package/openvswitch-python
  60. $(call Package/openvswitch/Default)
  61. TITLE:=Open vSwitch Python Support
  62. DEPENDS:=+openvswitch +python
  63. endef
  64. define Package/openvswitch-python/description
  65. Provides bindings and libraries for using Python to manipulate/work with Open vSwitch.
  66. endef
  67. define Package/openvswitch-ipsec
  68. $(call Package/openvswitch/Default)
  69. TITLE:=Open vSwitch GRE through IPsec tool
  70. DEPENDS:=+openvswitch-python
  71. endef
  72. define Package/openvswitch-ipsec/description
  73. The ovs-monitor-ipsec script provides support for encrypting GRE tunnels with
  74. IPsec.
  75. endef
  76. define Package/openvswitch-benchmark
  77. $(call Package/openvswitch/Default)
  78. TITLE:=Open vSwitch flow setup benchmark utility
  79. DEPENDS:=+openvswitch
  80. endef
  81. define Package/openvswitch-benchmark/description
  82. Utility for running OpenVSwitch benchmarking
  83. endef
  84. OVS_BIN_TOOLS:=ovs-appctl ovs-ofctl ovs-dpctl ovs-vsctl ovsdb-client
  85. define Package/openvswitch
  86. $(call Package/openvswitch/Default)
  87. TITLE:=Open vSwitch Userspace Package
  88. DEPENDS:=+openvswitch-base $(foreach t,$(OVS_BIN_TOOLS),+openvswitch-$(t))
  89. endef
  90. define Package/openvswitch/description
  91. Provides the main userspace components required for Open vSwitch to function.
  92. Includes also the main OVS utilities (ovs-appctl, ovs-vsctl, etc).
  93. endef
  94. define KernelPackage/openvswitch
  95. SECTION:=kernel
  96. CATEGORY:=Kernel modules
  97. SUBMENU:=Network Support
  98. TITLE:=Open vSwitch Kernel Package
  99. KCONFIG:=CONFIG_BRIDGE
  100. DEPENDS:=+kmod-stp @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan +kmod-nf-conntrack +kmod-nf-conntrack6 @($(SUPPORTED_KERNELS))
  101. FILES:= \
  102. $(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
  103. AUTOLOAD:=$(call AutoLoad,21,openvswitch)
  104. endef
  105. define KernelPackage/openvswitch/description
  106. This package contains the Open vSwitch kernel moodule and bridge compat
  107. module. Furthermore, it supports OpenFlow.
  108. endef
  109. CONFIGURE_ARGS += --with-linux=$(LINUX_DIR) --with-rundir=/var/run
  110. CONFIGURE_ARGS += --enable-ndebug
  111. CONFIGURE_ARGS += --disable-ssl
  112. CONFIGURE_ARGS += --enable-shared
  113. TARGET_CFLAGS += -flto -std=gnu99
  114. CONFIGURE_VARS += KARCH=$(LINUX_KARCH)
  115. MAKE_FLAGS += ARCH="$(LINUX_KARCH)"
  116. define OvsBinUtility
  117. define Package/openvswitch-$(1)
  118. $(call Package/openvswitch/Default)
  119. TITLE:=$(2)
  120. DEPENDS:=+openvswitch-base
  121. endef
  122. define Package/openvswitch-$(1)/description
  123. $(2)
  124. endef
  125. define Package/openvswitch-$(1)/install
  126. $(INSTALL_DIR) $$(1)/usr/bin/ ;\
  127. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/
  128. endef
  129. endef
  130. define Package/openvswitch-base/install
  131. $(INSTALL_DIR) $(1)/etc/openvswitch
  132. $(INSTALL_DIR) $(1)/etc/init.d
  133. $(INSTALL_BIN) ./files/etc/init.d/openvswitch.init $(1)/etc/init.d/openvswitch
  134. $(INSTALL_DIR) $(1)/usr/lib/
  135. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libofproto.so* $(1)/usr/lib/
  136. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopenvswitch.so* $(1)/usr/lib/
  137. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libovsdb.so* $(1)/usr/lib/
  138. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsflow.so* $(1)/usr/lib/
  139. $(INSTALL_DIR) $(1)/usr/bin/
  140. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovsdb-tool $(1)/usr/bin/
  141. $(INSTALL_DIR) $(1)/usr/sbin/
  142. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovs-vswitchd $(1)/usr/sbin/
  143. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ovsdb-server $(1)/usr/sbin/
  144. $(INSTALL_DIR) $(1)/usr/share/openvswitch/
  145. $(INSTALL_CONF) $(PKG_INSTALL_DIR)/usr/share/openvswitch/vswitch.ovsschema $(1)/usr/share/openvswitch/
  146. endef
  147. define Package/openvswitch-python/install
  148. $(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  149. $(CP) $(PKG_INSTALL_DIR)/usr/share/openvswitch/python/ovs/* $(1)/usr/lib/python$(PYTHON_VERSION)/ovs
  150. endef
  151. define Package/openvswitch-ipsec/install
  152. $(INSTALL_DIR) $(1)/usr/sbin/
  153. $(INSTALL_BIN) $(PKG_BUILD_DIR)/debian/ovs-monitor-ipsec $(1)/usr/sbin/
  154. endef
  155. define Package/openvswitch-benchmark/install
  156. $(INSTALL_DIR) $(1)/usr/bin/
  157. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ovs-benchmark $(1)/usr/bin/
  158. endef
  159. define Package/openvswitch/install
  160. :
  161. endef
  162. $(eval $(call OvsBinUtility,ovs-appctl,Open vSwitch app control utility))
  163. $(eval $(call OvsBinUtility,ovs-ofctl,Open vSwitch OpenFlow control utility))
  164. $(eval $(call OvsBinUtility,ovs-dpctl,Open vSwitch datapath management utility))
  165. $(eval $(call OvsBinUtility,ovs-vsctl,Open vSwitch ovs-vswitchd management utility))
  166. $(eval $(call OvsBinUtility,ovsdb-client,Open vSwitch database JSON-RPC client))
  167. $(foreach t,$(OVS_BIN_TOOLS),$(eval $(call BuildPackage,openvswitch-$(t))))
  168. $(eval $(call BuildPackage,openvswitch-base))
  169. $(eval $(call BuildPackage,openvswitch-python))
  170. $(eval $(call BuildPackage,openvswitch-ipsec))
  171. $(eval $(call BuildPackage,openvswitch-benchmark))
  172. $(eval $(call BuildPackage,openvswitch))
  173. $(eval $(call KernelPackage,openvswitch))