From 7d48a0d5468dcb6966c338e1d5ac619cd5abd866 Mon Sep 17 00:00:00 2001
From: "yang.tian" <yang.tian@nxp.com>
Date: Tue, 11 Dec 2018 17:38:48 +0800
Subject: [PATCH] MA-13748 Pass BDADDR from uboot cmdline

Pass bt mac address from uboot cmdline to write
ro.boot.btmacaddr property for bluetooth hal to parse
BDADDR which is composed from ro.boot.serialno,
or it will fall back to persist property seted in init.rc.

Change-Id: If6886596c79c699b8530d3249b1cc98f19aad51f
Signed-off-by: yang.tian <yang.tian@nxp.com>
---
 common/image-android.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/common/image-android.c b/common/image-android.c
index 67cb86f..71b93da 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -125,6 +125,17 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
 					serialnr.high,
 					serialnr.low);
 	strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline));
+
+	char bd_addr[16]={0};
+	sprintf(bd_addr,
+		"%08x%08x",
+		serialnr.high,
+		serialnr.low);
+	sprintf(newbootargs,
+		" androidboot.btmacaddr=%c%c:%c%c:%c%c:%c%c:%c%c:%c%c",
+		bd_addr[0],bd_addr[1],bd_addr[2],bd_addr[3],bd_addr[4],bd_addr[5],
+		bd_addr[6],bd_addr[7],bd_addr[8],bd_addr[9],bd_addr[10],bd_addr[11]);
+	strncat(commandline, newbootargs, sizeof(commandline) - strlen(commandline));
 #endif
 
 	/* append soc type into bootargs */
-- 
1.9.1