4
0

add option to keep all kernel modules

This commit is contained in:
Benjamin Böhmke 2020-01-29 18:38:21 +01:00
parent 45e3ea71ee
commit 895d54b046

View File

@ -256,26 +256,32 @@ mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Linux
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
echo ">> Remove kernel modules" echo ">> Remove kernel modules"
cd ${ROOTFS_PATH}/lib/modules
# loop all kernel versions if [ "$DEFAULT_KERNEL_MODULES" == "*" ]; then
for d in * ; do echo "skiped -> keep all modules"
echo "Remove $d"
# collect modules to keep else
moduleFiles=$(grep -E "/($(echo $DEFAULT_KERNEL_MODULES | sed "s/ /|/g")).ko:" $d/modules.dep | tr -d : | tr ' ' '\n' | sort | uniq | tr '\n' ' ') cd ${ROOTFS_PATH}/lib/modules
# copy required modules to tmp dir # loop all kernel versions
cd $d for d in * ; do
cp --parents modules.* ${moduleFiles} ../${d}_tmp echo "Remove $d"
cd ..
# replace original modules dir with new one # collect modules to keep
rm -rf $d moduleFiles=$(grep -E "/($(echo $DEFAULT_KERNEL_MODULES | sed "s/ /|/g")).ko:" $d/modules.dep | tr -d : | tr ' ' '\n' | sort | uniq | tr '\n' ' ')
mv ${d}_tmp $d
done
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 # create boot FS