[U-Boot] [PATCH] fs/fat: add a parameter: allow_whole_dev to fat_register_device()

Josh Wu josh.wu at atmel.com
Thu Jun 12 09:04:32 CEST 2014


Dear Wolfgang

Thanks for the review.

On 6/12/2014 2:26 PM, Wolfgang Denk wrote:
> Dear Josh Wu,
>
> In message <1402552643-13297-1-git-send-email-josh.wu at atmel.com> you wrote:
>> For SPL in FAT and envrionment load/save in FAT, to support no partition
>> table device (whole device is FAT partition). We need specify the partition
>> number as 0.
> Sorry, I cannot parse this.  What exactly do you mean here?

Sorry, Let me try to explain it a little bit:
In U-Boot when we access a partition of a device, we use 'ifname 
dev:part' format.
For instance: 'mmc 0:1' means the MMC card's #1 partition of the device #0.

But for a case if the mmc device has no partition table (MBR), it only 
has one FAT partition.
To support that case, we need to access by using 'mmc 0:0'.

So the problem is: if we specify mmc 0:0 then I cannot access the mmc 
device if it has a partition table.
And if we specify mmc 0:1 then I cannot access if it has no partition table.

For the fs layer this case is solved by use 'mmc 0', or 'mmc 0:auto' by 
commit:
10a37fd7a4 (disk: get_device_and_partition() "auto" partition and cleanup)

But for env fat and SPL fat, we don't use the function in above commit 
as we use a simpler function fat_register_device().
So this patch make this function works too.

>
>> But in FAT SPL and environment case, when we specify the partition number as
>> 1, it is reasonable to support the device has no partition table and only a
>> FAT partition.
> Why would the expectations in SPL be different from other use cases?

For example, when I use SPL binary in mmc card, I want it to load the 
file: u-boot.img from the first partition.
I expect it should work even if the mmc device has no partition table.

But when I define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION as 1.  it cannot 
work when the mmc has no partition table.

same thing happens for saving environment to a FAT file in MMC.

>
>> +int fat_register_device(block_dev_desc_t *dev_desc, int part_no,
>> +			bool allow_whole_dev);
> Please make this an "int" type, and use 0 and 1.

Is there any special concern for that? like cause machine compatiable issue?

Best Regards,
Josh Wu

>
> Thanks.
>
> Best regards,
>
> Wolfgang Denk
>



More information about the U-Boot mailing list