public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] add usb_system_autoupdate command.
@ 2008-11-15 16:28 Matteo Facchinetti
  2008-11-16  8:39 ` Marco Cavallini
  2008-11-16  9:04 ` Marco
  0 siblings, 2 replies; 5+ messages in thread
From: Matteo Facchinetti @ 2008-11-15 16:28 UTC (permalink / raw)
  To: u-boot

Hi,

I have add the possibility to automatic update entire flash using a USB 
pendrive.

To make it, need the following steps:
1) insert usb pendrive. In pendrive must be present these files: 
install.dat and the files we want to copy.
2) from uboot console: => usb_system_autoupdate
3) the system update start, reading information from install.dat file.

The install.dat file raws has this syntax:
<file_type> "<file_name>" <star_flash_addr_partition> 
<end_flash_addr_partition>

file_type values: kernel, uboot, fdt, rootfs.

In attachment there's an example of install.dat and the source code.

Now using it on my system (mpc5200, uboot_1.3.1) but there's a problem 
that I can't fix:
if try to update uboot partition, it freeze in line 211 when call 
do_flerase().

debugging I can see that it freeze in:
cmd_flash.c
434:     printf ("Erased %d sectors\n", erased);
after uboot partition erasing.


Can you help me?


Thanks in advance.
Matteo Facchinetti







-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmd_usb_system_autoupdate.c
Type: text/x-csrc
Size: 7013 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20081115/6a8fb823/attachment.c 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: install.dat
Type: chemical/x-mopac-input
Size: 185 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20081115/6a8fb823/attachment.dat 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] add usb_system_autoupdate command.
  2008-11-15 16:28 [U-Boot] add usb_system_autoupdate command Matteo Facchinetti
@ 2008-11-16  8:39 ` Marco Cavallini
  2008-11-16  9:04 ` Marco
  1 sibling, 0 replies; 5+ messages in thread
From: Marco Cavallini @ 2008-11-16  8:39 UTC (permalink / raw)
  To: u-boot

Matteo Facchinetti ha scritto:
> Hi,
> 
> I have add the possibility to automatic update entire flash using a USB
> pendrive.
> 
> To make it, need the following steps:
> 1) insert usb pendrive. In pendrive must be present these files:
> install.dat and the files we want to copy.
> 2) from uboot console: => usb_system_autoupdate
> 3) the system update start, reading information from install.dat file.
> 
> The install.dat file raws has this syntax:
> <file_type> "<file_name>" <star_flash_addr_partition>
> <end_flash_addr_partition>
> 
> file_type values: kernel, uboot, fdt, rootfs.
> 
> In attachment there's an example of install.dat and the source code.
> 
> Now using it on my system (mpc5200, uboot_1.3.1) but there's a problem
> that I can't fix:
> if try to update uboot partition, it freeze in line 211 when call
> do_flerase().
> 
> debugging I can see that it freeze in:
> cmd_flash.c
> 434:     printf ("Erased %d sectors\n", erased);
> after uboot partition erasing.
> 
> 
> Can you help me?

Posting output messages of the procedure may help.

Cordiali Saluti / Kindest Regards / mit freundlichen Gr?ssen
--
Marco Cavallini | KOAN sas | Bergamo - Italia
 embedded and real-time software engineering
Phone:+39-035-255.235 - Fax:+39-178-22.39.748
      http://www.KoanSoftware.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] add usb_system_autoupdate command.
  2008-11-15 16:28 [U-Boot] add usb_system_autoupdate command Matteo Facchinetti
  2008-11-16  8:39 ` Marco Cavallini
@ 2008-11-16  9:04 ` Marco
  2008-11-17 13:50   ` Matteo Facchinetti
  1 sibling, 1 reply; 5+ messages in thread
From: Marco @ 2008-11-16  9:04 UTC (permalink / raw)
  To: u-boot

Hi Matteo,

in my opinion you should follow the "philosophy" of updater.c under the
tools folder to erase the flash. This command is very interesting, let
me know if you fix your problem.

Regards,

Marco

Matteo Facchinetti ha scritto:
> Hi,
> 
> I have add the possibility to automatic update entire flash using a USB
> pendrive.
> 
> To make it, need the following steps:
> 1) insert usb pendrive. In pendrive must be present these files:
> install.dat and the files we want to copy.
> 2) from uboot console: => usb_system_autoupdate
> 3) the system update start, reading information from install.dat file.
> 
> The install.dat file raws has this syntax:
> <file_type> "<file_name>" <star_flash_addr_partition>
> <end_flash_addr_partition>
> 
> file_type values: kernel, uboot, fdt, rootfs.
> 
> In attachment there's an example of install.dat and the source code.
> 
> Now using it on my system (mpc5200, uboot_1.3.1) but there's a problem
> that I can't fix:
> if try to update uboot partition, it freeze in line 211 when call
> do_flerase().
> 
> debugging I can see that it freeze in:
> cmd_flash.c
> 434:     printf ("Erased %d sectors\n", erased);
> after uboot partition erasing.
> 
> 
> Can you help me?
> 
> 
> Thanks in advance.
> Matteo Facchinetti
> 
> 
> 
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] add usb_system_autoupdate command.
  2008-11-16  9:04 ` Marco
@ 2008-11-17 13:50   ` Matteo Facchinetti
  2008-12-09 23:06     ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Matteo Facchinetti @ 2008-11-17 13:50 UTC (permalink / raw)
  To: u-boot

Hi Marco,

I looked updater.c and and I take that code as example.

Well,
I removed all function as same as do_... (do_fat_fsload, do_protect, 
do_flerase, do_mem_cp).
In this way, I could remove also strcpy() and sprintf() needed to made 
their parameters and the result is that I cleaned and emproved all code.

Now all works correctly.
I think that the rewrite of the code, indirectly solve some bugs of 
memory corruption.

In attach, the code...
and if anyone try it, I'm interesting to feedback or opinions.

Thanks at all.
Matteo.




Marco wrote:
> Hi Matteo,
>
> in my opinion you should follow the "philosophy" of updater.c under the
> tools folder to erase the flash. This command is very interesting, let
> me know if you fix your problem.
>
> Regards,
>
> Marco
>
> Matteo Facchinetti ha scritto:
>   
>> Hi,
>>
>> I have add the possibility to automatic update entire flash using a USB
>> pendrive.
>>
>> To make it, need the following steps:
>> 1) insert usb pendrive. In pendrive must be present these files:
>> install.dat and the files we want to copy.
>> 2) from uboot console: => usb_system_autoupdate
>> 3) the system update start, reading information from install.dat file.
>>
>> The install.dat file raws has this syntax:
>> <file_type> "<file_name>" <star_flash_addr_partition>
>> <end_flash_addr_partition>
>>
>> file_type values: kernel, uboot, fdt, rootfs.
>>
>> In attachment there's an example of install.dat and the source code.
>>
>> Now using it on my system (mpc5200, uboot_1.3.1) but there's a problem
>> that I can't fix:
>> if try to update uboot partition, it freeze in line 211 when call
>> do_flerase().
>>
>> debugging I can see that it freeze in:
>> cmd_flash.c
>> 434:     printf ("Erased %d sectors\n", erased);
>> after uboot partition erasing.
>>
>>
>> Can you help me?
>>
>>
>> Thanks in advance.
>> Matteo Facchinetti
>>
>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>>     
>
>   

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmd_usb_system_autoupdate.c
Type: text/x-csrc
Size: 6692 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20081117/6e6e406a/attachment.c 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: install.dat
Type: chemical/x-mopac-input
Size: 185 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20081117/6e6e406a/attachment.dat 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] add usb_system_autoupdate command.
  2008-11-17 13:50   ` Matteo Facchinetti
@ 2008-12-09 23:06     ` Wolfgang Denk
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2008-12-09 23:06 UTC (permalink / raw)
  To: u-boot

Dear Matteo,

In message <492176A0.7040101@sirius-es.it> you wrote:
> 
> I looked updater.c and and I take that code as example.
> 
> I removed all function as same as do_... (do_fat_fsload, do_protect, 
> do_flerase, do_mem_cp).
> In this way, I could remove also strcpy() and sprintf() needed to made 
> their parameters and the result is that I cleaned and emproved all code.
> 
> Now all works correctly.

Hm... it may work for you, but it's mostly unusable by anybody else
given the complete lack of documentation.

> In attach, the code...
> and if anyone try it, I'm interesting to feedback or opinions.

Here a general comment first: we already have quitre a number of such
auto-update mechanisms in U-Boot, including  updates  from  USB  mass
storage device (like yours, or board/trab/auto_update.c or
board/mcc200/auto_update.c or board/esd/common/auto_update.c), and
updates over TFTP (see doc/README.update).

In my opinion, the code described in doc/README.update is probably the
most advanced and powerful, as it moves the description of the update
files from the code into the download image (using FIT image format).

So instead of adding yet another highly specific implementation for a
pretty common task, I'd much rather see patches that come up  with  a
generalization of this feature, i. e. something that allows reuse for
other systems, eventually even replacing (parts of) the old, existing
code.


Now for your patch:

* The Signed-off-by line is missing.
* You exceed the maximum line length in many places.
* You use an incorrect brace style.
* There is lots of trailing white space.
* It is not configurable (i.e. cannot be removed for boards that don't
  need it / don't want it.
* And it has some pretty strange parts, like this error "handling":

> error_exit:
> 	udelay(1000*1000*5);
> 	return 1;

I'm sorry, but this patch would  need  a  major  rework  to  make  it
acceptable  for  mainline, but as mentioned above, such efforts would
(in my opinion) be better invested in designing  and  implementing  a
more general solution.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Our management frequently gets lost in thought.   That's because it's
unfamiliar territory.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-12-09 23:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-15 16:28 [U-Boot] add usb_system_autoupdate command Matteo Facchinetti
2008-11-16  8:39 ` Marco Cavallini
2008-11-16  9:04 ` Marco
2008-11-17 13:50   ` Matteo Facchinetti
2008-12-09 23:06     ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox