How a bootloader can read a DVD(cd)?

2019-02-27 03:58发布

I have a first stage bootloader written in assembly. I need that it loads the second stage bootloader from dvd(or cd). I only found examples where it reads from floopy or hdd. The interrupt used there is 13h. In the interrupt description it says that it can read floppies and hdd's. i've tried to use 13h to read a CD as if it was a floppy but it did not work.

Question: is there a difference between floppies and dvd's (in the sense of accessing them), can i use CHS(cilinder, head, sector), what its the sector size, can i use the 13h instruction to correctly read a dvd. maybe some examples. I've looked at LILO's source code and found only 13h there so it must work. Thanks.

3条回答
Ridiculous、
2楼-- · 2019-02-27 04:35

You can make a bootable CD out of a bootable floppy image file with the mkisofs tool. Here's how I do it under Windows:

  1. Create a subdirectory, CdFiles, containing a bootable floppy image file, floppy.img (1474560 bytes long), and any other files that I want on the CD.
  2. mkisofs.exe -b floppy.img -v -r -l -o cd.iso CdFiles

It will create a CD ISO image file, cd.iso, which you can either burn on a CD and boot from the disk or use in any PC emulator and boot directly from the image.

The BIOS will emulate a floppy drive on the CD with the contents of floppy.img and it will be able to access itself normally via int 13h using drive number 0. In order to access the entire CD via int 13h you will need to create a hard drive image (bootable) and specify a different emulation method (not sure how to do it with mkisofs, never tried hdd images). The same will happen, but now a hard drive will be emulated on top of the CD and it will be drive number 80h for int 13h.

查看更多
Summer. ? 凉城
3楼-- · 2019-02-27 04:37

LILO doesn't work for booting from CDs, so I wouldn't expect it to contain any code for reading those. Try taking a look at the ISOLINUX bootloader, which is what's most often used on Linux boot CDs.

查看更多
Anthone
4楼-- · 2019-02-27 04:47

A bootloader loads from DVD - it loads from floppy or hard disc. The DVD / CD runs in emulation mode and exposes a floppy / disc during the boot process

查看更多
登录 后发表回答