forked from friendlyarm/h3_lichee
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfuse_boot-img.sh
executable file
·56 lines (44 loc) · 942 Bytes
/
fuse_boot-img.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
SDCARD=$1
boot_img=boot.fex
function pt_error()
{
echo -e "\033[1;31mERROR: $*\033[0m"
}
function pt_warn()
{
echo -e "\033[1;31mWARN: $*\033[0m"
}
function pt_info()
{
echo -e "\033[1;32mINFO: $*\033[0m"
}
pt_warn "This script is only for ANDROID."
if [ $UID -ne 0 ]
then
pt_error "Please run as root."
exit
fi
if [ $# -ne 1 ]; then
pt_error "Usage:$0 device"
exit 1
fi
DEV_NAME=`basename $1`
BLOCK_CNT=`cat /sys/block/${DEV_NAME}/size`
if [ $? -ne 0 ]; then
pt_error "Can't find device ${DEV_NAME}"
exit 1
fi
if [ ${BLOCK_CNT} -le 0 ]; then
pt_error "NO media found in card reader."
exit 1
fi
if [ ${BLOCK_CNT} -gt 64000000 ]; then
pt_error "Block device size (${BLOCK_CNT}) is too large"
exit 1
fi
cd tools/pack/out/ > /dev/null
[ -e ${boot_img} ] && dd if=${boot_img} of=${SDCARD} bs=1M seek=68
sync
cd - > /dev/null
pt_info "FINISH: boot.img fuse success"