init: add a hook before parsing system properties

Also properly implement weak symbol overridden while at it.

Change-Id: Id563c8aaa52c0e41823dbb035f0319a6531f12b7
Signed-off-by: micky387 <mickaelsaibi@free.fr>
diff --git a/init/Android.bp b/init/Android.bp
index 9da8dd2..12f97ca 100644
--- a/init/Android.bp
+++ b/init/Android.bp
@@ -84,6 +84,7 @@
     "uevent_listener.cpp",
     "ueventd.cpp",
     "ueventd_parser.cpp",
+    "vendor_init.cpp",
 ]
 
 soong_config_module_type {
@@ -225,7 +226,7 @@
         "libcap",
     ] + select(soong_config_variable("libinit", "vendor_init_lib"), {
         any @ flag_val: [flag_val],
-        default: ["vendor_init"],
+        default: [],
     }),
     export_cflags: select(soong_config_variable("libinit", "vendor_init_device_symlinks"), {
         "true": ["-DTARGET_CREATE_DEVICE_SYMLINKS"],
@@ -255,15 +256,6 @@
 }
 
 cc_library_static {
-    name: "vendor_init",
-    ramdisk_available: true,
-    recovery_available: true,
-    srcs: [
-        "vendor_init.cpp",
-    ],
-}
-
-cc_library_static {
     name: "libinit",
     defaults: ["libinit_defaults"],
 }
@@ -293,7 +285,6 @@
     stem: "init",
     defaults: [
         "init_defaults",
-        "vendor_init_defaults",
     ],
     srcs: ["main.cpp"],
     symlinks: ["ueventd"],
@@ -488,7 +479,6 @@
     name: "init_first_stage",
     defaults: [
         "init_first_stage_defaults",
-        "vendor_init_defaults",
     ],
 }
 
@@ -497,7 +487,6 @@
     defaults: [
         "avf_build_flags_cc",
         "init_first_stage_defaults",
-        "vendor_init_defaults",
     ],
     cflags: ["-DMICRODROID=1"],
     no_full_install: true,
diff --git a/init/property_service.cpp b/init/property_service.cpp
index ea4860e..e7bf97c 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -1425,6 +1425,8 @@
     ProcessKernelCmdline();
     ProcessBootconfig();
 
+    vendor_process_bootenv();
+
     // Propagate the kernel variables to internal variables
     // used by init as well as the current required properties.
     ExportKernelBootProps();
diff --git a/init/vendor_init.cpp b/init/vendor_init.cpp
index e4b1268..e833351 100644
--- a/init/vendor_init.cpp
+++ b/init/vendor_init.cpp
@@ -44,5 +44,10 @@
 }
 #endif
 
+__attribute__ ((weak))
+void vendor_process_bootenv()
+{
+}
+
 }
 }
diff --git a/init/vendor_init.h b/init/vendor_init.h
index 0bae2db..22d0750 100644
--- a/init/vendor_init.h
+++ b/init/vendor_init.h
@@ -33,11 +33,11 @@
 namespace android {
 namespace init {
 
-extern void vendor_load_properties(void);
-
+void vendor_load_properties();
 #ifdef TARGET_CREATE_DEVICE_SYMLINKS
-extern void vendor_create_device_symlinks(int partNum, std::string partName, std::vector<std::string>& links);
+void vendor_create_device_symlinks(int partNum, std::string partName, std::vector<std::string>& links);
 #endif
+void vendor_process_bootenv();
 
 }
 }