-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_bmc
executable file
·123 lines (102 loc) · 2.73 KB
/
update_bmc
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#2024/3/22 EyerNi( ͡° ͜ʖ ͡°)
#!/bin/bash
function pre_run()
{
CHIP_OFFSET=$(grep 'chip_offset:' config.ini | sed 's?chip_offset:??')
IMAGE_OFFSET=$(grep 'image_offset:' config.ini | sed 's?image_offset:??')
PLATFORM_BALL=$(grep 'platform_ball:' config.ini | sed 's?platform_ball:??')
}
function arch_check()
{
echo -e "**************************************"
echo -e "\033[32m processing arch check \033[0m"
echo
CMD=`uname -m | cut -c 1-6`
if [ "$CMD" != "x86_64" ]; then
echo -e "\033[31m not a x86_64 arch computer , bye bye ! \033[0m"
exit 1
fi
echo -e " OK"
echo -e ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo
}
function print_help()
{
echo -e "**************************************"
echo -e "\033[32m tool brife
USAGE :
____> "0" ----->1st
| "1" ----->2nd
|
| ___>"romx.ima" ---> the image's name
| |
| |
./40_update_bmc ARG1 ARG2 ARG3
|
|___>"WIPE" --->whole image update
"REFERSH" --->only update none conf area
\033[0m";
echo -e " OK"
echo -e ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo
}
function wipe_update_chip()
{
echo -e "**************************************"
echo -e "\033[32m processing whole chip update \033[0m"
echo
./fake_socflash_x86_64 option=g if=$2 gpio_b=$PLATFORM_BALL"0" gpio_f=$PLATFORM_BALL"1" cs=$1
echo -e " OK , please wait BMC recovery "
echo -e ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo
}
function preserve_update_chip()
{
echo -e "**************************************"
echo -e "\033[32m processing keep conf chip update \033[0m"
echo
./fake_socflash_x86_64 option=g if=$2 gpio_b=$PLATFORM_BALL"0" gpio_f=$PLATFORM_BALL"1" cs=$1 skip=$CHIP_OFFSET offset=$IMAGE_OFFSET
echo -e " OK , please wait BMC recovery "
echo -e ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
echo
}
function MAIN()
{
if [ ! -n "$1" ];then
print_help;
exit 1
fi
if [ ! -n "$2" ];then
print_help;
exit 1
fi
if [ ! -n "$3" ];then
print_help;
exit 1
fi
arch_check;
pre_run;
if [ "$1" != "0" ];then
if [ "$1" != "1" ];then
echo -e "1"
print_help;
exit 1
fi
fi
if [ "$3" != "WIPE" ];then
if [ "$3" != "REFERSH" ];then
echo -e "2"
print_help;
exit 1
fi
fi
if [ "$3" == "WIPE" ];then
wipe_update_chip $1 $2;
exit 1
elif [ "$3" == "REFERSH" ];then
preserve_update_chip $1 $2;
exit 1
fi
print_help;
}
MAIN $1 $2 $3