summaryrefslogtreecommitdiff
path: root/initscripts/initscripts-1.0/ramdisk
diff options
context:
space:
mode:
authorMichael Lauer <mickey@vanille-media.de>2004-08-18 18:05:36 +0000
committerMichael Lauer <mickey@vanille-media.de>2004-08-18 18:05:36 +0000
commitde483831517a3d2519ddceee88677fbca76c3e23 (patch)
tree9a2db284fca3663dee550af86e5d543a89194151 /initscripts/initscripts-1.0/ramdisk
parentdce609a8dcabdd0a7e9cc7036ad265b8ba986002 (diff)
Merge bk://openembedded@openembedded.bkbits.net/packages
into r2d2.tm.informatik.uni-frankfurt.de:/local/pkg/oe/packages 2004/08/18 20:05:27+02:00 uni-frankfurt.de!mickey fix ramdisk script in initscripts and use mtdblock as non-volatile ramdisk for collie. what about h3600? BKrev: 41239a70ra_rEsVjg3iw8GOxEMT0Vw
Diffstat (limited to 'initscripts/initscripts-1.0/ramdisk')
-rw-r--r--initscripts/initscripts-1.0/ramdisk44
1 files changed, 44 insertions, 0 deletions
diff --git a/initscripts/initscripts-1.0/ramdisk b/initscripts/initscripts-1.0/ramdisk
index e69de29bb2..b1bc8d6992 100644
--- a/initscripts/initscripts-1.0/ramdisk
+++ b/initscripts/initscripts-1.0/ramdisk
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+. /etc/default/rcS
+
+if test ! -e /proc/mtd
+then
+ test "$VERBOSE" != "no" && echo >&2 "/proc not mounted, or mtd support not enabled in kernel."
+ exit
+fi
+
+RAM_MTD_NO=`cat /proc/mtd | grep mtdram | tail -n 1 | cut -d: -f1 | cut -dd -f2`
+if test -z "$RAM_MTD_NO"; then exit 0; fi
+
+if test -e /dev/mtdblock/0
+then
+ RAM_MTD=/dev/mtd/$RAM_MTD_NO
+ RAM_MTDBLK=/dev/mtdblock/$RAM_MTD_NO
+else
+ RAM_MTD=/dev/mtd$RAM_MTD_NO
+ RAM_MTDBLK=/dev/mtdblock$RAM_MTD_NO
+fi
+
+RAM_MNTPT=/mnt/ram
+RAM_MTD_SIZE_HEX=`cat /proc/mtd | grep mtdram | tail -n 1 | cut -d" " -f 2`
+RAM_MTD_SIZE=`dc 0x$RAM_MTD_SIZE_HEX 1024 / p`
+OLD_MTD_SIZE=`cat /etc/ramdisk.conf`
+echo $RAM_MTD_SIZE > /etc/ramdisk.conf
+
+if test ! -d "$RAM_MNTPT"; then echo >&2 "Mountpoint $RAM_MNTPT does not exist!"; exit 0; fi
+
+if (test ! -e /etc/.configured) || test "$OLD_MTD_SIZE" != "$RAM_MTD_SIZE"; then
+ test "$VERBOSE" != "no" && echo -n "Wiping ramdisk: "
+ dd if=/dev/zero bs=1024 count=$RAM_MTD_SIZE of=$RAM_MTD 2>/dev/null >&2 || exit 1
+ test "$VERBOSE" != "no" && echo "$RAM_MTD";
+ test "$VERBOSE" != "no" && echo -n "Creating filesystem on ramdisk: "
+ mkfs.ext2 $RAM_MTDBLK 2>/dev/null >&2 || exit 1
+ test "$VERBOSE" != "no" && echo "$RAM_MTDBLK";
+fi
+
+test "$VERBOSE" != "no" && echo -n "Mounting ramdisk: "
+mount $RAM_MTDBLK $RAM_MNTPT 2>/dev/null >&2 || exit 1
+test "$VERBOSE" != "no" && echo "$RAM_MTDBLK";
+
+exit 0