OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 2:11 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: creating the floppy image and booting with bochs.
PostPosted: Fri Dec 19, 2008 1:49 pm 
Offline
Member
Member

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

Top
 Profile  
 
 Post subject: Re: creating the floppy image and booting with bochs.
PostPosted: Fri Dec 19, 2008 4:55 pm 
Offline

Joined: Sun Jan 14, 2007 12:43 pm
Posts: 9
Location: Oulu, Finland
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?


Top
 Profile  
 
 Post subject: Re: creating the floppy image and booting with bochs.
PostPosted: Fri Dec 19, 2008 4:59 pm 
Offline
Member
Member

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


Top
 Profile  
 
 Post subject: Re: creating the floppy image and booting with bochs.
PostPosted: Mon Dec 22, 2008 10:43 pm 
Offline
Member
Member

Joined: Wed Feb 27, 2008 12:40 am
Posts: 162
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 ).


Top
 Profile  
 
 Post subject: Re: creating the floppy image and booting with bochs.
PostPosted: Tue Dec 23, 2008 1:39 am 
Offline
Member
Member

Joined: Wed Jun 11, 2008 5:30 pm
Posts: 27
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).


Top
 Profile  
 
 Post subject: Re: creating the floppy image and booting with bochs.
PostPosted: Tue Dec 23, 2008 2:18 am 
Offline
User avatar

Joined: Sun Apr 27, 2008 7:59 am
Posts: 19
Location: The Netherlands, Amersfoort
Hi eXeCuTeR and others,

I use:
Code:
grub> install (fd0)/grub/stage1 (fd0) (fd0)/grub/stage2 (fd0)/grub/menu.lst

instead of the
Code:
Running "install /grub/stage1 (fd0) /grub/stage2 p /grub/menu.lst "... succeeded

that
Code:
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot], SemrushBot [Bot] and 103 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group