diff --git a/src/freedombone-image b/src/freedombone-image index 020b4a88..1eab460b 100755 --- a/src/freedombone-image +++ b/src/freedombone-image @@ -153,6 +153,10 @@ MULTIPATH_TOOLS_REPO="https://aur.archlinux.org/multipath-tools.git" MBR_REPO="https://aur.archlinux.org/mbr.git" CLIAPP_REPO="git://git.liw.fi/cliapp" +# Whether to use a SATA drive and if so what its device/partition name is +# eg. sda2 +EXTERNAL_DRIVE= + function image_setup { setup_type=$1 @@ -453,6 +457,10 @@ do shift LOCAL_NAME="$1" ;; + --sata|--hdd) + shift + EXTERNAL_DRIVE="$1" + ;; *) # unknown option ;; @@ -601,6 +609,7 @@ make "$IMAGE_TYPE" \ INSECURE="$INSECURE" \ AMNESIC="$AMNESIC" \ SOCIALINSTANCE="$SOCIALINSTANCE" \ + EXTERNAL_DRIVE="$EXTERNAL_DRIVE" \ LOCAL_NAME="$LOCAL_NAME" # shellcheck disable=SC2181 diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index fdd6233f..1635587b 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -141,6 +141,10 @@ BMX7_COMMIT='0a82c7c10fef44b259b35e77ab33632aa132d219' PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin +# Whether to use a SATA drive and if so what its device/partition name is +# eg. sda2 +EXTERNAL_DRIVE= + configure_backports() { echo "deb http://${DEBIAN_REPO}/debian/ ${DEBIAN_VERSION}-backports main" >> "$rootdir/etc/apt/sources.list" } diff --git a/src/freedombone-image-hardware-setup b/src/freedombone-image-hardware-setup index c63978c0..ea297faa 100755 --- a/src/freedombone-image-hardware-setup +++ b/src/freedombone-image-hardware-setup @@ -155,6 +155,10 @@ beaglebone_repack_kernel() { a20_setup_boot() { dtb="$1" + a20_root_device='mmcblk0p2' + if [ "$2" ]; then + a20_root_device="$2" + fi # Setup boot.cmd if grep -q btrfs /etc/fstab ; then @@ -173,7 +177,7 @@ a20_setup_boot() { setenv mmcdev 0 setenv mmcpart 1 -setenv mmcroot /dev/mmcblk0p2 ro +setenv mmcroot /dev/${a20_root_device} ro setenv mmcrootfstype $fstype rootwait fixrtc setenv mmcrootflags subvol=@ @@ -239,27 +243,27 @@ case "$MACHINE" in enable_serial_console ttyO0 ;; cubietruck) - a20_setup_boot sun7i-a20-cubietruck.dtb + a20_setup_boot sun7i-a20-cubietruck.dtb "$EXTERNAL_DRIVE" enable_serial_console ttyS0 ;; a20-olinuxino-lime) - a20_setup_boot sun7i-a20-olinuxino-lime.dtb + a20_setup_boot sun7i-a20-olinuxino-lime.dtb "$EXTERNAL_DRIVE" enable_serial_console ttyS0 ;; a20-olinuxino-lime2) - a20_setup_boot sun7i-a20-olinuxino-lime2.dtb + a20_setup_boot sun7i-a20-olinuxino-lime2.dtb "$EXTERNAL_DRIVE" enable_serial_console ttyS0 ;; a20-olinuxino-micro) - a20_setup_boot sun7i-a20-olinuxino-micro.dtb + a20_setup_boot sun7i-a20-olinuxino-micro.dtb "$EXTERNAL_DRIVE" enable_serial_console ttyS0 ;; cubieboard2) - a20_setup_boot sun7i-a20-cubieboard2.dtb + a20_setup_boot sun7i-a20-cubieboard2.dtb "$EXTERNAL_DRIVE" enable_serial_console ttyS0 ;; pcduino3) - a20_setup_boot sun7i-a20-pcduino3.dtb + a20_setup_boot sun7i-a20-pcduino3.dtb "$EXTERNAL_DRIVE" enable_serial_console ttyS0 ;; esac diff --git a/src/freedombone-image-make b/src/freedombone-image-make index 899fe691..b708918d 100755 --- a/src/freedombone-image-make +++ b/src/freedombone-image-make @@ -77,6 +77,7 @@ export INSECURE export AMNESIC export SOCIALINSTANCE export LOCAL_NAME +export EXTERNAL_DRIVE # Locate vmdebootstrap program fetched in Makefile basedir=`pwd` @@ -225,6 +226,7 @@ sed -i "s|INSECURE=.*|INSECURE=\"${INSECURE}\"|g" "$TEMP_CUSTOMISE3" sed -i "s|AMNESIC=.*|AMNESIC=\"${AMNESIC}\"|g" "$TEMP_CUSTOMISE3" sed -i "s|SOCIALINSTANCE=.*|SOCIALINSTANCE=\"${SOCIALINSTANCE}\"|g" "$TEMP_CUSTOMISE3" sed -i "s|LOCAL_NAME=.*|LOCAL_NAME=\"${LOCAL_NAME}\"|g" "$TEMP_CUSTOMISE3" +sed -i "s|EXTERNAL_DRIVE=.*|EXTERNAL_DRIVE=\"${EXTERNAL_DRIVE}\"|g" "$TEMP_CUSTOMISE3" sed -i 's|#!/bin/bash||g' "$TEMP_CUSTOMISE3" cat $TEMP_CUSTOMISE2 $TEMP_CUSTOMISE3 > $TEMP_CUSTOMISE4