Android MediaTek bootloader 的序列号长度 & 移除非字母和数字限制 SN-Writer工具支持写入

目录

修改的文件:

文件修改说明:


这个是我在mtk芯片方案android 5.1的修改 , 据我所知12版本以内都是这么改
灰常简单 希望能帮助有需要的人。

主要对 MediaTek bootloader 的序列号长度和打印设置进行了优化,提高了序列号的长度,并改变了打印设置,使其在构建中也能打印调试信息。

修改的文件:

  1. bootable/bootloader/lk/app/mt_boot/mt_boot.c
  2. bootable/bootloader/lk/target//xxx/include/target/cust_usb.h

文件修改说明:

  1. mt_boot.c: 修改了串行号的长度定义,从19个字符增加到36个字符。同时,修改了打印设置,使其在用户构建中也能打印调试信息,而不仅仅是在开发者构建中打印。
    同时修改了`read_product_info`函数。原来的函数会检查读取到的产品信息中的每个字符,如果字符既不是字母也不是数字,那么函数就会返回0。注释掉了这个检查,所以现在的函数会接受任何字符。
  2. cust_usb.h: 修改了串行号的长度定义,从19个字符增加到36个字符。

     
---
 bootable/bootloader/lk/app/mt_boot/mt_boot.c                  | 11 +++++------
 .../lk/target/xxx8735_xxx/include/target/cust_usb.h          |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)
 mode change 100644 => 100755 bootable/bootloader/lk/target/xxx8735_xxx/include/target/cust_usb.h

diff --git a/bootable/bootloader/lk/app/mt_boot/mt_boot.c b/bootable/bootloader/lk/app/mt_boot/mt_boot.c
index 7ccabdb..e960fe7 100755
--- a/bootable/bootloader/lk/app/mt_boot/mt_boot.c
+++ b/bootable/bootloader/lk/app/mt_boot/mt_boot.c
@@ -78,14 +78,14 @@ u8 g_oemkey[OEM_PUBK_SZ] = {OEM_PUBK};
 
 /* Please define SN_BUF_LEN in cust_usb.h */
 #ifndef SN_BUF_LEN
-#define SN_BUF_LEN	19	/* fastboot use 13 bytes as default, max is 19 */
+#define SN_BUF_LEN	36	/* fastboot use 13 bytes as default, max is 19 */
 #endif
 
 #define FDT_BUFF_SIZE  1024
 #define FDT_BUFF_PATTERN  "BUFFEND"
 
 #define DEFAULT_SERIAL_NUM "0123456789ABCDEF"
-#define SERIAL_NUM_FROM_BARCODE
+#define SERIAL_NUM_FROM_BARCODE  1
 /*
  * Support read barcode from /dev/pro_info to be serial number.
  * Then pass the serial number from cmdline to kernel.
@@ -571,11 +571,10 @@ int boot_linux_fdt(void *kernel, unsigned *tags,
 
 
     if (!has_set_p2u) {
-		//shh modify print uart0  to normal uart0
 #ifdef USER_BUILD
-        sprintf(cmdline,"%s%s",cmdline," printk.disable_uart=1");
+        sprintf(cmdline,"%s%s",cmdline," printk.disable_uart=0");
 #else
-        sprintf(cmdline,"%s%s",cmdline," printk.disable_uart=1 ddebug_query=\"file *mediatek* +p ; file *gpu* =_\"");
+        sprintf(cmdline,"%s%s",cmdline," printk.disable_uart=0 ddebug_query=\"file *mediatek* +p ; file *gpu* =_\"");
 #endif
 
         /*Append pre-loader boot time to kernel command line*/
@@ -780,7 +779,7 @@ void boot_linux(void *kernel, unsigned *tags,
 #endif
     if (!has_set_p2u) {
 #ifdef USER_BUILD
-        sprintf(cmdline,"%s%s",cmdline," printk.disable_uart=1");
+        sprintf(cmdline,"%s%s",cmdline," printk.disable_uart=0");
 #else
         sprintf(cmdline,"%s%s",cmdline," printk.disable_uart=0 ddebug_query=\"file *mediatek* +p ; file *gpu* =_\"");
 #endif
diff --git a/bootable/bootloader/lk/target/xxx8735_xxx/include/target/cust_usb.h b/bootable/bootloader/lk/target/xxx8735_xxx/include/target/cust_usb.h
old mode 100644
new mode 100755
index ec29e4b..bd26001
--- a/bootable/bootloader/lk/target/xxx8735_xxx/include/target/cust_usb.h
+++ b/bootable/bootloader/lk/target/xxx8735_xxx/include/target/cust_usb.h
@@ -9,6 +9,6 @@
 #define USB_MANUFACTURER	"MediaTek"
 #define USB_PRODUCT_NAME	"Android"
 #define FASTBOOT_DEVNAME	"mt6752_device"
-#define SN_BUF_LEN		19
+#define SN_BUF_LEN		36
 
 #endif /* __CUST_USB_H__ */
-- 
bootable/bootloader/lk/app/mt_boot/mt_boot.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/bootable/bootloader/lk/app/mt_boot/mt_boot.c b/bootable/bootloader/lk/app/mt_boot/mt_boot.c
index e960fe7..074cdce 100755
--- a/bootable/bootloader/lk/app/mt_boot/mt_boot.c
+++ b/bootable/bootloader/lk/app/mt_boot/mt_boot.c
@@ -1140,8 +1140,10 @@ static inline int read_product_info(char *buf)
 	for( ; tmp < SN_BUF_LEN; tmp++) {
 		if( (buf[tmp] == 0 || buf[tmp] == 0x20) && tmp > 0) {
 			break;
-		} else if( !isalpha(buf[tmp]) && !isdigit(buf[tmp]))
-			return 0;
+		}
+		//$shh$20190311$disabled$sn -$
+		/* else if( !isalpha(buf[tmp]) && !isdigit(buf[tmp]))
+			return 0;*/
 	}
 	return tmp;
 }
-- 
1.9.1

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一歲抬頭

点赞1元,收藏免费,打赏随意。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值