瑞芯微rk固件打包

主要脚本路径

~/android/rk3588/android12/build.sh
~/android/rk3588/android12/RKTools/linux/Linux_Pack_Firmware/rockdev/mkupdate.sh

脚本打包命令

build.sh -u -f

build.sh最终会调用RKTools/linux/Linux_Pack_Firmware/rockdev/下的工具

以rk3588为例

主要就是以下几条命令

//进入打包工具目录,并使用mkupdate.sh打包脚本,参数一为rk3588,参数二为Image
cd RKTools/linux/Linux_Pack_Firmware/rockdev && ./mkupdate.sh rk3588 Image

//产生 package-file-tmp文件,分区表
./gen-package-file.sh Image > package-file-tmp

//根据package-file-tmp打包固件,生产update.img
./afptool -pack ./ Image/update.img package-file-tmp || pause

// 最后将MiniLoaderAll加进去,系统未Android系统
./rkImageMaker -RK3588 Image/MiniLoaderAll.bin Image/update.img update.img -os_type:androidos || pause

注:rkImageMaker 与 afptool -pack是不开放源码

另外还有解包工具

~/android/rk3588/android12/RKTools/linux/Linux_Pack_Firmware/rockdev/unpack.sh

打包

./afptool -pack ./Image/update.img || pause

// afptool(Android Firmware Package Tool)
// 当前目录有package-file,分区表
./afptool -pack ./Image/update.img || pause
------ PACKAGE ------
Add file: ./package-file
package-file,Add file: ./package-file done,offset=0x800,size=0x11a,userspace=0x1
Add file: ./Image/MiniLoaderAll.bin
bootloader,Add file: ./Image/MiniLoaderAll.bin done,offset=0x1000,size=0x661c0,userspace=0xcd
Add file: ./Image/parameter.txt
parameter,Add file: ./Image/parameter.txt done,offset=0x67800,size=0x1d5,userspace=0x1
Add file: ./Image/uboot.img
uboot,Add file: ./Image/uboot.img done,offset=0x68000,size=0x400000,userspace=0x800
Add file: ./Image/misc.img
misc,Add file: ./Image/misc.img done,offset=0x468000,size=0xc000,userspace=0x18
Add file: ./Image/boot.img
boot,Add file: ./Image/boot.img done,offset=0x474000,size=0x1ff4400,userspace=0x3fe9
Add file: ./Image/recovery.img
recovery,Add file: ./Image/recovery.img done,offset=0x2468800,size=0x1e23400,userspace=0x3c47
Add file: ./Image/rootfs.img
rootfs,Add file: ./Image/rootfs.img done,offset=0x428c000,size=0x849fd000,userspace=0x1093fa
Add CRC...
Make firmware OK!
------ OK ------

./rkImageMaker -RK3568 Image/MiniLoaderAll.bin Image/update.img update.img -os_type:androidos || pause

// 指定主控,-RK3568,-RK3588等
// 将Image目录下的miniloader与update合成rk固件(update.img),并放在当前目录
./rkImageMaker -RK3568 Image/MiniLoaderAll.bin Image/update.img update.img -os_type:androidos || pause
********rkImageMaker ver 2.0********
Generating new image, please wait...
Writing head info...
Writing boot file...
Writing firmware...
Generating MD5 data...
MD5 data generated successfully!
New image generated successfully!

解包

./rkImageMaker -unpack update.img output || pause
./afptool -unpack output/firmware.img output || pause

容易出现的问题

  • ./rkImageMaker -RKxxx,指定主控类型不正确,导致烧录时会提示check chip失败
  • ./afptool -pack ./Image/update.img 必须按照当前目录存在package-file, ./Image/目录下有分区img,按这个部署,不是会提示打开失败;

你可能感兴趣的:(android,linux)