From 83e5ef9fbb508b60aa0d1126a7eeae67ef65637c Mon Sep 17 00:00:00 2001 From: Sevinj Aghayeva Date: Fri, 8 Apr 2022 07:26:05 -0400 Subject: mbuto: handle adding built-in modules We first assign the output of modprobe to a string and check if it is a built-in module and add its node if so. Otherwise, we process every token in modprobe output and try to see if it is a module. Signed-off-by: Sevinj Aghayeva --- mbuto | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/mbuto b/mbuto index 3884f5a..e8e4129 100755 --- a/mbuto +++ b/mbuto @@ -700,22 +700,27 @@ kmod_add() { __find_path="${MODDIR}/lib/modules" fi - for __t in $("${MODPROBE}" -S "${KERNEL}" -d "${__d_opt}" -q \ - --show-depends -- "$(${BASENAME} -- ${1})"); do - __t="$(${BASENAME} -- "${__t%*.ko}")" - if ${MODPROBE} -S "${KERNEL}" -d "${__d_opt}" -q \ - --show-depends -- "$(${BASENAME} -- "${__t}")"; then - __src="$(${FIND} ${__find_path} -name "${__t}.ko")" - __dst="${wd}/${__src##${MODDIR}}" - if ! "${DIFF}" "${__src}" "${__dst}" 2>/dev/null; then - "${MKDIR}" -p "$("${DIRNAME}" "${__dst}")" - "${CP}" -a "${__src}" "${__dst}" - fi - kmod_node "${1}" - elif [ -z "${__f%builtin *}" ]; then + __f=$("${MODPROBE}" -S "${KERNEL}" -d "${__d_opt}" -q \ + --show-depends -- "$(${BASENAME} -- ${1})") + case ${__f} in + "builtin "*) kmod_node "${1}" - fi - done + ;; + *) + for __t in ${__f}; do + __t="$(${BASENAME} -- "${__t%*.ko}")" + if ${MODPROBE} -S "${KERNEL}" -d "${__d_opt}" -q \ + --show-depends -- "$(${BASENAME} -- "${__t}")"; then + __src="$(${FIND} ${__find_path} -name "${__t}.ko")" + __dst="${wd}/${__src##${MODDIR}}" + if ! "${DIFF}" "${__src}" "${__dst}" 2>/dev/null; then + "${MKDIR}" -p "$("${DIRNAME}" "${__dst}")" + "${CP}" -a "${__src}" "${__dst}" + fi + kmod_node "${1}" + fi + done + esac } # kmod_post() - Copy files for modprobe on target, run depmod -- cgit v1.2.3