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 校驗的功能:
 
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章