Discussion:
[uClinux-dev] RAM based filesystem in uclinux
Ashish Phogat
2013-03-22 13:28:18 UTC
Permalink
Hi folks,
I have some basic problem:

I have my uclinux currently running on Coldfire board from RAM. I have
romfs as my file system but that is read only file system.I donot enable
MTD support, blckmem is also disabled.

I enabled a RAM disk(CONFIG_BLK_DEV_RAM) and initrd(CONFIG_BLK_DEV_INITRD)
and choose rootfs as my filesystem.


Now I want to change my configuration so that I have a writable filesystem
in RAM.

I am confused with the configurations I need to set to choose a writable
file system for uclinux running from RAM.

What uclinux configuration I need to select to boot uclinux in RAM with
writeable filesystem?

I guess I donot need MTD because that is used for FLASH memory, Neither I
need blckmen that is also for FLASH memory. I need to just create a block
on RAM and just put a filesystem on that block.

Please correct me if I am wrong.

Please also proivde the reason which and why a particular configuration is
enabled. What role the config is playing in writeable filesystem?
Thanks a lot for replying
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20130322/c3795582/attachment.html>
Lennart Sorensen
2013-03-22 13:41:27 UTC
Permalink
Post by Ashish Phogat
Hi folks,
I have my uclinux currently running on Coldfire board from RAM. I have
romfs as my file system but that is read only file system.I donot enable
MTD support, blckmem is also disabled.
I enabled a RAM disk(CONFIG_BLK_DEV_RAM) and initrd(CONFIG_BLK_DEV_INITRD)
and choose rootfs as my filesystem.
Now I want to change my configuration so that I have a writable filesystem
in RAM.
I am confused with the configurations I need to set to choose a writable
file system for uclinux running from RAM.
What uclinux configuration I need to select to boot uclinux in RAM with
writeable filesystem?
I guess I donot need MTD because that is used for FLASH memory, Neither I
need blckmen that is also for FLASH memory. I need to just create a block
on RAM and just put a filesystem on that block.
Please correct me if I am wrong.
Please also proivde the reason which and why a particular configuration is
enabled. What role the config is playing in writeable filesystem?
Thanks a lot for replying
We use initramfs and a cpio archive joined with the kernel in a multipart
uImage. Works great. In the case of busybox and other multicall binaries,
using hardlinks uses vastly less ram than symlinks (each symlink uses
one page of ram to store the symlink file).

The fact we can recreate the cpio archive and update the uImage from
the kernel and cpio archive is great. No recompile crap to deal with
the way romfs and such have tended to need. For us building the kernel
and the filesystem are totally seperate issues.
--
Len Sorensen
Ashish Phogat
2013-03-22 14:06:03 UTC
Permalink
I am using Linux kernel version 2.4...Whether initramfs is available in
that kernel version 2.4 with cpio archieve.
DO I need to select initrd or ramdisk with initramfs?

I am sorry I am new to uclinux/linux. I am building myself in uclinux

Thanks
Ashish Phogat

On Fri, Mar 22, 2013 at 9:41 AM, Lennart Sorensen <
Post by Ashish Phogat
Post by Ashish Phogat
Hi folks,
I have my uclinux currently running on Coldfire board from RAM. I have
romfs as my file system but that is read only file system.I donot enable
MTD support, blckmem is also disabled.
I enabled a RAM disk(CONFIG_BLK_DEV_RAM) and
initrd(CONFIG_BLK_DEV_INITRD)
Post by Ashish Phogat
and choose rootfs as my filesystem.
Now I want to change my configuration so that I have a writable
filesystem
Post by Ashish Phogat
in RAM.
I am confused with the configurations I need to set to choose a writable
file system for uclinux running from RAM.
What uclinux configuration I need to select to boot uclinux in RAM with
writeable filesystem?
I guess I donot need MTD because that is used for FLASH memory, Neither I
need blckmen that is also for FLASH memory. I need to just create a block
on RAM and just put a filesystem on that block.
Please correct me if I am wrong.
Please also proivde the reason which and why a particular configuration
is
Post by Ashish Phogat
enabled. What role the config is playing in writeable filesystem?
Thanks a lot for replying
We use initramfs and a cpio archive joined with the kernel in a multipart
uImage. Works great. In the case of busybox and other multicall binaries,
using hardlinks uses vastly less ram than symlinks (each symlink uses
one page of ram to store the symlink file).
The fact we can recreate the cpio archive and update the uImage from
the kernel and cpio archive is great. No recompile crap to deal with
the way romfs and such have tended to need. For us building the kernel
and the filesystem are totally seperate issues.
--
Len Sorensen
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20130322/d26d6995/attachment.html>
Lennart Sorensen
2013-03-22 15:02:37 UTC
Permalink
Post by Ashish Phogat
I am using Linux kernel version 2.4...Whether initramfs is available in
that kernel version 2.4 with cpio archieve.
DO I need to select initrd or ramdisk with initramfs?
I am sorry I am new to uclinux/linux. I am building myself in uclinux
Oh we are using 2.6.29. I would not want to go back to 2.4.

I am not aware of any good options for 2.4 kernels, although given I
stopped bothering with 2.4 8 years ago I might just have forgotten.
--
Len Sorensen
Ashish Phogat
2013-03-22 20:47:24 UTC
Permalink
Anyone Else having Idea about my query related to RAM based filesystem.

On Fri, Mar 22, 2013 at 11:02 AM, Lennart Sorensen <
Post by Lennart Sorensen
Post by Ashish Phogat
I am using Linux kernel version 2.4...Whether initramfs is available in
that kernel version 2.4 with cpio archieve.
DO I need to select initrd or ramdisk with initramfs?
I am sorry I am new to uclinux/linux. I am building myself in uclinux
Oh we are using 2.6.29. I would not want to go back to 2.4.
I am not aware of any good options for 2.4 kernels, although given I
stopped bothering with 2.4 8 years ago I might just have forgotten.
--
Len Sorensen
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20130322/280c0557/attachment.html>
Greg Ungerer
2013-03-22 22:49:37 UTC
Permalink
Hi Lennart,
Post by Lennart Sorensen
The fact we can recreate the cpio archive and update the uImage from
the kernel and cpio archive is great. No recompile crap to deal with
the way romfs and such have tended to need. For us building the kernel
and the filesystem are totally seperate issues.
I don't follow you here. How does using a ROMfs mean that building
the kernel and filesystem are not separate?

Regards
Greg
Ashish Phogat
2013-03-23 23:14:54 UTC
Permalink
Hi,
Could someone provide me the mechanism/configuration to have a RAM based
filesystem which is writable? My kernel is 2.4.

Thanks for replying
Post by Greg Ungerer
Hi Lennart,
Post by Lennart Sorensen
The fact we can recreate the cpio archive and update the uImage from
the kernel and cpio archive is great. No recompile crap to deal with
the way romfs and such have tended to need. For us building the kernel
and the filesystem are totally seperate issues.
I don't follow you here. How does using a ROMfs mean that building
the kernel and filesystem are not separate?
Regards
Greg
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20130324/c1688e2e/attachment.html>
Steve deRosier
2013-03-24 02:25:00 UTC
Permalink
Ashish,

With respect, people here have already mentioned a couple of ways. The most
common for non-embedded systems is a initramfs or initrd via a cpio
archive. There's extensive documentation on this in
Documentation/initrd.txt.

Embedded systems typically _don't_ want a writable root filesystem. uClinux
is typically setup with a romfs, and then a writeable ramfs located at
/var. If you're looking for a space to write temporary files during
runtime, you'd probably want to do so there. Be aware of course that those
go away at reboot. And for that matter, typically the way the initramfs or
initrd work is you may be able to write to them, but on reboot any changes
aren't persisted anyway.

In my rc file:
/bin/expand /etc/ramfs.img /dev/ram1
mount -t ext2 /dev/ram1 /var

There's also tmpfs. You can set one of those up (exist in 2.4??) and mount
on some arbitrary mount point.

For writable and persisting, you're going to need to use a real filesystem
on some real media, either disk or flash. And if you don't need
persistance, then I don't see why directing your temp files to an already
writable space in /var or /tmp won't work.

As for the exact configuration settings and all that... well, you're on a
2.4 kernel and nearly no one is bothering with that kernel anymore. Heck,
I'm working on a 3.2 kernel and someone told me the other day that I'm way
out-of-date. Anyway, since you're on a 2.4 kernel, I certainly don't
remember the specific settings anymore, nor do I have one setup that way
lying around to check for you. You're going to do some looking and some
trial-and-error to figure out the correct settings. But I'd be shocked if
there isn't some legacy how-to out there. And
the aforementioned documentation should be sufficient.

If you don't have a very compelling reason to stay on a 2.4 kernel you
might want to consider upgrading. Especially if you're starting a new
project.

I hope that helps,
- Steve
Post by Ashish Phogat
Hi,
Could someone provide me the mechanism/configuration to have a RAM based
filesystem which is writable? My kernel is 2.4.
Thanks for replying
Post by Greg Ungerer
Hi Lennart,
Post by Lennart Sorensen
The fact we can recreate the cpio archive and update the uImage from
the kernel and cpio archive is great. No recompile crap to deal with
the way romfs and such have tended to need. For us building the kernel
and the filesystem are totally seperate issues.
I don't follow you here. How does using a ROMfs mean that building
the kernel and filesystem are not separate?
Regards
Greg
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20130323/54be2807/attachment.html>
Ashish Phogat
2013-03-24 03:30:08 UTC
Permalink
Thanks that helps a lot..Thanks again..
Post by Steve deRosier
Ashish,
With respect, people here have already mentioned a couple of ways. The
most common for non-embedded systems is a initramfs or initrd via a cpio
archive. There's extensive documentation on this in
Documentation/initrd.txt.
Embedded systems typically _don't_ want a writable root filesystem.
uClinux is typically setup with a romfs, and then a writeable ramfs located
at /var. If you're looking for a space to write temporary files during
runtime, you'd probably want to do so there. Be aware of course that those
go away at reboot. And for that matter, typically the way the initramfs or
initrd work is you may be able to write to them, but on reboot any changes
aren't persisted anyway.
/bin/expand /etc/ramfs.img /dev/ram1
mount -t ext2 /dev/ram1 /var
There's also tmpfs. You can set one of those up (exist in 2.4??) and mount
on some arbitrary mount point.
For writable and persisting, you're going to need to use a real filesystem
on some real media, either disk or flash. And if you don't need
persistance, then I don't see why directing your temp files to an already
writable space in /var or /tmp won't work.
As for the exact configuration settings and all that... well, you're on a
2.4 kernel and nearly no one is bothering with that kernel anymore. Heck,
I'm working on a 3.2 kernel and someone told me the other day that I'm way
out-of-date. Anyway, since you're on a 2.4 kernel, I certainly don't
remember the specific settings anymore, nor do I have one setup that way
lying around to check for you. You're going to do some looking and some
trial-and-error to figure out the correct settings. But I'd be shocked if
there isn't some legacy how-to out there. And
the aforementioned documentation should be sufficient.
If you don't have a very compelling reason to stay on a 2.4 kernel you
might want to consider upgrading. Especially if you're starting a new
project.
I hope that helps,
- Steve
Post by Ashish Phogat
Hi,
Could someone provide me the mechanism/configuration to have a RAM based
filesystem which is writable? My kernel is 2.4.
Thanks for replying
On Sat, Mar 23, 2013 at 4:19 AM, Greg Ungerer <gregungerer at westnet.com.au
Post by Greg Ungerer
Hi Lennart,
Post by Lennart Sorensen
The fact we can recreate the cpio archive and update the uImage from
the kernel and cpio archive is great. No recompile crap to deal with
the way romfs and such have tended to need. For us building the kernel
and the filesystem are totally seperate issues.
I don't follow you here. How does using a ROMfs mean that building
the kernel and filesystem are not separate?
Regards
Greg
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20130324/0f89bf1c/attachment.html>
Lennart Sorensen
2013-03-25 16:14:06 UTC
Permalink
Post by Greg Ungerer
Hi Lennart,
Post by Lennart Sorensen
The fact we can recreate the cpio archive and update the uImage from
the kernel and cpio archive is great. No recompile crap to deal with
the way romfs and such have tended to need. For us building the kernel
and the filesystem are totally seperate issues.
I don't follow you here. How does using a ROMfs mean that building
the kernel and filesystem are not separate?
Well the way I saw it done when I looked at romfs, was that it was part
of the kernel image so you had to do the linking with the romfs files
in place to get the kernel image.

Can you replace the romfs without using the kernel source tree, with
just a vmlinux (or equivelant) file around?
--
Len Sorensen
Ashish Phogat
2013-03-25 21:47:50 UTC
Permalink
hey Thanks Greg,
I succeded in doing that. Thank you for your Superb help. Thank you very
much again.

Thanks
Ashish phogat

On Mon, Mar 25, 2013 at 12:14 PM, Lennart Sorensen <
Post by Lennart Sorensen
Post by Greg Ungerer
Hi Lennart,
Post by Lennart Sorensen
The fact we can recreate the cpio archive and update the uImage from
the kernel and cpio archive is great. No recompile crap to deal with
the way romfs and such have tended to need. For us building the kernel
and the filesystem are totally seperate issues.
I don't follow you here. How does using a ROMfs mean that building
the kernel and filesystem are not separate?
Well the way I saw it done when I looked at romfs, was that it was part
of the kernel image so you had to do the linking with the romfs files
in place to get the kernel image.
Can you replace the romfs without using the kernel source tree, with
just a vmlinux (or equivelant) file around?
--
Len Sorensen
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20130325/29760c49/attachment.html>
Greg Ungerer
2013-03-26 01:45:57 UTC
Permalink
Post by Lennart Sorensen
Post by Greg Ungerer
Hi Lennart,
Post by Lennart Sorensen
The fact we can recreate the cpio archive and update the uImage from
the kernel and cpio archive is great. No recompile crap to deal with
the way romfs and such have tended to need. For us building the kernel
and the filesystem are totally seperate issues.
I don't follow you here. How does using a ROMfs mean that building
the kernel and filesystem are not separate?
Well the way I saw it done when I looked at romfs, was that it was part
of the kernel image so you had to do the linking with the romfs files
in place to get the kernel image.
Can you replace the romfs without using the kernel source tree, with
just a vmlinux (or equivelant) file around?
Yes. On many occasions I have mixed various kernel binary and romfs
images when testing regressions. It's so easy the way we do this on
ColdFire, I just "cat" them together.

Regards
Greg
Lennart Sorensen
2013-03-26 14:08:10 UTC
Permalink
Post by Greg Ungerer
Yes. On many occasions I have mixed various kernel binary and romfs
images when testing regressions. It's so easy the way we do this on
ColdFire, I just "cat" them together.
Well that does sound pretty easy. The kernel config for romfs made it
sound a lot more complicated than that.

I will stick with initramfs though since it works nicely, and having
r/w access is sometimes useful when debuging things. initramfs does
seem to lack execute in place which I highly suspect works on romfs,
even though there doesn't appear to be any reason it shouldn't work
for initramfs.
--
Len Sorensen
Greg Ungerer
2013-03-25 07:07:40 UTC
Permalink
Hi Ashish,
Post by Ashish Phogat
Hi folks,
I have my uclinux currently running on Coldfire board from RAM. I have romfs as my file system but that is read only file system.I donot enable MTD support, blckmem is also disabled.
I enabled a RAM disk(CONFIG_BLK_DEV_RAM) and initrd(CONFIG_BLK_DEV_INITRD) and choose rootfs as my filesystem.
Now I want to change my configuration so that I have a writable filesystem in RAM.
I am confused with the configurations I need to set to choose a writable file system for uclinux running from RAM.
What uclinux configuration I need to select to boot uclinux in RAM with writeable filesystem?
I guess I donot need MTD because that is used for FLASH memory, Neither I need blckmen that is also for FLASH memory. I need to just create a block on RAM and just put a filesystem on that block.
Please correct me if I am wrong.
Please also proivde the reason which and why a particular configuration is enabled. What role the config is playing in writeable filesystem?
I have done this in the past, using a RAM disk as the root on a
ColdFire board. But it has been quite a few years since I last
did it.

All you should need in the kernel is:

CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=4192
CONFIG_BLK_DEV_INITRD=y

Adjust the CONFIG_BLK_DEV_RAM_SIZE to something that makes sense
for you. And you need to enable the filesystem type of course too.
So if you are using an ext2 then enable CONFIG_EXT2_FS.

You do not require MTD or blkmem drivers in the kernel, do not
enable them.

The next thing you need to do create your base root filesystem.
If using EXT2 for example you will use the genext2fs tool.
There is plenty of examples in the uClinux-dist if you grep
for it.

After all this you need to modify your boot args to pass in
the address of the rootfs image in RAM too. From memory you
want something like:

initrd=0x400000,4M root=/dev/ram0

Regards
Greg
Loading...