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

Radio Tron paleywiener at yahoo.com
Sun Nov 2 07:05:56 PST 2008


heh, If you are going to resort to shameless self-aggrandization how can I refuse <g> just kidding! <g> Thanks awfully. Actually, I had posted to the gPXE list and Marty Connor (Etherboot) suggested I try SYSLINUX's memdisk: (gPXE->pxelinux->memdisk->GRUB+IMAGE). The reason for GRUB in the image is because it seems more flexible (I can add a GRUB passwd, and can boot into Windows/Linux on HD/floppy/USB or re-edit the GRUB cmd line and boot anything..

Trouble is, I'm not able to build a proper MSDOS-IMAGE with HD/Floppy emulation
because I don't understand how all this works. The QEMU tip is neat, however I
would like to learn about the inner workings, and use basic tools like fdisk,
dd and perl and not let Knoppix do all the work :p

The "Hacking GRUB" section within the GRUB docs, has the structure of Master
Boot Record, and format of partition tables sections missing.. I tried editing
the defective HD-Image file that Symantec creates, and inserted GRUB stage1 and
fat_stage1_5 at sectors 1, 2. Then I dumped the FAT16 FS that was embedded at
sectors 63-end, mounted that, created /boot/grub and copied stage2 and a
menu.lst file.Also copied stage2 to / and /boot (just to be safe). Then
repatched the Symantec image with the new FS. Then mkisofs, and when i boot I
get: GRUB GRUB GRUB, in an endless stream! Which probably means stage2 is not
loading - but what am I doing wrong???

I also tried stage1, stage2 at sectors 1,2. That works but, at the GRUB
prompt: NULL (<TAB>   lists devices: fd0 fd1.. fd6 hd0, and rootnoverify(fd0);
chainloader +1; boot(fd0) b0rks.. Probably implies that HD emulation is kaput
because stage2 nuked things (exceeds sectors 2-63)

mkisofs -b osboot.img -hard-disk-boot -o osboot.iso ./
Gives me: "Size of boot image is 48132 sectors -> Emulating a hard disk
Warning: image size does not match geometry (48195)"

Should I increase the size of the partition by 63 sectors? I tried
dd if=/dev/zero count=63>>osboot.img but that didn't work because fdisk
osboot.img continues to reports 24066 blocks instead of 24098. I deleted the
partition in fdisk but couldn't recreate it with 24098 blocks.

Quite frankly, I need too much help :) It's better if you guys could point me to the docs. I've already checked out the GRUB docs.. dunno what else to look at.. src may be beyond me..


      




More information about the Syslinux mailing list