1#!/bin/bash 2# 3# Copyright (c) 2020 Rockchip Electronics Co., Ltd 4# 5# SPDX-License-Identifier: GPL-2.0 6# 7set -e 8 9function usage() 10{ 11 echo 12 echo "usage:" 13 echo " $0 -f [uboot.img]" 14 echo 15} 16 17function args_process() 18{ 19 if [ $# -ne 2 ]; then 20 usage 21 exit 1 22 fi 23 24 while [ $# -gt 0 ]; do 25 case $1 in 26 -f) 27 IMG=$2 28 shift 2 29 ;; 30 *) 31 usage 32 exit 1 33 ;; 34 esac 35 done 36 37 if [ ! -f ${IMG} ]; then 38 echo "ERROR: No ${IMG}" 39 exit 1 40 fi 41} 42 43function image_msg() 44{ 45 echo "[Commit version]:" 46 strings ${IMG} | grep '\-g[0-9,a-f][0-9,a-f][0-9,a-f][0-9,a-f][0-9,a-f][0-9,a-f][0-9,a-f]' | sort --uniq 47 strings ${IMG} | grep 'Built :' | sort --uniq 48} 49 50args_process $* 51image_msg 52