Add mbtk_reboot

Change-Id: I16682b505016b15c9f69819bd100da7e7fd75ae4
diff --git a/mbtk/mbtk_utils/device_info.c b/mbtk/mbtk_utils/device_info.c
index 3dd9b2a..0993c06 100755
--- a/mbtk/mbtk_utils/device_info.c
+++ b/mbtk/mbtk_utils/device_info.c
@@ -1,3 +1,4 @@
+#include "mbtk_type.h"
 #include "mbtk_device.h"
 
 static char* band_2_str(mbtk_modem_band_area_enum band_area)
@@ -35,6 +36,7 @@
     printf("Revision_Out:%s\n", info_basic.revision_out);
     printf("Revision_In:%s\n", info_basic.revision_in);
     printf("AB System:%s\n", info_basic.ab_support ? "Yes" : "No");
+    printf("Reboot flag:%d\n", info_basic.reboot_flag);
 
     mbtk_device_info_modem_t info_modem;
     memset(&info_modem, 0, sizeof(mbtk_device_info_modem_t));
diff --git a/mbtk/mbtk_utils/mbtk_reboot.c b/mbtk/mbtk_utils/mbtk_reboot.c
new file mode 100755
index 0000000..3263d73
--- /dev/null
+++ b/mbtk/mbtk_utils/mbtk_reboot.c
@@ -0,0 +1,57 @@
+#include "mbtk_type.h"
+#include "mbtk_device.h"
+
+static char* band_2_str(mbtk_modem_band_area_enum band_area)
+{
+    switch(band_area)
+    {
+        case MBTK_MODEM_BAND_AREA_CN:
+            return "CN";
+        case MBTK_MODEM_BAND_AREA_EU:
+            return "EU";
+        default:
+            return "ALL";
+    }
+}
+
+static void help()
+{
+    printf("mbtk_reboot [download]\n");
+}
+
+int main(int argc, char *argv[])
+{
+    if(argc == 1) {
+        system("reboot -f");
+    } else if(argc == 2) {
+        if(strcmp(argv[1], "download")) {
+            help();
+            return 0;
+        }
+    } else {
+        help();
+        return 0;
+    }
+
+    mbtk_device_info_basic_t info_basic;
+    memset(&info_basic, 0, sizeof(mbtk_device_info_basic_t));
+    int result = mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t));
+    if(result) {
+        printf("mbtk_dev_info_read(BASIC) fail.\n");
+        return -1;
+    }
+
+    info_basic.reboot_flag = MBTK_REBOOT_FLAG_DOWNLOAD;
+    result = mbtk_dev_info_write(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t));
+    if(result) {
+        printf("mbtk_dev_info_write(BASIC) fail.\n");
+        return -1;
+    }
+
+    system("sync");
+    system("reboot -f");
+
+    return 0;
+}
+
+