Created
October 22, 2012 19:47
-
-
Save mattes/3933631 to your computer and use it in GitHub Desktop.
format sd card for arch linux and others
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Quelle: http://omappedia.org/wiki/Minimal-FS_SD_Configuration, 06.06.2012 | |
if [ ! "$1" = "/dev/sda" ] ; then | |
unset LANG | |
DRIVE=$1 | |
if [ -b "$DRIVE" ] ; then | |
dd if=/dev/zero of=$DRIVE bs=1024 count=1024 | |
SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'` | |
echo DISK SIZE - $SIZE bytes | |
CYLINDERS=`echo $SIZE/255/63/512 | bc` | |
echo CYLINDERS - $CYLINDERS | |
{ | |
echo ,9,0x0C,* | |
echo ,,,- | |
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE | |
mkfs.vfat -F 32 -n "boot" ${DRIVE}1 | |
mke2fs -j -L "rootfs" ${DRIVE}2 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
short url in raw http://goo.gl/cY09b