[uClinux-dev] how to upgrade the jffs2 of root in linux

advan advan at rexian.com
Fri Oct 19 04:48:21 EDT 2007


Hi,Matt 

  first , thank your kind . According to your idea, I think it should do the process as below:

 1. mount a  tmpfs in RAM , cp upgrade-routine into tmpfs and execute it .

 2. umount root file system ,I only use "umount /" because of no '/dev/root' device,but in here , I also don't umount '/' , it will be shown 'device is busy'. I   want to find some process via 'fuser -m /' then to kill these process be using '/', but it  seems the busybox doesn't support 'fuser' command , so I don't know how to umount root filesystem .

3. erase /dev/mtdblock1 partition 

4. open /dev/mtdblock1 (use low 'open' function), and orderly write 64k size into file very time from httpd through ethernet interface,total 3M/64K (flash sector :64k)

5.when write data into flash ok, reboot the system 

if the program is operating item #4 , the device is be power off ,then the device's /dev/mtdblock1 will be destroyed lead not to use the device . I don't want to expect so result .

the device Basic information :
  hardware platform : mips r4000 
  kernel version : 2.4.25 
   uclibc library 
   busybox 
   flash : 4 M ( 3M as root file system jffs2 , 1M as Redboot and kernel image )
   RAM :8M (remain approximately 500K-1M after booting kernel and loading application)
   Upgrate file : jffs2.bin (3M), now don't think over kernel image 
   upgrade method : http server(CGI) through ethernet 

Matt , please you help me how to do this , Thank you very much .
Best Regards 
                                              advan 



advan
2007-10-19



·¢¼þÈË£º Crane, Matthew
·¢ËÍʱ¼ä£º 2007-10-17 21:23:14
ÊÕ¼þÈË£º uClinux development list
³­ËÍ£º 
Ö÷Ì⣺ RE: RE: Re: [uClinux-dev] how to upgrade the jffs2 of root in linux

Hi, 

With minimal memory alternative options would be to stream the image to your flash.

If your system is minimal, maybe you do not need to keep a flash fs mounted.  Can your system remain up if you unmount the existing jffs root?  

If so, and if ram/flash is at a premium, it is possible to execute a simple program that does all upgrade.

The program would need to:

- unmount root, e.g. system( "umount /dev/root" )
- use mtd calls to unlock/erase flash
- receive upgrade package. .
- as file comes in, write to flash.
- once written to flash ok, the partition can be remounted from within the process, e.g. system( "mount <root dev>") 
- if the program is running from a /tmp tmpfs, it could be restarted on failure, until the rootfs is restored. 

Rather then write a program from scratch, one of the simple embedded web servers out there can be modified to recieve post of file.   I believe uclinux has sparse httpd.

If you do something like this the possiblity of failing in the middle of upgrade is likely.  A fail safe image or bootloader with upgrade option would be needed to keep the system recoverable.  

The best place for an upgrade is sometimes the bootloader, maybe when an upgrade is requested, jump to bootloader and leave up to the bootloader.

It may be too that your options for upgrade would improve by minimizing the size of the root partition, or the part that needs to be upgraded.

Just suggestions, I don't know details of your requirments,

Matt




From: uclinux-dev-bounces at uclinux.org [mailto:uclinux-dev-bounces at uclinux.org] On Behalf Of advan
Sent: Wednesday, October 17, 2007 5:35 AM
To: uClinux development list
Subject: Re: RE: Re: [uClinux-dev] how to upgrade the jffs2 of root in linux


Hi,Matt 
the  netflash also needs enough memory space ,when I use './netflash -K -r /dev/mtd1 192.168.1.218 jffs2.bin' via tftpserver through ethernet , the netflash requestes  virtual memory  always to store the data and that it's very slow . like my case , the embedded device's memory is very limited . free memory is only 1M ,otherwise the size of jffs2.bin is 3M , it seems it's difficult to netflash too , 
what do you think ? 
Thank you very much 

Best Regards 
                              cookie 




advan
2007-10-17



·¢¼þÈË£º Crane, Matthew
·¢ËÍʱ¼ä£º 2007-10-16 21:16:37
ÊÕ¼þÈË£º uClinux development list
³­ËÍ£º 
Ö÷Ì⣺ RE: Re: [uClinux-dev] how to upgrade the jffs2 of root in linux

Can netflash upgrade a mounted root partition?

If you don't have the memory to mount the tmp partition in ram, then keep a small second tmp partition in your flash, switch to that, run netflash, and then switch back to the new main parttion. 

Matt




From: uclinux-dev-bounces at uclinux.org [mailto:uclinux-dev-bounces at uclinux.org] On Behalf Of Nikita Tabatsky
Sent: Tuesday, October 16, 2007 5:06 AM
To: uClinux development list
Subject: Re: Re: [uClinux-dev] how to upgrade the jffs2 of root in linux


Hi, Advan
 yes, netflash it's flash tool.
 sorry, i forgot to insert link :)
http://cvs.uclinux.org/cgi-bin/cvsweb.cgi/uClinux-dist/user/netflash/ 
Nik.


On 10/16/07, advan <advan at rexian.com> wrote: 
Hi,Nik
    Thank you , what is netflash ,it's a flash tool ?
 could you offer a link address ?
 Best Regards
                             advan




advan
2007-10-16



·¢¼þÈË£º Nikita Tabatsky
·¢ËÍʱ¼ä£º 2007-10-15 17:54:26
ÊÕ¼þÈË£º uClinux development list
³­ËÍ£º 
Ö÷Ì⣺ Re: [uClinux-dev] how to upgrade the jffs2 of root in linux

Hi, Advan
You can use netflash for upgrade your jffs2 partition.
Nik.


On 10/15/07, advan < advan at rexian.com> wrote: 
hi, everyone 
  I build jffs2 as root file system in my embedded platform with uclinux os , I also build a web http server(boa) , through httpd server , I can upload a new jffs2 root file-system into the platform memery ,then I want to use new jfffs file to re-write jffs2 partition ,because linux is using this partition as its root file system , if I directly write it into the jffs2 partition ,then linux will cause crash and errors . anybody know how to do ?
thank you in advance 

                                   advan




advan
2007-10-15

_______________________________________________
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
To unsubscribe see: 
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
To unsubscribe see: 
http://mailman.uclinux.org/mailman/options/uclinux-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.uclinux.org/pipermail/uclinux-dev/attachments/20071019/52a97543/attachment.html


More information about the uClinux-dev mailing list