summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Schwebel <r.schwebel@pengutronix.de>2007-11-28 09:09:08 +0100
committerMarc Kleine-Budde <mkl@pengutronix.de>2007-11-28 09:40:36 +0100
commite75fbbea2ad5f659bd4e61398a8314efb360c6a8 (patch)
tree09be6d416e21fa1c244fe4dab42d3f45b6a18518
parent675ff8ef8c0c5ae1ff448752f38c9900a7474911 (diff)
downloadbarebox-e75fbbea2ad5f659bd4e61398a8314efb360c6a8.tar.gz
barebox-e75fbbea2ad5f659bd4e61398a8314efb360c6a8.tar.xz
pcm038: add default environment
Add a default environment for the phyCORE-i.MX27. Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r--board/pcm038/env/bin/_update27
-rw-r--r--board/pcm038/env/bin/boot38
-rw-r--r--board/pcm038/env/bin/init19
-rw-r--r--board/pcm038/env/bin/update_kernel8
-rw-r--r--board/pcm038/env/bin/update_root8
-rw-r--r--board/pcm038/env/config25
6 files changed, 125 insertions, 0 deletions
diff --git a/board/pcm038/env/bin/_update b/board/pcm038/env/bin/_update
new file mode 100644
index 0000000000..2abed97c61
--- /dev/null
+++ b/board/pcm038/env/bin/_update
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+if [ -z "$part" -o -z "$image" ]; then
+ echo "define \$part and \$image"
+ exit 1
+fi
+
+if [ \! -e "$part" ]; then
+ echo "Partition $part does not exist"
+ exit 1
+fi
+
+if [ $# = 1 ]; then
+ image=$1
+fi
+
+if [ x$ip = xdhcp ]; then
+ dhcp
+fi
+
+unprotect $part
+
+echo "erasing partition $part"
+erase $part
+
+echo "flashing $image to $part"
+tftp $image $part
diff --git a/board/pcm038/env/bin/boot b/board/pcm038/env/bin/boot
new file mode 100644
index 0000000000..cd8a5c9392
--- /dev/null
+++ b/board/pcm038/env/bin/boot
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+. /env/config
+
+if [ x$1 = xflash ]; then
+ root=flash
+ kernel=flash
+fi
+
+if [ x$1 = xnet ]; then
+ root=net
+ kernel=net
+fi
+
+addpart /dev/nor0 $mtdparts
+
+if [ $root = flash ]; then
+ bootargs="$bootargs root=$rootpart rootfstype=jffs2"
+else
+ if [ x$ip = xdhcp ]; then
+ bootargs="$bootargs ip=dhcp"
+ else
+ bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::"
+ fi
+ bootargs="$bootargs root=/dev/nfs nfsroot=$eth0.serverip:$nfsroot,v3,tcp"
+fi
+
+bootargs="$bootargs mtdparts=physmap-flash.0:$mtdparts"
+
+if [ $kernel = net ]; then
+ if [ x$ip = xdhcp ]; then
+ dhcp
+ fi
+ tftp $uimage uImage
+ bootm uImage
+else
+ bootm /dev/nor0.kernel
+fi
diff --git a/board/pcm038/env/bin/init b/board/pcm038/env/bin/init
new file mode 100644
index 0000000000..b8d8399842
--- /dev/null
+++ b/board/pcm038/env/bin/init
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+PATH=/env/bin
+export PATH
+
+. /env/config
+
+echo
+echo -n "Hit any key to stop autoboot: "
+timeout -a $autoboot_timeout
+if [ $? != 0 ]; then
+ echo
+ echo "type update_kernel [<imagename>] to update kernel into flash"
+ echo "type udate_root [<imagename>] to update rootfs into flash"
+ echo
+ exit
+fi
+
+boot \ No newline at end of file
diff --git a/board/pcm038/env/bin/update_kernel b/board/pcm038/env/bin/update_kernel
new file mode 100644
index 0000000000..1ad95fc5d6
--- /dev/null
+++ b/board/pcm038/env/bin/update_kernel
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. /env/config
+
+image=$uimage
+part=/dev/nor0.kernel
+
+. /env/bin/_update $1
diff --git a/board/pcm038/env/bin/update_root b/board/pcm038/env/bin/update_root
new file mode 100644
index 0000000000..b757a5b922
--- /dev/null
+++ b/board/pcm038/env/bin/update_root
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. /env/config
+
+image=$jffs2
+part=/dev/nor0.root
+
+. /env/bin/_update $1
diff --git a/board/pcm038/env/config b/board/pcm038/env/config
new file mode 100644
index 0000000000..0d68a5549b
--- /dev/null
+++ b/board/pcm038/env/config
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# can be either 'net' or 'flash'
+kernel=net
+root=net
+
+# use 'dhcp' todo dhcp in uboot and in kernel
+ip=dhcp
+
+eth0.ipaddr=192.168.23.164
+eth0.netmask=255.255.255.0
+eth0.gateway=192.168.23.2
+eth0.serverip=192.168.23.2
+eth0.ethaddr=00:50:c2:72:a7:4a
+
+uimage=uImage-pcm038
+jffs2=root-pcm038.jffs2
+
+autoboot_timeout=3
+
+nfsroot="/ptx/work/octopus/rsc/svn/oselas/bsp/phytec/phyCORE-i.MX27/OSELAS.BSP-Phytec-phyCORE-i.MX27-trunk/root"
+bootargs="console=ttymxc0,115200"
+
+mtdparts="128k(uboot)ro,128k(ubootenv),128k(alternate),1536k(kernel),-(root)"
+rootpart="/dev/mtdblock3" \ No newline at end of file