6b13f685e
김민수
BSP 최초 추가
|
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
|
#!/bin/sh
if [ `id -u` -ne 0 ]
then
echo Run as root
exit
fi
DEVICE=/dev/mmcblk0
if [ -z "$1" ]
then
echo "-------------------"
REMOVABLE_DRIVES=""
for _device in /sys/block/*/device; do
if echo $(readlink -f "$_device")|egrep -q "usb"; then
_disk=$(echo "$_device" | cut -f4 -d/)
_size=$(echo "scale=2;$(cat /sys/block/sdb/device/block/sdb/size) * 512 / 1024 / 1024 / 1024" | bc -l)
echo /dev/$_disk: $_size GB
REMOVABLE_DRIVES="$REMOVABLE_DRIVES /dev/$_disk"
fi
done
echo "-------------------"
PS3="Select usb disk device: "
select ITEM in "$REMOVABLE_DRIVES"
do
if [ -n "$ITEM" ]
then
echo SELECTED DEVICE: $ITEM
DEVICE=$ITEM
break
fi
done
else
DEVICE=$1
fi
TEST_LETTER=`basename $DEVICE | cut -c1-2`
case $TEST_LETTER in
sd)
PART1=${DEVICE}1
PART2=${DEVICE}2
PART3=${DEVICE}3
PART4=${DEVICE}4
PART5=${DEVICE}5
PART6=${DEVICE}6
PART7=${DEVICE}7
;;
mm)
PART1=${DEVICE}p1
PART2=${DEVICE}p2
PART3=${DEVICE}p3
PART4=${DEVICE}p4
PART5=${DEVICE}p5
PART6=${DEVICE}p6
PART7=${DEVICE}p7
;;
esac
umount ${PART1}
umount ${PART2}
umount ${PART3}
umount ${PART4}
echo "==== make partitions ==============================="
fdisk -S1 -H1 ${DEVICE} << EOF
o
n
p
1
131072
196607
n
p
2
196608
262143
n
p
3
262144
524287
n
p
524288
t
1
b
t
2
b
a
1
w
EOF
## format partitions
echo "==== format partitions ============================="
mkfs.fat ${PART1} -n BOOT0
mkfs.fat ${PART2} -n BOOT1
mkfs.ext4 -F ${PART3} -L APP
mkfs.ext4 -F ${PART4} -L DATA
fdisk -S1 -H1 -l ${DEVICE}
|