Browse Source

Enable booting from sata on A20 boards

Bob Mottram 7 years ago
parent
commit
8b4ada33d3

+ 9
- 0
src/freedombone-image View File

153
 MBR_REPO="https://aur.archlinux.org/mbr.git"
153
 MBR_REPO="https://aur.archlinux.org/mbr.git"
154
 CLIAPP_REPO="git://git.liw.fi/cliapp"
154
 CLIAPP_REPO="git://git.liw.fi/cliapp"
155
 
155
 
156
+# Whether to use a SATA drive and if so what its device/partition name is
157
+# eg. sda2
158
+EXTERNAL_DRIVE=
159
+
156
 function image_setup {
160
 function image_setup {
157
     setup_type=$1
161
     setup_type=$1
158
 
162
 
453
             shift
457
             shift
454
             LOCAL_NAME="$1"
458
             LOCAL_NAME="$1"
455
             ;;
459
             ;;
460
+        --sata|--hdd)
461
+            shift
462
+            EXTERNAL_DRIVE="$1"
463
+            ;;
456
         *)
464
         *)
457
             # unknown option
465
             # unknown option
458
             ;;
466
             ;;
601
      INSECURE="$INSECURE" \
609
      INSECURE="$INSECURE" \
602
      AMNESIC="$AMNESIC" \
610
      AMNESIC="$AMNESIC" \
603
      SOCIALINSTANCE="$SOCIALINSTANCE" \
611
      SOCIALINSTANCE="$SOCIALINSTANCE" \
612
+     EXTERNAL_DRIVE="$EXTERNAL_DRIVE" \
604
      LOCAL_NAME="$LOCAL_NAME"
613
      LOCAL_NAME="$LOCAL_NAME"
605
 
614
 
606
 # shellcheck disable=SC2181
615
 # shellcheck disable=SC2181

+ 4
- 0
src/freedombone-image-customise View File

141
 
141
 
142
 PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
142
 PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
143
 
143
 
144
+# Whether to use a SATA drive and if so what its device/partition name is
145
+# eg. sda2
146
+EXTERNAL_DRIVE=
147
+
144
 configure_backports() {
148
 configure_backports() {
145
     echo "deb http://${DEBIAN_REPO}/debian/ ${DEBIAN_VERSION}-backports main" >> "$rootdir/etc/apt/sources.list"
149
     echo "deb http://${DEBIAN_REPO}/debian/ ${DEBIAN_VERSION}-backports main" >> "$rootdir/etc/apt/sources.list"
146
 }
150
 }

+ 11
- 7
src/freedombone-image-hardware-setup View File

155
 
155
 
156
 a20_setup_boot() {
156
 a20_setup_boot() {
157
     dtb="$1"
157
     dtb="$1"
158
+    a20_root_device='mmcblk0p2'
159
+    if [ "$2" ]; then
160
+        a20_root_device="$2"
161
+    fi
158
 
162
 
159
     # Setup boot.cmd
163
     # Setup boot.cmd
160
     if grep -q btrfs /etc/fstab ; then
164
     if grep -q btrfs /etc/fstab ; then
173
 setenv mmcdev 0
177
 setenv mmcdev 0
174
 setenv mmcpart 1
178
 setenv mmcpart 1
175
 
179
 
176
-setenv mmcroot /dev/mmcblk0p2 ro
180
+setenv mmcroot /dev/${a20_root_device} ro
177
 setenv mmcrootfstype $fstype rootwait fixrtc
181
 setenv mmcrootfstype $fstype rootwait fixrtc
178
 setenv mmcrootflags subvol=@
182
 setenv mmcrootflags subvol=@
179
 
183
 
239
         enable_serial_console ttyO0
243
         enable_serial_console ttyO0
240
         ;;
244
         ;;
241
     cubietruck)
245
     cubietruck)
242
-        a20_setup_boot sun7i-a20-cubietruck.dtb
246
+        a20_setup_boot sun7i-a20-cubietruck.dtb "$EXTERNAL_DRIVE"
243
         enable_serial_console ttyS0
247
         enable_serial_console ttyS0
244
         ;;
248
         ;;
245
     a20-olinuxino-lime)
249
     a20-olinuxino-lime)
246
-        a20_setup_boot sun7i-a20-olinuxino-lime.dtb
250
+        a20_setup_boot sun7i-a20-olinuxino-lime.dtb "$EXTERNAL_DRIVE"
247
         enable_serial_console ttyS0
251
         enable_serial_console ttyS0
248
         ;;
252
         ;;
249
     a20-olinuxino-lime2)
253
     a20-olinuxino-lime2)
250
-        a20_setup_boot sun7i-a20-olinuxino-lime2.dtb
254
+        a20_setup_boot sun7i-a20-olinuxino-lime2.dtb "$EXTERNAL_DRIVE"
251
         enable_serial_console ttyS0
255
         enable_serial_console ttyS0
252
         ;;
256
         ;;
253
     a20-olinuxino-micro)
257
     a20-olinuxino-micro)
254
-        a20_setup_boot sun7i-a20-olinuxino-micro.dtb
258
+        a20_setup_boot sun7i-a20-olinuxino-micro.dtb "$EXTERNAL_DRIVE"
255
         enable_serial_console ttyS0
259
         enable_serial_console ttyS0
256
         ;;
260
         ;;
257
     cubieboard2)
261
     cubieboard2)
258
-        a20_setup_boot sun7i-a20-cubieboard2.dtb
262
+        a20_setup_boot sun7i-a20-cubieboard2.dtb "$EXTERNAL_DRIVE"
259
         enable_serial_console ttyS0
263
         enable_serial_console ttyS0
260
         ;;
264
         ;;
261
     pcduino3)
265
     pcduino3)
262
-        a20_setup_boot sun7i-a20-pcduino3.dtb
266
+        a20_setup_boot sun7i-a20-pcduino3.dtb "$EXTERNAL_DRIVE"
263
         enable_serial_console ttyS0
267
         enable_serial_console ttyS0
264
         ;;
268
         ;;
265
 esac
269
 esac

+ 2
- 0
src/freedombone-image-make View File

77
 export AMNESIC
77
 export AMNESIC
78
 export SOCIALINSTANCE
78
 export SOCIALINSTANCE
79
 export LOCAL_NAME
79
 export LOCAL_NAME
80
+export EXTERNAL_DRIVE
80
 
81
 
81
 # Locate vmdebootstrap program fetched in Makefile
82
 # Locate vmdebootstrap program fetched in Makefile
82
 basedir=`pwd`
83
 basedir=`pwd`
225
 sed -i "s|AMNESIC=.*|AMNESIC=\"${AMNESIC}\"|g" "$TEMP_CUSTOMISE3"
226
 sed -i "s|AMNESIC=.*|AMNESIC=\"${AMNESIC}\"|g" "$TEMP_CUSTOMISE3"
226
 sed -i "s|SOCIALINSTANCE=.*|SOCIALINSTANCE=\"${SOCIALINSTANCE}\"|g" "$TEMP_CUSTOMISE3"
227
 sed -i "s|SOCIALINSTANCE=.*|SOCIALINSTANCE=\"${SOCIALINSTANCE}\"|g" "$TEMP_CUSTOMISE3"
227
 sed -i "s|LOCAL_NAME=.*|LOCAL_NAME=\"${LOCAL_NAME}\"|g" "$TEMP_CUSTOMISE3"
228
 sed -i "s|LOCAL_NAME=.*|LOCAL_NAME=\"${LOCAL_NAME}\"|g" "$TEMP_CUSTOMISE3"
229
+sed -i "s|EXTERNAL_DRIVE=.*|EXTERNAL_DRIVE=\"${EXTERNAL_DRIVE}\"|g" "$TEMP_CUSTOMISE3"
228
 sed -i 's|#!/bin/bash||g' "$TEMP_CUSTOMISE3"
230
 sed -i 's|#!/bin/bash||g' "$TEMP_CUSTOMISE3"
229
 
231
 
230
 cat $TEMP_CUSTOMISE2 $TEMP_CUSTOMISE3 > $TEMP_CUSTOMISE4
232
 cat $TEMP_CUSTOMISE2 $TEMP_CUSTOMISE3 > $TEMP_CUSTOMISE4