cleanup/merge: MMC -> media

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
pull/22/head
Robert Nelson 12 years ago
parent df3e05c97f
commit f74861674f

@ -31,7 +31,6 @@ MIRROR="http://rcn-ee.net/deb"
BOOT_LABEL="boot" BOOT_LABEL="boot"
PARTITION_PREFIX="" PARTITION_PREFIX=""
unset MMC
unset USE_BETA_BOOTLOADER unset USE_BETA_BOOTLOADER
unset USE_LOCAL_BOOT unset USE_LOCAL_BOOT
unset LOCAL_BOOTLOADER unset LOCAL_BOOTLOADER
@ -1114,17 +1113,17 @@ unmount_all_drive_partitions () {
echo "Unmounting Partitions" echo "Unmounting Partitions"
echo "-----------------------------" echo "-----------------------------"
NUM_MOUNTS=$(mount | grep -v none | grep "$MMC" | wc -l) NUM_MOUNTS=$(mount | grep -v none | grep "$media" | wc -l)
## for (i=1;i<=${NUM_MOUNTS};i++) ## for (i=1;i<=${NUM_MOUNTS};i++)
for ((i=1;i<=${NUM_MOUNTS};i++ )) for ((i=1;i<=${NUM_MOUNTS};i++ ))
do do
DRIVE=$(mount | grep -v none | grep "$MMC" | tail -1 | awk '{print $1}') DRIVE=$(mount | grep -v none | grep "$media" | tail -1 | awk '{print $1}')
umount ${DRIVE} >/dev/null 2>&1 || true umount ${DRIVE} >/dev/null 2>&1 || true
done done
echo "Zeroing out Partition Table" echo "Zeroing out Partition Table"
dd if=/dev/zero of=${MMC} bs=1M count=16 || drive_error_ro dd if=/dev/zero of=${media} bs=1M count=16 || drive_error_ro
sync sync
} }
@ -1134,7 +1133,7 @@ sfdisk_boot_partition () {
echo "Using sfdisk to create BOOT partition" echo "Using sfdisk to create BOOT partition"
echo "-----------------------------" echo "-----------------------------"
LC_ALL=C sfdisk --in-order --Linux --unit M "${MMC}" <<-__EOF__ LC_ALL=C sfdisk --in-order --Linux --unit M "${media}" <<-__EOF__
${conf_boot_startmb},${conf_boot_endmb},${sfdisk_fstype},* ${conf_boot_startmb},${conf_boot_endmb},${sfdisk_fstype},*
__EOF__ __EOF__
@ -1146,7 +1145,7 @@ dd_uboot_boot () {
echo "" echo ""
echo "Using dd to place bootloader on drive" echo "Using dd to place bootloader on drive"
echo "-----------------------------" echo "-----------------------------"
dd if=${TEMPDIR}/dl/${UBOOT} of=${MMC} seek=${dd_uboot_seek} bs=${dd_uboot_bs} dd if=${TEMPDIR}/dl/${UBOOT} of=${media} seek=${dd_uboot_seek} bs=${dd_uboot_bs}
} }
dd_spl_uboot_boot () { dd_spl_uboot_boot () {
@ -1154,8 +1153,8 @@ dd_spl_uboot_boot () {
echo "" echo ""
echo "Using dd to place bootloader on drive" echo "Using dd to place bootloader on drive"
echo "-----------------------------" echo "-----------------------------"
dd if=${TEMPDIR}/dl/${UBOOT} of=${MMC} seek=${dd_spl_uboot_seek} bs=${dd_spl_uboot_bs} dd if=${TEMPDIR}/dl/${UBOOT} of=${media} seek=${dd_spl_uboot_seek} bs=${dd_spl_uboot_bs}
dd if=${TEMPDIR}/dl/${UBOOT} of=${MMC} seek=${dd_uboot_seek} bs=${dd_uboot_bs} dd if=${TEMPDIR}/dl/${UBOOT} of=${media} seek=${dd_uboot_seek} bs=${dd_uboot_bs}
bootloader_installed=1 bootloader_installed=1
} }
@ -1167,8 +1166,8 @@ format_partition_error () {
format_boot_partition () { format_boot_partition () {
echo "Formating Boot Partition" echo "Formating Boot Partition"
echo "-----------------------------" echo "-----------------------------"
partprobe ${MMC} partprobe ${media}
LC_ALL=C ${mkfs} ${MMC}${PARTITION_PREFIX}1 ${mkfs_label} || format_partition_error LC_ALL=C ${mkfs} ${media}${PARTITION_PREFIX}1 ${mkfs_label} || format_partition_error
} }
create_partitions () { create_partitions () {
@ -1202,7 +1201,7 @@ create_partitions () {
esac esac
format_boot_partition format_boot_partition
echo "Final Created Partition:" echo "Final Created Partition:"
LC_ALL=C fdisk -l ${MMC} LC_ALL=C fdisk -l ${media}
echo "-----------------------------" echo "-----------------------------"
} }
@ -1210,12 +1209,12 @@ populate_boot () {
echo "Populating Boot Partition" echo "Populating Boot Partition"
echo "-----------------------------" echo "-----------------------------"
partprobe ${MMC} partprobe ${media}
if [ ! -d ${TEMPDIR}/disk ] ; then if [ ! -d ${TEMPDIR}/disk ] ; then
mkdir -p ${TEMPDIR}/disk mkdir -p ${TEMPDIR}/disk
fi fi
if mount -t ${mount_partition_format} ${MMC}${PARTITION_PREFIX}1 ${TEMPDIR}/disk; then if mount -t ${mount_partition_format} ${media}${PARTITION_PREFIX}1 ${TEMPDIR}/disk; then
mkdir -p ${TEMPDIR}/disk/backup mkdir -p ${TEMPDIR}/disk/backup
mkdir -p ${TEMPDIR}/disk/dtbs mkdir -p ${TEMPDIR}/disk/dtbs
@ -1354,7 +1353,7 @@ populate_boot () {
echo "-----------------------------" echo "-----------------------------"
else else
echo "-----------------------------" echo "-----------------------------"
echo "Unable to mount ${MMC}${PARTITION_PREFIX}1 at ${TEMPDIR}/disk to complete populating Boot Partition" echo "Unable to mount ${media}${PARTITION_PREFIX}1 at ${TEMPDIR}/disk to complete populating Boot Partition"
echo "Please retry running the script, sometimes rebooting your system helps." echo "Please retry running the script, sometimes rebooting your system helps."
echo "-----------------------------" echo "-----------------------------"
exit exit
@ -1383,9 +1382,9 @@ populate_boot () {
} }
check_mmc () { check_mmc () {
FDISK=$(LC_ALL=C fdisk -l 2>/dev/null | grep "Disk ${MMC}" | awk '{print $2}') FDISK=$(LC_ALL=C fdisk -l 2>/dev/null | grep "Disk ${media}" | awk '{print $2}')
if [ "x${FDISK}" = "x${MMC}:" ] ; then if [ "x${FDISK}" = "x${media}:" ] ; then
echo "" echo ""
echo "I see..." echo "I see..."
echo "fdisk -l:" echo "fdisk -l:"
@ -1400,7 +1399,7 @@ check_mmc () {
fi fi
echo "" echo ""
unset response unset response
echo -n "Are you 100% sure, on selecting [${MMC}] (y/n)? " echo -n "Are you 100% sure, on selecting [${media}] (y/n)? "
read response read response
if [ "x${response}" != "xy" ] ; then if [ "x${response}" != "xy" ] ; then
exit exit
@ -1408,7 +1407,7 @@ check_mmc () {
echo "" echo ""
else else
echo "" echo ""
echo "Are you sure? I Don't see [${MMC}], here is what I do see..." echo "Are you sure? I Don't see [${media}], here is what I do see..."
echo "" echo ""
echo "fdisk -l:" echo "fdisk -l:"
LC_ALL=C fdisk -l 2>/dev/null | grep "Disk /dev/" --color=never LC_ALL=C fdisk -l 2>/dev/null | grep "Disk /dev/" --color=never
@ -1696,18 +1695,18 @@ while [ ! -z "$1" ] ; do
case $1 in case $1 in
-h|--help) -h|--help)
usage usage
MMC=1 media=1
;; ;;
--probe-mmc) --probe-mmc)
MMC="/dev/idontknow" media="/dev/idontknow"
check_root check_root
check_mmc check_mmc
;; ;;
--mmc) --mmc)
checkparm $2 checkparm $2
MMC="$2" media="$2"
unset PARTITION_PREFIX unset PARTITION_PREFIX
echo ${MMC} | grep mmcblk >/dev/null && PARTITION_PREFIX="p" echo ${media} | grep mmcblk >/dev/null && PARTITION_PREFIX="p"
check_root check_root
check_mmc check_mmc
;; ;;
@ -1783,7 +1782,7 @@ while [ ! -z "$1" ] ; do
shift shift
done done
if [ ! "${MMC}" ] ; then if [ ! "${media}" ] ; then
echo "ERROR: --mmc undefined" echo "ERROR: --mmc undefined"
usage usage
fi fi

Loading…
Cancel
Save