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

advan advan at rexian.com
Sun Oct 21 22:16:52 EDT 2007


Hi,Wilshire
   Right,I must have to re-mount a new rootsystem to execute some system commands .My device is using the Redboot as bootloader , which is able to support Ethernet and TFTP , But the upgraded firmware file is be obtained by httpd(CGI) , in flash , It already have no space to store .
can you have other good idea ? Thank you very much .

Best Regards 
                                   advan




advan
2007-10-22



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

Hi Advan,

advan wrote:
> 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
> ------------------------------------------------------------------------
Just and idea...
If you are using u-boot as a bootloader why not do the update inside 
u-boot ??

In the suggestion below you will still need access to a sort of root 
file system to execute the system commands.

Regards

   Phil Wilshire

> *???:* 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/ 
>  <http://cvs.uclinux.org/cgi-bin/cvsweb.cgi/uClinux-dist/user/netflash/ >
> Nik.
> 
> On 10/16/07, *advan*  <advan at rexian.com  <mailto: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  <mailto: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  <mailto:uClinux-dev at uclinux.org >
>         http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
>         This message was resent by uclinux-dev at uclinux.org
>          <mailto: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  <mailto:uClinux-dev at uclinux.org >
>     http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
>     This message was resent by uclinux-dev at uclinux.org
>      <mailto: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

_______________________________________________
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/20071022/9fb8071d/attachment.html


More information about the uClinux-dev mailing list