-define Package/kmod-madwifi/install
- mkdir -p $(1)/etc/modules.d
- mkdir -p $(1)/etc/init.d
- mkdir -p $(1)/lib/modules/$(LINUX_VERSION)
- mkdir -p $(1)/usr/sbin
- install -m0644 ./files/madwifi.modules $(1)/etc/modules.d/20-madwifi
- echo ath_rate_$(RATE_CONTROL) >> $(1)/etc/modules.d/20-madwifi
+MAKE_ARGS:= \
+ PATH="$(TARGET_PATH)" \
+ ARCH="$(LINUX_KARCH)" \
+ CROSS_COMPILE="$(TARGET_CROSS)" \
+ TARGET="$(HAL_TARGET)" \
+ TOOLPREFIX="$(KERNEL_CROSS)" \
+ TOOLPATH="$(KERNEL_CROSS)" \
+ KERNELPATH="$(LINUX_DIR)" \
+ LDOPTS="--no-warn-mismatch " \
+ ATH_RATE="ath_rate/$(RATE_CONTROL)" \
+ WARNINGS="-Wno-unused" \
+ $(if $(CONFIG_MADWIFI_DEBUG),,DEBUG="") \
+ DO_MULTI=1
+
+MAKE_VARS:= \
+ COPTS="-DCONFIG_ATHEROS_RATE_DEFAULT='\"$(RATE_CONTROL)\"' -DATH_REVERSE_ENGINEERING=1" \
+
+HALFILE:=$(lastword $(sort $(wildcard ./ath_hal-*.tgz)))
+ifneq ($(HALFILE),)
+ define Build/Prepare
+ $(call Build/Prepare/Default)
+ rm -rf $(PKG_BUILD_DIR)/tmp
+ mkdir -p $(PKG_BUILD_DIR)/tmp
+ tar xvzf $(HALFILE) -C $(PKG_BUILD_DIR)/tmp
+ $(CP) $(PKG_BUILD_DIR)/tmp/ath_hal*/* $(PKG_BUILD_DIR)/hal/
+ rm -rf $(PKG_BUILD_DIR)/tmp
+ # patch cflags
+ $(SED) 's, -E[LB],,' \
+ -e 's, -mips2,,' \
+ -e 's, -mapcs-32,,' \
+ $(PKG_BUILD_DIR)/hal/public/*.inc
+ $(SED) 's,march=armv4,march=armv5te,' \
+ $(PKG_BUILD_DIR)/hal/public/xscale*.inc
+ endef
+endif
+