#!/bin/bash # # Tool to rebuild kernel modules after kernel recompile # function EXPORT_FUNCTIONS() { echo -n; } function inherit() { echo -n; } ROOT="/" PORTDIR=$(portageq portdir) source /sbin/functions.sh source ${PORTDIR}/eclass/linux-info.eclass source ${PORTDIR}/eclass/linux-mod.eclass # TODO better detection here #KERNEL_DIR=$(pwd) get_version || die set_kvobj #local subdir moduledir modulename i rawvalue result BUILD_PARAMS BUILD_TARGETS for i in /usr/src/linux-mod/* do for j in $(< ${i}/SRCDIRS) do einfo "Preparing ${j} dir modules" cd ${i}/${j} # eval build-params rawvalue="$(< BUILD_PARAMS)" result="" for k in ${rawvalue} do eval evaled="${k}" result="${result} ${evaled}" done BUILD_PARAMS="${result}" BUILD_TARGETS="$(< BUILD_TARGETS)" # make module :) make clean || rm *.o *.ko *.mod.c make ${BUILD_PARAMS} ${BUILD_TARGETS:-module} for k in $(< MODULE_NAMES) do einfo "Installing ${k/*:} module in category ${k/:*}" if [ ! -e /lib/modules/${KV_FULL}/${k/:*} ] ; then mkdir /lib/modules/${KV_FULL}/${k/:*}; fi cp ${k/*:}.${KV_OBJ} /lib/modules/${KV_FULL}/${k/:*} done # clean up make clean || rm *.o *.ko *.mod.c rm .[^.]* -r done done update_depmod #update_modules