二、 serial number 生成
文件 : mt_devs.c
__init int mt_board_init(void)
{
uint64_t key;
#if defined(CONFIG_MTK_USB_UNIQUE_SERIAL) || defined(MTK_SEC_FASTBOOT_UNLOCK_SUPPORT) //使用serial number或者使用 "0123456789ABCDEF" 开、关配置
key = get_devinfo_with_index(13);
key = (key << 32) | get_devinfo_with_index(12);
#else
key = 0;
#endif
if (key != 0)
get_serial(key, get_chip_code(), serial_number); //获取cpu chip id
else
memcpy(serial_number, "0123456789ABCDEF", 16);
retval = kobject_init_and_add(&sn_kobj, &sn_ktype, NULL, "sys_info"); //创建/sys/sys_info/serial_number接口供上层访问获取serial num
if (retval < 0)
printk("[%s] fail to add kobject\n", "sys_info");
}
/* ========================================================================= */
/* implementation of serial number attribute */