在build_updateimg()中调用构建logo.img的方法

function build_updateimg(){
	# Enable building if env partition is no exist
	check_config ENV_SIZE || return 0

	IMAGE_PATH=$RK_PROJECT_OUTPUT_IMAGE
	PACK_TOOL_PATH=$SDK_ROOT_DIR/tools/linux/Linux_Pack_Firmware

	//这是新增的方法,需要调用
	build_logo_img

	# run update.img package script
	$PACK_TOOL_PATH/mk-update_pack.sh -id $RK_CHIP -i $IMAGE_PATH

	finish_build
}

脚本新增方法

function build_logo_img(){
	local bmp_bpp bmp_compression bmp_dib_size bmp_file_size bmp_height
	local bmp_image_size bmp_magic bmp_offset bmp_planes bmp_width
	local env_has_logo include_logo logo_dst logo_src logo_tmp
	local logo_file_size=230454

	# A stale env.img would make the packer silently omit (or retain) logo.
	env_has_logo=n
	if [ -f "$RK_PROJECT_OUTPUT_IMAGE/env.img" ] &&
		strings "$RK_PROJECT_OUTPUT_IMAGE/env.img" | grep -Fq '(logo)'; then
		env_has_logo=y
	fi

	if [[ "$RK_PARTITION_CMD_IN_ENV" != *"(logo)"* ]]; then
		if [ "$env_has_logo" = "y" ]; then
			msg_error "env.img still contains the logo partition; rebuild env.img before packing update.img"
			return 1
		fi
		return 0
	fi

	if [ "$env_has_logo" != "y" ]; then
		msg_error "env.img does not contain the configured logo partition; run ./build.sh firmware or ./build.sh all first"
		return 1
	fi

	include_logo=${RK_INCLUDE_LOGO_IMAGE:-y}
	logo_dst="$RK_PROJECT_OUTPUT_IMAGE/logo.img"
	case "$include_logo" in
		y)
			;;
		n)
			# logo.img is a generated artifact. Removing it is necessary because
			# mk-update_pack.sh includes every matching image left in this dir.
			rm -f "$logo_dst"
			msg_info "Skip logo.img to preserve the Logo already stored on the device"
			return 0
			;;
		*)
			msg_error "RK_INCLUDE_LOGO_IMAGE must be y or n: $include_logo"
			return 1
			;;
	esac

	logo_src=${RK_LOGO_IMAGE_SOURCE:-sysdrv/source/kernel/logo.bmp}
	[[ "$logo_src" != /* ]] && logo_src="$SDK_ROOT_DIR/$logo_src"
	if [ ! -f "$logo_src" ]; then
		msg_error "Not found factory Logo BMP: $logo_src"
		return 1
	fi

	bmp_magic=$(od -An -tx1 -N2 "$logo_src" | tr -d '[:space:]')
	bmp_file_size=$(od -An -tu4 -j2 -N4 "$logo_src" | tr -d '[:space:]')
	bmp_offset=$(od -An -tu4 -j10 -N4 "$logo_src" | tr -d '[:space:]')
	bmp_dib_size=$(od -An -tu4 -j14 -N4 "$logo_src" | tr -d '[:space:]')
	bmp_width=$(od -An -td4 -j18 -N4 "$logo_src" | tr -d '[:space:]')
	bmp_height=$(od -An -td4 -j22 -N4 "$logo_src" | tr -d '[:space:]')
	bmp_planes=$(od -An -tu2 -j26 -N2 "$logo_src" | tr -d '[:space:]')
	bmp_bpp=$(od -An -tu2 -j28 -N2 "$logo_src" | tr -d '[:space:]')
	bmp_compression=$(od -An -tu4 -j30 -N4 "$logo_src" | tr -d '[:space:]')
	bmp_image_size=$(od -An -tu4 -j34 -N4 "$logo_src" | tr -d '[:space:]')

	if [ "$bmp_magic" != "424d" ] ||
		[ "$bmp_file_size" != "$logo_file_size" ] ||
		[ "$bmp_offset" != "54" ] || [ "$bmp_dib_size" != "40" ] ||
		[ "$bmp_width" != "240" ] ||
		{ [ "$bmp_height" != "320" ] && [ "$bmp_height" != "-320" ]; } ||
		[ "$bmp_planes" != "1" ] || [ "$bmp_bpp" != "24" ] ||
		[ "$bmp_compression" != "0" ] ||
		{ [ "$bmp_image_size" != "0" ] && [ "$bmp_image_size" != "230400" ]; }; then
		msg_error "Invalid factory Logo BMP; expected 240x(+/-)320, 24bpp BI_RGB, bfSize=$logo_file_size: $logo_src"
		return 1
	fi

	if [ "$(stat -c %s "$logo_src")" -lt "$logo_file_size" ]; then
		msg_error "Factory Logo BMP is shorter than bfSize: $logo_src"
		return 1
	fi

	mkdir -p "$RK_PROJECT_OUTPUT_IMAGE"
	logo_tmp="$logo_dst.tmp.$$"
	if ! dd if="$logo_src" of="$logo_tmp" bs=$logo_file_size count=1 \
		iflag=fullblock status=none; then
		rm -f "$logo_tmp"
		msg_error "Failed to generate logo.img from $logo_src"
		return 1
	fi
	if [ "$(stat -c %s "$logo_tmp")" -ne "$logo_file_size" ]; then
		rm -f "$logo_tmp"
		msg_error "Generated logo.img has an unexpected size"
		return 1
	fi
	mv -f "$logo_tmp" "$logo_dst"
	msg_info "Generated factory logo.img: $logo_dst ($logo_file_size bytes)"
}