-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhal_app1
64 lines (56 loc) · 1.27 KB
/
hal_app1
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
#!/bin/sh
# This is developed by laojifuli to get the boot block device
_pd=""
_arg=""
BOOT_DRIVES=""
extract_rootfs2()
{
FLASH_TMP="/flashfs_tmp"
[ -d $FLASH_TMP ] || /bin/mkdir $FLASH_TMP
/bin/mount $1 $FLASH_TMP -o ro
if [ $? != 0 ]; then
/bin/echo "hal_app1: mount $1 failed."
/bin/umount $1 1>/dev/null 2>&1
return 1
else
/bin/tar -xjf ${FLASH_TMP}/boot/rootfs2.bz -C / 1>/dev/null 2>&1
/bin/echo "hal_app1: extract_rootfs2 successful."
fi
/bin/umount $1 1>/dev/null 2>&1
/bin/sync
return 0
}
if [ $# -gt 0 ]; then
while [ "$1" != "" ]; do
case $1 in
--get_boot_pd ) shift
_pd="boot"
_arg=$1
;;
--get_boot_pd_part ) shift
_pd="part"
_arg=$1
;;
--boot )
_pd="rootfs2"
;;
esac
shift
done
BOOT_DRIVES=$(/sbin/hal_app2)
if [ "x$BOOT_DRIVES" = "x" ]; then
exit
fi
if [ "$_pd" = "rootfs2" ]; then
extract_rootfs2 "/dev/${BOOT_DRIVES}2"
exit
fi
if [ "$_pd" = "boot" ]; then
echo "/dev/$BOOT_DRIVES"
exit
fi
if [ "$_pd" = "part" ]; then
_index=$(($(echo $_arg | sed 's/.*,obj_index=//g') + 2))
echo "/dev/$BOOT_DRIVES$_index"
fi
fi