-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcopy_boot.sh
More file actions
executable file
·69 lines (52 loc) · 1.38 KB
/
copy_boot.sh
File metadata and controls
executable file
·69 lines (52 loc) · 1.38 KB
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
#!/bin/bash
MACHINE=beaglebone
if [ "x${1}" = "x" ]; then
echo -e "\nUsage: ${0} <block device>\n"
exit 0
fi
if [ ! -d /media/card ]; then
echo "Temporary mount point [/media/card] not found"
exit 1
fi
if [ -z "$OETMP" ]; then
echo -e "\nWorking from local directory"
SRCDIR=.
else
echo -e "\nOETMP: $OETMP"
if [ ! -d ${OETMP}/deploy/images/${MACHINE} ]; then
echo "Directory not found: ${OETMP}/deploy/images/${MACHINE}"
exit 1
fi
SRCDIR=${OETMP}/deploy/images/${MACHINE}
fi
if [ ! -f ${SRCDIR}/MLO-${MACHINE} ]; then
echo -e "File not found: ${SRCDIR}/MLO-${MACHINE}\n"
exit 1
fi
if [ ! -f ${SRCDIR}/u-boot-${MACHINE}.img ]; then
echo -e "File not found: ${SRCDIR}/u-boot-${MACHINE}.img\n"
exit 1
fi
DEV=/dev/${1}1
if [ -b $DEV ]; then
echo "Formatting FAT partition on $DEV"
sudo mkfs.vfat -F 32 ${DEV} -n BOOT
echo "Mounting $DEV"
sudo mount ${DEV} /media/card
echo "Copying MLO"
sudo cp ${SRCDIR}/MLO-${MACHINE} /media/card/MLO
echo "Copying u-boot"
sudo cp ${SRCDIR}/u-boot-${MACHINE}.img /media/card/u-boot.img
if [ -f ${SRCDIR}/uEnv.txt ]; then
echo "Copying ${SRCDIR}/uEnv.txt to /media/card"
sudo cp ${SRCDIR}/uEnv.txt /media/card
elif [ -f ./uEnv.txt ]; then
echo "Copying ./uEnv.txt to /media/card"
sudo cp ./uEnv.txt /media/card
fi
echo "Unmounting ${DEV}"
sudo umount ${DEV}
else
echo -e "\nBlock device not found: $DEV\n"
fi
echo "Done"