全志平臺Tina系統R18用dragonSN同時燒寫key到efuse和flash
在產品生產的過程中,客戶可能會選擇使用安全固件,這樣的話安全相關的rotpk是燒寫到efues中的,而普通的key諸如bt_mac \ wifi_mac是需要燒到flash中的private中的,這個時候就需要做如下修改:
1.工具dragonSN支持同時燒錄兩種存儲介質的KEY
2.5.7版本以上的dragonSN應該已經支持了這個功能。2.5.7之前很多個版本應該就就已經支持了,沒有測試,不能確定是哪個版本開始支持的。
2.設備端uboot支持同時燒錄兩種存儲介質的KEY:
(1)uboot中加入這個宏:
chenkunyao@Exdroid35:~/workspace/ftina2.0/etina/lichee/brandy/u-boot-2014.07/include/configs$ git diff .
diff --git a/u-boot-2014.07/include/configs/sun50iw1p1.h b/u-boot-2014.07/include/configs/sun50iw1p1.h
index 6ef4cd0..ba49d9f 100755
--- a/u-boot-2014.07/include/configs/sun50iw1p1.h
+++ b/u-boot-2014.07/include/configs/sun50iw1p1.h
@@ -129,6 +129,9 @@
#define CONFIG_SYS_I2C_SPEED 400000
#define CONFIG_SYS_I2C_SLAVE 0x10
+//R18 sgw flash rotpk and flash key at the same time
+#define CONFIG_SUNXI_PRIVATE_KEY
+
//#define CONFIG_SUNXI_DMA
#define CONFIG_SUNXI_CHIPID
#define CONFIG_SUNXI_ARISC_EXIST
(2)重新編譯uboot:
source build/envsetup.sh 獲取環境變量
lunch 選擇要編的方案
cd lichee 進入內核目錄
mboot 編譯
./tools/add_hash_uboot.sh -f u-boot.bin -m uboot
build_uboot
"u-boot.bin" -> "u-boot-spinor-sun50iw1p1.bin"
"u-boot-spinor-sun50iw1p1.bin" -> "/home/chenkunyao/workspace/ftina2.0/etina/lichee/brandy/u-boot-2014.07/../../../target/allwinner/tulip-common/bin/u-boot-spinor-sun50iw1p1.bin"
mboot success!
(3)將重新編譯出來的uboot 複製到相應的地方,如果沒有修改打包時獲取uboot的位置的話,這一步可以不做
(4)pack 重新編譯打包
(5)使用dragonSN,全局變量設置爲安全key,燒寫key
(6)這個時候燒進去private的key沒有文件系統,是裸數據,不能掛載之後看到,可以用hexdump看到:
root@TinaLinux:/tmp# hexdump -C /dev/by-name/private
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000fe000 73 75 6e 78 69 00 ff ff 01 00 00 00 ff ff ff ff |sunxi...........|
000fe010 ff ff ff ff ff ff ff ff 73 6e 00 ff ff ff ff ff |........sn......|
000fe020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000fe030 ff ff ff ff ff ff ff ff 31 32 33 00 ff ff ff ff |........123.....|
000fe040 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
*
000fe0b0 ff ff ff ff ff ff ff ff 01 00 00 00 ff ff ff ff |................|
000fe0c0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|