* [U-Boot] [U-boot] mmc write|read howto
@ 2013-04-26 20:51 Jagan Teki
2013-04-27 6:25 ` Josh Wu
0 siblings, 1 reply; 5+ messages in thread
From: Jagan Teki @ 2013-04-26 20:51 UTC (permalink / raw)
To: u-boot
Hi All,
I need some help regarding mmc write and mmc read commands usage.
I am using a 4GB SD/MMC plus and socked eMMC cards, usually I am
formatting these cards on my host pc with
fat partition and copy the images into card. while in the u-boot level
I am reading the images from card and copy it onto mem addr
like fatload mmc 0 0x1000 uImage.
Can we write the images onto these cards in u-boot level?, using mmc write.
same way can we read back using mmc read? if so how to do that.
Request for help.
Thanks,
Jagan.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [U-boot] mmc write|read howto
2013-04-26 20:51 [U-Boot] [U-boot] mmc write|read howto Jagan Teki
@ 2013-04-27 6:25 ` Josh Wu
2013-04-27 9:26 ` Jagan Teki
0 siblings, 1 reply; 5+ messages in thread
From: Josh Wu @ 2013-04-27 6:25 UTC (permalink / raw)
To: u-boot
Hi, Jagan
On 4/27/2013 4:51 AM, Jagan Teki wrote:
> Hi All,
>
> I need some help regarding mmc write and mmc read commands usage.
>
> I am using a 4GB SD/MMC plus and socked eMMC cards, usually I am
> formatting these cards on my host pc with
> fat partition and copy the images into card. while in the u-boot level
> I am reading the images from card and copy it onto mem addr
> like fatload mmc 0 0x1000 uImage.
>
> Can we write the images onto these cards in u-boot level?, using mmc write.
> same way can we read back using mmc read? if so how to do that.
yes, define the CONFIG_FAT_WRITE macro in your board config file.
re-build your u-boot. then you will find "fatwrite" command.
U-Boot> fatwrite
fatwrite - write file into a dos filesystem
Usage:
fatwrite <interface> <dev[:part]> <addr> <filename> <bytes>
- write file 'filename' from the address 'addr' in RAM
to 'dev' on 'interface'
so you can use:
fatwrite mmc 0 0x20000000 file 0x4000
Best Regards,
Josh Wu
>
> Request for help.
>
> Thanks,
> Jagan.
> _______________________________________________
> 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] [U-boot] mmc write|read howto
2013-04-27 6:25 ` Josh Wu
@ 2013-04-27 9:26 ` Jagan Teki
2013-04-27 9:38 ` Josh Wu
2013-04-27 10:52 ` Josh Wu
0 siblings, 2 replies; 5+ messages in thread
From: Jagan Teki @ 2013-04-27 9:26 UTC (permalink / raw)
To: u-boot
Hi Josh,
On Sat, Apr 27, 2013 at 11:55 AM, Josh Wu <josh.wu@atmel.com> wrote:
> Hi, Jagan
>
>
> On 4/27/2013 4:51 AM, Jagan Teki wrote:
>>
>> Hi All,
>>
>> I need some help regarding mmc write and mmc read commands usage.
>>
>> I am using a 4GB SD/MMC plus and socked eMMC cards, usually I am
>> formatting these cards on my host pc with
>> fat partition and copy the images into card. while in the u-boot level
>> I am reading the images from card and copy it onto mem addr
>> like fatload mmc 0 0x1000 uImage.
>>
>> Can we write the images onto these cards in u-boot level?, using mmc
>> write.
>> same way can we read back using mmc read? if so how to do that.
>
>
> yes, define the CONFIG_FAT_WRITE macro in your board config file.
> re-build your u-boot. then you will find "fatwrite" command.
>
> U-Boot> fatwrite
> fatwrite - write file into a dos filesystem
>
> Usage:
> fatwrite <interface> <dev[:part]> <addr> <filename> <bytes>
> - write file 'filename' from the address 'addr' in RAM
> to 'dev' on 'interface'
>
> so you can use:
> fatwrite mmc 0 0x20000000 file 0x4000
Thanks for your information.
I will try the fatwrite, and this must require to have the card should
formatted as FAT on host, is it?
Any possibility to do the formation on u-boot itself.?
Thanks,
Jagan.
>
> Best Regards,
> Josh Wu
>
>>
>> Request for help.
>>
>> Thanks,
>> Jagan.
>> _______________________________________________
>> 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] [U-boot] mmc write|read howto
2013-04-27 9:26 ` Jagan Teki
@ 2013-04-27 9:38 ` Josh Wu
2013-04-27 10:52 ` Josh Wu
1 sibling, 0 replies; 5+ messages in thread
From: Josh Wu @ 2013-04-27 9:38 UTC (permalink / raw)
To: u-boot
On 4/27/2013 5:26 PM, Jagan Teki wrote:
> Hi Josh,
>
> On Sat, Apr 27, 2013 at 11:55 AM, Josh Wu <josh.wu@atmel.com> wrote:
>> Hi, Jagan
>>
>>
>> On 4/27/2013 4:51 AM, Jagan Teki wrote:
>>> Hi All,
>>>
>>> I need some help regarding mmc write and mmc read commands usage.
>>>
>>> I am using a 4GB SD/MMC plus and socked eMMC cards, usually I am
>>> formatting these cards on my host pc with
>>> fat partition and copy the images into card. while in the u-boot level
>>> I am reading the images from card and copy it onto mem addr
>>> like fatload mmc 0 0x1000 uImage.
>>>
>>> Can we write the images onto these cards in u-boot level?, using mmc
>>> write.
>>> same way can we read back using mmc read? if so how to do that.
>>
>> yes, define the CONFIG_FAT_WRITE macro in your board config file.
>> re-build your u-boot. then you will find "fatwrite" command.
>>
>> U-Boot> fatwrite
>> fatwrite - write file into a dos filesystem
>>
>> Usage:
>> fatwrite <interface> <dev[:part]> <addr> <filename> <bytes>
>> - write file 'filename' from the address 'addr' in RAM
>> to 'dev' on 'interface'
>>
>> so you can use:
>> fatwrite mmc 0 0x20000000 file 0x4000
> Thanks for your information.
>
> I will try the fatwrite, and this must require to have the card should
> formatted as FAT on host, is it?
yes. Also U-Boot can support EXT2, EXT4, UBI read. And EXT4 write
(CONFIG_CMD_EXT4_WRITE).
> Any possibility to do the formation on u-boot itself.?
according to my understanding, no.
Best Regards,
Josh Wu
>
> Thanks,
> Jagan.
>
>> Best Regards,
>> Josh Wu
>>
>>> Request for help.
>>>
>>> Thanks,
>>> Jagan.
>>> _______________________________________________
>>> 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] [U-boot] mmc write|read howto
2013-04-27 9:26 ` Jagan Teki
2013-04-27 9:38 ` Josh Wu
@ 2013-04-27 10:52 ` Josh Wu
1 sibling, 0 replies; 5+ messages in thread
From: Josh Wu @ 2013-04-27 10:52 UTC (permalink / raw)
To: u-boot
Hi, Jagan
Since I am working on the fatwrite part for the moment. And there is a
bug find in U-Boot fat write.
You can check the thread here:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/158939
following patch can fix it:
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 5829adf..b7ba8ea 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -561,7 +561,7 @@ set_cluster(fsdata *mydata, __u32 clustnum, __u8
*buffer,
unsigned long size)
{
int idx = 0;
- __u32 startsect;
+ __u32 startsect, nr_sectors;
if (clustnum > 0)
startsect = mydata->data_begin +
@@ -571,7 +571,11 @@ set_cluster(fsdata *mydata, __u32 clustnum, __u8
*buffer,
debug("clustnum: %d, startsect: %d\n", clustnum, startsect);
- if (disk_write(startsect, size / mydata->sect_size, buffer) < 0) {
+ nr_sectors = size / mydata->sect_size;
+ if (nr_sectors == 0)
+ nr_sectors = 1;
+
+ if (disk_write(startsect, nr_sectors, buffer) < 0) {
debug("Error writing data\n");
return -1;
}
--
1.7.9.5
Best Regards,
Josh Wu
On 4/27/2013 5:26 PM, Jagan Teki wrote:
> Hi Josh,
>
> On Sat, Apr 27, 2013 at 11:55 AM, Josh Wu <josh.wu@atmel.com> wrote:
>> Hi, Jagan
>>
>>
>> On 4/27/2013 4:51 AM, Jagan Teki wrote:
>>> Hi All,
>>>
>>> I need some help regarding mmc write and mmc read commands usage.
>>>
>>> I am using a 4GB SD/MMC plus and socked eMMC cards, usually I am
>>> formatting these cards on my host pc with
>>> fat partition and copy the images into card. while in the u-boot level
>>> I am reading the images from card and copy it onto mem addr
>>> like fatload mmc 0 0x1000 uImage.
>>>
>>> Can we write the images onto these cards in u-boot level?, using mmc
>>> write.
>>> same way can we read back using mmc read? if so how to do that.
>>
>> yes, define the CONFIG_FAT_WRITE macro in your board config file.
>> re-build your u-boot. then you will find "fatwrite" command.
>>
>> U-Boot> fatwrite
>> fatwrite - write file into a dos filesystem
>>
>> Usage:
>> fatwrite <interface> <dev[:part]> <addr> <filename> <bytes>
>> - write file 'filename' from the address 'addr' in RAM
>> to 'dev' on 'interface'
>>
>> so you can use:
>> fatwrite mmc 0 0x20000000 file 0x4000
> Thanks for your information.
>
> I will try the fatwrite, and this must require to have the card should
> formatted as FAT on host, is it?
> Any possibility to do the formation on u-boot itself.?
>
> Thanks,
> Jagan.
>
>> Best Regards,
>> Josh Wu
>>
>>> Request for help.
>>>
>>> Thanks,
>>> Jagan.
>>> _______________________________________________
>>> U-Boot mailing list
>>> U-Boot at lists.denx.de
>>> http://lists.denx.de/mailman/listinfo/u-boot
>>
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-27 10:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26 20:51 [U-Boot] [U-boot] mmc write|read howto Jagan Teki
2013-04-27 6:25 ` Josh Wu
2013-04-27 9:26 ` Jagan Teki
2013-04-27 9:38 ` Josh Wu
2013-04-27 10:52 ` Josh Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox