Bladeren bron

Update the prep command with a new Beaglebone Black image

Bob Mottram 10 jaren geleden
bovenliggende
commit
3217d9def6
1 gewijzigde bestanden met toevoegingen van 27 en 59 verwijderingen
  1. 27
    59
      src/freedombone-prep

+ 27
- 59
src/freedombone-prep Bestand weergeven

@@ -51,14 +51,12 @@ NAMESERVER2='85.214.20.141'
51 51
 
52 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 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 61
 function show_help {
64 62
     echo ''
@@ -82,7 +80,6 @@ if [ -d /media ]; then
82 80
     fi
83 81
     if [ -d /media/usb0 ]; then
84 82
         MICROSD_MOUNT_POINT=/media
85
-        BOOT=usb0
86 83
     fi
87 84
 fi
88 85
 if [ ! -d $MICROSD_MOUNT_POINT ]; then
@@ -92,7 +89,6 @@ if [ ! -d $MICROSD_MOUNT_POINT ]; then
92 89
 fi
93 90
 
94 91
 echo "MICROSD_MOUNT_POINT=$MICROSD_MOUNT_POINT"
95
-echo "BOOT=$BOOT"
96 92
 
97 93
 while [[ $# > 1 ]]
98 94
 do
@@ -156,47 +152,39 @@ if [ ! -b ${MICROSD_DRIVE}1 ]; then
156 152
     exit 2
157 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 161
 if [ ! -d ~/freedombone ]; then
160 162
     mkdir ~/freedombone
161 163
 fi
162 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 168
     fi
173 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 175
     exit 4
180 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 181
 sync
182
+
195 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 188
 sync
201 189
 
202 190
 if [ ! -b ${MICROSD_DRIVE}1 ]; then
@@ -209,13 +197,6 @@ if [ ! -b ${MICROSD_DRIVE}1 ]; then
209 197
     fi
210 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 200
 if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
220 201
     echo ''
221 202
     echo "The rootfs partition $MICROSD_MOUNT_POINT/$ROOTFS was not found."
@@ -230,8 +211,6 @@ if [ ! -d $MICROSD_MOUNT_POINT/$ROOTFS/home ]; then
230 211
     exit 65688
231 212
 fi
232 213
 
233
-$SUDO cp $MICROSD_MOUNT_POINT/$BOOT/bbb-uEnv.txt $MICROSD_MOUNT_POINT/$BOOT/uEnv.txt
234
-
235 214
 $SUDO sed -i 's/iface eth0 inet dhcp/iface eth0 inet static/g' $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
236 215
 $SUDO sed -i "/iface eth0 inet static/a\    dns-nameservers $NAMESERVER1 $NAMESERVER2" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
237 216
 $SUDO sed -i "/iface eth0 inet static/a\    gateway $ROUTER_IP_ADDRESS" $MICROSD_MOUNT_POINT/$ROOTFS/etc/network/interfaces
@@ -250,15 +229,8 @@ if [ ! -f $MICROSD_MOUNT_POINT/$ROOTFS/usr/local/bin/freedombone ]; then
250 229
 fi
251 230
 
252 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 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 234
 echo '' >> /tmp/freedombone_motd
263 235
 echo '    adduser [username]' >> /tmp/freedombone_motd
264 236
 echo '' >> /tmp/freedombone_motd
@@ -283,18 +255,14 @@ echo ''
283 255
 echo 'The microSD card can now be removed and inserted into the Beaglebone Black.'
284 256
 echo 'Once the Beaglebone has booted then you can log in with:'
285 257
 echo ''
286
-echo "    ssh debian@$BBB_FIXED_IP_ADDRESS"
258
+echo "    ssh root@$BBB_FIXED_IP_ADDRESS"
287 259
 echo ''
288
-echo 'The password is "temppwd".'
260
+echo 'The root password should be changed with the command "passwd".'
289 261
 cat /tmp/freedombone_motd
290 262
 rm /tmp/freedombone_motd
291 263
 $SUDO umount $MICROSD_MOUNT_POINT/$ROOTFS
292
-$SUDO umount $MICROSD_MOUNT_POINT/$BOOT
293 264
 sync
294 265
 if [ -d $MICROSD_MOUNT_POINT/$ROOTFS ]; then
295 266
     $SUDO rm -rf $MICROSD_MOUNT_POINT/$ROOTFS
296 267
 fi
297
-if [ -d $MICROSD_MOUNT_POINT/$BOOT ]; then
298
-    $SUDO rm -rf $MICROSD_MOUNT_POINT/$BOOT
299
-fi
300 268
 exit 0