1#!/system/bin/sh
2DEV=/dev/block/mmcblk0p16
3
4CMD=$1
5BASE=0x200000
6BASE_MAIN=0xac00000
7
8case $CMD in
9cp1)
10	echo dump cp1
11	let addr=$BASE
12	echo $addr
13	hexdump -s $addr -n 4096 $DEV;;
14cp2)
15	echo dump cp2
16	let addr=$BASE+0x200000
17	hexdump -s $addr -n 4096 $DEV;;
18cp)
19	echo dump cp1 and cp2
20	let addr=$BASE
21	hexdump -s $addr -n 409 $DEV
22	let addr=$BASE+0x200000
23	hexdump -s $addr -n 4096 $DEV;;
24cp1_all)
25	echo dump cp1 all
26	let addr=$BASE
27	hexdump -s $addr -n 20480 $DEV;;
28cp2_all)
29	echo dump cp2 all
30	let addr=$BASE+0x200000
31	hexdump -s $addr -n 20480 $DEV;;
32cp_all)
33	echo dump cp1 and cp2 all
34	let addr=$BASE
35	hexdump -s $addr -n 20480 $DEV
36	let addr=$BASE+0x200000
37	hexdump -s $addr -n 20480 $DEV;;
38blk)
39	let addr=$BASE_MAIN+$2*0x200000+$3*0x1000
40	hexdump -s $addr -n 4096 $DEV
41	echo ;;
42inode)
43	let addr=$BASE_MAIN+$2*0x200000+$3*0x1000
44	for i in `seq $3 511`
45	do
46		hexdump -s $addr -n 8 $DEV
47		let end=$addr+0x0ff0
48		hexdump -s $end -n 16 $DEV
49		let addr=$addr+0x1000
50	done
51	echo ;;
52*)
53	let addr=$1*0x1000
54	let segno=$addr-$BASE_MAIN
55	let segno=$segno/0x200000
56	let off=$addr-$BASE_MAIN
57	let off=$off%0x200000/0x1000
58	echo $segno, $off
59	hexdump -s $addr -n 4096 $DEV
60	echo ;;
61esac
62