Note: You are viewing an old version of this page. View the current version.

I suggest redirecting the results into a cachefile, because the extraction is pretty slow.

srcsysmod_kmod() {
  tab="$(printf "\t")"
  (
    cd /usr/src/sys/modules
    find . -type f -name 'Makefile' | sed -e 's#^\./##' | xargs dirname | sort | while read dir
    do
      makefile="${dir}/Makefile"
      kmod="$(cat "${makefile}" | egrep '^KMOD' | sed -e "s/^KMOD[ ${tab}]*=[ ${tab}]*//" )"
      [ "${kmod}" ] && echo "${dir}${tab}${kmod}"
    done
  )
}