module load: attempt to load modules from /vendor

Use TW_LOAD_VENDOR_MODULES := "module1.ko module2.ko modulen.ko"
in BoardConfig to have TWRP attempt to load kernel modules during
startup. For fastboot ramdisks, TWRP will attempt to load from
the ramdisk from /vendor/lib/modules. You can have the build
system copy the modules to
Otherwise in recovery in boot mode, TWRP will attempt the following:
check /lib/modules (ramdisk vendor_boot)
check /lib/modules/N.N (ramdisk vendor_boot)
check /lib/modules/N.N-gki (ramdisk vendor_boot)
check /vendor/lib/modules (ramdisk)
check /vendor/lib/modules/1.1 (ramdisk prebuilt modules)
check /vendor/lib/modules/N.N (vendor mounted)
check /vendor/lib/modules/N.N-gki (vendor mounted)

Change-Id: I2dccf199e37d47cb7a7e79b0e11026d67b4e3186
diff --git a/kernel_module_loader.hpp b/kernel_module_loader.hpp
new file mode 100644
index 0000000..fe89031
--- /dev/null
+++ b/kernel_module_loader.hpp
@@ -0,0 +1,33 @@
+#include <dirent.h>
+#include <string>
+#include <vector>
+#include <android-base/strings.h>
+#include <modprobe/modprobe.h>
+#include <sys/utsname.h>
+#include "twcommon.h"
+#include "twrp-functions.hpp"
+#define VENDOR_MODULE_DIR "/vendor/lib/modules"    // Base path for vendor kernel modules to check by TWRP
+#define VENDOR_BOOT_MODULE_DIR "/lib/modules"      // vendor_boot ramdisk GKI modules to check by TWRP
+typedef enum {
+class KernelModuleLoader
+    static bool Load_Vendor_Modules(BOOT_MODE mode); // Load specific maintainer defined kernel modules in TWRP
+	static bool Try_And_Load_Modules(std::string module_dir); // Use libmodprobe to attempt loading kernel modules
+	static bool Write_Module_List(std::string module_dir); // Write list of modules to load from TW_LOAD_VENDOR_MODULES
+    static bool Copy_Modules_To_Tmpfs(std::string module_dir); // Copy modules to ramdisk for loading
\ No newline at end of file