芯片序列号可作为唯一识别ID使用,具有许多用途,本文简单介绍全志平台获取芯片序列号的方法。
1.结果演示
- 演示最终获取芯片ID后,将字符串写入到一个属性中
console:/ # getprop persist.svt.chipnumber
388520d1010706200000520000000000
2.芯片信息获取
- 可通过下面属性获取芯片ID
console:/ #
console:/ #
console:/ #
console:/ # cat /sys/class/sunxi_info/sys_info
sunxi_platform : sun50iw12
sunxi_secure : normal
sunxi_serial : 388520d1010706200000520000000000
sunxi_chiptype : 00000043
sunxi_batchno : 0x18600001
console:/ #
3.通过shell命令获取芯片ID字符串
- 切割演示
console:/ # cat /sys/class/sunxi_info/sys_info | busybox grep sunxi_serial | cut -d ':' -f2 | cut -d ' ' -f2 <
388520d1010706200000520000000000
console:/ #
4.写入序列号
- 先通过cut切割目标字符串
- 后通过setprop persist.svt.chipnumber写入
cat /sys/class/sunxi_info/sys_info | busybox grep sunxi_serial | cut -d ':' -f2 | cut -d ' ' -f2 | xargs setprop persist.svt.chipnumber