diff options
author | Richard Purdie <richard@openedhand.com> | 2006-07-21 10:10:31 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-07-21 10:10:31 +0000 |
commit | b2f192faabe412adce79534e22efe9fb69ee40e2 (patch) | |
tree | 7076c49d4286f8a1733650bd8fbc7161af200d57 /meta/packages/initscripts/initscripts-1.0/ramdisk | |
parent | 2cf0eadf9f730027833af802d7e6c90b44248f80 (diff) | |
download | poky-b2f192faabe412adce79534e22efe9fb69ee40e2.tar.gz |
Rename /openembedded/ -> /meta/
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@530 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/initscripts/initscripts-1.0/ramdisk')
-rwxr-xr-x | meta/packages/initscripts/initscripts-1.0/ramdisk | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/meta/packages/initscripts/initscripts-1.0/ramdisk b/meta/packages/initscripts/initscripts-1.0/ramdisk new file mode 100755 index 0000000000..03ac9bd05b --- /dev/null +++ b/meta/packages/initscripts/initscripts-1.0/ramdisk | |||
@@ -0,0 +1,46 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | . /etc/default/rcS | ||
4 | |||
5 | FSTYPE=ext2 | ||
6 | |||
7 | if test ! -e /proc/mtd | ||
8 | then | ||
9 | test "$VERBOSE" != "no" && echo >&2 "/proc not mounted, or mtd support not enabled in kernel." | ||
10 | exit | ||
11 | fi | ||
12 | |||
13 | RAM_MTD_NO=`cat /proc/mtd | grep mtdram | tail -n 1 | cut -d: -f1 | cut -dd -f2` | ||
14 | if test -z "$RAM_MTD_NO"; then exit 0; fi | ||
15 | |||
16 | if test -e /dev/mtdblock/0 | ||
17 | then | ||
18 | RAM_MTD=/dev/mtd/$RAM_MTD_NO | ||
19 | RAM_MTDBLK=/dev/mtdblock/$RAM_MTD_NO | ||
20 | else | ||
21 | RAM_MTD=/dev/mtd$RAM_MTD_NO | ||
22 | RAM_MTDBLK=/dev/mtdblock$RAM_MTD_NO | ||
23 | fi | ||
24 | |||
25 | RAM_MNTPT=/mnt/ram | ||
26 | RAM_MTD_SIZE_HEX=`cat /proc/mtd | grep mtdram | tail -n 1 | cut -d" " -f 2` | ||
27 | RAM_MTD_SIZE=`dc 0x$RAM_MTD_SIZE_HEX 1024 / p` | ||
28 | test -e /etc/ramdisk.conf && OLD_MTD_SIZE=`cat /etc/ramdisk.conf` | ||
29 | echo $RAM_MTD_SIZE > /etc/ramdisk.conf | ||
30 | |||
31 | if test ! -d "$RAM_MNTPT"; then echo >&2 "Mountpoint $RAM_MNTPT does not exist!"; exit 0; fi | ||
32 | |||
33 | if (test ! -e /etc/.configured) || test "$OLD_MTD_SIZE" != "$RAM_MTD_SIZE"; then | ||
34 | test "$VERBOSE" != "no" && echo -n "Wiping ramdisk: " | ||
35 | dd if=/dev/zero bs=1024 count=$RAM_MTD_SIZE of=$RAM_MTD 2>/dev/null >&2 || exit 1 | ||
36 | test "$VERBOSE" != "no" && echo "$RAM_MTD"; | ||
37 | test "$VERBOSE" != "no" && echo -n "Creating filesystem on ramdisk: " | ||
38 | mkfs.$FSTYPE $RAM_MTDBLK 2>/dev/null >&2 || exit 1 | ||
39 | test "$VERBOSE" != "no" && echo "$RAM_MTDBLK"; | ||
40 | fi | ||
41 | |||
42 | test "$VERBOSE" != "no" && echo -n "Mounting ramdisk: " | ||
43 | mount -t $FSTYPE $RAM_MTDBLK $RAM_MNTPT 2>/dev/null >&2 || exit 1 | ||
44 | test "$VERBOSE" != "no" && echo "$RAM_MTDBLK"; | ||
45 | |||
46 | exit 0 | ||