X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=cirros-testvm%2Fsrc-cirros%2Fbuildroot-2015.05%2Fboard%2Ffreescale%2Fimx28evk%2Fcreate-boot-sd.sh;fp=cirros-testvm%2Fsrc-cirros%2Fbuildroot-2015.05%2Fboard%2Ffreescale%2Fimx28evk%2Fcreate-boot-sd.sh;h=5e050cbadad94c65adb3a3b1af25a3f2ad39449b;hb=b0a0f15dfaa205161a7fcb20cf1b8cd4948c2ef3;hp=0000000000000000000000000000000000000000;hpb=c6ac3cd55ee2da956195eee393b0882105dfad4e;p=packages%2Ftrusty%2Fcirros-testvm.git diff --git a/cirros-testvm/src-cirros/buildroot-2015.05/board/freescale/imx28evk/create-boot-sd.sh b/cirros-testvm/src-cirros/buildroot-2015.05/board/freescale/imx28evk/create-boot-sd.sh new file mode 100755 index 0000000..5e050cb --- /dev/null +++ b/cirros-testvm/src-cirros/buildroot-2015.05/board/freescale/imx28evk/create-boot-sd.sh @@ -0,0 +1,97 @@ +#!/bin/sh + +set -u +set -e + +PROGNAME=$(basename $0) + +usage() +{ + echo "Create an SD card that boots on an i.MX28 EVK board." + echo + echo "Note: all data on the the card will be completely deleted!" + echo "Use with care!" + echo "Superuser permissions may be required to write to the device." + echo + echo "Usage: ${PROGNAME} " + echo "Arguments:" + echo " The device to be written to" + echo + echo "Example: ${PROGNAME} /dev/mmcblk0" + echo +} + +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +if [ $(id -u) -ne 0 ]; then + echo "${PROGNAME} must be run as root" + exit 1 +fi + +DEV=${1} + +# The partition name prefix depends on the device name: +# - /dev/sde -> /dev/sde1 +# - /dev/mmcblk0 -> /dev/mmcblk0p1 +if echo ${DEV}|grep -q mmcblk ; then + PART="p" +else + PART="" +fi + +PART1=${DEV}${PART}1 +PART2=${DEV}${PART}2 +PART3=${DEV}${PART}3 + +# Unmount the partitions if mounted +umount ${PART1} || true +umount ${PART2} || true +umount ${PART3} || true + +# First, clear the card +dd if=/dev/zero of=${DEV} bs=1M count=20 + +sync + +# Partition the card. +# SD layout for i.MX28 boot: +# - Special partition type 53 at sector 2048, containing an SD-SB-encapsulated u-boot +# - FAT partition containing zImage +# - ext2/3 partition formatted as ext2 or ext3, containing the root filesystem. +sfdisk --force -u S ${DEV} <