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

Michael McConnell soruk at eridani.co.uk
Sat Nov 1 13:45:03 PDT 2008


On Sat, 1 Nov 2008, Radio Tron wrote:

> 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 ]

Do you have qemu installed, and do you have a Knoppix disc or ISO? If so, 
try:
1. qemu-img create -f raw myImage 50M
2. qemu -boot d -hda myImage -cdrom /path/to/knoppix.iso (or /dev/cdrom)

The Knoppix session within QEMU will see your hard disc image as an IDE hard 
disc, so you can partition it with fdisk, run mkdosfs on it, and install grub 
as if you were working with a real hard disc.

QEMU will also take care of the disc geometry for you.

Hope that helps.

-- Michael "Soruk" McConnell
    Eridani Star System

    MailStripper - http://www.MailStripper.eu/ - SMTP spam filter




More information about the Syslinux mailing list