[En-Nut-Discussion] PHAT example code ?

Jesper Hansen jesperh at telia.com
Wed Jan 25 16:52:16 CET 2006



Harald Kipp wrote:
> At 14:27 25.01.2006 +0100, you wrote:
> 
>> Most often cards start directly with the volume boot sector at 
>> physical sector 0.
> 
> 
> I've tried to find some reliable infos on this topic and
> ended up with looking to other published code. They all
> seem to expect a partition table.
> 
>> I've mostly seen the partition sector on new cards, but if you format 
>> a card in Windows, it will normally NOT get a partition sector.
> 
> 
> During testing it took seconds for me to corrupt the
> file system on the card. So I reformatted on Win2k
> and WinCe (requiring an external tool, btw. PPCs
> can't do what every 50 bucks camera can do). All
> format variations created a partition table.
> 
> Anyway, I agree that cards without partition table
> should be supported. I'll look into it.

I did some experimenting with partitions....
If you reformat a card (in Windows) that already have a partition 
sector, it will be preserved. If the partition sector is damaged (I 
cleared it to 0), Windows will reformat the card without a partition 
sector and place the volume boot sector at physical sector 0.
There is no (easy) way to place a partition on a removeable drive (SD 
cards, CF cards e.t.c.) in Windows. Both the Disk Manager and the 
DISKPART tools does not allow that.
I have a lot of SD cards, some have the partition sector, some doesn't, 
so I think it's important that PHAT support both variants.


>> But, when fiddling with the httpd sample and my Nut 3, I found another 
>> problem.
>> The PHAT driver didn't implement dev_size causing _filelength to fail.
>> So, here's a solution for that :
> 
> 
> Oops, that reminds me of the email from Kroum Vassilev,
> who reported the same and provided this and possibly
> more fixes regarding HTTP using PHAT.

This was the only change I made in the httpd server, then HTTPD sample 
worked fine (after I added the registering of the PHAT, MMC and set 
HttpRoot to PHAT0:/
But I realized, when trying to use the sample dir from the httpd sample 
that PHAT does not support long filemames <shock> !

I suppose this is a planned feature ?

/Jesper



More information about the En-Nut-Discussion mailing list