bochs booting

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
0xBADC0DE

bochs booting

Post by 0xBADC0DE »

does anyone know how to set up a bochs config file so that it boots from an image file instead of a floppy disk because i do not have a floppy disk on my laptop.
Slasher

Re:bochs booting

Post by Slasher »

In your bochsrc.txt file, under FLOPPYA section put a '#' infront of
all of them
...
...

#floppya: 1_44=a:, status=inserted
and remove the '#' infront of
floppya: 1_44=floppy.img, status=inserted

This will make bochs look for a file named floppy.img in the current directory and use this as floppy a:
you can use any filename you like, just make sure the file actually exists.
Since you don't have a floppy drive, you will need a program to create the disk image from you Os files. Winimage is a good one.
http://members.aol.com/gvollant/winimage.htm

If you get winImage, to make a bootable floppy image
click on new(or select new from the file menu), then choose 1.44Mb under standard format. Then click on Image menu and select boot sector properties. Click on open and select your boot sector file.Then click on OK.
After that all you have to do is drag and drop the files that are required to run you os. or use the Inject option under the Image menu to to it.

Peace ;D
0xBADC0DE

Re:bochs booting

Post by 0xBADC0DE »

ok i made the image file and i tried to boot it using bochs. bochs boots it but nothing ever gets printed to the screen when i try to write to video memory. i tried someone else's hello world bootloader and it also did not print to the bochs screen. is there something wrong with my bochsrc file?

Code: Select all

megs: 32

romimage: file=BIOS-bochs-latest, address=0xf0000
vgaromimage: VGABIOS-elpin-2.40

floppya: 1_44=floppy.img, status=inserted

boot: a

log: bochsout.txt

0xBADC0DE

Re:bochs booting

Post by 0xBADC0DE »

or maybe i have to enable a20 before writing to vid memory?
0xBADC0DE

Re:bochs booting

Post by 0xBADC0DE »

here is my bootloader that im just trying to get to print a letter:

Code: Select all

[org 0x0]
[bits 16]

stage1:
mov ax, 0x7c0
mov cs, ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
jmp stage2

stage2:
mov ax, 0x9000
mov ss, ax
mov sp, 0x1000
jmp stage3

stage3:
mov ax, 0xb800
mov es, ax
mov di, 0x0
mov byte [es:di], 'j'
inc di
mov byte [es:di], 0x07

hang:
jmp hang


msg1 db '#bootloader loaded->0x7c00'
msgdone db 'done'

times 510-($-$$) db 0
sig dw 0xAA55
pini

Re:bochs booting

Post by pini »

You don't have to deal with the A20 line since the video memory is located below the first MB.

Could you post the bochs output ?
0xBADC0DE

Re:bochs booting

Post by 0xBADC0DE »

bochs output: (i am trying this on a laptop. im not sure if laptops are different from desktops in terms of osdevving)

00000000000i[ ] Bochs x86 Emulator 2.1.pre2
00000000000i[ ] Build from CVS snapshot on November 27, 2003
00000000000i[ ] System configuration
00000000000i[ ] processors: 1
00000000000i[ ] A20 line support: yes
00000000000i[ ] APIC support: no
00000000000i[ ] CPU configuration
00000000000i[ ] level: 5
00000000000i[ ] fpu support: yes
00000000000i[ ] paging support: yes, tlb enabled: yes
00000000000i[ ] mmx support: yes
00000000000i[ ] sse support: no
00000000000i[ ] v8086 mode support: yes
00000000000i[ ] 3dnow! support: no
00000000000i[ ] PAE support: no
00000000000i[ ] PGE support: no
00000000000i[ ] PSE support: no
00000000000i[ ] x86-64 support: no
00000000000i[ ] SEP support: no
00000000000i[ ] Optimization configuration
00000000000i[ ] Guest2HostTLB support: yes
00000000000i[ ] RepeatSpeedups support: yes
00000000000i[ ] Icache support: yes
00000000000i[ ] Host Asm support: yes
00000000000i[MEM0 ] allocated memory at 012E0020. after alignment, vector=012E1000
00000000000i[MEM0 ] 32.00MB
00000000000i[MEM0 ] rom at 0xf0000/65536 ('BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/32768 ('VGABIOS-elpin-2.40')
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Tue Dec 23 14:00:19 2003 (time0=1072206019)
00000000000i[DMA ] channel 4 used by cascade
00000000000i[DMA ] channel 2 used by Floppy Drive
00000000000i[FDD ] fd0: 'floppy.img' ro=0, h=2,t=80,spt=18
00000000000i[WGUI ] IME disabled
00000000000i[VGA ] interval=30000
00000000000i[VGA ] VBE Bochs Display Extension Enabled
00000000000i[ ] init_mem of 'harddrv' plugin device by virtual method
00000000000i[ ] init_mem of 'keyboard' plugin device by virtual method
00000000000i[ ] init_mem of 'serial' plugin device by virtual method
00000000000i[ ] init_mem of 'parallel' plugin device by virtual method
00000000000i[ ] init_mem of 'extfpuirq' plugin device by virtual method
00000000000i[ ] init_mem of 'gameport' plugin device by virtual method
00000000000i[ ] init_dev of 'harddrv' plugin device by virtual method
00000000000i[HD ] Boot device will be 'a'
00000000000i[HD ] Floppy boot signature check is enabled
00000000000i[ ] init_dev of 'keyboard' plugin device by virtual method
00000000000i[KBD ] will paste characters every 1000 keyboard ticks
00000000000i[ ] init_dev of 'serial' plugin device by virtual method
00000000000i[SER ] com1 at 0x03f8 irq 4
00000000000i[ ] init_dev of 'parallel' plugin device by virtual method
00000000000i[PAR ] parallel port 1 at 0x378 irq 7
00000000000i[ ] init_dev of 'extfpuirq' plugin device by virtual method
00000000000i[ ] init_dev of 'gameport' plugin device by virtual method
00000000000i[ ] reset of 'harddrv' plugin device by virtual method
00000000000i[ ] reset of 'keyboard' plugin device by virtual method
00000000000i[ ] reset of 'serial' plugin device by virtual method
00000000000i[ ] reset of 'parallel' plugin device by virtual method
00000000000i[ ] reset of 'extfpuirq' plugin device by virtual method
00000000000i[ ] reset of 'gameport' plugin device by virtual method
00000004049i[BIOS ] rombios.c,v 1.102 2003/11/25 22:56:11 cbothamy Exp $
00000330064i[KBD ] reset-disable command received
00000390000i[WGUI ] dimension update x=720 y=400 fontheight=16 fontwidth=9 bpp=8
00002359147e[HD ] device set to 0 which does not exist
00002359440e[HD ] device set to 1 which does not exist
0xBADC0DE

Re:bochs booting

Post by 0xBADC0DE »

ok i wrote the bin file to a floppy disk and tried to boot from it on my desktop and it worked. so either my laptop has a different video memory address or bochs on my laptop is not configured properly. i am trying to set up my laptop to be the computer i write it on as well as test it.
0xBADC0DE

Re:bochs booting

Post by 0xBADC0DE »

is the video memory location on laptops different than desktops?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:bochs booting

Post by Pype.Clicker »

bochs will simply ignore where your pc video memory is and is likely to offer it through 0xB8000.

I don't think video memory is at another position on laptops, except for monochrome laptops (where it's at 0xB0000 according to PC VGA standards)

One thing that may occur is that your laptop is not booting in text but rather in graphical mode. If this is the case and if you're not resetting to mode 3 (for instance) using VGA INT10, the 0xB8000 is ignored and the bitmap (should be 0xA0000, but it could also be using some linear-framebuffer at the discretion of the BIOS) is used instead ...
Slasher

Re:bochs booting

Post by Slasher »

You can't do
mov cs,ax

instead do

Code: Select all

[section .text]
[bits 16]
org 0x7c00

push cs
pop ds
....
....
the Bochs error seems to indicate that the Hd is not available. Do you have any definitions for harddisk images enabled. if so make them comments by placing a '#' infront of them.
0xBADC0DE

Re:bochs booting

Post by 0xBADC0DE »

codeslasher: would the definitions be in the bochssrc.txt file? if so, i posted my current bochssrc file earlier in this thread that i am using
Slasher

Re:bochs booting

Post by Slasher »

Its copmplaining that a device (HD) is being set which doesn't exist.
Try this one.

[attachment deleted by admin]
Post Reply