summaryrefslogtreecommitdiff
path: root/tools/add_hash_bl31.sh
blob: 1814460641a6166641036b17cbf9b1a5a1878b3c (plain)
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
#!/bin/bash
set -e

BUILD_FILE=bl31.bin
BUILD_MODE=bl31

show_help()
{
    printf "\n add_hash.sh - add git log hash value into uboot,boot0,sboot,fes \n"
    echo " eg :"
    echo " ./add_hash.sh -f input_file -m file_flag "
    echo " file_flag = uboot or boot0 or sboot"
    printf "\n\n"
}


build_bl31()
{
    dd if=./${BUILD_FILE} of=./bl31_back bs=48 count=1 status=noxfer 2> /dev/null
    dd if=./cur.log  of=./bl31_back ibs=64 conv=notrunc,sync oflag=append obs=64 count=1 status=noxfer 2> /dev/null
    dd if=./${BUILD_FILE} of=./bl31_back ibs=112 obs=112 conv=notrunc oflag=append skip=1 status=noxfer 2> /dev/null
    mv bl31_back ${BUILD_FILE}
}


do_common()
{
    if [ "x${BUILD_MODE}" = "xbl31" ] ; then
        echo " add commit info for bl31 "
        build_bl31
    else
        echo "build none"
    fi
}
while getopts f:m: OPTION
do
    case $OPTION in
        f)
            BUILD_FILE=$OPTARG
            ;;
        m)
            BUILD_MODE=$OPTARG
            ;;
        *)
            show_help
            exit
            ;;
    esac
done

do_common