ltq-ptm: fix build with kernel 4.9
[librecmc/librecmc.git] / package / kernel / broadcom-wl / Makefile
1 #
2 # Copyright (C) 2006-2014 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=broadcom-wl
12 PKG_VERSION:=5.10.56.27.3
13 PKG_RELEASE:=8
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(ARCH).tar.bz2
16 PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
17
18 ifeq ($(ARCH),mipsel)
19 PKG_HASH:=26a8c370f48fc129d0731cfd751c36cae1419b0bc8ca35781126744e60eae009
20 endif
21 ifeq ($(ARCH),mips)
22 PKG_HASH:=ca6a86ca3e3e9c85b6dbb665b35bcbf338c37829c1b2f1994487d55664886045
23 endif
24
25 PKG_USE_MIPS16:=0
26 PKG_FLAGS:=nonshared
27
28 include $(INCLUDE_DIR)/package.mk
29
30 define Package/broadcom-wl/Default
31   SECTION:=kernel
32   CATEGORY:=Kernel modules
33   DEPENDS:=@PACKAGE_kmod-brcm-wl||PACKAGE_kmod-brcm-wl-mini
34   SUBMENU:=Proprietary BCM43xx WiFi driver
35   SUBMENUDEP:=@TARGET_brcm47xx||TARGET_brcm63xx
36 endef
37
38 define KernelPackage/brcm-wl/Default
39   $(call Package/broadcom-wl/Default)
40   SECTION:=kernel
41   DEPENDS:=@TARGET_brcm47xx||TARGET_brcm63xx +wireless-tools
42   TITLE:=Kernel driver for BCM43xx chipsets
43   FILES:=$(PKG_BUILD_DIR)/driver$(1)/wl.ko $(PKG_BUILD_DIR)/glue/wl_glue.ko
44   AUTOLOAD:=$(call AutoLoad,30,wl_glue wl)
45 endef
46
47 define KernelPackage/brcm-wl/Default/description
48  This package contains the proprietary wireless driver for the Broadcom 
49  BCM43xx chipset.
50 endef
51
52 define KernelPackage/brcm-wl
53 $(call KernelPackage/brcm-wl/Default,)
54   TITLE+= (normal version)
55 endef
56
57 define KernelPackage/brcm-wl/description
58 $(call KernelPackage/brcm-wl/Default/description)
59 endef
60
61 define KernelPackage/brcm-wl-mini
62 $(call KernelPackage/brcm-wl/Default,-mini)
63   TITLE+= (Legacy version)
64 endef
65
66 define KernelPackage/brcm-wl-mini/description
67 $(call KernelPackage/brcm-wl/Default/description)
68 endef
69
70 define Package/wlc
71 $(call Package/broadcom-wl/Default)
72   TITLE:=wl driver setup utility
73 endef
74
75 define Package/wlc/description
76  This package contains an utility for initializing the proprietary Broadcom 
77  wl driver.
78 endef
79
80 define Package/wl
81 $(call Package/broadcom-wl/Default)
82   TITLE:=Proprietary Broadcom wl driver config utility
83 endef
84
85 define Package/wl/description
86  This package contains the proprietary utility (wl) for configuring the 
87  proprietary Broadcom wl driver.
88 endef
89
90 define Package/nas
91 $(call Package/broadcom-wl/Default)
92   TITLE:=Proprietary Broadcom WPA/WPA2 authenticator
93 endef
94
95 define Package/nas/description
96  This package contains the proprietary WPA/WPA2 authenticator (nas) for the 
97  proprietary Broadcom wl driver.
98 endef
99
100 MAKE_KMOD := $(MAKE) -C "$(LINUX_DIR)" \
101                 CROSS_COMPILE="$(TARGET_CROSS)" \
102                 ARCH="$(LINUX_KARCH)" \
103                 PATH="$(TARGET_PATH)" \
104                 SUBDIRS="$(PKG_BUILD_DIR)/kmod" \
105
106 define Build/Prepare
107         $(call Build/Prepare/Default)
108         $(CP) $(PKG_BUILD_DIR)/driver $(PKG_BUILD_DIR)/driver-mini
109         $(CP) ./src/glue $(PKG_BUILD_DIR)/glue
110 endef
111
112 define Build/Compile
113         # Compile the kernel part
114         $(MAKE_KMOD) \
115                 SUBDIRS="$(PKG_BUILD_DIR)/driver" \
116                 MODFLAGS="-DMODULE -mlong-calls" \
117                 modules
118
119         $(MAKE_KMOD) \
120                 SUBDIRS="$(PKG_BUILD_DIR)/driver-mini" \
121                 MODFLAGS="-DMODULE -mlong-calls" \
122                 BUILD_TYPE="wl_apsta_mini" \
123                 modules
124
125         # Compile glue driver
126         $(MAKE_KMOD) -C "$(LINUX_DIR)" \
127                 SUBDIRS="$(PKG_BUILD_DIR)/glue" \
128                 modules                                        
129
130         # Compile libshared
131         $(MAKE) -C $(PKG_BUILD_DIR)/shared \
132                 $(TARGET_CONFIGURE_OPTS) \
133                 CFLAGS="$(TARGET_CFLAGS) -I. -I$(PKG_BUILD_DIR)/driver/include" \
134                 all
135
136         $(TARGET_CC) -o $(PKG_BUILD_DIR)/wlc \
137                 -I$(PKG_BUILD_DIR)/shared -I$(PKG_BUILD_DIR)/driver/include \
138                 ./src/wlc.c $(PKG_BUILD_DIR)/shared/libshared.a
139
140         $(TARGET_CC) -o $(PKG_BUILD_DIR)/nas \
141                 $(PKG_BUILD_DIR)/nas_exe.o \
142                 $(PKG_BUILD_DIR)/shared/libshared.a
143
144         $(TARGET_CC) -o $(PKG_BUILD_DIR)/wl \
145                 $(PKG_BUILD_DIR)/wl_exe.o \
146                 $(PKG_BUILD_DIR)/shared/libshared.a
147 endef
148
149 define Build/InstallDev
150         $(INSTALL_DIR) $(1)/usr/lib
151         $(CP) $(PKG_BUILD_DIR)/shared/libshared.a $(1)/usr/lib/
152 endef
153
154 define Package/wlc/install
155         $(CP) ./files/* $(1)/
156         $(INSTALL_DIR) $(1)/sbin
157         $(INSTALL_BIN) $(PKG_BUILD_DIR)/wlc $(1)/sbin/
158 endef
159
160 define Package/wlc/postinst
161 #!/bin/sh
162 [ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/wlunbind enable || true
163 endef
164
165 define Package/wl/install
166         $(INSTALL_DIR) $(1)/usr/sbin
167         $(INSTALL_BIN) $(PKG_BUILD_DIR)/wl $(1)/usr/sbin/
168 endef
169
170 define Package/nas/install
171         $(INSTALL_DIR) $(1)/usr/sbin
172         $(INSTALL_BIN) $(PKG_BUILD_DIR)/nas $(1)/usr/sbin/
173         $(LN) nas $(1)/usr/sbin/nas4not
174         $(LN) nas $(1)/usr/sbin/nas4wds
175 endef
176
177 $(eval $(call KernelPackage,brcm-wl))
178 $(eval $(call KernelPackage,brcm-wl-mini))
179 $(eval $(call BuildPackage,wlc))
180 $(eval $(call BuildPackage,wl))
181 $(eval $(call BuildPackage,nas))