Page 1 of 1

problem with kernel

Posted: Mon Apr 21, 2008 9:56 am
by aztex
my kernel is loading but is not printing anything..
i am using grub..

Posted: Mon Apr 21, 2008 10:40 am
by Kieran
Im sorry, but your description provides no clue as to why you are having this problem.

Posted: Mon Apr 21, 2008 10:43 am
by Combuster

Posted: Mon Apr 21, 2008 11:17 am
by aztex
i wrote a c function to print strings on the screen...
when i booted this kernel in bochs..

it did not print anything..

if i give one print statement the system halts..
if i give more print statement then it restarts..

i have attached the file

Posted: Mon Apr 21, 2008 11:39 am
by Combuster
What does bochs say before it crashes? Is that all code? how do you compile it? have you read the [wiki]Category:FAQ[/wiki] page about strings? 5)...? 6)...? 7)...? X) ...? Z)....? why is cline not set in clear_screen()?

Posted: Mon Apr 21, 2008 12:01 pm
by aztex
ya. only one file..
gcc -c -m32 -B /home/vivek/os/kernel -Wall -nostdlib -nostartfiles -nostdinc -std=gnu99 *.c
as --32 startk.s -o startk.so
'ld -m elf_i386 -T linker.ld startk.so *.o -o kernel'

i use these for compilations..

bochs does not crash.. it keeps on restarting...

Posted: Mon Apr 21, 2008 8:28 pm
by piranha
whats in your 'startk.s' file? Try adding a for loop after the kprint call and see what happens.

-JL

Posted: Tue Apr 22, 2008 12:18 am
by aztex
this is the main function

void main()
{
while(1);
}

but still it rebooots.
i have attached the floopy image..

Posted: Tue Apr 22, 2008 12:27 am
by aztex
sorry i could not upload the floopy image..

Posted: Tue Apr 22, 2008 12:29 am
by aztex
this is the assembly file..

Posted: Tue Apr 22, 2008 12:40 am
by thepowersgang
including the link.ld file would be useful and in an archive would be better.

I can't see much but putting a

Code: Select all

jmp $
after the "hlt" instruction might help and insert

Code: Select all

for(;;);
at the bottom of kmain.

Try running it with these and see what it does. If that fails use the bochs debugger to find the error.

Posted: Tue Apr 22, 2008 1:25 am
by aztex
i get undefined reference to _alloca
undefined reference to _main

when i link the files y is it????

Posted: Tue Apr 22, 2008 2:03 am
by JamesM
Read the FAQ.

You need a crosscompiler.