feat: add standalone factory test firmware

This commit is contained in:
chenjintao
2026-09-23 17:12:54 +08:00
parent 1f55943c29
commit 3e86e6cd66
14 changed files with 1349 additions and 2 deletions
+136
View File
@@ -0,0 +1,136 @@
# Windows 生成产测 customer_fs.bin
## 1. 说明
产测固件从 U 盘文件系统根目录读取以下三个文件:
```text
factory_boot_zh.mp3
factory_pass_zh.mp3
factory_shutdown_zh.mp3
```
仓库中的待打包目录是:
```text
audio_prompts\factory_test\customer_fs
```
SDK 自带的 Windows 工具是:
```text
ql-cross-tool\win32\mklfs-v2.exe
```
工具的命令格式为:
```text
mklfs-v2.exe -c <待打包目录> -s <文件系统字节数> -i <输出镜像>
```
当前 `EG800AKCN_11LG/customer_fs.bin` 的大小是 262144 字节,因此产测镜像也使用
262144。不要改变该容量,除非同时确认分区表允许更大的 customer_fs。
## 2. 检查资源
在 Windows `cmd.exe` 中进入仓库根目录:
```bat
cd /d D:\你的路径\banban
dir audio_prompts\factory_test\customer_fs
```
应看到且只需要打包以下文件:
```text
factory_boot_zh.mp3
factory_pass_zh.mp3
factory_shutdown_zh.mp3
```
代码访问的是文件系统根目录,所以不要在 `customer_fs` 目录里面再创建一层同名目录。
## 3. 备份现有镜像
现有镜像属于原业务固件。先备份,避免之后无法恢复:
```bat
copy /Y ql-config\config\EG800AKCN_11LG\customer_fs.bin ^
ql-config\config\EG800AKCN_11LG\customer_fs.bin.before-factory-test
```
本仓库提交不会替你执行此覆盖操作。
## 4. 生成到临时输出目录
先生成到独立目录,不要让打包工具直接覆盖配置目录:
```bat
if not exist output\factory-test mkdir output\factory-test
ql-cross-tool\win32\mklfs-v2.exe ^
-c audio_prompts\factory_test\customer_fs ^
-s 262144 ^
-i output\factory-test\customer_fs.bin
```
工具应正常退出,并生成:
```text
output\factory-test\customer_fs.bin
```
检查镜像大小:
```bat
for %I in (output\factory-test\customer_fs.bin) do @echo %~zI bytes
```
结果必须是:
```text
262144 bytes
```
如果把命令写进 `.bat` 文件,`%I` 要写成 `%%I`。
## 5. 放入项目配置目录
确认临时镜像大小正确后再复制:
```bat
copy /Y output\factory-test\customer_fs.bin ^
ql-config\config\EG800AKCN_11LG\customer_fs.bin
```
此时再执行产测 APP 和整包构建:
```bat
build.bat app
build.bat firmware
```
`build_package.bat` 会从下面的位置取 customer_fs:
```text
ql-config\config\EG800AKCN_11LG\customer_fs.bin
```
## 6. 烧录后验证
1. 长按开机后应听到“设备已开机,开始硬件测试啦”。
2. 串口应出现 `BOOT_AUDIO` 的 `node_result=PASS`。
3. 如果返回 `1002`,说明 APP 已更新但 customer_fs 没有更新,或文件名/层级错误。
4. 如果返回 `1003`,文件存在但无法解码或播放超时;检查 MP3 是否为完整文件。
5. 通过 USB CDC 抓取 `FT1 ` 开头的完整日志,确认 IMEI、ICCID、NFC UID 和耗时均出现。
## 7. 恢复业务文件系统
需要恢复原业务固件时:
```bat
copy /Y ql-config\config\EG800AKCN_11LG\customer_fs.bin.before-factory-test ^
ql-config\config\EG800AKCN_11LG\customer_fs.bin
```
然后重新执行 `build.bat firmware`。不要把产测 customer_fs 和正式业务 APP 混合发布。