[U-Boot] Request for Help: How to save data to an SD/MMC card

Hi All,
I have a need to dump memory contents to a filesystem on an SD/MMC card so I can transfer it to my dev PC. I don't have a working network driver, so TFTP is out
Now I notice that U-Boot has code to support writing to FAT filesystems, but it does not appear to be plumbed in
Alternatively, I could patch up the recently posted ext4 code and give that a go
Is there any other existing mechanism to write a file to a filesystem on an SD/MMC card in U-Boot?
Regards,
Graeme

Dear Graeme,
In message CALButCKwVh571bhgV9NQ82HYiFVJ=uGMFvVTYa5NV5M=kWvtGw@mail.gmail.com you wrote:
I have a need to dump memory contents to a filesystem on an SD/MMC card so I can transfer it to my dev PC. I don't have a working network driver, so TFTP is out
Add a network driver? :-)
Now I notice that U-Boot has code to support writing to FAT filesystems, but it does not appear to be plumbed in
Correct. (V)FAT support is read-only, like for nearly all other file systems.
Alternatively, I could patch up the recently posted ext4 code and give that a go
That would be a good idea - the more people testing that code, the better.
Is there any other existing mechanism to write a file to a filesystem on an SD/MMC card in U-Boot?
Yaffs is the only other file system in U-Boot that has write support.
If I were you, I'd try to get the ext4 code running.
Best regards,
Wolfgang Denk

Hi Wolfgang,
On Tue, Dec 13, 2011 at 7:14 PM, Wolfgang Denk wd@denx.de wrote:
Dear Graeme,
In message CALButCKwVh571bhgV9NQ82HYiFVJ=uGMFvVTYa5NV5M=kWvtGw@mail.gmail.com you wrote:
I have a need to dump memory contents to a filesystem on an SD/MMC card so I can transfer it to my dev PC. I don't have a working network driver, so TFTP is out
Add a network driver? :-)
I tried, but the technical documentation I have is somewhat less than perfect :( - I'm still chasing that up
Now I notice that U-Boot has code to support writing to FAT filesystems, but it does not appear to be plumbed in
Correct. (V)FAT support is read-only, like for nearly all other file systems.
Alternatively, I could patch up the recently posted ext4 code and give that a go
That would be a good idea - the more people testing that code, the better.
Is there any other existing mechanism to write a file to a filesystem on an SD/MMC card in U-Boot?
Yaffs is the only other file system in U-Boot that has write support.
If I were you, I'd try to get the ext4 code running.
OK, I'll focus on the ext4 patches
If you like, I can take on responsibility of getting them into mainline through the staging repo, but this is unlikely to happen until well into the new year
Regards,
Graeme

Hi Ilya,
On Wed, Dec 14, 2011 at 10:26 AM, Ilya Yanok yanok@emcraft.com wrote:
Hi Graeme,
Graeme Russ <graeme.russ <at> gmail.com> writes:
I have a need to dump memory contents to a filesystem on an SD/MMC
Do you really need a filesystem for this? You can easily dump memory to SD using block write.
Well I want to copy the data back to my dev PC - If the SD/MMC card is formatted with a filesystem, it is trivial to transfer the data back and forth
Regards,
Graeme

On 2011-12-14 00:28, Graeme Russ wrote:
Hi Ilya,
On Wed, Dec 14, 2011 at 10:26 AM, Ilya Yanokyanok@emcraft.com wrote:
Hi Graeme,
Graeme Russ<graeme.russ<at> gmail.com> writes:
I have a need to dump memory contents to a filesystem on an SD/MMC
Do you really need a filesystem for this? You can easily dump memory to SD using block write.
Well I want to copy the data back to my dev PC - If the SD/MMC card is formatted with a filesystem, it is trivial to transfer the data back and forth
Regards,
Graeme _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
dd i=<card> o=<file> ?

Hi Graeme,
On 14.12.2011 03:28, Graeme Russ wrote:
I have a need to dump memory contents to a filesystem on an SD/MMC
Do you really need a filesystem for this? You can easily dump memory to SD using block write.
Well I want to copy the data back to my dev PC - If the SD/MMC card is formatted with a filesystem, it is trivial to transfer the data back and forth
Well, it shouldn't be that hard to get the data written to specific blocks on the dev PC using dd command.
Regards, Ilya.

Hi Ilya,
On Wed, Dec 14, 2011 at 10:34 AM, Ilya Yanok yanok@emcraft.com wrote:
Hi Graeme,
On 14.12.2011 03:28, Graeme Russ wrote:
I have a need to dump memory contents to a filesystem on an SD/MMC
Do you really need a filesystem for this? You can easily dump memory to SD using block write.
Well I want to copy the data back to my dev PC - If the SD/MMC card is formatted with a filesystem, it is trivial to transfer the data back and forth
Well, it shouldn't be that hard to get the data written to specific blocks on the dev PC using dd command.
But what about bad blocks?
But I imagine this problem exists when using a file system not designed with explicit bad-block handling - Do SD/MMC cards deal with bad blocks internally? I'm not familiar with the low level details, I just know that enabling MMC in U-Boot 'just works' on my board
Regards,
Graeme

Hi Graeme,
On 14.12.2011 03:37, Graeme Russ wrote:
Well, it shouldn't be that hard to get the data written to specific blocks on the dev PC using dd command.
But what about bad blocks?
You don't need to worry much about this. MMC/SD card are not a raw flash devices they contain FTL that handles this internally. See http://www.linux-mtd.infradead.org/doc/ubifs.html#L_raw_vs_ftl for details.
That's why you can use generic filesystems on MMC/SD (neither FAT not EXT2/3/4 is not designed for raw flash).
Regards, Ilya.

Hi Ilya,
On Wed, Dec 14, 2011 at 10:46 AM, Ilya Yanok yanok@emcraft.com wrote:
Hi Graeme,
On 14.12.2011 03:37, Graeme Russ wrote:
Well, it shouldn't be that hard to get the data written to specific blocks on the dev PC using dd command.
But what about bad blocks?
You don't need to worry much about this. MMC/SD card are not a raw flash devices they contain FTL that handles this internally. See http://www.linux-mtd.infradead.org/doc/ubifs.html#L_raw_vs_ftl for details.
That's why you can use generic filesystems on MMC/SD (neither FAT not EXT2/3/4 is not designed for raw flash).
Thanks, that is good to know - I'll try this out when I get a chance
Nonetheless, I think it will be advantageous to have filesystem write support in U-Boot anyway to allow seamless transfer of data between development mchines, U-Boot and the target OS.
Regards,
Graeme
participants (4)
-
Graeme Russ
-
Ilya Yanok
-
Ulf Samuelsson
-
Wolfgang Denk