usb: Initialize USB Code Update
Compile the USB Code Update function after enabling `usb-code-update`,
and expect to pass in the name of the USB mount folder when calling
the process.
Also, the dependency of CLI11 has been added.
Tested: enabled `usb-code-update` and built `phosphor-bmc-code-mgmt`
successfully and check that there is a `phosphor-usb-code-update`
process in image-bmc.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Iedfb63c3866cc8542afef9b54bfeaaf5f7b40c6b
diff --git a/usb/meson.build b/usb/meson.build
new file mode 100644
index 0000000..f0ac2d0
--- /dev/null
+++ b/usb/meson.build
@@ -0,0 +1,22 @@
+if cpp.has_header('CLI/CLI.hpp')
+ CLI11_dep = declare_dependency()
+else
+ CLI11_dep = dependency(
+ 'CLI11',
+ fallback: [ 'CLI11', 'CLI11_dep' ],
+ )
+endif
+
+source = [
+ 'usb_manager_main.cpp',
+ ]
+
+executable(
+ 'phosphor-usb-code-update',
+ source,
+ dependencies: [
+ CLI11_dep,
+ ],
+ install: true,
+ install_dir: get_option('bindir')
+)
diff --git a/usb/usb_manager_main.cpp b/usb/usb_manager_main.cpp
new file mode 100644
index 0000000..b5a538d
--- /dev/null
+++ b/usb/usb_manager_main.cpp
@@ -0,0 +1,14 @@
+#include <CLI/CLI.hpp>
+
+int main(int argc, char** argv)
+{
+ std::string fileName{};
+
+ CLI::App app{"Update the firmware of OpenBMC via USB app"};
+ app.add_option("-f,--fileName", fileName,
+ "Get the name of the USB mount folder");
+
+ CLI11_PARSE(app, argc, argv);
+
+ return 0;
+}