[oe-commits] Ulf Samuelsson : Add support files for AT91 SD card boot

git version control git at git.openembedded.org
Mon Feb 28 12:36:53 UTC 2011


Module: openembedded.git
Branch: ulf/linux-2.6.30-2011-01-16
Commit: 7df021a6faba5b27ccb8d0db8811202a3b8e00b0
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=7df021a6faba5b27ccb8d0db8811202a3b8e00b0

Author: Ulf Samuelsson <ulf.samuelsson at atmel.com>
Date:   Mon Feb 28 09:35:16 2011 +0100

Add support files for AT91 SD card boot

---

 recipes/at91-sd-card-boot/at91-sd-card-boot_1.0.bb |   33 +++++++++++
 recipes/at91-sd-card-boot/files/PROGRAM.BIN        |  Bin 0 -> 63420 bytes
 .../files/at91sam9g45ekes/at91sam9g45ekes.machid   |    9 +++
 .../files/at91sam9m10ekes/at91sam9m10ekes.machid   |    9 +++
 .../files/at91sam9m10g45ek/at91sam9m10g45ek.machid |    9 +++
 recipes/at91-sd-card-boot/files/build.sh           |   16 ++++++
 recipes/at91-sd-card-boot/files/genfiles.sh        |   14 +++++
 recipes/at91-sd-card-boot/files/mksdcard.sh        |   57 ++++++++++++++++++++
 8 files changed, 147 insertions(+), 0 deletions(-)

diff --git a/recipes/at91-sd-card-boot/at91-sd-card-boot_1.0.bb b/recipes/at91-sd-card-boot/at91-sd-card-boot_1.0.bb
new file mode 100644
index 0000000..06a4b88
--- /dev/null
+++ b/recipes/at91-sd-card-boot/at91-sd-card-boot_1.0.bb
@@ -0,0 +1,33 @@
+DESCRIPTION = "at91 sd-card tools: Useful utilities for Booting an at91 from an SD-Card"
+SECTION = "bootloaders"
+
+PR = "r3"
+DEFAULT_PREFERENCE = "-1"
+DEFAULT_PREFERENCE_at91sam9g45ek = "3"
+DEFAULT_PREFERENCE_at91sam9g45ekes = "3"
+DEFAULT_PREFERENCE_at91sam9m10ek = "3"
+DEFAULT_PREFERENCE_at91sam9m10ekes = "3"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+SRC_URI = " \
+	file://${MACHINE}.machid \
+	file://build.sh \
+	file://genfiles.sh \
+	file://mksdcard.sh \
+	http://ftp.at91.com/build/buildroot/at91sam9g45-USBMSA.bin \
+	"
+SD_TOOLS = "${DEPLOY_DIR_IMAGE}/at91-sd-card-tools"
+
+do_install () {
+	install	-d	${SD_TOOLS}
+	if [ -e ${WORKDIR}/${MACHINE}.machid ] ; then
+		install -m 0755	${SD_TOOLS}/${MACHINE}.machid
+	fi
+	install -m 0755	${WORKDIR}/build.sh			${SD_TOOLS}/build.sh
+	install -m 0755	${WORKDIR}/genfiles.sh			${SD_TOOLS}/genfiles.sh
+	install -m 0755	${WORKDIR}/mksdcard.sh			${SD_TOOLS}/mksdcard.sh
+	install -m 0755	${WORKDIR}/at91sam9g45-USBMSA.bin	${SD_TOOLS}/PROGRAM.BIN
+
+}
+
diff --git a/recipes/at91-sd-card-boot/files/PROGRAM.BIN b/recipes/at91-sd-card-boot/files/PROGRAM.BIN
new file mode 100755
index 0000000..718d709
Binary files /dev/null and b/recipes/at91-sd-card-boot/files/PROGRAM.BIN differ
diff --git a/recipes/at91-sd-card-boot/files/at91sam9g45ekes/at91sam9g45ekes.machid b/recipes/at91-sd-card-boot/files/at91sam9g45ekes/at91sam9g45ekes.machid
new file mode 100755
index 0000000..0d0d5a1
--- /dev/null
+++ b/recipes/at91-sd-card-boot/files/at91sam9g45ekes/at91sam9g45ekes.machid
@@ -0,0 +1,9 @@
+setenv	at91sam9m10ekes		9cd
+setenv	at91sam9g45ekes		8a4
+setenv	at91sam9m10g45ek	726
+
+setenv machid ${at91sam9g45ekes}
+
+setenv bootargs 'mem=128M console=ttyS0,115200 root=/dev/mmcblk0p2 rootdelay=2 rootfstype=ext3 rw'
+
+
diff --git a/recipes/at91-sd-card-boot/files/at91sam9m10ekes/at91sam9m10ekes.machid b/recipes/at91-sd-card-boot/files/at91sam9m10ekes/at91sam9m10ekes.machid
new file mode 100755
index 0000000..da36e44
--- /dev/null
+++ b/recipes/at91-sd-card-boot/files/at91sam9m10ekes/at91sam9m10ekes.machid
@@ -0,0 +1,9 @@
+setenv	at91sam9m10ekes		9cd
+setenv	at91sam9g45ekes		8a4
+setenv	at91sam9m10g45ek	726
+
+setenv machid ${at91sam9m10ekes}
+
+setenv bootargs 'mem=128M console=ttyS0,115200 root=/dev/mmcblk0p2 rootdelay=2 rootfstype=ext3 rw'
+
+
diff --git a/recipes/at91-sd-card-boot/files/at91sam9m10g45ek/at91sam9m10g45ek.machid b/recipes/at91-sd-card-boot/files/at91sam9m10g45ek/at91sam9m10g45ek.machid
new file mode 100755
index 0000000..e135027
--- /dev/null
+++ b/recipes/at91-sd-card-boot/files/at91sam9m10g45ek/at91sam9m10g45ek.machid
@@ -0,0 +1,9 @@
+setenv	at91sam9m10ekes		9cd
+setenv	at91sam9g45ekes		8a4
+setenv	at91sam9m10g45ek	726
+
+setenv machid ${at91sam9m10g45ek}
+
+setenv bootargs 'mem=128M console=ttyS0,115200 root=/dev/mmcblk0p2 rootdelay=2 rootfstype=ext3 rw'
+
+
diff --git a/recipes/at91-sd-card-boot/files/build.sh b/recipes/at91-sd-card-boot/files/build.sh
new file mode 100755
index 0000000..5624de5
--- /dev/null
+++ b/recipes/at91-sd-card-boot/files/build.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+process	()
+{
+	if [ -f $1.machid ] ; then
+		mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "$1 machid script" -d $1.machid U-BOOT.ENV
+	fi
+}
+
+process	at91sam9g45ekes
+process	at91sam9m10ekes
+process	at91sam9m10g45ek
+process	at91sam9m10g45ek_android
+
+
+
diff --git a/recipes/at91-sd-card-boot/files/genfiles.sh b/recipes/at91-sd-card-boot/files/genfiles.sh
new file mode 100755
index 0000000..3a8a8ba
--- /dev/null
+++ b/recipes/at91-sd-card-boot/files/genfiles.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+LOG=filenames.txt
+BOOTFILE=`ls	*.bin	| grep sdcardboot`
+UBOOTFILE=`ls	*.bin	| grep "u-boot"`
+UIMAGEFILE=`ls	*.bin	| grep uImage`
+
+echo	"BOOT.BIN:	$BOOTFILE"	>	$LOG
+echo	"U-BOOT.BIN:	$UBOOTFILE"	>>	$LOG
+echo	"UIMAGE:		$UIMAGEFILE"	>>	$LOG
+
+mv	$BOOTFILE	BOOT.BIN
+mv	$UBOOTFILE	U-BOOT.BIN
+mv	$UIMAGEFILE	UIMAGE
+
diff --git a/recipes/at91-sd-card-boot/files/mksdcard.sh b/recipes/at91-sd-card-boot/files/mksdcard.sh
new file mode 100755
index 0000000..78ba5b8
--- /dev/null
+++ b/recipes/at91-sd-card-boot/files/mksdcard.sh
@@ -0,0 +1,57 @@
+#! /bin/sh
+# Format an SD-Card for an AT91SAM9
+# (c) 2011 Ulf Samuelsson
+# (c) 2009 Graeme Gregory
+# This script is GPLv3 licensed!
+
+if	[ "x$1" == "x" ] ; then
+	echo	"Usage:"
+	echo	"\t./mksdcard.sh	<device>	[ erase ]"
+	echo	"Examples:"
+	echo	"\t./mksdcard.sh	/dev/sdb"
+	echo	"\t./mksdcard.sh	/dev/sdb	1024"
+	exit
+fi
+
+DRIVE=$1
+if	[ "1" == "1" ] ; then
+HEADS=63
+SECTORS=62
+FATSIZE=120
+else
+HEADS=255
+SECTORS=63
+FATSIZE=34
+fi
+BLOCKSIZE=512
+
+SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
+echo "DISK SIZE - $SIZE bytes"
+
+# BLOCKCOUNT=`echo $SIZE/$BLOCKSIZE | bc`
+BLOCKCOUNT=`echo	$FATSIZE*2048	| bc`
+echo BLOCK COUNT - $BLOCKCOUNT blocks
+
+CYLINDERS=`echo $SIZE/$HEADS/$SECTORS/512 | bc`
+echo CYLINDERS - $CYLINDERS
+
+if	[ "x$2" == "xerase" ] ; then
+echo		`date	+%T`
+printf		"%-40s"	"Erasing SD-Card"
+dd if=/dev/zero of=$DRIVE bs=$BLOCKSIZE count=2048 # 65536
+#$BLOCKCOUNT
+echo	"COMPLETE"
+echo		`date	+%T`
+fi
+
+{
+echo ,$FATSIZE,0x0C,*
+echo ,,0x83
+#echo ,,,-
+} | sfdisk -D -H $HEADS -S $SECTORS -C $CYLINDERS $DRIVE
+
+dd if=/dev/zero of=${DRIVE}1 bs=512 count=1
+
+mkfs.vfat -F 32 -n "boot"	${DRIVE}1
+mkfs.ext3 	-L "rootfs"	${DRIVE}2
+





More information about the Openembedded-commits mailing list