这个是我在mtk芯片方案android 5.1的修改 , 据我所知12版本以内都是这么改
灰常简单 希望能帮助有需要的人。
主要对 MediaTek bootloader 的序列号长度和打印设置进行了优化,提高了序列号的长度,并改变了打印设置,使其在构建中也能打印调试信息。
修改的文件:
bootable/bootloader/lk/app/mt_boot/mt_boot.c
bootable/bootloader/lk/target//xxx/include/target/cust_usb.h
文件修改说明:
mt_boot.c
: 修改了串行号的长度定义,从19个字符增加到36个字符。同时,修改了打印设置,使其在用户构建中也能打印调试信息,而不仅仅是在开发者构建中打印。
同时修改了`read_product_info`函数。原来的函数会检查读取到的产品信息中的每个字符,如果字符既不是字母也不是数字,那么函数就会返回0。注释掉了这个检查,所以现在的函数会接受任何字符。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