软件:
硬件:
1. 首先,准备一个明文固件hello-world.bin
-
基于esp-idf-v5.1.2\examples\get-started\hello_world 例程,使用如下指令,直接编译,获取明文固件
hello-world.bin
idf.py set-target esp32c3
idf.py build
2. **接下来,基于[esp-
idf-v5.1.2\examples\system\ota\simple_ota_example](https://github.com/espressif/esp-
idf/tree/v5.1.2/examples/system/ota/simple_ota_example) 例程进行测试**
- 将明文固件
hello-world.bin
放到 esp-idf-v5.1.2\examples\system\ota\simple_ota_example 目录下
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/7729fe7fc24d4de1a8849e77fe116ce0.png)
3. 使用如下指令获取secure boot V2 key
espsecure.py generate_signing_key secure_boot_signing_key.pem --version 2
4. **使用如下指令,通过生成的secure_boot_signing_key.pem
文件对 明文的 hello-world.bin
进行签名,生成被签名的 SIGNED_hello_world.bin
**
espsecure.py sign_data --version 2 --keyfile secure_boot_signing_key.pem --output SIGNED_hello_world.bin hello_world.bin
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/0ca1fee8a443470c91f67e5bc44659a1.png)
5. **为了方便 OTA 测试,我们[在本地开启一个 HTTP Server
服务器](https://blog.csdn.net/weixin_42083266/article/details/134696145?spm=1001.2014.3001.5502),将签名的
SIGNED_hello_world.bin
上传到 HTTP Server
中**
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/366b2e0eeb7343c4879baf02d6375ae2.png)
6. **基于[esp-
idf-v5.1.2\examples\system\ota\simple_ota_example](https://github.com/espressif/esp-
idf/tree/v5.1.2/examples/system/ota/simple_ota_example) 例程,开启如下软件配置**
-
开启 Flash 加密 和 安全启动模式
→ Security features
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/7a8266110ecb45b6a72dd2419d1902c9.png) -
增大
partition-table
偏移地址
→ Partition Table
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/803780802607473fb05cd470b4ce718d.png) -
设置待 OTA 的
SIGNED_hello_world.bin
文件路径
→ Example Configuration
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/988465bf17e94a729a8e340aa680e31b.png) -
与 PC 连接相同的路由器
→ Example Connection Configuration
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/fb7091a199d14fb3ac0f4d82bd06866f.png) -
开启 HTTP Server OTA 的支持
→ Component config → ESP HTTPS OTA
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/edf64049cf7244ae93e673ebc2686e6b.png) -
关闭
NVS
加密
由于开启 Flash 加密
后,默认也会使能 NVS 加密
,但我们这里没有进行 NVS 加密的相关设置,因此需要关闭 NVS 加密
的配置
→ Component config → NVS
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/b8d78cf69bdc4ebb82cfd6c4061ae30d.png)
7. 使用如下指令编译bootloader
,并下载被签名的 bootloader.bin
idf.py bootloader
idf.py -p COM* boorloader-flash
8. 使用如下指令,对工程进行编译,并下载编译后的固件
idf.py build
idf.py -p COM* flash monitor
9. 检查固件运行日志
注意:确保稳定的供电环境
-
固件首次运行启动后,会先检查 secure boot 签名验证,然后执行 Flash 加密
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/252bf92d8e25452ca8fd71d2c9936d93.png) -
Flash 加密完成后,会进行软件重启,然后开始运行用户固件
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/c3d00791fb3f4e1c8ccf64cd1cbd4e05.png) -
运行 factory 分区的固件,开启 OTA
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/eef088512a6c48aa85abeae4715d6ba8.png) -
OTA 完成,会再次软件重启,运行 OTA 分区的固件
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/ef4720d9275241bbad702da327f843f6.png)
![在这里插入图片描述](https://img-
blog.csdnimg.cn/direct/4d3485c0a9a4456ca2cd58204bcb35f9.png)
学习计划安排
我一共划分了六个阶段,但并不是说你得学完全部才能上手工作,对于一些初级岗位,学到第三四个阶段就足矣~
这里我整合并且整理成了一份【282G】的网络安全从零基础入门到进阶资料包,需要的小伙伴可以扫描下方CSDN官方合作二维码免费领取哦,无偿分享!!!
如果你对网络安全入门感兴趣,那么你需要的话可以
点击这里👉网络安全重磅福利:入门&进阶全套282G学习资源包免费分享!
①网络安全学习路线
②上百份渗透测试电子书
③安全攻防357页笔记
④50份安全攻防面试指南
⑤安全红队渗透工具包
⑥HW护网行动经验总结
⑦100个漏洞实战案例
⑧安全大厂内部视频资源
⑨历年CTF夺旗赛题解析
![](https://img-blog.csdnimg.cn/img_convert/694403d898162d253a67abd97c526a25.jpeg)