Page 1 of 1

boot from cd [fixed]

Posted: Mon Jan 01, 2007 9:08 pm
by GLneo
hi all, i have a boot loader that boots from a floppy disk but i want to boot from a cdrom, does the bios have a function for this and how do i use it.

my old code is attached...

thx

Posted: Mon Jan 01, 2007 9:33 pm
by Brynet-Inc
Well.. You could try reading up on the El Torito standard.

http://www.phoenix.com/NR/rdonlyres/98D ... scdrom.pdf

I should also note that since BSD and Linux offer bootable cdroms, Their bootloaders are usually open source.

http://www.openbsd.org/cgi-bin/cvsweb/s ... nd/cdboot/
http://www.kernel.org/git/?p=boot/sysli ... olinux.asm (See line 297 onward..)

Nothing wrong with also reading up on:
BIOS INT 13 Specifications, including any extensions.
ATAPI Specifications and the ISO 9660 Specification.

Posted: Tue Jan 02, 2007 5:20 am
by Otter
To boot from cd using El Torito is very easy. You need a bootloader image like when you're booting from floppy, with a few differences:
1) the boot image can be larger than 512 Byte
2) you dont need the 55AA in the end

In general, the image is loaded at address 0x7C00, but El Torito allows to select another base address. The simplest is to use a ISO9660 creator like mkisofs oder UltraISO or whatever.

Posted: Tue Jan 02, 2007 6:12 am
by Combuster
The easiest thing to do is to create a floppy image (you might already have it), then instruct mkisofs to make an el-torito emulation CD
From my makefile:

Code: Select all

mos.iso: floppy.img
        -mkdir cd
        cp floppy.img cd
        mkisofs -o mos.iso -A MOSCD -b floppy.img cd
        rm -r -f cd/*
        rmdir cd
i.e. create a empty dir (cd), stuff in there whatever you want on the cd (incl image)
call mkisofs:
-o mos.iso = the output is mos.iso
-A MOSCD = the CD label
-b floppy.img = your bootloader
cd = the directory to get everything
after that i remove the temporary directory.

The result is a CD (image) that boots as if it were a floppy.

(Note: El-Torito emulation isnt the same as no-emulation El-Torito. some bioses seem to support one but not the other)

Posted: Tue Jan 02, 2007 10:24 am
by Dex
The KISS way to do it , is to open up your cd burn software and click on the make bootable (some time in the new projects), it will pop up a window asking for a bootable floppy image point it to your floppy image then burn it and that's it you have a bootable cd.

PS: Make sure your BIOS is set to boot from CD before hdd.

Posted: Tue Jan 02, 2007 10:55 am
by GLneo
i like Combuster idea, but does floppy.img have to know its on a cd? becouse my boot loader trys to load the kernel from floppy?, well i'll just try it

thx everyone!

Posted: Tue Jan 02, 2007 10:58 am
by Combuster
GLneo wrote:i like Combuster idea, but does floppy.img have to know its on a cd? becouse my boot loader trys to load the kernel from floppy?, well i'll just try it
Nope. Like i said, it boots from the cd as if it were an actual floppy. (unless you do low level hardware access or tell the bios to end the emulation)

Posted: Tue Jan 02, 2007 11:26 am
by GLneo

Code: Select all

root@COMPUTER:~# mkdir cd
root@COMPUTER:~# cp a.img cd
root@COMPUTER:~# mkisofs -o LOS.iso -A LemonOS -b a.img cd
Size of boot image is 56 sectors -> mkisofs: Error - boot image 'cd/a.img' has not an allowable size.
root@COMPUTER:~#
what does this mean???

Posted: Tue Jan 02, 2007 11:32 am
by Combuster
your floppy image is 'wrong' in the sense that it isnt 1.44MB (2880 sectors). You'll have to append zeroes to it

Posted: Tue Jan 02, 2007 11:33 am
by GLneo
o i see, what comand would do that?

Posted: Wed Jan 03, 2007 3:43 pm
by GLneo
solved it!, i made an addition to makeboot: "attached"

Re: boot from cd [fixed]

Posted: Tue Jan 16, 2007 11:22 am
by forkart
GLneo wrote:hi all, i have a boot loader that boots from a floppy disk but i want to boot from a cdrom, does the bios have a function for this and how do i use it.

my old code is attached...

thx
you can try to use magiciso to make bootable iso image from bootable floppy disk. Just read guide below.
http://www.magiciso.com/FAQ/FAQ0006.htm

Posted: Sun Jan 21, 2007 8:09 pm
by kataklinger
Word of the warnning:
If you use 'No emulation' mode you should know that you specify size of boot image, which is going to be loaded into memory, in _sectors_ ! Specification says that _sector_ size is 2048 bytes not 512 (_virtual_sector_ size is 512), but some BIOSes use _virtual_sector size and others use _sector_ size to calculate total size of boot image.
I hate those guys!