fat: handle Windows formatted partition (thru USB Mass Storage)
Heinrich Schuchardt
xypron.glpk at gmx.de
Thu Jan 16 20:20:19 CET 2020
On 1/16/20 11:39 AM, Andy Shevchenko wrote:
>
>>> Obviously U-Boot's fat code cannot handle it.
>>
>> So precisely, U-Boot cannot handle nested partition( table)s?
>
> Seems so. We need to be able to supply the partition number we would
> like to open, something like
> cmd <interface> [<dev>[:<partition>[:<nested partition>]]]
> otherwise it will require some (error prone) heuristics to understand
> which one user would like to use.
>
I have formatted a USB stick Windows 10.
When I display the partition table with fdisk it shows:
Device Boot Start End Sectors Size Id Type
/dev/sdb1 1935758368 3615603091 1679844724 801G 61 SpeedStor
/dev/sdb2 0 0 0 0B 65 Novell
Netware 386
/dev/sdb4 28049408 28049850 443 221.5K 0 Empty
But there is no partition table at all. The FAT filesystem starts at
sector 0. I can mount the disk with
sudo mount /dev/sdb /mnt
In U-Boot I can read the file system as partition 0:
=> ls scsi 0:0
System Volume Information/
11 test.txt.txt
1 file(s), 1 dir(s)
=> load scsi 0:0 0x40200000 test.txt.txt
11 bytes read in 10 ms (1000 Bytes/s)
=> md.b 0x40200000 b
40200000: 48 65 6c 6c 6f 20 77 6f 72 6c 64 Hello world
=>
The UEFI shell started from U-Boot sees the file system:
Mapping table
FS0: Alias(s):F0a0:;BLK0:
/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Scsi(0,0)
In the UEFI shell I created a new text file. I could read it in Windows.
Now I formatted the USB in Linux with gdisk to give it a GPT partition
table:
Number Start (sector) End (sector) Size Code Name
1 2048 33556479 16.0 GiB 0700 Microsoft
basic data
2 33556480 62521310 13.8 GiB 0700 Microsoft
basic data
and formatted the partitions with mkfs.vfat as FAT32.
Now Windows sees this USB stick as two partions and can read files
created in Linux.
So this is what I learnt:
Windows 10 does not support MBR partition tables on USB sticks.
Windows 10 supports GPT partition tables on USB sticks.
Windows formats empty USB sticks without any partition table at all.
There is no obvious compatibility issue in U-Boot.
Best regards
Heinrich
More information about the U-Boot
mailing list