-
Notifications
You must be signed in to change notification settings - Fork 10
/
mt7621_ddr.sh
executable file
·34 lines (29 loc) · 1.11 KB
/
mt7621_ddr.sh
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
#!/bin/sh
VAR=$4
DDR3=$(echo ${VAR##*DDR3})
if [ "$DDR3" == "$4" ]; then
ddr_param_offset=200
else
ddr_param_offset=96
fi
LINE_NUM=$(cat ./$3|sed -n "/$4/=")
LINE_NUM=$(echo $LINE_NUM + "1"|bc)
if [ "$5" == "IN_NAND" ]; then
offset=$ddr_param_offset
sed -n "${LINE_NUM}p" ./$3|xxd -r -c 32|dd bs=1 count=32 seek=$offset of=$2 conv=notrunc
offset=$(echo $offset + "32"|bc)
LINE_NUM=$(echo $LINE_NUM + "1"|bc)
sed -n "${LINE_NUM}p" ./$3|xxd -r -c 32|dd bs=1 count=32 seek=$offset of=$2 conv=notrunc
offset=$(echo $offset + "32"|bc)
LINE_NUM=$(echo $LINE_NUM + "1"|bc)
sed -n "${LINE_NUM}p" ./$3|xxd -r -c 32|dd bs=1 count=32 seek=$offset of=$2 conv=notrunc
else
offset=$(echo "(($(stat -c %s uboot.bin)+$ddr_param_offset))" |bc)
sed -n "${LINE_NUM}p" ./$3|xxd -r -c 32|dd bs=1 count=32 seek=$offset of=$2 conv=notrunc
LINE_NUM=$(echo $LINE_NUM + "1"|bc)
offset=$(echo $offset + "32"|bc)
sed -n "${LINE_NUM}p" ./$3|xxd -r -c 32|dd bs=1 count=32 seek=$offset of=$2 conv=notrunc
LINE_NUM=$(echo $LINE_NUM + "1"|bc)
offset=$(echo $offset + "32"|bc)
sed -n "${LINE_NUM}p" ./$3|xxd -r -c 32|dd bs=1 count=32 seek=$offset of=$2 conv=notrunc
fi