Changes between Version 2 and Version 3 of howto/SD_Config/OSX


Ignore:
Timestamp:
Apr 21, 2014, 8:37:37 AM (10 years ago)
Author:
mschulz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • howto/SD_Config/OSX

    v2 v3  
    3838 1. Repeat for additional .bin config files in additional slots if needed.
    3939 1. Eject the SD card in the Finder (if it's mounted).
     40
     41'''Using a shell script to copy a .bin file to the SD card:'''[[BR]]
     42The following script automatically looks for the file descriptor of the SD card and copies the .bin file to the chosen slot. To execute the script:
     43 1. copy the script to a text file
     44 1. save it under the name copytosd.sh
     45 1. make it executable (chmod +x copytosd.sh)
     46 1. run it as root: sudo ./copytosd.sh.
     47{{{
     48#!/bin/sh
     49# Author: Matthias Schulz <mschulz@seemoo.tu-darmstadt.de>
     50# The author is not responsible for the consequences of use of this script
     51
     52# Check if at least two arguments are passed
     53if [ $# -lt 2 ]
     54then
     55        echo "Usage : ./copytosd.sh filename slot [description]"
     56        exit
     57fi
     58
     59if [ $# -eq 3 ]
     60then
     61                find "/Volumes/WARP SD" -name "`printf \"Slot %s - *\" \"$2\"`" -delete
     62                FILE="/Volumes/WARP SD/`printf \"Slot %s - %s\" \"$2\" \"$3\"`"
     63                echo "" > $FILE
     64fi
     65
     66DISK=/dev/`diskutil list | grep "WARP SD" | cut -c 69-73`
     67
     68diskutil unmountDisk $DISK
     69
     70case "$2" in
     710)  dd bs=512 seek=131072 if=$1 of=$DISK
     72    ;;
     731)  dd bs=512 seek=163840 if=$1 of=$DISK
     74    ;;
     752)  dd bs=512 seek=196608 if=$1 of=$DISK
     76    ;;
     773) dd bs=512 seek=229376 if=$1 of=$DISK
     78   ;;
     794) dd bs=512 seek=262144 if=$1 of=$DISK
     80   ;;
     815) dd bs=512 seek=294912 if=$1 of=$DISK
     82   ;;
     836) dd bs=512 seek=327680 if=$1 of=$DISK
     84   ;;
     857) dd bs=512 seek=360448 if=$1 of=$DISK
     86   ;;
     87*) echo "Error: use a slot number between 0 and 7"
     88   exit
     89   ;;
     90esac
     91
     92diskutil unmountDisk $DISK
     93}}}