Bochs cdrom

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
mobruan
Member
Member
Posts: 71
Joined: Thu Oct 09, 2008 8:25 am
Location: Rio de Janeiro - Brazil

Bochs cdrom

Post by mobruan »

Hi, how do i boot in bochs from a cd-rom?
Thanks
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Bochs cdrom

Post by Troy Martin »

Well, if you're using a physical CD, put in into your CD drive and edit your bochsrc config file to have something like this in it:

Code: Select all

ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata0-master: type=cdrom, path="x", status=inserted
Where "x" is the name of the drive that has the CD in it. Change your boot: something line to boot: cdrom and save it. It should boot now. I haven't used Bochs since 2.3.0 (mid-2006!)
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
mobruan
Member
Member
Posts: 71
Joined: Thu Oct 09, 2008 8:25 am
Location: Rio de Janeiro - Brazil

Re: Bochs cdrom

Post by mobruan »

Hi, and if i want to boot from image?
Thanks!
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: Bochs cdrom

Post by Troy Martin »

Replace the "x" with "imagename.iso" where imagename.iso is the filename of the image :P
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
mobruan
Member
Member
Posts: 71
Joined: Thu Oct 09, 2008 8:25 am
Location: Rio de Janeiro - Brazil

Re: Bochs cdrom

Post by mobruan »

Hi, didnt work. I think i need a program to generate a cd-rom image. Now i´m only chance the extension of the archive to .img.
what do you think?
thanks
User avatar
Masterkiller
Member
Member
Posts: 153
Joined: Sat May 05, 2007 6:20 pm

Re: Bochs cdrom

Post by Masterkiller »

Booting from CD is more complicated than booting a diskette. You should have a boot volume descriptor at sector 17 (or just somewhere between main volume descriptor in sector 16 and terminate descriptor). Boot volume descriptor points to special sector that describes LBA block from where to load, number of sectors to load and load address. Last two things are not always supported and load address is still 0x07C0:0x0000 (0x7C00) and only one sector is loaded (even only first 512 of the sector).
For more information click here: http://en.wikipedia.org/wiki/El_Torito_ ... _standard) and look somewhere in the external links.
.ISO file can be created manually (even using assembler). First 2048 bytes from the file are the first sector, secont 2048 are the second and so on.
ALCA OS: Project temporarity suspended!
Current state: real-mode kernel-FS reader...
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Bochs cdrom

Post by egos »

The standard provides boot block with size of 65535 512-byted sectors (usually just 4 sectors).
If you have seen bad English in my words, tell me what's wrong, please.
mobruan
Member
Member
Posts: 71
Joined: Thu Oct 09, 2008 8:25 am
Location: Rio de Janeiro - Brazil

Re: Bochs cdrom

Post by mobruan »

Hi, if diskete is more easie i´ll try it. What i have to write in the config file to boot from a diskete image?
Thanks
User avatar
samueldotj
Member
Member
Posts: 32
Joined: Mon Nov 13, 2006 12:24 am

Re: Bochs cdrom

Post by samueldotj »

Creating a grub bootable ISO is easy - see http://wiki.osdev.org/Mkisofs
User avatar
Walling
Member
Member
Posts: 158
Joined: Mon Dec 04, 2006 6:06 am
Location: Berlin, Germany

Re: Bochs cdrom

Post by Walling »

I use a .iso image myself in my "reseach" OS. All virtual machines support booting it. I do that because I won't develop a file system driver soon (ISO9660 format is complicated I hear); instead I ask GRUB to load the modules I need. In that sense .iso images are really easy.

You need to get GRUB Legacy compiled for El Torito boot. It is a file called stage2_eltorito. If you're using Linux and have GRUB installed, just find it in /usr/lib/grub/i386-pc/stage2_eltorito. If you're using Windows, google the file. Create a directory for your .iso image content. I'll call it "iso". Then create the directory structure needed for GRUB:

Code: Select all

iso/
  boot/
    you-can-put-your-kernel-here
    grub/
      stage2_eltorito
      menu.lst
In menu.lst you write something like this:

Code: Select all

default 0
timeout 10

title My kernel
kernel /boot/you-can-put-your-kernel-here
module /foo/bar/module ...
You don't have to use the "root" command. When GRUB boots in El Torito mode, the root is already set to "(cd)". Now create the .iso image using mkisofs / genisoimage, like this:

Code: Select all

mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o my_kernel.iso iso
That's it (beside adding the tasks to your Makefile). Boot it and enjoy.
Post Reply