summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base-files/base-files/collie/fstab4
-rw-r--r--initscripts/initscripts-1.0/ramdisk44
-rw-r--r--initscripts/initscripts_1.0.oe6
3 files changed, 51 insertions, 3 deletions
diff --git a/base-files/base-files/collie/fstab b/base-files/base-files/collie/fstab
index 65fd48755c..96eba78873 100644
--- a/base-files/base-files/collie/fstab
+++ b/base-files/base-files/collie/fstab
@@ -3,4 +3,6 @@ proc /proc proc defaults 0 0
/dev/hda1 /mnt/cf auto defaults,sync,noauto,noatime,user,exec,suid 0 0
/dev/mmcda1 /mnt/card auto defaults,sync,noauto,noatime,user,exec,suid 0 0
tmpfs /var tmpfs defaults 0 0
-tmpfs /mnt/ram tmpfs defaults 0 0
+
+# we use a non-volatile ramdisk, see /etc/init.d/ramdisk
+#tmpfs /mnt/ram tmpfs defaults 0 0
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
diff --git a/initscripts/initscripts_1.0.oe b/initscripts/initscripts_1.0.oe
index 153822ef7c..8e64426eb3 100644
--- a/initscripts/initscripts_1.0.oe
+++ b/initscripts/initscripts_1.0.oe
@@ -4,7 +4,7 @@ SECTION = "base"
PRIORITY = "required"
DEPENDS = "makedevs"
RDEPENDS = "makedevs"
-PR = "r4"
+PR = "r5"
SRC_URI = "file://halt \
file://ramdisk \
@@ -46,6 +46,7 @@ do_install () {
${D}/${sysconfdir}/rc5.d \
${D}/${sysconfdir}/rc6.d \
${D}/${sysconfdir}/default
+
install -m 0755 ${WORKDIR}/bootmisc.sh ${D}/etc/init.d
install -m 0755 ${WORKDIR}/checkroot.sh ${D}/etc/init.d
install -m 0755 ${WORKDIR}/finish ${D}/etc/init.d
@@ -53,6 +54,7 @@ do_install () {
install -m 0755 ${WORKDIR}/hostname.sh ${D}/etc/init.d
install -m 0755 ${WORKDIR}/mountall.sh ${D}/etc/init.d
install -m 0755 ${WORKDIR}/mountnfs.sh ${D}/etc/init.d
+ install -m 0755 ${WORKDIR}/ramdisk ${D}/etc/init.d
install -m 0755 ${WORKDIR}/reboot ${D}/etc/init.d
install -m 0755 ${WORKDIR}/rmnologin ${D}/etc/init.d
install -m 0755 ${WORKDIR}/sendsigs ${D}/etc/init.d
@@ -80,6 +82,7 @@ do_install () {
ln -sf ../init.d/urandom ${D}/etc/rc6.d/S30urandom
ln -sf ../init.d/umountnfs.sh ${D}/etc/rc6.d/S31umountnfs.sh
# ln -sf ../init.d/umountfs ${D}/etc/rc6.d/S40umountfs
+ ln -sf ../init.d/ramdisk ${D}/etc/rcS.d/S30ramdisk
ln -sf ../init.d/reboot ${D}/etc/rc6.d/S90reboot
ln -sf ../init.d/sendsigs ${D}/etc/rc0.d/S20sendsigs
ln -sf ../init.d/urandom ${D}/etc/rc0.d/S30urandom
@@ -99,7 +102,6 @@ do_install () {
ln -sf ../init.d/devices ${D}/etc/rcS.d/S01devices
ln -sf ../init.d/sysfs.sh ${D}/etc/rcS.d/S36sysfs
ln -sf ../init.d/devpts.sh ${D}/etc/rcS.d/S31devpts.sh
-# ln -sf ../init.d/ramdisk ${D}/etc/rcS.d/S30ramdisk
install -m 0755 ${WORKDIR}/device_table.txt ${D}/etc/device_table
}