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