#!/bin/sh

. config/options $1

RAMFS_DRV_SUBSYSTEMS="ata ide scsi"

VER=`ls $PKG_BUILD/modules/lib/modules`

mkdir -p $INSTALL/lib/modules/$VER
  cp -r $PKG_BUILD/modules/* $INSTALL
  rm -f $INSTALL/lib/modules/$VER/modules.*

$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

# copy kernel firmwares (if present)
mkdir -p $INSTALL/lib/firmware
  [ -d $PKG_BUILD/modules/lib/firmware ] && \
    cp -rf $PKG_BUILD/modules/lib/firmware/* $INSTALL/lib/firmware || true

mkdir -p $INSTALL/etc
  cp $PKG_DIR/config/modules $INSTALL/etc

mkdir -p $INSTALL/etc/modprobe.d
