浏览代码

Update the prep command with a new Beaglebone Black image

Bob Mottram 10 年前
父节点
当前提交
3217d9def6
共有 1 个文件被更改,包括 27 次插入59 次删除
  1. 27
    59
      src/freedombone-prep

+ 27
- 59
src/freedombone-prep 查看文件

51
 
51
 
52
 MICROSD_MOUNT_POINT="/media/$USER"
52
 MICROSD_MOUNT_POINT="/media/$USER"
53
 
53
 
54
-DEBIAN_FILE_NAME="debian-jessie-console-armhf-2014-08-13"
54
+DEBIAN_FILE_NAME="bone-debian-8.1-console-armhf-2015-07-12-2gb"
55
 
55
 
56
 # Downloads for the Debian installer
56
 # Downloads for the Debian installer
57
-DOWNLOAD_LINK1="https://rcn-ee.net/deb/rootfs/jessie/$DEBIAN_FILE_NAME.tar.xz"
58
-DOWNLOAD_LINK2="http://ynezz.ibawizard.net/beagleboard/jessie/$DEBIAN_FILE_NAME.tar.xz"
57
+DOWNLOAD_LINK1="https://rcn-ee.com/rootfs/bb.org/testing/2015-07-12/console/$DEBIAN_FILE_NAME.img.xz"
59
 
58
 
60
-ROOTFS='rootfs'
61
-BOOT='BOOT'
59
+ROOTFS='bbb'
62
 
60
 
63
 function show_help {
61
 function show_help {
64
     echo ''
62
     echo ''
82
     fi
80
     fi
83
     if [ -d /media/usb0 ]; then
81
     if [ -d /media/usb0 ]; then
84
         MICROSD_MOUNT_POINT=/media
82
         MICROSD_MOUNT_POINT=/media
85
-        BOOT=usb0
86
     fi
83
     fi
87
 fi
84
 fi
88
 if [ ! -d $MICROSD_MOUNT_POINT ]; then
85
 if [ ! -d $MICROSD_MOUNT_POINT ]; then
92
 fi
89
 fi
93
 
90
 
94
 echo "MICROSD_MOUNT_POINT=$MICROSD_MOUNT_POINT"
91
 echo "MICROSD_MOUNT_POINT=$MICROSD_MOUNT_POINT"
95
-echo "BOOT=$BOOT"
96
 
92
 
97
 while [[ $# > 1 ]]
93
 while [[ $# > 1 ]]
98
 do
94
 do
156
     exit 2
152
     exit 2
157
 fi
153
 fi
158
 
154
 
155
+SUDO=
156
+if [ -f /usr/bin/sudo ]; then
157
+    SUDO='sudo'
158
+fi
159
+$SUDO apt-get install p7zip dd wget
160
+
159
 if [ ! -d ~/freedombone ]; then
161
 if [ ! -d ~/freedombone ]; then
160
     mkdir ~/freedombone
162
     mkdir ~/freedombone
161
 fi
163
 fi
162
 cd ~/freedombone
164
 cd ~/freedombone
163
-if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
164
-    wget $DOWNLOAD_LINK1
165
-fi
166
-if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
167
-    # try another site
168
-    wget $DOWNLOAD_LINK2
169
-    if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.tar.xz ]; then
170
-        echo 'The Debian installer could not be downloaded'
171
-        exit 3
165
+if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.img.xz ]; then
166
+    if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.img ]; then
167
+        wget $DOWNLOAD_LINK1
172
     fi
168
     fi
173
 fi
169
 fi
174
 
170
 
175
-echo 'Extracting files...'
176
-tar xJf $DEBIAN_FILE_NAME.tar.xz
177
-if [ ! -d ~/freedombone/$DEBIAN_FILE_NAME ]; then
178
-    echo "Couldn't extract files"
171
+echo 'Extracting image...'
172
+xz -d $DEBIAN_FILE_NAME.img.xz
173
+if [ ! -f ~/freedombone/$DEBIAN_FILE_NAME.img ]; then
174
+    echo "Couldn't extract image"
179
     exit 4
175
     exit 4
180
 fi
176
 fi
181
-cd $DEBIAN_FILE_NAME
182
-
183
-SUDO=
184
-if [ -f /usr/bin/sudo ]; then
185
-    SUDO='sudo'
186
-fi
187
-$SUDO apt-get install u-boot-tools dosfstools git-core kpartx wget parted
188
-$SUDO ./setup_sdcard.sh --mmc $MICROSD_DRIVE --dtb beaglebone
189
 
177
 
190
-echo ''
191
-echo ''
192
-$SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
193
-$SUDO umount $MICROSD_MOUNT_POINT/$BOOT
178
+cd ~/freedombone
179
+echo 'Flashing image. This may take a while.'
180
+$SUDO dd if=$DEBIAN_FILE_NAME.img of=$MICROSD_DRIVE
194
 sync
181
 sync
182
+
195
 sleep 5
183
 sleep 5
196
-$SUDO mkdir -p $MICROSD_MOUNT_POINT/$BOOT
197
-$SUDO mkdir -p $MICROSD_MOUNT_POINT/$ROOTFS
198
-$SUDO mount ${MICROSD_DRIVE}1 $MICROSD_MOUNT_POINT/$BOOT
199
-$SUDO mount ${MICROSD_DRIVE}2 $MICROSD_MOUNT_POINT/$ROOTFS
184
+if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
185
+    $SUDO mkdir -p $MICROSD_MOUNT_POINT/$ROOTFS
186
+fi
187
+$SUDO mount ${MICROSD_DRIVE}1 $MICROSD_MOUNT_POINT/$ROOTFS
200
 sync
188
 sync
201
 
189
 
202
 if [ ! -b ${MICROSD_DRIVE}1 ]; then
190
 if [ ! -b ${MICROSD_DRIVE}1 ]; then
209
     fi
197
     fi
210
 fi
198
 fi
211
 
199
 
212
-if [ ! -d $MICROSD_MOUNT_POINT/$BOOT ]; then
213
-    echo ''
214
-    echo "The boot partition $MICROSD_MOUNT_POINT/$BOOT was not found."
215
-    ls $MICROSD_MOUNT_POINT
216
-    exit 67857
217
-fi
218
-
219
 if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
200
 if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
220
     echo ''
201
     echo ''
221
     echo "The rootfs partition $MICROSD_MOUNT_POINT/$ROOTFS was not found."
202
     echo "The rootfs partition $MICROSD_MOUNT_POINT/$ROOTFS was not found."
230
     exit 65688
211
     exit 65688
231
 fi
212
 fi
232
 
213
 
233
-$SUDO cp $MICROSD_MOUNT_POINT/$BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/$BOOT/uEnv.txt
234
-
235
 $SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
214
 $SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
236
 $SUDO sed -i "/iface eth0 inet static/a\    dns-nameservers $NAMESERVER1 $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
215
 $SUDO sed -i "/iface eth0 inet static/a\    dns-nameservers $NAMESERVER1 $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
237
 $SUDO sed -i "/iface eth0 inet static/a\    gateway $ROUTER_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
216
 $SUDO sed -i "/iface eth0 inet static/a\    gateway $ROUTER_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
250
 fi
229
 fi
251
 
230
 
252
 # change the motd to show further install instructions
231
 # change the motd to show further install instructions
253
-echo 'Become the root user by typing:' > /tmp/freedombone_motd
254
-echo '' >> /tmp/freedombone_motd
255
-echo '    su' >> /tmp/freedombone_motd
256
 echo '' >> /tmp/freedombone_motd
232
 echo '' >> /tmp/freedombone_motd
257
-echo 'Using the password "root". Change the root user password by typing:' >> /tmp/freedombone_motd
258
-echo '' >> /tmp/freedombone_motd
259
-echo '    passwd' >> /tmp/freedombone_motd
260
-echo '' >> /tmp/freedombone_motd
261
-echo 'Then create a user for the system with:' >> /tmp/freedombone_motd
233
+echo 'Create a user for the system with:' >> /tmp/freedombone_motd
262
 echo '' >> /tmp/freedombone_motd
234
 echo '' >> /tmp/freedombone_motd
263
 echo '    adduser [username]' >> /tmp/freedombone_motd
235
 echo '    adduser [username]' >> /tmp/freedombone_motd
264
 echo '' >> /tmp/freedombone_motd
236
 echo '' >> /tmp/freedombone_motd
283
 echo 'The microSD card can now be removed and inserted into the Beaglebone Black.'
255
 echo 'The microSD card can now be removed and inserted into the Beaglebone Black.'
284
 echo 'Once the Beaglebone has booted then you can log in with:'
256
 echo 'Once the Beaglebone has booted then you can log in with:'
285
 echo ''
257
 echo ''
286
-echo "    ssh debian@$BBB_FIXED_IP_ADDRESS"
258
+echo "    ssh root@$BBB_FIXED_IP_ADDRESS"
287
 echo ''
259
 echo ''
288
-echo 'The password is "temppwd".'
260
+echo 'The root password should be changed with the command "passwd".'
289
 cat /tmp/freedombone_motd
261
 cat /tmp/freedombone_motd
290
 rm /tmp/freedombone_motd
262
 rm /tmp/freedombone_motd
291
 $SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
263
 $SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
292
-$SUDO umount $MICROSD_MOUNT_POINT/$BOOT
293
 sync
264
 sync
294
 if [ -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
265
 if [ -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
295
     $SUDO rm -rf $MICROSD_MOUNT_POINT/$ROOTFS
266
     $SUDO rm -rf $MICROSD_MOUNT_POINT/$ROOTFS
296
 fi
267
 fi
297
-if [ -d $MICROSD_MOUNT_POINT/$BOOT ]; then
298
-    $SUDO rm -rf $MICROSD_MOUNT_POINT/$BOOT
299
-fi
300
 exit 0
268
 exit 0