[U-Boot] [PATCH] cmd_nand/cmd_ubi/cmd_nboot: Set environment variable 'filesize'

Wolfgang Denk wd at denx.de
Wed Jul 16 14:45:23 CEST 2014


Dear Rostislav Lisovy,

In message <1405500531-25486-1-git-send-email-lisovy at merica.cz> you wrote:
> The environment variable 'filesize' is commonly used for
> storing information about the size of the last read/retrieved
> file. The variable is essential when writing U-boot scripts.
> This patch adds the capability of storing the information about
> the size of read data into the 'filesize' variable for other
> commands (nand read/ubi read/nboot) as well.

I'm not happy with that.  I think this is actually dangerous.

First, you mix two different concepts here.  As the name "FILEsize"
suggests, it is related to the size of a data object "file".  This
comes as natural name when loading data from a TFTP server or when
reading a *file* from some file system.  Extending this to mean any
amount of data looks inconsistent and even broken to me.

Second, there might be scripts out there which get broken by your
modification.  For example, when I download a file over TFTP to RAM, I
expect that "filesize" holds the exact amount of bytes of this file.
When I now use "nand write ... +${filesize}", the write size would be
rounded up to the next full erase block size of the NAND.  Any later
reference to "filesize" will now see a different (larger) value than
expected.

There are problably other scenarios which may get broken by such
unexpected (and new) behaviour.

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
Q:  Do you know what the death rate around here is?
A:  One per person.


More information about the U-Boot mailing list