@@ -69,6 +69,9 @@ DEVICE="mojito"
6969# your device or check source
7070DEFCONFIG=neternels_defconfig
7171
72+ # Build modules. 0 = NO | 1 = YES
73+ MODULES=1
74+
7275# Specify compiler.
7376# 'clang' or 'gcc'
7477COMPILER=gcc
@@ -184,6 +187,11 @@ DATE=$(TZ=GMT-8 date +"%Y%m%d-%H%M")
184187 git clone --depth 1 --no-single-branch https://github.com/NetErnels/AnyKernel3.git -b mojito
185188 msg " || Cloning libufdt ||"
186189 git clone https://android.googlesource.com/platform/system/libufdt " $KERNEL_DIR " /scripts/ufdt/libufdt
190+ if [ $MODULES = " 1" ]
191+ then
192+ msg " || Cloning neternels-modules ||"
193+ git clone --depth 1 https://github.com/neternels/neternels-modules.git Mod
194+ fi
187195}
188196
189197# #------------------------------------------------------##
@@ -290,14 +298,17 @@ build_kernel() {
290298
291299 msg " || Started Compilation ||"
292300 make -j" $PROCS " O=out \
293- " ${MAKE[@]} " 2>&1 | tee error.log
294- make -j" $PROCS " O=out \
295- " ${MAKE[@]} " modules_prepare
296- make -j" $PROCS " O=out \
297- " ${MAKE[@]} " modules INSTALL_MOD_PATH=" $KERNEL_DIR " /out/modules
298- make -j" $PROCS " O=out \
299- " ${MAKE[@]} " modules_install INSTALL_MOD_PATH=" $KERNEL_DIR " /out/modules
300- find " $KERNEL_DIR " /out/modules -type f -iname ' *.ko' -exec cp {} AnyKernel3/modules/system/lib/modules/ \;
301+ " ${MAKE[@]} " 2>&1 | tee error.log
302+ if [ $MODULES = " 1" ]
303+ then
304+ make -j" $PROCS " O=out \
305+ " ${MAKE[@]} " modules_prepare
306+ make -j" $PROCS " O=out \
307+ " ${MAKE[@]} " modules INSTALL_MOD_PATH=" $KERNEL_DIR " /out/modules
308+ make -j" $PROCS " O=out \
309+ " ${MAKE[@]} " modules_install INSTALL_MOD_PATH=" $KERNEL_DIR " /out/modules
310+ find " $KERNEL_DIR " /out/modules -type f -iname ' *.ko' -exec cp {} Mod/system/lib/modules/ \;
311+ fi
301312
302313 BUILD_END=$( date +" %s" )
303314 DIFF=$(( BUILD_END - BUILD_START))
@@ -334,6 +345,14 @@ gen_zip() {
334345 fi
335346 cdir AnyKernel3
336347 zip -r $ZIPNAME -$DEVICE -$VERSION . -x " .git*" -x " README.md" -x " *.zip"
348+ if [ $MODULES = " 1" ]
349+ then
350+ cdir ../Mod
351+ rm -rf system/lib/modules/placeholder
352+ zip -r $ZIPNAME -$DEVICE -modules-$VERSION . -x " .git*" -x " LICENSE.md" -x " *.zip"
353+ MOD_NAME=" $ZIPNAME -$DEVICE -modules-$VERSION "
354+ cdir ../AnyKernel3
355+ fi
337356
338357 # # Prepare a final zip variable
339358 ZIP_FINAL=" $ZIPNAME -$DEVICE -$VERSION "
@@ -353,7 +372,12 @@ gen_zip() {
353372
354373 if [ " $PTTG " = 1 ]
355374 then
356- tg_post_build " $ZIP_FINAL .zip" " Build took : $(( DIFF / 60 )) minute(s) and $(( DIFF % 60 )) second(s)"
375+ tg_post_build " $ZIP_FINAL .zip" " Build took : $(( DIFF / 60 )) minute(s) and $(( DIFF % 60 )) second(s)"
376+ if [ $MODULES = " 1" ]
377+ then
378+ cdir ../Mod
379+ tg_post_build " $MOD_NAME .zip" " Flash this in magisk for loadable kernel modules"
380+ fi
357381 fi
358382 cd ..
359383}
0 commit comments