summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xrecipes/mkcard/files/mkcard.sh78
-rw-r--r--recipes/mkcard/mkcard_0.5.bb14
2 files changed, 92 insertions, 0 deletions
diff --git a/recipes/mkcard/files/mkcard.sh b/recipes/mkcard/files/mkcard.sh
new file mode 100755
index 0000000..3e70dbc
--- /dev/null
+++ b/recipes/mkcard/files/mkcard.sh
@@ -0,0 +1,78 @@
1#! /bin/sh
2# mkcard.sh v0.5
3# (c) Copyright 2009 Graeme Gregory <dp@xora.org.uk>
4# Licensed under terms of GPLv2
5#
6# Parts of the procudure base on the work of Denys Dmytriyenko
7# http://wiki.omap.com/index.php/MMC_Boot_Format
8
9export LC_ALL=C
10
11if [ $# -ne 1 ]; then
12 echo "Usage: $0 <drive>"
13 exit 1;
14fi
15
16DRIVE=$1
17
18dd if=/dev/zero of=$DRIVE bs=1024 count=1024
19
20SIZE=`fdisk -l $DRIVE | grep Disk | grep bytes | awk '{print $5}'`
21
22echo DISK SIZE - $SIZE bytes
23
24CYLINDERS=`echo $SIZE/255/63/512 | bc`
25
26echo CYLINDERS - $CYLINDERS
27
28{
29echo ,9,0x0C,*
30echo ,,,-
31} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
32
33sleep 1
34
35
36if [ -x `which kpartx` ]; then
37 kpartx -a ${DRIVE}
38fi
39
40# handle various device names.
41# note something like fdisk -l /dev/loop0 | egrep -E '^/dev' | cut -d' ' -f1
42# won't work due to https://bugzilla.redhat.com/show_bug.cgi?id=649572
43
44PARTITION1=${DRIVE}1
45if [ ! -b ${PARTITION1} ]; then
46 PARTITION1=${DRIVE}p1
47fi
48
49DRIVE_NAME=`basename $DRIVE`
50DEV_DIR=`dirname $DRIVE`
51
52if [ ! -b ${PARTITION1} ]; then
53 PARTITION1=$DEV_DIR/mapper/${DRIVE_NAME}p1
54fi
55
56PARTITION2=${DRIVE}2
57if [ ! -b ${PARTITION2} ]; then
58 PARTITION2=${DRIVE}p2
59fi
60if [ ! -b ${PARTITION2} ]; then
61 PARTITION2=$DEV_DIR/mapper/${DRIVE_NAME}p2
62fi
63
64
65# now make partitions.
66if [ -b ${PARTITION1} ]; then
67 umount ${PARTITION1}
68 mkfs.vfat -F 32 -n "boot" ${PARTITION1}
69else
70 echo "Cant find boot partition in /dev"
71fi
72
73if [ -b ${PARITION2} ]; then
74 umount ${PARTITION2}
75 mke2fs -t ext3 -j -L "rootfs" ${PARTITION2}
76else
77 echo "Cant find rootfs partition in /dev"
78fi
diff --git a/recipes/mkcard/mkcard_0.5.bb b/recipes/mkcard/mkcard_0.5.bb
new file mode 100644
index 0000000..3671f7a
--- /dev/null
+++ b/recipes/mkcard/mkcard_0.5.bb
@@ -0,0 +1,14 @@
1DESCRIPTION = "mkcard.sh v0.5"
2LICENSE = "GPLv2+"
3LIC_FILES_CHKSUM = "file://${COREBASE}/bitbake/COPYING;md5=751419260aa954499f7abaabaa882bbe"
4SECTION = "devel"
5PR = "0"
6
7SRC_URI = "file://mkcard.sh"
8
9do_install () {
10 install -d ${D}${bindir}/
11 install -m 0755 ${WORKDIR}/mkcard.sh ${D}${bindir}/
12}
13
14BBCLASSEXTEND = "nativesdk"