Add fuse check property

Root cause:
Add fuse check property

How to fix:
. N/A

RiskArea:
. Secuity,Fuse

Change-Id: Ifa193a11f0ba28b6b236c3ba3e032b15564889b6
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 2c95b08..f7ec3c8 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -260,6 +260,19 @@
 static int auth_kernel_img = 0;
 static device_info device = {DEVICE_MAGIC,0,0,0,0,{0},{0},{0},1,{0},0,{0}};
 
+/*[Arima_8910][jhchen] add fuse check property 20181031 begin*/
+#ifdef ENABLE_FUSE_CHECK
+static const char *fuse_blown     = " androidboot.oem.color=red";
+static const char *fuse_not_blown = " androidboot.oem.color=brown";
+#endif
+/*[Arima_8910][jhchen] 20181031 end*/
+
+/*[Arima_8910][jhchen] add fuse check property 20181031 begin*/
+#ifdef ENABLE_FUSE_CHECK
+    int is_fused = 0;
+#endif
+/*[Arima_8910][jhchen] 20181031 end*/
+
 static bool is_allow_unlock = 0;
 
 static char frp_ptns[2][8] = {"config","frp"};
@@ -726,6 +739,21 @@
 	}
 #endif
 
+/*[Arima_8910][jhchen] add fuse check property 20181031 begin*/
+#ifdef ENABLE_FUSE_CHECK
+	{
+		int hw_key_status = readl(0xA01D0);
+		is_fused = (hw_key_status & 0x2) >> 1;
+		dprintf(CRITICAL, "hw_key_status = 0x%x, is_fused=%d\n", hw_key_status, is_fused);
+		if (is_fused) {
+	        cmdline_len += strlen(fuse_blown);
+		} else {
+	        cmdline_len += strlen(fuse_not_blown);
+		}
+    }
+#endif
+/*[Arima_8910][jhchen] 20181031 end*/
+
 	if (cmdline_len > 0) {
 		const char *src;
 		unsigned char *dst;
@@ -1011,6 +1039,20 @@
 			while ((*dst++ = *src++));
 		}
 #endif
+
+/*[Arima_8910][jhchen] add fuse check property 20181031 begin*/
+#ifdef ENABLE_FUSE_CHECK
+		if (is_fused) {
+			src = fuse_blown;
+			if (have_cmdline) --dst;
+			while ((*dst++ = *src++));
+		} else {
+			src = fuse_not_blown;
+			if (have_cmdline) --dst;
+			while ((*dst++ = *src++));
+		}
+#endif
+/*[Arima_8910][jhchen] 20181031 end*/
 	}
 
 
@@ -4976,19 +5018,13 @@
 
 void get_bootloader_version(unsigned char *buf)
 {
-	/* Show SW and modem version and internal storage size on fastboot screen start */
-	//snprintf((char*)buf, MAX_RSP_SIZE, "%s",  device.bootloader_version);
-	memcpy(buf, ARIMA_BOOTLOADER_VERSION, MAX_VERSION_LEN);
-	dprintf(CRITICAL, "ARIMA_BOOTLOADER_VERSION:%s\n",ARIMA_BOOTLOADER_VERSION);
+	snprintf((char*)buf, MAX_RSP_SIZE, "%s",  device.bootloader_version);
 	return;
 }
 
 void get_baseband_version(unsigned char *buf)
 {
-	/* Show SW and modem version and internal storage size on fastboot screen start */
-	//snprintf((char*)buf, MAX_RSP_SIZE, "%s", device.radio_version);
-	memcpy(buf, ARIMA_BASEBAND_VERSION, MAX_VERSION_LEN);
-	dprintf(CRITICAL, "ARIMA_BASEBAND_VERSION:%s\n",ARIMA_BASEBAND_VERSION);
+	snprintf((char*)buf, MAX_RSP_SIZE, "%s", device.radio_version);
 	return;
 }
 
diff --git a/makefile b/makefile
index d185daa..4f54ef6 100755
--- a/makefile
+++ b/makefile
@@ -75,6 +75,10 @@
   CFLAGS += -DENABLE_EARLY_ETHERNET=1
 endif
 
+# [Arima_8910][jhchen] add fuse check property 20181031 begin
+CFLAGS += -DENABLE_FUSE_CHECK=1
+# [Arima_8910][jhchen] 20181031 end
+
 # setup toolchain prefix
 TOOLCHAIN_PREFIX ?= arm-eabi-
 CFLAGS += -fstack-protector-all
@@ -180,10 +184,6 @@
   DEFINES += TARGET_USE_SYSTEM_AS_ROOT_IMAGE=0
 endif
 
-DEFINES += ARIMA_BASEBAND_VERSION=
-DEFINES += ARIMA_BOOTLOADER_VERSION=
-$(warning DEFINES : $(DEFINES))
-
 # these need to be filled out by the project/target/platform rules.mk files
 TARGET :=
 PLATFORM :=