[U-Boot] fatwrite issue in sub-directories
Benoît Thébaudeau
benoit.thebaudeau.dev at gmail.com
Wed Jul 20 21:42:23 CEST 2016
Hi Nicolas,
On Wed, Jul 20, 2016 at 6:21 PM, Nicolas le bayon <nlebayon at gmail.com> wrote:
> Hi all,
>
> With a quite old u-boot release (October 2015 more or less), I has some
> different issues around fatwrite operations. I realigned a few things
> around FAT with latest release, and now I observe only one issue. Maybe
> this has been discussed here before, I searched but no success.
>
> I'd like to save a file on an external device (sd card or usb stick), but
> not on the root, in a sub-directory. I made the implementation with EXT4
> and it works fine. But no way (for the moment) with FAT.
>
> Here is the behaviour, let's imagine the device contains only a "mydir"
> directory.
>> fatls <device>
> mydir/
>> fatwrite <device> <addr> myfile.txt <filesize>
>> fatls <device>
> mydir/
> myfile.txt
>> fatwrite <device> <addr> mydir/myfile2.txt <filesize>
>> fatls <device>
> mydir/
> myfile.txt
> mydir/myfile2.txt
> In fact, data is stored in a file strangely named with a '/' character.
>
> And when I put the device back on my Linux PC, I can see myfile.txt,
> nothing special in mydir directory, and no "mydir/myfile2.txt" file.
>
> Does someone have already observed this?
Yes. The issue is that do_fat_write() only supports filenames, and not
full paths, so whatever you give it ends up as a filename in the root
directory. There is no workaround.
Best regards,
Benoît
More information about the U-Boot
mailing list