MTK logo.bin手动制作(个人博客:浏览器直接输入wugn.tech)

概述

目前A800项目有客户需要更换logo图片的需求,不同客户有不用的定制需求。

代码分析

  • 目前情况,执行命令systool update bootlogo logo-verified.bin烧录失败:
02-01 11:20:47.694  3096  3096 W sec  : VerifyImageByName logo-verified.bin
02-01 11:20:47.694  3096  3096 W sec  : file logo-verified.bin size=2596592
02-01 11:20:47.783  3096  3096 W sec  : VerifyImageByName logo-verified.bin OK! [ret=0]
02-01 11:20:47.784   542  2328 W systool_server: FUNC(svr_systoolWriteRawImage)
02-01 11:20:47.784   542  2328 W         : write_raw_image devName=unknown-bootlogo-part, imagePath=logo-verified.
bin started.
02-01 11:20:47.785   542  2328 E         : Cannot open device unknown-bootlogo-part

logo分区手动打包过程

  • 编译lk的时候会打包生成logo-verified.bin烧录镜像,log如下:
Compiling_BMP_TO_RAW dev/logo/hdplus/hdplus_uboot.bmp
Compiling_BMP_TO_RAW dev/logo/hdplus/hdplus_battery.bmp
dev/logo/tool/bmp_to_raw /home/wugn/A800-project/out/target/product/k61v1_64_bsp/obj/BOOTLOADER_OBJ/build-k61v1_64_bsp/dev/logo/hdplus/hdplus_uboot.raw dev/logo/hdplus/hdplus_uboot.bmp
Compiling_BMP_TO_RAW dev/logo/hdplus/hdplus_num_2.bmp
Compiling_BMP_TO_RAW dev/logo/hdplus/hdplus_low_battery.bmp
Compiling_BMP_TO_RAW dev/logo/hdplus/hdplus_charger_ov.bmp
Compiling_BMP_TO_RAW dev/logo/hdplus/hdplus_num_7.bmp
Compiling_BMP_TO_RAW dev/logo/hdplus/hdplus_num_8.bmp


压缩所有图片生成hdplus.raw,一定要按照顺序
zpiping 

1.bmp图片转成raw格式
  • 工具及操作:
dev/logo/tool/bmp_to_raw 

rule.mk:
$(BUILDDIR)/%.raw: %.bmp $(BMP_TO_RAW)
	@$(MKDIR)
	@echo "Compiling_BMP_TO_RAW $<"
	$(BMP_TO_RAW) $@ $<
	
手动转换uboot图片操作:
./bmp_to_raw hdplus_uboot.raw hdplus_uboot.bmp
2.压缩所有图片生成hdplus.raw,一定要按照顺序
  • 工具及操作:
zlib压缩性能非常优良,能将数百M文件压缩到几十M
dev/logo/tool/zpipe
用法:
[Usage] compress -l n output input1 [input2]
Example: compress -l 9 logo.bin logo.raw battery.raw
  • 问题点
使用该命令压缩图片
./zpipe -l 9 logo.bin hdplus.raw hdplus/*

发现烧进去logo显示成电池图片了
最好发现是一定要按照顺序压缩,不然代码解压的时候是根据index来选图片的,这条命令使图片压缩顺序乱了。
3.mkimage打包生成logo.bin
这个工具可以用来制作不压缩或者压缩的多种可启动映象文件
用法:
Usage: ./mkimage <img_path> <cfg_path> > out_image

./mkimage hdplus.raw img_hdr_logo.cfg > logo.bin

img_hdr_logo.cfg内容:
NAME = logo 
4.单独签名logo.bin文件
  • 如下命令:
BOARD_AVB_ENABLE=true python vendor/mediatek/proprietary/scripts/sign-image_v2/sign_flow.py -target logo.bin -env_cfg vendor/mediatek/proprietary/scripts/sign-image_v2/env.cfg mt6761 k61v1_64_bsp_

最终代码

MTK_LOGO_TOOL=${ANDROID_ROOT}/droid/customer/mtk_tool
MTK_SIGN_DIR=${ANDROID_ROOT}/vendor/mediatek/proprietary/scripts/sign-image_v2/out
BASE_LOGO=hdplus
# mtk sign_file inPath outPath
function mtk_sign_file()
{
	echo "enter mtk_sign_file"
	cd ${ANDROID_ROOT}
	if [ ! -d "$MTK_SIGN_DIR" ];then
		mkdir -p $MTK_SIGN_DIR
	fi
	
	echo "start mv ${MTK_LOGO_TOOL}/logo.bin to $MTK_SIGN_DIR"
	mv ${MTK_LOGO_TOOL}/logo.bin $MTK_SIGN_DIR
	
	echo "start sign $MTK_SIGN_DIR/logo.bin to $MTK_SIGN_DIR/logo-verified.bin"
	BOARD_AVB_ENABLE=true python vendor/mediatek/proprietary/scripts/sign-image_v2/sign_flow.py -target logo.bin -env_cfg vendor/mediatek/proprietary/scripts/sign-image_v2/env.cfg mt6761 k61v1_64_bsp_
	
}

# mtk make logo image file
function mtk_mk_logo_file()
{
	# first of all use bmp_to_raw to make raw file from bmp
	cd ${MTK_LOGO_TOOL}
	echo "Compiling_BMP_TO_RAW /${MTK_LOGO_TOOL}/bmp_to_raw ${BASE_LOGO}_uboot.raw $gBootlogoFile"
	cp $gBootlogoFile ${MTK_LOGO_TOOL}
	./bmp_to_raw ${BASE_LOGO}_uboot.raw $gBootlogoFile
	mv ${MTK_LOGO_TOOL}/${BASE_LOGO}_uboot.raw ${MTK_LOGO_TOOL}/${BASE_LOGO}/
	
	echo "start zpiping ${MTK_LOGO_TOOL}/${BASE_LOGO}.raw"
	./zpipe -l 9 ${MTK_LOGO_TOOL}/${BASE_LOGO}.raw  \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_uboot.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_battery.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_low_battery.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_charger_ov.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_0.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_1.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_2.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_3.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_4.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_5.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_6.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_7.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_8.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_9.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_num_percent.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_animation_01.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_animation_02.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_animation_03.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_animation_04.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_animation_05.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_animation_06.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_animation_07.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_animation_08.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_animation_09.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_animation_10.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_10_01.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_10_02.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_10_03.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_10_04.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_10_05.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_10_06.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_10_07.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_10_08.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_10_09.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_10_10.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_bg.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_img.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_bat_100.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_kernel.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_low_battery01.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_low_battery02.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_low_battery_remind.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_uboot_fastboot.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_100.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_ani-01.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_ani-02.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_ani-03.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_ani-04.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_ani-05.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_ani-06.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_00.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_01.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_02.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_03.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_04.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_05.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_06.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_07.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_08.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_09.raw \
	${MTK_LOGO_TOOL}/${BASE_LOGO}/${BASE_LOGO}_fast_charging_percent.raw

	
	echo "start mkimage ${MTK_LOGO_TOOL}/logo.bin"
	./mkimage ${BASE_LOGO}.raw img_hdr_logo.cfg > logo.bin
	rm ${MTK_LOGO_TOOL}/${BASE_LOGO}.raw
}
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值