FAT16
Posted: Sun Jun 30, 2013 1:24 am
Hi all,
I decided it was time to implement the FAT16 filesystem in my OS. I have setup the BPB successfully.
I dd my bootsector (followed by 999.5KiB of zeroes) to a usb flash drive, then set the word directly after the bootsector (first FAT entry) to 0xFFF0 and the word at the second FAT entry to 0xFFFF (end of file). The first part of the flash drive then looks like this:
Then I mount the device in ubuntu, copy my stage 2 "STAGE2.BIN", which is 457 bytes in size, to the drive. This results in the third entry of the FAT being set to 0xFFF0???? What is going on here?
This is my BPB (set up for a 1MiB volume):
I decided it was time to implement the FAT16 filesystem in my OS. I have setup the BPB successfully.
I dd my bootsector (followed by 999.5KiB of zeroes) to a usb flash drive, then set the word directly after the bootsector (first FAT entry) to 0xFFF0 and the word at the second FAT entry to 0xFFFF (end of file). The first part of the flash drive then looks like this:
Code: Select all
e9 ab 00 53 6b 75 78 4f 53 00 00 00 02 01 01 00 02 00 02 00 08 f0 08 00 00 00 00 00 00
00 00 00 00 00 00 00 80 00 29 0f a7 01 53 53 6b 75 78 4f 53 20 44 69 73 6b 46 41 54 31
36 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 82 00 07 00 82 80 45 72
72 6f 72 20 6c 6f 61 64 69 6e 67 20 73 65 63 74 6f 72 28 73 29 0d 0a 00 53 54 41 47 45
32 20 20 42 49 4e 4b 45 52 4e 45 4c 20 20 42 49 4e 53 79 73 74 65 6d 20 66 69 6c 65 73
20 6d 69 73 73 69 6e 67 0d 0a 00 53 74 61 67 65 32 20 4c 6f 61 64 65 64 00 00 00 00 00
88 16 54 7c b8 e0 07 fa 8e d0 bc 00 04 fb 31 c0 8e d8 b8 20 00 f7 26 11 7c f7 36 0b 7c
89 c1 a1 10 7c f7 26 16 7c 03 06 0e 7c a3 ac 7c 31 d2 8b 1e 52 7c 86 c1 e8 9e 00 8b 0e
11 7c 8b 3e 52 7c 51 b9 0b 00 be 6f 7c 57 f3 a6 5f 74 08 59 83 c7 20 e2 ed eb 6d 8b 45
1a a3 aa 7c 8b 0e 0e 7c 31 c0 a0 10 7c f7 26 16 7c 31 d2 8b 1e 52 7c e8 65 00 8b 1e 50
7c a1 aa 7c 83 e8 02 0f b6 16 0d 7c f7 e2 03 06 ac 7c 89 c1 31 d2 a0 0d 7c e8 46 00 a1
aa 7c d1 e0 03 06 52 7c 89 c3 8b 17 83 fa f8 7d 11 89 16 aa 7c a1 0d 7c f7 26 0b 7c 01
06 50 7c eb be be 9c 7c e8 11 00 fa f4 ea 00 07 00 00 fa f4 be 85 7c e8 02 00 fa f4 b4
0e ac 3c 00 74 04 cd 10 eb f5 c3 a2 40 7c 89 1e 42 7c 89 16 44 7c 88 0e 46 7c 8a 16 54
7c be 3e 7c b4 42 cd 13 72 01 c3 be 55 7c e8 d1 ff fa f4 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa f0 ff ff ff 00 00 00 00 00 00....... (zeroes)
This is my BPB (set up for a 1MiB volume):
Code: Select all
db 'SkuxOS',0x00,0x00 ;OEM identifier
bpbBytesPerSector dw 512 ;bytes per sector
bpbSectorsPerCluster db 1 ;sectors per cluster
bpbReservedSectors dw 1 ;number of reserved sectors
bpbNumberOfFATS db 2 ;number of FATs
bpbRootDirectoryEntries dw 512 ;number of root directory entries
dw 2048 ;number of sectors (1 MiB disk = 512*2048 bytes)
db 0xF0 ;media descriptor
bpbSectorsPerFAT dw 8 ;sectors per FAT
dw 0 ;sectors per track
dw 0 ;number of heads
dd 0 ;hidden sectors
dd 0 ;number of sectors (only used if disk size > 32MiB)
db 0x80 ;drive number
db 0 ;reserved
db 0x29 ;extended boot signature
dd 0x5301A70F ;serial number
db 'SkuxOS Disk' ;volume label
db 'FAT16', 0x00, 0x00, 0x00