The
pramfs
file system supports persistent memory devices such as
SRAM. Instead of having a block emulation layer over such a
memory area and using a normal file system on top of that,
pramfs
seeks to induce minimal overhead in this situation. Most
important in this respect is that the normal block layer caching of
the Linux kernel is circumvented in
pramfs
.
The most important parameters for normal usage are
-
physaddr
: The physical address of the static memory.
-
init
: When given, it will initialize the file system to that size.
We will show a sample usage of
pramfs
in this section using normal
DRAM on a board with at least 256MB of memory. For
pramfs
we reserve the upper
32MB by appending
mem=224M
to the kernel command line.
First off we generate some testdata on a persistent file system (
/tmp
) to demonstrate
that
pramfs
survives a reboot (of course with power always applied to keep the DRAM refreshed):
bash-3.00# dd if=/dev/urandom bs=1M count=8 of=/tmp/testdata
8+0 records in
8+0 records out
bash-3.00#
Next we mount the 32MB that we reserved and initialize it to be 32MB in size and
copy the testfile. A final compare shows that the copy was indeed successful so we
can reboot:
bash-3.00# mount -t pramfs -o physaddr=0xe000000,init=0x2000000 none /mnt
bash-3.00# cp /tmp/testdata /mnt
bash-3.00# cmp /tmp/testdata /mnt/testdata
bash-3.00# reboot
Having rebooted (using
mem=224M
on the kernel command line again of course)
we mount the file system but this time without the
init
parameter
because it is preinitialized. We then check the contents again:
bash-3.00# mount -t pramfs -o physaddr=0xe000000 none /mnt
bash-3.00# ls /mnt
testdata
bash-3.00# cmp /tmp/testdata /mnt/testdata
bash-3.00#