creating the floppy image and booting with bochs.

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
eXeCuTeR
Member
Member
Posts: 63
Joined: Tue Dec 09, 2008 12:43 pm

creating the floppy image and booting with bochs.

Post by eXeCuTeR »

I'm trying to create a floppy image in order to boot my kernel (and not used a pre-made floppy image!)
I've created a new directory named /mnt and a new image called floppy.img and did the following:

Code: Select all

dd if=/dev/zero of=floppy.img bs=1024 count=1440
sudo /sbin/losetup /dev/loop0 floppy.img
sudo mkfs -t ext2 /dev/loop0
sudo mount -t ext2 /dev/loop0 /home/executer/Desktop/paging/mnt
sudo cp src/kernel /home/executer/Desktop/paging/mnt/kernel
cd mnt
sudo mkdir grub
sudo cp /usr/lib/grub/i386-pc/stage[12] /home/executer/Desktop/paging/mnt/grub
sudo grub --device-map=/dev/null
sudo umount /dev/loop0
sudo /sbin/losetup -d /dev/loop0
sudo bochs -f bochsrc.txt
bochsrc.txt is supposed to tell Bochs to load floppy.img,

Code: Select all

megs: 32
romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0x00000
vgaromimage: /usr/share/bochs/VGABIOS-elpin-2.40
floppya: 1_44=floppy.img, status=inserted
boot: a
log: bochsout.txt
mouse: enabled=0
clock: sync=realtime
cpu: ips=500000
but apparently this is not working! Bochs tries to boot from floppy and then it says that there's no bootable device!
(i also tried qemu -fda floppy.img, and still it said "No bootable device.")
Please help out guys, thanks.
(I've gotta mention that i've created a grub directory in the mnt dir and put stage 1, stage 2 in it...and i also installed grub in /dev/loop0 this way:

Code: Select all

grub --device-map=/dev/null
grub> device (fd0) /dev/loop0
grub>root (fd0)
// root(fd0) produced: Unknown partition table signature
grub> setup (fd0)
// setup(fd0) produced:
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... no
 Running "install /grub/stage1 (fd0) /grub/stage2 p /grub/menu.lst "... succeed
ed
Done.
)
Last edited by eXeCuTeR on Sat Dec 20, 2008 4:42 am, edited 3 times in total.
Ztane
Posts: 9
Joined: Sun Jan 14, 2007 12:43 pm
Location: Oulu, Finland

Re: creating the floppy image and booting with bochs.

Post by Ztane »

Ahem, so you have /dev/loop0 in your bochsrc? Bochs uses disk image files as is, so why not try replace that with floppy.img?
eXeCuTeR
Member
Member
Posts: 63
Joined: Tue Dec 09, 2008 12:43 pm

Re: creating the floppy image and booting with bochs.

Post by eXeCuTeR »

Ztane wrote:Ahem, so you have /dev/loop0 in your bochsrc? Bochs uses disk image files as is, so why not try replace that with floppy.img?
Yeah, floppy.img is in there, not /dev/loop0.
Hangin10
Member
Member
Posts: 162
Joined: Wed Feb 27, 2008 12:40 am

Re: creating the floppy image and booting with bochs.

Post by Hangin10 »

Once you have one floppy image with a filesystem containing /boot/grub/stage1&2, and one image that starts with stage1+2, perhaps use floppya for the bootable image, and floppyb for the filesystem one, and then boot bochs and go root (fd1) / setup (fd1), and you're good to go (along with my grammar apparently, that sentence was horrible! #-o ).
geppy
Member
Member
Posts: 27
Joined: Wed Jun 11, 2008 5:30 pm

Re: creating the floppy image and booting with bochs.

Post by geppy »

either Bochs can't find floppy.img or it can't find signature 0aa55h at the end of first 512bait of the floppy image (check with hex editor).
User avatar
kasper
Posts: 19
Joined: Sun Apr 27, 2008 7:59 am
Location: The Netherlands, Amersfoort
Contact:

Re: creating the floppy image and booting with bochs.

Post by kasper »

Hi eXeCuTeR and others,

I use:

Code: Select all

grub> install (fd0)/grub/stage1 (fd0) (fd0)/grub/stage2 (fd0)/grub/menu.lst
instead of the

Code: Select all

Running "install /grub/stage1 (fd0) /grub/stage2 p /grub/menu.lst "... succeeded
that

Code: Select all

grub> setup (fd0)
produces.

Until now I ran grub install from within bochs. Via an auxilary disk created with dd. But directly running grub on a loop device is easier. Thanks for this question.

Kasper
Post Reply