I followed the steps outlined on the Loopback_Device wiki entry to create and format the image file. The fdisk print-out of the partition table:
The bootstrap program is just simply prints hello world and hangs, the important part is the BPB, which comes straight from QUASI, is as follows:Disk hdd.img: 51 MB, 51609600 bytes
16 heads, 63 sectors/track, 100 cylinders, total 100800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x308a691d
Device Boot Start End Blocks Id System
hdd.img1 * 2048 100799 49376 c W95 FAT32 (LBA)
According to the wiki MBR, when fdisk partitions a drive it will install an MBR which does the following:OEM_ID db "AABBCCDD"
BytesPerSector dw 0x0200
SectorsPerCluster db 0x08
ReservedSectors dw 0x0020
TotalFATs db 0x02
MaxRootEntries dw 0x0000
NumberOfSectors dw 0x0000
MediaDescriptor db 0xF8
SectorsPerFAT dw 0x0000
SectorsPerTrack dw 0x003D
SectorsPerHead dw 0x0002
HiddenSectors dd 0x00000000
TotalSectors dd 0x00FE3B1F
BigSectorsPerFAT dd 0x00000778
Flags dw 0x0000
FSVersion dw 0x0000
RootDirectoryStart dd 0x00000002
FSInfoSector dw 0x0001
BackupBootSector dw 0x0006
TIMES 13 DB 0 ;jumping to next offset
DriveNumber db 0x00
Signature db 0x29
VolumeID dd 0xFFFFFFFF
VolumeLabel db "AABBCCDDEEF"
SystemID db "FAT32 "
The MBR that FDISK uses is coded to:
- relocate itself to 0x0000:0x0600
- examine the byte at offset 0x1be, 0x1ce, 0x1de, and 0x1ee to determine the active partition
- load only the first sector of the active partition (which is expected to contain a DOS bootsector) to 0x0000:0x7c00 (hence the previous relocation)
- set SI
- jump to 0x7c00 -- transferring control to the DOS bootsector.
I have attempted this with:
and also with a seek value of 2047 in case that dd would seek past 2047 and then start writing at 2048. But unfortunately neither of these attempts work.dd if=boot of=hdd.img seek=2048 conv=notrunc
After copying the new sector across the image can still be mounted and written to, but if I boot it there is no "Hello World".
Either one of my steps is wrong or I am missing a step.
I was hoping that someone here could shine some light on the subject for me?
Thanks for your time in reading.
Andy