From 895d54b04636efd4c99fca3fa4e7c32b7ff5b690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=B6hmke?= Date: Wed, 29 Jan 2020 18:38:21 +0100 Subject: [PATCH] add option to keep all kernel modules --- resources/build.sh | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/resources/build.sh b/resources/build.sh index a306e33..cdc6394 100755 --- a/resources/build.sh +++ b/resources/build.sh @@ -256,26 +256,32 @@ mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Linux # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # echo ">> Remove kernel modules" -cd ${ROOTFS_PATH}/lib/modules -# loop all kernel versions -for d in * ; do - echo "Remove $d" +if [ "$DEFAULT_KERNEL_MODULES" == "*" ]; then + echo "skiped -> keep all modules" - # collect modules to keep - moduleFiles=$(grep -E "/($(echo $DEFAULT_KERNEL_MODULES | sed "s/ /|/g")).ko:" $d/modules.dep | tr -d : | tr ' ' '\n' | sort | uniq | tr '\n' ' ') +else + cd ${ROOTFS_PATH}/lib/modules - # copy required modules to tmp dir - cd $d - cp --parents modules.* ${moduleFiles} ../${d}_tmp - cd .. + # loop all kernel versions + for d in * ; do + echo "Remove $d" - # replace original modules dir with new one - rm -rf $d - mv ${d}_tmp $d -done + # collect modules to keep + moduleFiles=$(grep -E "/($(echo $DEFAULT_KERNEL_MODULES | sed "s/ /|/g")).ko:" $d/modules.dep | tr -d : | tr ' ' '\n' | sort | uniq | tr '\n' ' ') -cd ${WORK_PATH} + # copy required modules to tmp dir + cd $d + cp --parents modules.* ${moduleFiles} ../${d}_tmp + cd .. + + # replace original modules dir with new one + rm -rf $d + mv ${d}_tmp $d + done + + cd ${WORK_PATH} +fi # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # create boot FS