1#
2# Copyright (c) 2015 The Linux Foundation. All rights reserved.
3# Permission to use, copy, modify, and/or distribute this software for
4# any purpose with or without fee is hereby granted, provided that the
5# above copyright notice and this permission notice appear in all copies.
6# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
7# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
8# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
9# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
10# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
11# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
12# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
13#
14
15include $(TOPDIR)/rules.mk
16include $(INCLUDE_DIR)/kernel.mk
17
18PKG_NAME:=shortcut-fe-simulated-driver
19#PKG_SOURCE_PROTO:=git
20#PKG_BRANCH:=master
21PKG_RELEASE:=1
22
23LOCAL_SRC:=$(TOPDIR)/qca/src/shortcut-fe
24include $(INCLUDE_DIR)/local-development.mk
25ifeq ($(DUMP)$(PKG_VERSION),)
26#  PKG_REV:=$(shell git ls-remote $(PKG_SOURCE_URL) $(PKG_BRANCH) | cut -b -7)
27#  PKG_VERSION:=g$(PKG_REV)
28endif
29
30#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
31#PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
32#PKG_SOURCE_VERSION:=$(PKG_REV)
33
34include $(INCLUDE_DIR)/package.mk
35
36define KernelPackage/shortcut-fe-drv
37  SECTION:=kernel
38  CATEGORY:=Kernel modules
39  SUBMENU:=Network Support
40  DEPENDS:=+kmod-shortcut-fe
41  TITLE:=Simulated sfe driver for ECM
42  FILES:=$(PKG_BUILD_DIR)/shortcut-fe-drv.ko
43  AUTOLOAD:=$(call AutoLoad,10,shortcut-fe-drv)
44endef
45
46define KernelPackage/shortcut-fe-drv/Description
47Simulated sfe driver which act as an adapter to convert message between a connection manager and the SFE core engine.
48endef
49
50define Build/Prepare
51	mkdir -p $(PKG_BUILD_DIR)
52	$(CP) ./src/* $(PKG_BUILD_DIR)/
53endef
54
55EXTRA_CFLAGS+=-DSFE_SUPPORT_IPV6
56
57define Build/Compile
58	$(MAKE) -C "$(LINUX_DIR)" \
59		CROSS_COMPILE="$(TARGET_CROSS)" \
60		ARCH="$(LINUX_KARCH)" \
61		SUBDIRS="$(PKG_BUILD_DIR)" \
62		EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
63		modules
64endef
65
66define Build/InstallDev
67	$(INSTALL_DIR) $(1)/usr/include/shortcut-fe
68	$(CP) -rf $(PKG_BUILD_DIR)/sfe_drv.h $(1)/usr/include/shortcut-fe
69endef
70
71$(eval $(call KernelPackage,shortcut-fe-drv))
72