OpenWRT - UofG-netlab/BPFabric GitHub Wiki

Building BPFabric on OpenWRT routers

To build BPFabric for OpenWRT you need a work OpenWRT build system follow the instructions here to do so https://wiki.openwrt.org/doc/howto/build

Once you have the build system working, you need to create a new feed with a custom package

cd ~/openwrt
mkdir -p package/customfeed/BPFabric

vi Makefile

include $(TOPDIR)/rules.mk

PKG_NAME:=BPFabric
PKG_VERSION:=1
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/UofG-netlab/BPFabric.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=master
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

#HOST_BUILD_DEPENDS:=protoc-c/host protoc/hostl

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk

TARGET_LDFLAGS += -largp

define Package/BPFabric
  SECTION:=net
  CATEGORY:=Network
  TITLE:=BPFabric
  DEPENDS:=+libprotobuf-c
  MAINTAINER:=Simon Jouet <[email protected]>
endef

define Package/BPFabric/description
 BPFabric eBPF data plane programmable software switch
endef

define Package/BPFabric/install
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/softswitch/softswitch $(1)/usr/sbin/bpfabric
endef

$(eval $(call BuildPackage,BPFabric))

Edit the available feeds available

cp ~/openwrt/feeds.conf.default ~/openwrt/feeds.conf
vi ~/openwrt/feeds.conf

Add at the end of the file

src-link customfeed path_to_openwrt/package/customfeed

Install BPFabric to OpenWRT build system

./scripts/feeds update customfeed
./scripts/feeds install -p customfeed

Enable BPFabric to the build

make menuconfig
Network > BPFabric

Build OpenWRT

make V=s

Example build configuration for WDR3600

CONFIG_TARGET_ar71xx=y
CONFIG_TARGET_ar71xx_generic=y
CONFIG_TARGET_ar71xx_generic_TLWDR4300=y
CONFIG_DEVEL=y
CONFIG_PACKAGE_BPFabric=y
CONFIG_PACKAGE_argp-standalone=y
CONFIG_PACKAGE_kmod-tun=y
CONFIG_PACKAGE_kmod-usb-ohci=y
CONFIG_PACKAGE_libprotobuf-c=y
CONFIG_PACKAGE_libpthread=y
CONFIG_PACKAGE_libstdcpp=y
CONFIG_PACKAGE_uboot-ar71xx-nbg460n_550n_550nh=y
CONFIG_PACKAGE_zlib=y
CONFIG_SRC_TREE_OVERRIDE=y

create a new .config with the config above and run make defconfig to fill with the remaining options for the kernel build