#!/bin/sh

. config/options $1

VER=`ls $BUILD/linux*/modules/lib/modules`

mkdir -p $INSTALL/lib/modules/$VER/bcm_sta
[ $TARGET_ARCH = i386 ] && cp $PKG_BUILD/x86-32/wl.ko $INSTALL/lib/modules/$VER/bcm_sta
[ $TARGET_ARCH = x86_64 ] && cp $PKG_BUILD/x86-64/wl.ko $INSTALL/lib/modules/$VER/bcm_sta

  for MOD in `find $INSTALL/lib/modules/$VER/bcm_sta -name *.ko`; do
    $STRIP --strip-debug $MOD
  done

  $ROOT/$TOOLCHAIN/sbin/depmod -b $INSTALL $VER > /dev/null
  for i in `ls $INSTALL/lib/modules/*/modules.* | grep -v modules.dep | grep -v modules.alias | grep -v modules.symbols`; do
    rm -f $i
  done
