Article 6H1VX failed in creating bootable hdd image

failed in creating bootable hdd image

by
anctop
from LinuxQuestions.org on (#6H1VX)
Hi,

I am attempting to create a bootable hdd image which boots Syslinux and then chain loads FreeDOS.

At first I experiment with a physical hdd (/dev/sdb).
The procedure involves the following steps :
  1. Install the Syslinux MBR boot code.
    dd if=mbr.bin of=/dev/sdb bs=440 count=1 conv=notrunc
  2. Create a bootable partition (/dev/sdb1) of size 7MB and type 04 (FAT16 <32M).
  3. mkfs.fat /dev/sdb1
  4. Install the Syslinux boot loader.
    syslinux --install /dev/sdb1
  5. Mount "/dev/sdb1" at "/mnt"
    mount -t vfat /dev/sdb1 /mnt
  6. Copy the Syslinux modules "{chain,libutil,libcom32}.c32" to "/mnt"
  7. Copy the FreeDOS files "KERNEL.SYS" and "COMMAND.COM" to "/mnt"
  8. Create the file "/mnt/syslinux.cfg"
    Code:DEFAULT FreeDOS
    LABEL FreeDOS
    COM32 chain.c32
    APPEND fs freedos=/KERNEL.SYS
  9. umount /mnt
The resultant disk works as expected.

I proceed to repeat the procedure on an image file.
  1. dd if=/dev/zero of=FD.img bs=1M count=8
  2. losetup /dev/loop0 FD.img
  3. dd if=mbr.bin of=/dev/loop0 bs=440 count=1 conv=notrunc
  4. Create a bootable partition on "/dev/loop0" of size 7MB and type 04 (FAT16 <32M).
    "fdisk" reports that the partition starts at sector 2048.
  5. losetup -d /dev/loop0
    losetup -o 1048576 /dev/loop1 FD.img
  6. mkfs.fat /dev/loop1
  7. syslinux --install /dev/loop1
  8. mount /dev/loop1 at /mnt
  9. Copy the Syslinux and FreeDOS files to "/mnt"
  10. Create the file "/mnt/syslinux.cfg" as before
  11. umount /mnt
  12. losetup -d /dev/loop1
The resultant image file is then moved to a bootable device with a working copy of Syslinux (with module MEMDISK included).
When I try to load the image with the command :
Code:memdisk initrd=FD.img harddisk rawThe procedure halts at the step showing
Code:Loading boot sector... booting...Could someone kindly advise ?
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments