create libmodprobe, integrate into first_stage_init

Modprobe functionality is required both within first stage init and also
as a standalone binary. Create a library for this using and extending
the logic in modalias_handler.cpp.

First stage init will attempt to load modules from /lib/modules.

Bug: 129780532
Change-Id: Ie3582358fd839c2f64e1b386b30ed551a86aef5d
diff --git a/libmodprobe/Android.bp b/libmodprobe/Android.bp
new file mode 100644
index 0000000..a2824d1
--- /dev/null
+++ b/libmodprobe/Android.bp
@@ -0,0 +1,30 @@
+cc_library_static {
+    name: "libmodprobe",
+    cflags: [
+        "-Werror",
+    ],
+    recovery_available: true,
+    srcs: [
+        "libmodprobe.cpp",
+        "libmodprobe_ext.cpp",
+    ],
+    shared_libs: [
+        "libbase",
+    ],
+    export_include_dirs: ["include/"],
+}
+
+cc_test {
+    name: "libmodprobe_tests",
+    cflags: ["-Werror"],
+    shared_libs: [
+        "libbase",
+    ],
+    local_include_dirs: ["include/"],
+    srcs: [
+        "libmodprobe_test.cpp",
+        "libmodprobe.cpp",
+        "libmodprobe_ext_test.cpp",
+    ],
+    test_suites: ["device-tests"],
+}