kernel_module_loader: Load Modules as early as possible

 * This fixes unusually checking for unneeded directories for modules

 * Load Modules early, as it may required by decryption process

 * Tests: fastboot boot, ramdisk boot, fastbootd boot

Change-Id: I2aae88b6dfc0c98867209d4e4eb7e9d503682199
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
diff --git a/twrp.cpp b/twrp.cpp
index b7f4058..0362b80 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -48,10 +48,6 @@
 #include "twrp-functions.hpp"
 #include "data.hpp"
 
-#ifdef TW_LOAD_VENDOR_MODULES
-#include "kernel_module_loader.hpp"
-#endif
-
 #include "partitions.hpp"
 #ifdef __ANDROID_API_N__
 #include <android-base/strings.h>
@@ -391,6 +387,7 @@
 	DataManager::SetDefaultValues();
 	startupArgs startup;
 	startup.parse(&argc, &argv);
+	android::base::SetProperty(TW_FASTBOOT_MODE_PROP, startup.Get_Fastboot_Mode() ? "1" : "0");
 	printf("=> Linking mtab\n");
 	symlink("/proc/mounts", "/etc/mtab");
 	std::string fstab_filename = "/etc/twrp.fstab";
@@ -406,13 +403,11 @@
 #ifdef TW_LOAD_VENDOR_MODULES
 	if (startup.Get_Fastboot_Mode()) {
 		TWPartition* ven_dlkm = PartitionManager.Find_Partition_By_Path("/vendor_dlkm");
-		android::base::SetProperty("ro.twrp.fastbootd", "1");
 		PartitionManager.Prepare_Super_Volume(PartitionManager.Find_Partition_By_Path("/vendor"));
 		if(ven_dlkm) {
 			PartitionManager.Prepare_Super_Volume(ven_dlkm);
 		}
 	}
-	KernelModuleLoader::Load_Vendor_Modules();
 #endif
 
 	printf("Starting the UI...\n");