flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Bochs and a few questions

Author
Thread Post new topic Reply to topic
joao_foscarini



Joined: 11 Jan 2005
Posts: 5
joao_foscarini
1) Anyone here use Bochs? I'm having trouble setting it up on Linux and help would be appreciated. Rolling Eyes

2) How do I write my boot loader to the sector 0x7C00 of the floopy? Any specific program?

3) Anyone know any decent ASM tutorial I could use to make my OS? (newbie)


Thanks in advance,

Joao

EDIT - Okay, I think I got it to work.. but...:
Quote:
Please choose one: [2] 5
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] Bochs x86 Emulator 2.2.pre2
00000000000i[ ] Build from CVS snapshot on March 25, 2005
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: no
00000000000i[ ] RepeatSpeedups support: no
00000000000i[ ] Icache support: no
00000000000i[ ] Host Asm support: yes
00000000000i[ ] Fast function calls: no
00000000000e[ ] No romimage to load. Is your bochsrc file loaded/valid ?
00000000000i[MEM0 ] allocated memory at 0xb5b2c008. after alignment, vector=0xb5b2d000
00000000000i[MEM0 ] 32.00MB
00000000000p[MEM0 ] >>PANIC<< ROM: System BIOS image undefined
00000000000i[SYS ] Last time is 0
00000000000i[ ] restoring default signal behavior
========================================================================
Bochs is exiting with the following message:
[MEM0 ] ROM: System BIOS image undefined
========================================================================
00000000000i[CTRL ] quit_sim called with exit code 1
Post 03 Apr 2005, 23:33
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
1) I think bochs is a horrible tool. lol

2) You write to the first sector of your floppy, but the bios will load your boot loader to the address 0x7c00h and start from there.
Post 04 Apr 2005, 00:13
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
joao_foscarini



Joined: 11 Jan 2005
Posts: 5
joao_foscarini
roticv wrote:
1) I think bochs is a horrible tool. lol

2) You write to the first sector of your floppy, but the bios will load your boot loader to the address 0x7c00h and start from there.


Heh.. I prefer to use bochs then having to reboot my computer to test everything I do.

I know, but how do I write to the first sector of the floopy? is there any program for Linux to do it? I've done it before on Windows, but I don't remember what program I used...
Post 04 Apr 2005, 00:20
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc
Try this to copy the bootsector to the file (change the word 'bootsector' to the name of your bootsector file):

Code:
dd if=bootsector of=/dev/fd0    
Post 04 Apr 2005, 01:09
View user's profile Send private message Visit poster's website Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc
Quote:
00000000000e[ ] No romimage to load. Is your bochsrc file loaded/valid?


That implies that there's a problem with your bochsrc file. Maybe wrong paths to the bios.bin and vgabios.bin files.
Post 04 Apr 2005, 01:15
View user's profile Send private message Visit poster's website Reply with quote
joao_foscarini



Joined: 11 Jan 2005
Posts: 5
joao_foscarini
Thanks.

Uhh.. about that problem, I downloaded the source code and runned ./configure && make && make install. I use Ubuntu Linux.. I might as well download from the Synaptic Package Manager...

Okay. I just did... now when I run, I get

Quote:
00000000000i[ ] installing x module as the Bochs GUI
00000000000i[ ] Bochs x86 Emulator 2.2.pre2
00000000000i[ ] Build from CVS snapshot on March 25, 2005
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: no
00000000000i[ ] RepeatSpeedups support: no
00000000000i[ ] Icache support: no
00000000000i[ ] Host Asm support: yes
00000000000i[ ] Fast function calls: no
00000000000e[ ] No romimage to load. Is your bochsrc file loaded/valid ?
00000000000i[MEM0 ] allocated memory at 0xb5b2c008. after alignment, vector=0xb5b2d000
00000000000i[MEM0 ] 32.00MB
00000000000p[MEM0 ] >>PANIC<< ROM: System BIOS image undefined
00000000000i[SYS ] Last time is 0
00000000000i[ ] restoring default signal behavior
========================================================================
Bochs is exiting with the following message:
[MEM0 ] ROM: System BIOS image undefined
========================================================================
00000000000i[CTRL ] quit_sim called with exit code 1

How do I 'define' it?
and that error still there. Hmm...

my bochsrc file:
Quote:
config_interface: textconfig
display_library: sdl
romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xf0000
megs: 32
vgaromimage: file=/usr/share/vgabios/vgabios.bin
floppya: 1_44=/dev/fd0, status=inserted
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata1: enabled=0, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9
#ata0-master: type=disk, path="", mode=flat, cylinders=1024, heads=16, spt=63
ata0-slave: type=cdrom, path="/dev/cdrom", status=inserted

boot: cdrom

ips: 1000000
floppy_bootsig_check: disabled=0
log: /dev/stdout
panic: action=ask
error: action=report
info: action=report
debug: action=ignore
debugger_log: -
com1: enabled=1, dev=/dev/ttyS0
parport1: enabled=1, file="/dev/lp0"
sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=/dev/stdout, dmatimer=600000
vga_update_interval: 300000
keyboard_serial_delay: 250
keyboard_paste_delay: 100000
floppy_command_delay: 500
mouse: enabled=1
private_colormap: enabled=0
#ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:00, ethmod=linux, ethdev=eth0
#keyboard_mapping: enabled=0, map=/usr/share/bochs/keymaps/x11-pc-de.map
#keyboard_type: mf
#user_shortcut: keys=ctrlaltdel
#magic_break: enabled=1
#cmosimage: cmos.img
#load32bitOSImage: os=nullkernel, path=../kernel.img, iolog=../vga_io.log
#load32bitOSImage: os=linux, path=../linux.img, iolog=../vga_io.log, initrd=../initrd.img
#i440fxsupport: enabled=1
usb1: enabled=1, ioaddr=0xFF80, irq=10
#text_snapshot_check: enable

I don't see any bios.bin decleared... hmm...
Post 04 Apr 2005, 01:37
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 212
Location: Budapest, Hungary
Endre
joao_foscarini wrote:
I don't see any bios.bin decleared... hmm...

That's the problem. You may look at /usr/local/share/..., since install path prefix is usually /usr/local by default. Bochs also has a little program (I don't remember its name now, and I'm not at home currently, but you will certainly find it) which makes an empty FD/HDD image file. You can copy (with dd) your bootsector program into it and have bochs boot from it. If you want to copy/delete files (other than bootsector) to/from this image file just mount it as loop device (man mount).
Post 04 Apr 2005, 12:25
View user's profile Send private message Reply with quote
joao_foscarini



Joined: 11 Jan 2005
Posts: 5
joao_foscarini
Endre wrote:
joao_foscarini wrote:
I don't see any bios.bin decleared... hmm...

That's the problem. You may look at /usr/local/share/..., since install path prefix is usually /usr/local by default. Bochs also has a little program (I don't remember its name now, and I'm not at home currently, but you will certainly find it) which makes an empty FD/HDD image file. You can copy (with dd) your bootsector program into it and have bochs boot from it. If you want to copy/delete files (other than bootsector) to/from this image file just mount it as loop device (man mount).

Hmm...

What is the little program that does that? and how exactly do I copy my bootsector program into it?
Post 05 Apr 2005, 20:32
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc
Quote:
romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xf0000


That would be the equivilent of bios.bin. On your system it's called BIOS-bochs-latest.
Post 06 Apr 2005, 22:46
View user's profile Send private message Visit poster's website Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 212
Location: Budapest, Hungary
Endre
Quote:
What is the little program that does that? and how exactly do I copy my bootsector program into it?

Its name is bximage. It's an interactive and easy to use tool. With this program you can create, for example, a floppy image, that you can copy your bootsector program to (assumed your bootsector program is my_boot.bin and your floppy image file is floppy.img) as follows:
Code:
dd if=my_boot.bin of=floppy.img bs=512 conv=notrunc    
Now you can mount it as a loop device:
Code:
mount floppy.img /mnt/floppy -t msdos -o loop    
Now you see your floppy.img normally under /mnt/floppy (or where you've mounted it). That means that you can copy/delete files to/from it as I already mentioned. You have to set this floppy.img in your .bochsrc to make bochs to be able to boot from it. If your newly developed system seems to work correctly under bochs then you may want to make a "real" test. You have to copy the whole image file onto a floppy. You can do it also with dd:
Code:
dd if=floppy.img of=/dev/fd0 bs=512    
...and reboot your machine from this floppy.
Post 09 Apr 2005, 12:42
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.