-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathMakefile.openwrt
112 lines (93 loc) · 3.28 KB
/
Makefile.openwrt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Makefile to build the package in openwrt.
# goes into package/network/utils/ipfw3/Makefile
#
# Edit IPFW_DIR to point to the directory with the sources for ipfw
IPFW_DIR := $(TOPDIR)/../qemu-misc/ipfw3
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ipfw3
PKG_RELEASE:=1
# MV is undefined, we use it in the internal Makefiles
MV ?= mv
include $(INCLUDE_DIR)/package.mk
#Stuff depending on kernel version
$(warning --- openwrt kernel version $(KERNEL) linux dir $(LINUX_DIR) -------)
ifeq ($(KERNEL),2.4)
VERS:=openwrt
CFLAGS_WRT:=-DSYSCTL_NODE -DEMULATE_SYSCTL
IPFW_MOD:=ipfw_mod.o
IPFW_SRC_DIR:=SUBDIRS
else
#VERS:=2.6
IPFW_MOD:=ipfw_mod.ko
IPFW_SRC_DIR:=M
endif
define Package/ipfw3
SECTION:=utils
CATEGORY:=Utilities
TITLE := /sbin/ipfw
DEPENDS := +libc +libgcc
FILES := $(PKG_BUILD_DIR)/ipfw/ipfw
$(warning --- build dir is $(PKG_BUILD_DIR) ---)
endef
define Package/ipfw3/description
Control program for ipfw and dummynet
endef
# XXX not entirely clear why the install entry for userland works,
# given that /sbin/ipfw is in KernelPackage/ipfw3
define Package/ipfw3/install
$(INSTALL_DIR) $(1) /sbin
endef
# Description for the package.
# The names KernelPackage/ipfw3 must match the arguments to the
# call $(eval $(call KernelPackage,ipfw3)) used to build it
define KernelPackage/ipfw3
SUBMENU:=Other modules
TITLE:= IPFW and dummynet
# FILES is what makes up the module, both kernel and userland
# It must be in the KernelPackage section XXX
FILES := $(PKG_BUILD_DIR)/kipfw-mod/$(IPFW_MOD)
# AUTOLOAD:=$(call AutoLoad,80,ipfw_mod)
endef
define KernelPackage/kmod-ipfw3/description
ipfw and dummynet kernel module
endef
# Standard entries for the openwrt builds: Build/Prepare and Build/Compile
# Remember that commands must start with a tab
# 'prepare' instructions for both kernel and userland
# We copy the entire subtree, then build include_e/ which
# contains empty headers used by the kernel sources.
define Build/Prepare
# $(warning --- Preparing ipfw sources ---)
mkdir -p $(PKG_BUILD_DIR)
$(CP) -Rp $(IPFW_DIR)/* $(PKG_BUILD_DIR)/
# The kernel sources are spread in multiple places,
# so we put everything in kipfw-mod
mkdir -p $(PKG_BUILD_DIR)/kipfw-mod
cp -Rp $(IPFW_DIR)/kipfw/* $(PKG_BUILD_DIR)/kipfw-mod
cp `find $(IPFW_DIR)/sys -name \*.c` $(PKG_BUILD_DIR)/kipfw-mod
# we do not need cross parameters
(cd $(PKG_BUILD_DIR)/ipfw && $(MAKE) include_e )
(cd $(PKG_BUILD_DIR)/kipfw-mod && $(MAKE) include_e )
endef
define Build/Compile
# XXX check whether we need all linux_dir etc.
$(warning --- compile the user part for ipfw/openwrt ---)
$(MAKE) -C $(PKG_BUILD_DIR)/ipfw \
LINUX_DIR=$(LINUX_DIR) \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS) $(CFLAGS_WRT) -I./include_e -I./include -include ../glue.h -DNO_ALTQ -D__BSD_VISIBLE" \
_VER=$(VERS) all
$(warning --- compile the kernel part for ipfw/openwrt ---)
$(MAKE) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
LINUX_DIR=$(LINUX_DIR) \
KERNELPATH=$(LINUX_DIR) \
ARCH="$(LINUX_KARCH)" \
$(IPFW_SRC_DIR)="$(PKG_BUILD_DIR)/kipfw-mod" \
IPFW3_ROOT="$(PKG_BUILD_DIR)" \
_VER=$(VERS) modules
$(warning +++ done compile the kernel part for ipfw/openwrt ---)
endef
$(eval $(call BuildPackage,ipfw3))
$(eval $(call KernelPackage,ipfw3))