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

advan advan at rexian.com
Sun Oct 21 22:09:53 EDT 2007


Hi,Matt,
 Thank you , the device's root system file is as below :

#ls /
        sbin  proc  home  usr   var   tmp   mnt   lib   etc   dev   bin
  Note: all partitions are be running on the Jffs2 in addition to 'tmp' be running tmpfs (128K)

# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock1            2752      1968       784  72% /
tmpfs                      128        16       112  13% /tmp
/dev/mtdblock2             256       196        60  77% /mnt/user
Note : I want to upgrate '/dev/mtdblock1' just that is jffs2 root filesystem 

# mount
/dev/mtdblock1 on / type jffs2 (rw)
/proc on /proc type proc (rw)
tmpfs on /tmp type tmpfs (rw)
/dev/mtdblock2 on /mnt/user type jffs2 (rw)
#cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00030000 00010000 "RedBoot"
mtd1: 002b0000 00010000 "rootfs"
mtd2: 00040000 00010000 "user"
mtd3: 000b0000 00010000 "kernel.bin"
mtd4: 0000f000 00010000 "FIS directory"
mtd5: 00001000 00010000 "RedBoot config"

#cat /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
Mem:   6569984  5726208   843776        0        0  1544192
Swap:        0        0        0
MemTotal:         6416 kB
MemFree:           824 kB
MemShared:           0 kB
Buffers:             0 kB
Cached:           1508 kB
SwapCached:          0 kB
Active:           1428 kB
Inactive:          864 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:         6416 kB
LowFree:           824 kB
SwapTotal:           0 kB
SwapFree:            0 kB

#ps -e
  PID  Uid     VmSize Stat Command
    1 root        312 S   init
    2 root            SW  [keventd]
    3 root            RWN [ksoftirqd_CPU0]
    4 root            SW  [kswapd]
    5 root            SW  [bdflush]
    6 root            SW  [kupdated]
    7 root            SW  [mtdblockd]
   14 root            SWN [jffs2_gcd_mtd1]
   17 root            SWN [jffs2_gcd_mtd2]
   32 root        216 S   /sbin/watchdog /dev/watchdog
   33 root        212 D   /sbin/watchdog /dev/watchdog
   36 root        248 S   /sbin/liappup
   38 root        232 S   /bin/wlanserver
   53 root        336 S   inetd
   56 root        212 S   telnetd
   60 root        516 S   /bin/sh
   83 root        216 D   ifconfig eth0 0.0.0.0 up
  110 root        332 S   hostapd -B /etc/wlan/madwifi.conf
  272 root        524 S   /sbin/thttpd -C /etc/thttpd.conf
  310 root        308 R   ps -e

 the Redboot is able to support ethernet in bootloader ,Didn't you have more better method ? 

Best Regards 
                                               advan 



advan
2007-10-22



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


Hi, 

1.  You need to run your program from a filesystem that's not being overwritten by the upgrade.  You need to kill the processes using the existing rootfs.  

What is using your jffs2?  Do you have a logger running that writes to flash?  Is your /var partition in a tmpfs or running on the jffs2 parttion?  Often embedded systems will move the /var and sometimes /etc to the tmpfs.  

Do a ps -e to see what is using the root fs.  

You can make a minimal rootfs in your tmpfs partition with it containing all the bin files you want for ugprade, and then chroot to the tmpfs.   

3,4.  call erase on the /dev/mtd# char type device, may work for both, I dunno.  mtd_utils package has simple flash copy/erase programs which can be used in other code with a small work.

If you are using Redboot, maybe this makes more sense in there, if you have ethernet support in Redboot.  

Matt



From: uclinux-dev-bounces at uclinux.org [mailto:uclinux-dev-bounces at uclinux.org] On Behalf Of advan
Sent: Friday, October 19, 2007 4:48 AM
To: uClinux development list
Subject: Re: RE: RE: Re: [uClinux-dev] how to upgrade the jffs2 of root inlinux


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/20071022/e3b47671/attachment.html


More information about the uClinux-dev mailing list