Skip to content

Instantly share code, notes, and snippets.

@DVDPT
Last active August 31, 2015 10:10
Show Gist options
  • Save DVDPT/910fe1900dd081551ca8 to your computer and use it in GitHub Desktop.
Save DVDPT/910fe1900dd081551ca8 to your computer and use it in GitHub Desktop.
Create SD Card default partitions
card = //sd card device /dev/sdb
BOOT_PARTITION_START = 0
BOOT_PARTITION_SIZE = 8 //mb
ROOTFS_PARTITION_SIZE = 4096
FAT_FILE_SYSTEM = c
EXT4_FILE_SYSTEM = 83
// Create partitions
sfdisk --force -uM ${card} << EOF
${BOOT_PARTITION_START}, ${BOOT_PARTITION_SIZE}, ${FAT_FILE_SYSTEM},
,${ROOTFS_PARTITION_SIZE}, ${EXT4_FILE_SYSTEM} EOF
// Format partition to fat
mkfs.vfat -n boot ${card}1
// Format partition to ext4
mkfs.ext4 ${card}2 -Lrootfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment