[U-Boot] [PATCH] FAT on non standard sector size devices

Remy Bohmer linux at bohmer.net
Wed Nov 12 12:25:48 CET 2008


Hello Igor,

2008/11/12 Igor Luri <iluri at aotek.es>:
> Hi all!
>
> There are USB devices with sector size different than 512 bytes. In
> fact, I have one with 2048 bytes per sector:
>
> scsi0 : SCSI emulation for USB Mass Storage devices
>  Vendor: ChipsBnk  Model: Flash Disk        Rev: 4.00
>  Type:   Direct-Access                      ANSI SCSI revision: 02
> Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
> SCSI device sda: 129124 2048-byte hdwr sectors (264 MB)
> sda: Write Protect is off
> Partition check:
>  sda: sda1 sda2 sda3 sda4
>
> U-boot FAT filesystem code supposes that sector size is always 512
> bytes, consecuently fatload and fatls commands ends up with a
> segmentation fault.
>
> Attached patches adds FAT support on devices with sector size up to 8192
> bytes.

Please only sent patches inline, see http://lwn.net/Articles/139918/
for more info

> I have only tested on our custom board with u-boot 1.1.6 version. I
> would aprpeciate if someone could test this patch on latest version.

I just looked at it (not tested it yet), and I have some comments:

> -	unsigned char buffer[SECTOR_SIZE];
> +	unsigned char buffer[8192];
>  	disk_partition_t info;

Why hardcode this size to 8192, cant it be malloced somehow?
Is there a check that detects if the size is getting bigger than 8192
to prevent segfaults?

>   	if (!dev_desc->block_read)
> @@ -184,7 +185,7 @@ static void get_name (dir_entry *dirent, char *s_name)
>  	if (*s_name == DELETED_FLAG)
>  		*s_name = '\0';
>  	else if (*s_name == aRING)
> -		*s_name = 'å';
> +		*s_name = '�';

Some weird characters here... Is this change what you want?


Kind Regards,

Remy


More information about the U-Boot mailing list