rockchip的sdk编译时出现Error:Chip is invalid!
- 完整的log如下
********rkImageMaker ver 2.23********
Error:Chip is invalid!
ERROR: Running /root/work/LinuxSDK-v1.1/device/rockchip/common/scripts/mk-updateimg.sh - build_updateimg failed!
ERROR: exit code 254 from line 94:
"$RK_PACK_TOOL_DIR/rkImageMaker" -$TAG MiniLoaderAll.bin update.raw.img update.img -os_type:androidos
ERROR: call stack:
mk-updateimg.sh: build_updateimg(94)
mk-updateimg.sh: post_build_hook(167)
mk-updateimg.sh: main(178)
ERROR: Running /root/work/LinuxSDK-v1.1/device/rockchip/common/build-hooks/99-all.sh - build_all failed!
ERROR: exit code 254 from line 42:
"$SCRIPTS_DIR/mk-updateimg.sh"
ERROR: call stack:
99-all.sh: build_all(42)
99-all.sh: build_allsave(112)
99-all.sh: build_hook(137)
build-helper: try_func(63)
build-helper: try_hook(95)
build-helper: source(173)
99-all.sh: main(147)
ERROR: Running /root/work/LinuxSDK-v1.1/device/rockchip/common/build-hooks/99-all.sh - try_func build_hook allsave failed!
ERROR: exit code 254 from line 67:
build_hook
ERROR: call stack:
build-helper: try_func(67)
build-helper: try_hook(95)
build-helper: source(173)
99-all.sh: main(147)
ERROR: Running ./build.sh - run_hooks build allsave failed!
ERROR: exit code 254 from line 195:
/root/work/LinuxSDK-v1.1/device/rockchip/common/build-hooks/99-all.sh build allsave
ERROR: call stack:
build.sh: run_hooks(195)
build.sh: run_build_hooks(214)
build.sh: main(495)
build.sh: main(510)
ERROR: Running ./build.sh - run_build_hooks build allsave failed!
ERROR: exit code 254 from line 217:
build
ERROR: call stack:
build.sh: run_build_hooks(217)
build.sh: main(495)
build.sh: main(510)
- 查到代码出错在如下代码

位于<sdk_path>/device/rockchip/common/scripts/mk-updateimg.sh - 在93行之前加打印检查变量,发现TAG为‘RK’
- 在文件<sdk_path>/tools/linux/Linux_Pack_Firmware/rockdev/rk3588-mkupdate.sh也使用了该工具,由此可以初步推测出TAG这个变量本来应该是芯片名称,结果却是‘RK’

- 查到TAG是在如下代码之中赋值的
TAG=RK$(hexdump -s 21 -n 4 -e '4 "%c"' MiniLoaderAll.bin | rev)
- 关键是hexdump和MiniLoaderAll.bin,MiniLoaderAll.bin这个是二进制,我们使用hex工具查看,可以发现该文件之中确实有rk3588的字符串,所以问题应该不是处在该文件之中,而是出在hexdump上

- 运行hexdump读取,“hexdump -s 21 -n 4 -e ‘4 “%c”’ MiniLoaderAll.bin”,提示报错为“zsh: command not found: hexdump”
- 安装hexdump
sudo apt install bsdmainutils
- 再次使用build.sh,成功编译
