|
@@ -25,7 +25,7 @@ VERSION="1.00"
|
25
|
25
|
|
26
|
26
|
# typically /dev/sdb or /dev/sdc, depending upon how
|
27
|
27
|
# many drives there are on your system
|
28
|
|
-MICROSD_DRIVE=$1
|
|
28
|
+MICROSD_DRIVE=
|
29
|
29
|
|
30
|
30
|
# IP address of the router (gateway)
|
31
|
31
|
ROUTER_IP_ADDRESS="192.168.1.254"
|
|
@@ -41,43 +41,80 @@ DEBIAN_FILE_NAME="debian-jessie-console-armhf-2014-08-13"
|
41
|
41
|
DOWNLOAD_LINK1="https://rcn-ee.net/deb/rootfs/jessie/$DEBIAN_FILE_NAME.tar.xz"
|
42
|
42
|
DOWNLOAD_LINK2="http://ynezz.ibawizard.net/beagleboard/jessie/$DEBIAN_FILE_NAME.tar.xz"
|
43
|
43
|
|
44
|
|
-if [ ! MICROSD_DRIVE ]; then
|
45
|
|
- echo 'You need to specify a drive for the connected microSD.'
|
46
|
|
- echo 'This can most easily be found by removing the microSD, then'
|
47
|
|
- echo 'running:'
|
48
|
|
- echo ''
|
49
|
|
- echo ' ls /dev/sd*'
|
50
|
|
- echo ''
|
51
|
|
- echo 'Then plugging the microSD back in and entering the same command again'
|
52
|
|
- exit 1
|
|
44
|
+function show_help {
|
|
45
|
+ echo ''
|
|
46
|
+ echo 'freedombone-prep -d [microSD device] --ip [BBB static IP address] --iprouter [Router IP address]'
|
|
47
|
+ echo ''
|
|
48
|
+}
|
|
49
|
+
|
|
50
|
+while [[ $# > 1 ]]
|
|
51
|
+do
|
|
52
|
+key="$1"
|
|
53
|
+
|
|
54
|
+case $key in
|
|
55
|
+ -h|--help)
|
|
56
|
+ show_help
|
|
57
|
+ ;;
|
|
58
|
+ # Drive path for the microSD
|
|
59
|
+ -d|--drive)
|
|
60
|
+ shift
|
|
61
|
+ MICROSD_DRIVE="$1"
|
|
62
|
+ ;;
|
|
63
|
+ # BBB static IP address on the LAN
|
|
64
|
+ --ip)
|
|
65
|
+ shift
|
|
66
|
+ BBB_FIXED_IP_ADDRESS="$1"
|
|
67
|
+ ;;
|
|
68
|
+ # Router IP address on the LAN
|
|
69
|
+ --iprouter)
|
|
70
|
+ shift
|
|
71
|
+ ROUTER_IP_ADDRESS="$1"
|
|
72
|
+ ;;
|
|
73
|
+ *)
|
|
74
|
+ # unknown option
|
|
75
|
+ ;;
|
|
76
|
+esac
|
|
77
|
+shift
|
|
78
|
+done
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+if [ ! $MICROSD_DRIVE ]; then
|
|
82
|
+ echo 'You need to specify a drive for the connected microSD.'
|
|
83
|
+ echo 'This can most easily be found by removing the microSD, then'
|
|
84
|
+ echo 'running:'
|
|
85
|
+ echo ''
|
|
86
|
+ echo ' ls /dev/sd*'
|
|
87
|
+ echo ''
|
|
88
|
+ echo 'Then plugging the microSD back in and entering the same command again'
|
|
89
|
+ exit 1
|
53
|
90
|
fi
|
54
|
91
|
|
55
|
92
|
if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
56
|
|
- echo "The microSD drive could not be found at ${MICROSD_DRIVE}1"
|
57
|
|
- exit 2
|
|
93
|
+ echo "The microSD drive could not be found at ${MICROSD_DRIVE}1"
|
|
94
|
+ exit 2
|
58
|
95
|
fi
|
59
|
96
|
|
60
|
97
|
if [ ! -d ~/freedombone ]; then
|
61
|
|
- mkdir ~/freedombone
|
|
98
|
+ mkdir ~/freedombone
|
62
|
99
|
fi
|
63
|
100
|
cd ~/freedombone
|
64
|
101
|
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
|
65
|
|
- wget $DOWNLOAD_LINK1
|
|
102
|
+ wget $DOWNLOAD_LINK1
|
66
|
103
|
fi
|
67
|
104
|
if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
|
68
|
|
- # try another site
|
|
105
|
+ # try another site
|
69
|
106
|
wget $DOWNLOAD_LINK2
|
70
|
|
- if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
|
71
|
|
- echo 'The Debian installer could not be downloaded'
|
72
|
|
- exit 3
|
73
|
|
- fi
|
|
107
|
+ if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
|
|
108
|
+ echo 'The Debian installer could not be downloaded'
|
|
109
|
+ exit 3
|
|
110
|
+ fi
|
74
|
111
|
fi
|
75
|
112
|
|
76
|
113
|
echo 'Extracting files...'
|
77
|
114
|
tar xJf $DEBIAN_FILE_NAME.tar.xz
|
78
|
115
|
if [ ! -d ~/freedombone/$DEBIAN_FILE_NAME ]; then
|
79
|
|
- echo "Couldn't extract files"
|
80
|
|
- exit 4
|
|
116
|
+ echo "Couldn't extract files"
|
|
117
|
+ exit 4
|
81
|
118
|
fi
|
82
|
119
|
cd $DEBIAN_FILE_NAME
|
83
|
120
|
sudo ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone
|
|
@@ -87,13 +124,13 @@ echo ''
|
87
|
124
|
read -p "Eject the microSD card, re-insert it and wait a minute for it to mount, then press any key to continue... " -n1 -s
|
88
|
125
|
|
89
|
126
|
if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
90
|
|
- echo ''
|
91
|
|
- echo "The microSD drive could not be found at ${MICROSD_DRIVE}1"
|
92
|
|
- read -p "Wait for the drive to mount then press any key... " -n1 -s
|
93
|
|
- if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
94
|
|
- echo "microSD drive not found at ${MICROSD_DRIVE}1"
|
95
|
|
- exit 5
|
96
|
|
- fi
|
|
127
|
+ echo ''
|
|
128
|
+ echo "The microSD drive could not be found at ${MICROSD_DRIVE}1"
|
|
129
|
+ read -p "Wait for the drive to mount then press any key... " -n1 -s
|
|
130
|
+ if [ ! -b ${MICROSD_DRIVE}1 ]; then
|
|
131
|
+ echo "microSD drive not found at ${MICROSD_DRIVE}1"
|
|
132
|
+ exit 5
|
|
133
|
+ fi
|
97
|
134
|
fi
|
98
|
135
|
|
99
|
136
|
sudo cp $MICROSD_MOUNT_POINT/BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/BOOT/uEnv.txt
|