Page 1 of 2
Real mode problem
Posted: Wed Mar 19, 2008 11:41 am
by Danand
Hi!
I use linux and code my own os. I have writen a simple kernel and need to load it!
I have trying many many many many boot loaders but nobody of them work! I have qemu, bochs dont work here. Must i take boot.bin and kernel.bin in a img fil so then load it whit qemu, or use an other boot loader?
Posted: Wed Mar 19, 2008 1:43 pm
by bewing
If you are starting by writing the kernel, then you really should be using GRUB for your bootloader. Do you know why bochs is not working? It should. If bochs + GRUB is not working, then something is probably very wrong with your computer.
Posted: Wed Mar 19, 2008 2:37 pm
by Danand
Work grub in real mod? Then how? I don't now how to use bochs, i can't find no guide to get bochs to work!
Posted: Wed Mar 19, 2008 3:13 pm
by JamesM
I don't now how to use bochs, i can't find no guide to get bochs to work!
Then you have not searched thoroughly enough. Hint - check my signature.
Posted: Wed Mar 19, 2008 3:36 pm
by Danand
Now i just get errors in bochs..
Posted: Wed Mar 19, 2008 3:38 pm
by nekros
check the signature, awesome tutorials.
Posted: Wed Mar 19, 2008 3:59 pm
by Danand
I have done that! But im trying to remove and installing it agin, mayby its help
Posted: Wed Mar 19, 2008 4:06 pm
by Combuster
Posted: Wed Mar 19, 2008 5:59 pm
by Danand
Ok, here is my bochs log:
Code: Select all
00000000000i[ ] Bochs x86 Emulator 2.3
00000000000i[ ] Build from CVS snapshot on August 27, 2006
00000000000i[ ] System configuration
00000000000i[ ] processors: 1 (cores=1, HT threads=1)
00000000000i[ ] A20 line support: yes
00000000000i[ ] APIC support: yes
00000000000i[ ] CPU configuration
00000000000i[ ] level: 6
00000000000i[ ] paging support: yes, tlb enabled: yes
00000000000i[ ] SMP support: no
00000000000i[ ] FPU support: yes
00000000000i[ ] MMX support: yes
00000000000i[ ] SSE support: 4
00000000000i[ ] v8086 mode support: yes
00000000000i[ ] VME support: yes
00000000000i[ ] 3dnow! support: yes
00000000000i[ ] PAE support: yes
00000000000i[ ] PGE support: yes
00000000000i[ ] PSE support: yes
00000000000i[ ] x86-64 support: yes
00000000000i[ ] SEP support: yes
00000000000i[ ] Optimization configuration
00000000000i[ ] Guest2HostTLB support: yes
00000000000i[ ] RepeatSpeedups support: yes
00000000000i[ ] Icache support: yes
00000000000i[ ] Host Asm support: yes
00000000000i[ ] Fast function calls: yes
00000000000i[ ] Devices configuration
00000000000i[ ] NE2000 support: yes
00000000000i[ ] PCI support: yes
00000000000i[ ] SB16 support: yes
00000000000i[ ] USB support: yes
00000000000i[ ] VGA extension support: vbe
00000000000i[MEM0 ] allocated memory at 0xb5b4d008. after alignment, vector=0xb5b4e000
00000000000i[MEM0 ] 32,00MB
00000000000i[MEM0 ] rom at 0xf0000/65536 ('/usr/share/bochs/BIOS-bochs-latest')
00000000000p[MEM0 ] >>PANIC<< ROM: couldn't open ROM image file '/usr/share/bochs/VGABIOS-elpin-2.40'.
00000000000i[APIC?] set APIC ID to 0
00000000000i[APIC0] 80686
00000000000i[APIC0] local apic in CPU apicid=00 initializing
00000000000i[VTIME] using 'realtime pit' synchronization method
00000000000i[ ] lt_dlhandle is 0x82ece30
00000000000i[PLGIN] loaded plugin libbx_unmapped.la
00000000000i[ ] lt_dlhandle is 0x82ed9e8
00000000000i[PLGIN] loaded plugin libbx_biosdev.la
00000000000i[ ] lt_dlhandle is 0x82ee318
00000000000i[PLGIN] loaded plugin libbx_cmos.la
00000000000i[ ] lt_dlhandle is 0x82ee8e8
00000000000i[PLGIN] loaded plugin libbx_dma.la
00000000000i[ ] lt_dlhandle is 0x82ee390
00000000000i[PLGIN] loaded plugin libbx_pic.la
00000000000i[ ] lt_dlhandle is 0x82ef048
00000000000i[PLGIN] loaded plugin libbx_vga.la
00000000000i[ ] lt_dlhandle is 0x82ef8a0
00000000000i[PLGIN] loaded plugin libbx_floppy.la
00000000000i[ ] lt_dlhandle is 0x82f00e8
00000000000i[PLGIN] loaded plugin libbx_harddrv.la
00000000000i[ ] lt_dlhandle is 0x8301cb8
00000000000i[PLGIN] loaded plugin libbx_keyboard.la
00000000000i[ ] lt_dlhandle is 0x8301e50
00000000000i[PLGIN] loaded plugin libbx_serial.la
00000000000i[ ] lt_dlhandle is 0x8302310
00000000000i[PLGIN] loaded plugin libbx_parallel.la
00000000000i[ ] lt_dlhandle is 0x83033b0
00000000000i[PLGIN] loaded plugin libbx_extfpuirq.la
00000000000i[ ] lt_dlhandle is 0x8303888
00000000000i[PLGIN] loaded plugin libbx_gameport.la
00000000000i[ ] lt_dlhandle is 0x8303da0
00000000000i[PLGIN] loaded plugin libbx_speaker.la
00000000000i[ ] lt_dlhandle is 0x8304290
00000000000i[PLGIN] loaded plugin libbx_pci.la
00000000000i[ ] lt_dlhandle is 0x8304a20
00000000000i[PLGIN] loaded plugin libbx_pci2isa.la
00000000000i[ ] lt_dlhandle is 0x8305008
00000000000i[PLGIN] loaded plugin libbx_pci_ide.la
00000000000i[IOAP ] initializing I/O APIC
00000000000i[IOAP ] set APIC ID to 1
00000000000i[MEM0 ] Register memory access handlers: fec00000-fec00fff
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Thu Mar 20 00:56:40 2008 (time0=1205971000)
00000000000i[DMA ] channel 4 used by cascade
00000000000i[DMA ] channel 2 used by Floppy Drive
Can someone see if something is wrong?
Posted: Wed Mar 19, 2008 6:33 pm
by nekros
Are you getting errors, or are you just checking?
Posted: Wed Mar 19, 2008 7:10 pm
by Danand
Im trying to load my kernel! Im just testing with james tutorials. So when i test i get errors, i post the log over here. The bochs dont com up at all, so i need help then!
Posted: Wed Mar 19, 2008 7:21 pm
by nekros
please provide a detailed explanation of what you are doing.
Posted: Wed Mar 19, 2008 7:26 pm
by neon
Danand wrote:Im trying to load my kernel! Im just testing with james tutorials. So when i test i get errors, i post the log over here. The bochs dont com up at all, so i need help then!
Hm... Considering that "none" of the bootloaders work, and Bochs does not seem to do anything, perhaps you are not copying (or installing) your bootloader correctly in the first place?
You can check this for certain using Bochs debugger. (Search Google for tutorials)
Posted: Wed Mar 19, 2008 7:48 pm
by Danand
My kernel is in C, loader.s look like this:
Code: Select all
global _loader ; making entry point visible to linker
extern _kmain ; _kmain is defined elsewhere
; setting up the Multiboot header - see GRUB docs for details
MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries
MEMINFO equ 1<<1 ; provide memory map
FLAGS equ MODULEALIGN | MEMINFO ; this is the Multiboot 'flag' field
MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header
CHECKSUM equ -(MAGIC + FLAGS) ; checksum required
section .text
align 4
MultiBootHeader:
dd MAGIC
dd FLAGS
dd CHECKSUM
; reserve initial kernel stack space
STACKSIZE equ 0x4000 ; that's 16k.
_loader:
mov esp, stack+STACKSIZE ; set up the stack
push eax ; pass Multiboot magic number
push ebx ; pass Multiboot info structure
call _kmain ; call kernel proper
hlt ; halt machine should kernel return
section .bss
align 32
stack:
resb STACKSIZE ; reserve 16k stack on a quadword boundary
"setting up the Multiboot header - see GRUB docs for details" mens that i must use GRUB? I have googled in days after boot loaders, nobody of them have worket, or them workt, but them not load the kernel!
Posted: Wed Mar 19, 2008 9:27 pm
by neon
"setting up the Multiboot header - see GRUB docs for details" mens that i must use GRUB? I have googled in days after boot loaders, nobody of them have worket, or them workt, but them not load the kernel!
You do not *need* to use GRUB. Some members (myself included) developed their own bootloaders. If you are unable to get GRUB working, I would probably stay away from this for now... specifically if all you want to develop a kernel.
You still have not described how you are building everything (and copying the bootloader to your disk). Also, include what the problem is. How do you know it does not load the kernel? Is it even getting into _loader? What format is your kernel in (*.exe, *.elf, etc..)? How are you setting up GRUB?
We need details.
(Also, your loader.s is not at all a bootloader. I am suspecting GRUB is not set up correctly.)
Also, what compiler are you using for your C kernel? If you are sticking with 16 bit, I sure hope it can compile 16 bit real mode code and not 32 bit...