[U-Boot] [PATCH v1] fs: fat: dynamically allocate memory for temporary buffer

Stefan Agner stefan at agner.ch
Thu Dec 6 15:45:08 UTC 2018


On 06.12.2018 16:13, Tom Rini wrote:
> On Thu, Dec 06, 2018 at 02:58:52PM +0100, Stefan Agner wrote:
> 
>> From: Stefan Agner <stefan.agner at toradex.com>
>>
>> Drop the statically allocated get_contents_vfatname_block and
>> dynamically allocate a buffer only if required. This saves
>> 64KiB of memory.
>>
>> Signed-off-by: Stefan Agner <stefan.agner at toradex.com>
> 
> Is there a particular issue you're running into here, or just that what
> we're doing is just generally not a great idea?  I ask since I need to
> poke git history to make sure that the thing at the back of my mind
> about us needing to do this for some annoying boot case is intentional.

I was in the process checking large global variables since I had issues
on a target with limited SRAM (used pre-relocation). I only after
writing this patch I realized that the space for the .bss section is not
required pre-relocation, so the patch did not help in my particular
case.

That said, in git history I saw that get_contents_vfatname_block has
been used more broadly in earlier FAT implementations. Now it is only
used to handle a corner case: when loading from a file with an offset...
I guess the .bss section is cleared, so we probably safe 64KiB of
zeroing out... I feel it is still worth doing the change, but I don't
have a really strong feeling.

--
Stefan


More information about the U-Boot mailing list