Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-25 Thread Johnny Hung
2010/1/25 Chris Simmonds :
> Johnny Hung wrote:
>>
>> 2010/1/22 Marco Stornelli :
>>>
>>> 2010/1/22 Johnny Hung :

 2010/1/20 Marco Stornelli :
>
> 2010/1/20 Johnny Hung :
>>
>> 2010/1/19 Matthias Kaehlcke :
>>>
>>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>>
>> I consider to use ramdisk as rootfs because worry about wrong
>> operation in rootfs (is use jffs2 rootfs) and it will cause system
>> boot up failed.
>> Another query, does the syslogd/klogd log files also store in jffs2
>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>
>> BRs, H. Johnny
>>>
>>> --

 It seems there are a lot of file-systems I have to study :P. The same
 question is
 how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd
 part when
 system boot up?

>> Yes, I know. So if I want set etc directoyr to /dev/mtd5 not in rootfs
>> /, I need to add "/dev/mtdblock5  /etc        jffs2   defaults
>> 0       0" in /etc/fstab file but rootfs doesn't contain /etc
>> directory because /etc directoyr is store in /dev/mtdblock5.
>> Do you know what I mean? The kernel execute /sbin/init after mount
>> rootfs and /sbin/init is link to busybox, busybox will read
>> /etc/inittab file to initial. The problem is coming, how busybox to
>> read /etc in rootfs before mount /dev/mtdblock5 to /etc? There is no
>> program to mount /dev/mtdblock5 to /etc before busybox init execute.
>>
>> I think I must mistake some concept, please give me a hint.
>> Thank you
>> BRs, H. Johnny
>>
>

I got it. The rootfs contains at least /etc directory, /etc/inittab,
/etc/fstab. Bysybox will read /etc/fstab to mount etc to rootfs's etc
from other partition. Okay, it's reasonable. Another query, how to do
it in many Linux dist as Macro mentioned, use initramfs ? I am sure I
can arrange / to /dev/hda1 and /etc to /dev/hda2.

Thank you so much
BRs, H. Johnny

> You have two /etc directories: one in the the read-only root file system and
> one in the jffs2 fs. In the root fs you have /etc/fstab, /etc/inittab and
> any scripts it may call. The init program will mount /dev/mtdblock5 over the
> top of the /etc that is in the rootfs, so giving you the read/write version
> of /etc. Any files open in the old /etc - e.g. /etc/inittab - will continue
> to be open, but any new files opened in /etc will use the read/write version
> in jffs2. You can also do some interesting things with symbolic links...
> This technique works. I have used it in several projects.
>
> --
> Chris Simmonds                   2net Limited
> ch...@2net.co.uk                 http://www.2net.co.uk/
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-25 Thread Chris Simmonds

Johnny Hung wrote:

2010/1/22 Marco Stornelli :

2010/1/22 Johnny Hung :

2010/1/20 Marco Stornelli :

2010/1/20 Johnny Hung :

2010/1/19 Matthias Kaehlcke :

El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:


I consider to use ramdisk as rootfs because worry about wrong
operation in rootfs (is use jffs2 rootfs) and it will cause system
boot up failed.
Another query, does the syslogd/klogd log files also store in jffs2
rootfs? Write to jffs2 frequently will reduce flash life cycle.

BRs, H. Johnny

--

It seems there are a lot of file-systems I have to study :P. The same
question is
how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd part when
system boot up?


Yes, I know. So if I want set etc directoyr to /dev/mtd5 not in rootfs
/, I need to add "/dev/mtdblock5  /etcjffs2   defaults
0   0" in /etc/fstab file but rootfs doesn't contain /etc
directory because /etc directoyr is store in /dev/mtdblock5.
Do you know what I mean? The kernel execute /sbin/init after mount
rootfs and /sbin/init is link to busybox, busybox will read
/etc/inittab file to initial. The problem is coming, how busybox to
read /etc in rootfs before mount /dev/mtdblock5 to /etc? There is no
program to mount /dev/mtdblock5 to /etc before busybox init execute.

I think I must mistake some concept, please give me a hint.
Thank you
BRs, H. Johnny



You have two /etc directories: one in the the read-only root file system 
and one in the jffs2 fs. In the root fs you have /etc/fstab, 
/etc/inittab and any scripts it may call. The init program will mount 
/dev/mtdblock5 over the top of the /etc that is in the rootfs, so giving 
you the read/write version of /etc. Any files open in the old /etc - 
e.g. /etc/inittab - will continue to be open, but any new files opened 
in /etc will use the read/write version in jffs2. You can also do some 
interesting things with symbolic links... This technique works. I have 
used it in several projects.


--
Chris Simmonds   2net Limited
ch...@2net.co.uk http://www.2net.co.uk/

--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-24 Thread Johnny Hung
2010/1/22 Marco Stornelli :
> 2010/1/22 Johnny Hung :
>> 2010/1/20 Marco Stornelli :
>>> 2010/1/20 Johnny Hung :
 2010/1/19 Matthias Kaehlcke :
> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>
 I consider to use ramdisk as rootfs because worry about wrong
 operation in rootfs (is use jffs2 rootfs) and it will cause system
 boot up failed.
 Another query, does the syslogd/klogd log files also store in jffs2
 rootfs? Write to jffs2 frequently will reduce flash life cycle.

 BRs, H. Johnny
>
> --
>>>
>>
>> It seems there are a lot of file-systems I have to study :P. The same
>> question is
>> how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd part 
>> when
>> system boot up?
>>
>
Yes, I know. So if I want set etc directoyr to /dev/mtd5 not in rootfs
/, I need to add "/dev/mtdblock5  /etcjffs2   defaults
0   0" in /etc/fstab file but rootfs doesn't contain /etc
directory because /etc directoyr is store in /dev/mtdblock5.
Do you know what I mean? The kernel execute /sbin/init after mount
rootfs and /sbin/init is link to busybox, busybox will read
/etc/inittab file to initial. The problem is coming, how busybox to
read /etc in rootfs before mount /dev/mtdblock5 to /etc? There is no
program to mount /dev/mtdblock5 to /etc before busybox init execute.

I think I must mistake some concept, please give me a hint.
Thank you
BRs, H. Johnny

> Simply, you can mount each mount point with the fstab file and a
> script, same approach of every linux distribution, nothing more. Even
> in the pc world you can mount your /home on a partition with ext3,
> /var in a partition with ext4, and so on. A very simple approach to
> setup the system, it is to start with NFS for example with "whole" fs,
> copy what you need in the right place, setup the start-up script and
> reboot.
>
> Marco
>
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-22 Thread Marco Stornelli
2010/1/22 Johnny Hung :
> 2010/1/20 Marco Stornelli :
>> 2010/1/20 Johnny Hung :
>>> 2010/1/19 Matthias Kaehlcke :
 El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:

>>> I consider to use ramdisk as rootfs because worry about wrong
>>> operation in rootfs (is use jffs2 rootfs) and it will cause system
>>> boot up failed.
>>> Another query, does the syslogd/klogd log files also store in jffs2
>>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>>
>>> BRs, H. Johnny

 --
>>
>
> It seems there are a lot of file-systems I have to study :P. The same
> question is
> how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd part 
> when
> system boot up?
>

Simply, you can mount each mount point with the fstab file and a
script, same approach of every linux distribution, nothing more. Even
in the pc world you can mount your /home on a partition with ext3,
/var in a partition with ext4, and so on. A very simple approach to
setup the system, it is to start with NFS for example with "whole" fs,
copy what you need in the right place, setup the start-up script and
reboot.

Marco
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-21 Thread Johnny Hung
2010/1/20 Marco Stornelli :
> 2010/1/20 Johnny Hung :
>> 2010/1/19 Matthias Kaehlcke :
>>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>>
>> I consider to use ramdisk as rootfs because worry about wrong
>> operation in rootfs (is use jffs2 rootfs) and it will cause system
>> boot up failed.
>> Another query, does the syslogd/klogd log files also store in jffs2
>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>>
>> BRs, H. Johnny
>>>
>>> --
>

It seems there are a lot of file-systems I have to study :P. The same
question is
how to split my rootfs? Re-mount /etc, /var to another file-sysyem mtd part when
system boot up?

Thank your good advice.
BRs, H. Johnny
> In general a good splitting for rootfs could be: squashfs for rootfs,
> tmpfs for volatile data (/tmp), ubifs (with a flash partition) for
> "strong" permanent data (/etc, ) and pramfs for "light" permanent
> data (/var/log, .).
> I think you should "split" your rootfs. Ramdisk is an old approach
> with some drawbacks.
>
> Marco
>
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-21 Thread Johnny Hung
2010/1/20 Ricard Wanderlof :
>
> On Wed, 20 Jan 2010, Johnny Hung wrote:
>
>>> i'd also recommend you to consider if you really need the
>>> ramdisk. when using a ram disk its entire content is loaded to the RAM
>>> occupying space, even if you don't use certain files (or part of
>>> them). other filesystems are more efficient in this aspect.
>>> if the main purpose is to have a read only rootfs, i'd suggest a look
>>> at squashfs.
>>
>> I consider to use ramdisk as rootfs because worry about wrong
>> operation in rootfs (is use jffs2 rootfs) and it will cause system
>> boot up failed.
>
> You have a point, however, you could do two things to help:
>
> a) Mount the root file system as read-only. That way you can never write to
> it, unless you remount it read-write. But you can still reflash that
> partition if you need to upgrade.
>
> b) Register the mtd partition holding the root file system as read-only.
> This is even more seecure as remounting the file system won't permit writes.
> However, it also means you can't write to it for upgrading. (I
> don't think the mtd core permits changing an already registered mtd
> partition from readonly to writable, but I could be wrong.)
>
>> Another query, does the syslogd/klogd log files also store in jffs2
>> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>
> I think it is fairly common to have a combination of devices:
>
> / (root)        is a readonly flash device (mtd partition)
> /etc            is a writable flash device (mtd partition)
> /tmp and /var   are ramdisks (tmpfs), so they are writable, but lost when
>                power is cycled.

I think it's a good combination for my board. How do I sepcific the
/etc to another mtd part?
The busybox init will parse /etc/inittab after setup signal handler
and initializes console. I only
know to do it is to re-mount etc directory from another mtd to /etc.
Is it right?

Thank your help.
BRs, H. Johnny

>
> /Ricard
> --
> Ricard Wolf Wanderlöf                           ricardw(at)axis.com
> Axis Communications AB, Lund, Sweden            www.axis.com
> Phone +46 46 272 2016                           Fax +46 46 13 61 30
>
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-20 Thread Marco Stornelli
2010/1/20 Matthias Kaehlcke :
> El Wed, Jan 20, 2010 at 08:57:44AM +0100 Marco Stornelli ha dit:
>
>> 2010/1/20 Johnny Hung :
>> > 2010/1/19 Matthias Kaehlcke :
>> >> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>> >>
>> > I consider to use ramdisk as rootfs because worry about wrong
>> > operation in rootfs (is use jffs2 rootfs) and it will cause system
>> > boot up failed.
>> > Another query, does the syslogd/klogd log files also store in jffs2
>> > rootfs? Write to jffs2 frequently will reduce flash life cycle.
>> >
>> > BRs, H. Johnny
>> >>
>> >> --
>>
>> In general a good splitting for rootfs could be: squashfs for rootfs,
>> tmpfs for volatile data (/tmp), ubifs (with a flash partition) for
>> "strong" permanent data (/etc, ) and pramfs for "light" permanent
>> data (/var/log, .).
>
> if ubifs is a good choice depends on the size of the partition, iirc
> it has a significant overhead for very small partitions.
>
> once using ubi it could be interesting to set up the read-only rootfs
> partition upon ubi in order to spread the wear out over a maximum of blocks.
>

I don't know the size constraints of Johnny, so it can be useful to use jffs2.

Marco
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-20 Thread Matthias Kaehlcke
El Wed, Jan 20, 2010 at 08:57:44AM +0100 Marco Stornelli ha dit:

> 2010/1/20 Johnny Hung :
> > 2010/1/19 Matthias Kaehlcke :
> >> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
> >>
> > I consider to use ramdisk as rootfs because worry about wrong
> > operation in rootfs (is use jffs2 rootfs) and it will cause system
> > boot up failed.
> > Another query, does the syslogd/klogd log files also store in jffs2
> > rootfs? Write to jffs2 frequently will reduce flash life cycle.
> >
> > BRs, H. Johnny
> >>
> >> --
> 
> In general a good splitting for rootfs could be: squashfs for rootfs,
> tmpfs for volatile data (/tmp), ubifs (with a flash partition) for
> "strong" permanent data (/etc, ) and pramfs for "light" permanent
> data (/var/log, .).

if ubifs is a good choice depends on the size of the partition, iirc
it has a significant overhead for very small partitions.

once using ubi it could be interesting to set up the read-only rootfs
partition upon ubi in order to spread the wear out over a maximum of blocks.

-- 
Matthias Kaehlcke
Embedded Linux Developer
Barcelona

You can chain me, you can torture me, you can even
  destroy this body, but you will never imprison my mind
(Mahatma Gandhi)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Marco Stornelli
2010/1/20 Johnny Hung :
> 2010/1/19 Matthias Kaehlcke :
>> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>>
> I consider to use ramdisk as rootfs because worry about wrong
> operation in rootfs (is use jffs2 rootfs) and it will cause system
> boot up failed.
> Another query, does the syslogd/klogd log files also store in jffs2
> rootfs? Write to jffs2 frequently will reduce flash life cycle.
>
> BRs, H. Johnny
>>
>> --

In general a good splitting for rootfs could be: squashfs for rootfs,
tmpfs for volatile data (/tmp), ubifs (with a flash partition) for
"strong" permanent data (/etc, ) and pramfs for "light" permanent
data (/var/log, .).
I think you should "split" your rootfs. Ramdisk is an old approach
with some drawbacks.

Marco
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Matthias Kaehlcke
El Wed, Jan 20, 2010 at 08:15:01AM +0100 Ricard Wanderlof ha dit:

> On Wed, 20 Jan 2010, Johnny Hung wrote:
>
>>> i'd also recommend you to consider if you really need the
>>> ramdisk. when using a ram disk its entire content is loaded to the RAM
>>> occupying space, even if you don't use certain files (or part of
>>> them). other filesystems are more efficient in this aspect.
>>> if the main purpose is to have a read only rootfs, i'd suggest a look
>>> at squashfs.
>>
>> I consider to use ramdisk as rootfs because worry about wrong
>> operation in rootfs (is use jffs2 rootfs) and it will cause system
>> boot up failed.
>
> You have a point, however, you could do two things to help:
>
> a) Mount the root file system as read-only. That way you can never write  
> to it, unless you remount it read-write. But you can still reflash that  
> partition if you need to upgrade.
>
> b) Register the mtd partition holding the root file system as read-only.
> This is even more seecure as remounting the file system won't permit  
> writes. However, it also means you can't write to it for upgrading. (I
> don't think the mtd core permits changing an already registered mtd  
> partition from readonly to writable, but I could be wrong.)

AFAIK the mtd core doesn't permit changing a partition from ro to
rw. but if you happen to need to reflash the partition anyway, you can
load a tiny kernel modules that changes the flag indicating if a
partition is writable.

i once had to recurr to this solution and it works ;)

-- 
Matthias Kaehlcke
Embedded Linux Developer
Barcelona

Tant qu'il y aura sur terre des hommes pour qui existe un concept
d' 'honneur national', la menace d'une nouvelle guerre subsistera
  (B. Traven)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Matthias Kaehlcke
El Wed, Jan 20, 2010 at 10:32:15AM +0800 Johnny Hung ha dit:

> 2010/1/19 Matthias Kaehlcke :
> > El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
> >
> >> On Tue, 19 Jan 2010, Johnny Hung wrote:
> >>
> >>> Okay, I think the steps is below if my rootfs is ramdisk and configure
> >>> files in jffs2,
> >>>
> >>> 1. cp /etc/* /mnt/mtd/etc/    (/mnt/mtd is my jffs2 fs)
> >>> 2. rm -rf /etc/*
> >>> 3. make symbolic links from all /etc/xx to /mnt/mtd/etc/xxx
> >>> 4. remake ramdisk rootfs
> >>>
> >>> It seems all files in ramdisk rootfs /etc all links to /mnt/mtd/etc/
> >>> and try to modify these files is effective after reboot.
> >>> But is this a common way in embedded linux ?
> >>
> 
> Thanks, I understand.
> 
> >> In principle, but it is easier (and cleaner) to make a symbolic link from
> >> (say) /etc -> /mnt/mtd/etc without linking every individual file and
> >> directory.
> >
> > i totally agree with ricard when you want to move the entire directory
> > to jffs2 and not only some selected files
> >
> >> You could also use a jffs2 file system in flash for your rootfs, that way
> >> you wouldn't need a ramdisk at all.
> >
> > i'd also recommend you to consider if you really need the
> > ramdisk. when using a ram disk its entire content is loaded to the RAM
> > occupying space, even if you don't use certain files (or part of
> > them). other filesystems are more efficient in this aspect.
> > if the main purpose is to have a read only rootfs, i'd suggest a look
> > at squashfs.
> 
> I consider to use ramdisk as rootfs because worry about wrong
> operation in rootfs (is use jffs2 rootfs) and it will cause system
> boot up failed.

you could set up a rootfs partition with a read-only file system
(squashfs, jffs2 mounted ro) and a second partition that's writable.

> Another query, does the syslogd/klogd log files also store in jffs2
> rootfs? Write to jffs2 frequently will reduce flash life cycle.

by default the log files will be written to /var/log, if this
directory happens to be on a jffs2 partition writes will go there and
produce wear out. to avoid this you could set up a small tmpfs (in
RAM) and mount it on /var

-- 
Matthias Kaehlcke
Embedded Linux Developer
Barcelona

  We can't solve problems by using the same kind
 of thinking we used when we created them
 (Albert Einstein)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Ricard Wanderlof


On Wed, 20 Jan 2010, Johnny Hung wrote:


i'd also recommend you to consider if you really need the
ramdisk. when using a ram disk its entire content is loaded to the RAM
occupying space, even if you don't use certain files (or part of
them). other filesystems are more efficient in this aspect.
if the main purpose is to have a read only rootfs, i'd suggest a look
at squashfs.


I consider to use ramdisk as rootfs because worry about wrong
operation in rootfs (is use jffs2 rootfs) and it will cause system
boot up failed.


You have a point, however, you could do two things to help:

a) Mount the root file system as read-only. That way you can never write 
to it, unless you remount it read-write. But you can still reflash that 
partition if you need to upgrade.


b) Register the mtd partition holding the root file system as read-only.
This is even more seecure as remounting the file system won't permit 
writes. However, it also means you can't write to it for upgrading. (I
don't think the mtd core permits changing an already registered mtd 
partition from readonly to writable, but I could be wrong.)



Another query, does the syslogd/klogd log files also store in jffs2
rootfs? Write to jffs2 frequently will reduce flash life cycle.


I think it is fairly common to have a combination of devices:

/ (root)is a readonly flash device (mtd partition)
/etcis a writable flash device (mtd partition)
/tmp and /var   are ramdisks (tmpfs), so they are writable, but lost when
power is cycled.

/Ricard
--
Ricard Wolf Wanderlöf   ricardw(at)axis.com
Axis Communications AB, Lund, Swedenwww.axis.com
Phone +46 46 272 2016   Fax +46 46 13 61 30
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Johnny Hung
2010/1/19 Matthias Kaehlcke :
> El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:
>
>> On Tue, 19 Jan 2010, Johnny Hung wrote:
>>
>>> Okay, I think the steps is below if my rootfs is ramdisk and configure
>>> files in jffs2,
>>>
>>> 1. cp /etc/* /mnt/mtd/etc/    (/mnt/mtd is my jffs2 fs)
>>> 2. rm -rf /etc/*
>>> 3. make symbolic links from all /etc/xx to /mnt/mtd/etc/xxx
>>> 4. remake ramdisk rootfs
>>>
>>> It seems all files in ramdisk rootfs /etc all links to /mnt/mtd/etc/
>>> and try to modify these files is effective after reboot.
>>> But is this a common way in embedded linux ?
>>

Thanks, I understand.

>> In principle, but it is easier (and cleaner) to make a symbolic link from
>> (say) /etc -> /mnt/mtd/etc without linking every individual file and
>> directory.
>
> i totally agree with ricard when you want to move the entire directory
> to jffs2 and not only some selected files
>
>> You could also use a jffs2 file system in flash for your rootfs, that way
>> you wouldn't need a ramdisk at all.
>
> i'd also recommend you to consider if you really need the
> ramdisk. when using a ram disk its entire content is loaded to the RAM
> occupying space, even if you don't use certain files (or part of
> them). other filesystems are more efficient in this aspect.
> if the main purpose is to have a read only rootfs, i'd suggest a look
> at squashfs.

I consider to use ramdisk as rootfs because worry about wrong
operation in rootfs (is use jffs2 rootfs) and it will cause system
boot up failed.
Another query, does the syslogd/klogd log files also store in jffs2
rootfs? Write to jffs2 frequently will reduce flash life cycle.

BRs, H. Johnny
>
> --
> Matthias Kaehlcke
> Embedded Linux Developer
> Barcelona
>
>              La posibilidad de realizar un suenyo es lo
>                 que hace que la vida sea interesante
>                                                                 .''`.
>    using free software / Debian GNU/Linux | http://debian.org  : :'  :
>                                                                `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
>
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Matthias Kaehlcke
El Tue, Jan 19, 2010 at 02:17:22PM +0100 Ricard Wanderlof ha dit:

> On Tue, 19 Jan 2010, Johnny Hung wrote:
>
>> Okay, I think the steps is below if my rootfs is ramdisk and configure
>> files in jffs2,
>>
>> 1. cp /etc/* /mnt/mtd/etc/(/mnt/mtd is my jffs2 fs)
>> 2. rm -rf /etc/*
>> 3. make symbolic links from all /etc/xx to /mnt/mtd/etc/xxx
>> 4. remake ramdisk rootfs
>>
>> It seems all files in ramdisk rootfs /etc all links to /mnt/mtd/etc/
>> and try to modify these files is effective after reboot.
>> But is this a common way in embedded linux ?
>
> In principle, but it is easier (and cleaner) to make a symbolic link from 
> (say) /etc -> /mnt/mtd/etc without linking every individual file and  
> directory.

i totally agree with ricard when you want to move the entire directory
to jffs2 and not only some selected files

> You could also use a jffs2 file system in flash for your rootfs, that way 
> you wouldn't need a ramdisk at all.

i'd also recommend you to consider if you really need the
ramdisk. when using a ram disk its entire content is loaded to the RAM
occupying space, even if you don't use certain files (or part of
them). other filesystems are more efficient in this aspect.
if the main purpose is to have a read only rootfs, i'd suggest a look
at squashfs.

-- 
Matthias Kaehlcke
Embedded Linux Developer
Barcelona

  La posibilidad de realizar un suenyo es lo
 que hace que la vida sea interesante
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Ricard Wanderlof


On Tue, 19 Jan 2010, Johnny Hung wrote:


Okay, I think the steps is below if my rootfs is ramdisk and configure
files in jffs2,

1. cp /etc/* /mnt/mtd/etc/(/mnt/mtd is my jffs2 fs)
2. rm -rf /etc/*
3. make symbolic links from all /etc/xx to /mnt/mtd/etc/xxx
4. remake ramdisk rootfs

It seems all files in ramdisk rootfs /etc all links to /mnt/mtd/etc/
and try to modify these files is effective after reboot.
But is this a common way in embedded linux ?


In principle, but it is easier (and cleaner) to make a symbolic link from 
(say) /etc -> /mnt/mtd/etc without linking every individual file and 
directory.


You could also use a jffs2 file system in flash for your rootfs, that way 
you wouldn't need a ramdisk at all.


/Ricard
--
Ricard Wolf Wanderlöf   ricardw(at)axis.com
Axis Communications AB, Lund, Swedenwww.axis.com
Phone +46 46 272 2016   Fax +46 46 13 61 30
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Johnny Hung
2010/1/19 Matthias Kaehlcke :
> El Tue, Jan 19, 2010 at 06:13:07PM +0800 Johnny Hung ha dit:
>
>> 2010/1/19 Matthias Kaehlcke :
>> > El Tue, Jan 19, 2010 at 05:20:53PM +0800 Johnny Hung ha dit:
>> >
>> >> I have build an embedded Linux system and rootfs is a ramdisk. Ramdisk
>> >> rootfs resides in memory so modify files is non-effective after a
>> >> reboot. Some directories in rootfs, like /etc, /usr, ... are contain
>> >> many application configuration files and I want to mount it to jffs2
>> >> flash filesysyem so it will take effect after a reboot. Is it
>> >> possible?
>> >
>> How to do it? The ramdisk rootfs is ext2 filesystem and I try,
>> mount /mnt/mtd/etc /etc
>>
>> Try to modify /etc/ files is not works.
>
> ok, i understood you want to substitute the ramdisk rootfs by jffs2
> based one
>
> mounting the ramdisk as writable with the flash as backing storage
> isn't possible AFAIK. and even if it was possible it wouldn't be
> recommended as ext2 doesn't care about flash wear out, in consequence
> you would write the same blocks over and over again.
>
>> > yes, this is possible
>> >
>> >> I know the flash has write times limited so the log files
>> >> (syslogd/klogd) should not store in flash. In general, how to deploy
>> >> root file system for embedded linux with flash storage?
>> >
>> > - add jffs2 support to your kernel
>> > - create your image using mkfs.jffs2 from mtd-utils
>> > - flash the image
>> > - specify the rootfs partition and type in the bootargs of the kernel
>> The above procedure is to create a jffs2 rootfs image but I  prefer to
>> use ramdisk rootfs.
>> I think the rootfs is build as ramdisk and some configurable file is
>> store in jffs2 flash.
>

Okay, I think the steps is below if my rootfs is ramdisk and configure
files in jffs2,

1. cp /etc/* /mnt/mtd/etc/(/mnt/mtd is my jffs2 fs)
2. rm -rf /etc/*
3. make symbolic links from all /etc/xx to /mnt/mtd/etc/xxx
4. remake ramdisk rootfs

It seems all files in ramdisk rootfs /etc all links to /mnt/mtd/etc/
and try to modify these files is effective after reboot.
But is this a common way in embedded linux ?

I also have another idea, keep ramdisk rootfs /etc files and add a shell script.

1. The shell script execute when system boot up.
2. Check /mnt/mtd/etc/xxx if is exist. If yes, remove /etc/xxx file
and make a symbolic link to /mnt/mtd/etc/xxx. If no, keep /etc/xxx
file.
3. repeat 2 for all /etc files

Any suggestion?

Thank your help.
BRs, H. Johnny

> in this case follow the above steps, except the last one about the
> bootargs and mount the jffs2 partition from your init script. you
> could use symlinks from your ramdisk to the files on jffs2 to
> integrate them in your rootfs
>
> --
> Matthias Kaehlcke
> Embedded Linux Developer
> Barcelona
>
>      Anyone who has never made a mistake has never tried anything new
>                            (Albert Einstein)
>                                                                 .''`.
>    using free software / Debian GNU/Linux | http://debian.org  : :'  :
>                                                                `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
>
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Matthias Kaehlcke
El Tue, Jan 19, 2010 at 05:20:53PM +0800 Johnny Hung ha dit:

> I have build an embedded Linux system and rootfs is a ramdisk. Ramdisk
> rootfs resides in memory so modify files is non-effective after a
> reboot. Some directories in rootfs, like /etc, /usr, ... are contain
> many application configuration files and I want to mount it to jffs2
> flash filesysyem so it will take effect after a reboot. Is it
> possible?

yes, this is possible

> I know the flash has write times limited so the log files
> (syslogd/klogd) should not store in flash. In general, how to deploy
> root file system for embedded linux with flash storage?

- add jffs2 support to your kernel
- create your image using mkfs.jffs2 from mtd-utils
- flash the image
- specify the rootfs partition and type in the bootargs of the kernel

for further information i recommend the lecture of
http://free-electrons.com/doc/flash-filesystems.pdf

depending on your requirements/size of the rootfs partitions UBIFS
might be an option to consider

-- 
Matthias Kaehlcke
Embedded Linux Developer
Barcelona

  El trabajo es el refugio de los que no tienen nada que hacer
(Oscar Wilde)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Matthias Kaehlcke
El Tue, Jan 19, 2010 at 06:13:07PM +0800 Johnny Hung ha dit:

> 2010/1/19 Matthias Kaehlcke :
> > El Tue, Jan 19, 2010 at 05:20:53PM +0800 Johnny Hung ha dit:
> >
> >> I have build an embedded Linux system and rootfs is a ramdisk. Ramdisk
> >> rootfs resides in memory so modify files is non-effective after a
> >> reboot. Some directories in rootfs, like /etc, /usr, ... are contain
> >> many application configuration files and I want to mount it to jffs2
> >> flash filesysyem so it will take effect after a reboot. Is it
> >> possible?
> >
> How to do it? The ramdisk rootfs is ext2 filesystem and I try,
> mount /mnt/mtd/etc /etc
> 
> Try to modify /etc/ files is not works.

ok, i understood you want to substitute the ramdisk rootfs by jffs2
based one

mounting the ramdisk as writable with the flash as backing storage
isn't possible AFAIK. and even if it was possible it wouldn't be
recommended as ext2 doesn't care about flash wear out, in consequence
you would write the same blocks over and over again.

> > yes, this is possible
> >
> >> I know the flash has write times limited so the log files
> >> (syslogd/klogd) should not store in flash. In general, how to deploy
> >> root file system for embedded linux with flash storage?
> >
> > - add jffs2 support to your kernel
> > - create your image using mkfs.jffs2 from mtd-utils
> > - flash the image
> > - specify the rootfs partition and type in the bootargs of the kernel
> The above procedure is to create a jffs2 rootfs image but I  prefer to
> use ramdisk rootfs.
> I think the rootfs is build as ramdisk and some configurable file is
> store in jffs2 flash.

in this case follow the above steps, except the last one about the
bootargs and mount the jffs2 partition from your init script. you
could use symlinks from your ramdisk to the files on jffs2 to
integrate them in your rootfs

-- 
Matthias Kaehlcke
Embedded Linux Developer
Barcelona

  Anyone who has never made a mistake has never tried anything new
(Albert Einstein)
 .''`.
using free software / Debian GNU/Linux | http://debian.org  : :'  :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4  `-
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Johnny Hung
2010/1/19 Matthias Kaehlcke :
> El Tue, Jan 19, 2010 at 05:20:53PM +0800 Johnny Hung ha dit:
>
>> I have build an embedded Linux system and rootfs is a ramdisk. Ramdisk
>> rootfs resides in memory so modify files is non-effective after a
>> reboot. Some directories in rootfs, like /etc, /usr, ... are contain
>> many application configuration files and I want to mount it to jffs2
>> flash filesysyem so it will take effect after a reboot. Is it
>> possible?
>
How to do it? The ramdisk rootfs is ext2 filesystem and I try,
mount /mnt/mtd/etc /etc

Try to modify /etc/ files is not works.

> yes, this is possible
>
>> I know the flash has write times limited so the log files
>> (syslogd/klogd) should not store in flash. In general, how to deploy
>> root file system for embedded linux with flash storage?
>
> - add jffs2 support to your kernel
> - create your image using mkfs.jffs2 from mtd-utils
> - flash the image
> - specify the rootfs partition and type in the bootargs of the kernel
The above procedure is to create a jffs2 rootfs image but I  prefer to
use ramdisk rootfs.
I think the rootfs is build as ramdisk and some configurable file is
store in jffs2 flash.

Thank your reply.
BRs, H. Johnny

>
> for further information i recommend the lecture of
> http://free-electrons.com/doc/flash-filesystems.pdf
>
> depending on your requirements/size of the rootfs partitions UBIFS
> might be an option to consider
>
> --
> Matthias Kaehlcke
> Embedded Linux Developer
> Barcelona
>
>      El trabajo es el refugio de los que no tienen nada que hacer
>                            (Oscar Wilde)
>                                                                 .''`.
>    using free software / Debian GNU/Linux | http://debian.org  : :'  :
>                                                                `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-
>
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


mount ramdisk rootfs /etc directory to jffs2 filesystem.

2010-01-19 Thread Johnny Hung
Hi ALL,

I have build an embedded Linux system and rootfs is a ramdisk. Ramdisk
rootfs resides in memory so modify files is non-effective after a
reboot. Some directories in rootfs, like /etc, /usr, ... are contain
many application configuration files and I want to mount it to jffs2
flash filesysyem so it will take effect after a reboot. Is it
possible? I know the flash has write times limited so the log files
(syslogd/klogd) should not store in flash. In general, how to deploy
root file system for embedded linux with flash storage?

H. Johnny
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html