[syslinux] Patching your own boot-disk from first principles

Radio Tron paleywiener at yahoo.com
Sat Nov 1 12:12:59 PDT 2008


Hi,
I'm trying to build a bootable MSDOS disk and put it on a ISO with floppy and hard disk emulation. I want to use commonly available Linux tools like dd, losetup, mkdosfs, memdisk etc.

I have done the following:
1. dd if=/dev/zero of=myImage bs=1M count=50 [ Builds a 52MB image ]
2. losetup /dev/loop0 myImage [Links /dev/loop0 to myImage file ]
3. vi /grub/stage1; %!xxd; [ NULL the partion tablei within stage1 ];
   %!xxd -r;
4. cat /grub/stage1 /grub/fat_stage1_5 > /dev/loop0 [ Puts
   the GRUB boot loader into the MBR of the image and stage1_5 after 
   that ]
5. fdisk /dev/loop0 [ I use this to create a new single partition ]

I now have a hard disk image of 52MB with a single partition on it, and a MBR with GRUB?? Unfortunately I know of no way to format that partition as a MSDOS file system, and populate it with the DOS files and the DOS partition boot loader.

Could someone point me to docs that explain:
1. When I fdisk /dev/hda and print the partition table - how Cylinder values (Start/End) can be used to identify the start of a partition in bytes.
2. Where a MBR starts, what follows that, what is at the start of a partition, how a MSDOS boot loader loads a DOS system file, what system file is loaded (MSDOS)?
3. How I might install GRUB to a file which is acting as a block device (/dev/loop0)

[The reason I'm doing all this is because I've been playing with Symantec Ghost 2.55. They have some app to generate bootable images (PXE, CD boot). The bootable images don't load, apparently due to some problem with the way the images are being built! I dumped out the FAT16 file system that they were using, and want to stitch it back together.]

Could someone advice and help. I'm pretty much a noob and didn't know what my MBR contained until two days back. I'm trying to understand, solidly and clearly, how ISO's, floppy's, HD's and PXE's boot with MSDOS and with Linux. What offsets contain what.. stuff like that..


      




More information about the Syslinux mailing list