Rockchip 平台写入序列号

Vendor Storage Architecture
 
Data Layout
 
Data Layout
 
ID DEFINE
数据按照64-bytes对齐方式存储在NVM中,这表明每个项目的最小分配是 64 字节,所以写1-64字节,空间将分配为64字节,写65-128字节,空间将被分配为 128 字节。
 
API For UBOOT
  Source code : u-boot/board/rockchip/common/storage/storage.c  
int vendor_storage_init(void)
 function: Initialize vendor storage
 input : none
 return: 0, Initialize success
 other, Initialize fail
int vendor_storage_read(u32 id, void *pbuf, u32 size)
 function: read vendor storage by id
 input : id, item id; pbuf, data buffer; size, number byte to read. 
 return: other: number byte have read.
 -1, read fail.
int vendor_storage_write(u32 id, void *pbuf, u32 size)
 function: write vendor storage by id
 input : id: item id; pbuf: data buffer; size: number bytes to write. 
 return: 0: write success
 other: write fail
API For Kernel
Source code : kernel/drivers/soc/rockchip/rk_vendor_storage.c
                       kernel/drivers/soc/rockchip/sdmmc_vendor_storage.c
int rk_vendor_read(u32 id, void *pbuf, u32 size) 
 function: read vendor storage by id
 input : id: item id; pbuf: data buffer; size: number bytes to read. 
 return: other: number byte have read.
 -1: read fail
int rk_vendor_write(u32 id, void *pbuf, u32 size)
 function: write vendor storage by id
 input : id, item id; pbuf: data buffer; size: number bytes to write. 
 return: 0: write success
 other : write fail
Kernel configuration
Makefile:
Menuconfig:
 
注意事项
SN 默认都是要求符合 GMS 的规范, 要求长度不大于 14 且字母开头的数字字母组合 ,如果没有按要求写 入,重启设备之后,看到的 SN 不是自己写入的 SN ,而是系统随机生成的。对于这个问题的解决办法
1. 重新写入符合 GMS 的规范的 SN
2. 对于不需要使用 GMS 服务的场景,可以从 SDK 里面去掉 SN 校验的功能:
 
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章