Kernel will not boot

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.
meh
Member
Member
Posts: 52
Joined: Sun Oct 21, 2007 4:30 pm

Kernel will not boot

Post by meh »

My operating system kernel will not boot, and I think it is because the kernel loader (the assembly code that calls the main function) will not link with the kernel. Any help would be appreciated.
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

What happens when you try to link the entry code with the kernel? Also, what OS, compiler, language, etc. are you using?

By the by, what boot loader are you using? (eg. GRUB, LILO, etc.)
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

What is with first time posters? :roll:

Do they honestly think we can read minds? and/or access their source code just by concentrating "really really hard"? 8)

AusZero, Try diagnosing the issue yourself.. most emulators have debugging capabilities that help.. :wink:
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

Brynet-Inc wrote:What is with first time posters? :roll:

Do they honestly think we can read minds? and/or access their source code just by concentrating "really really hard"? 8)

AusZero, Try diagnosing the issue yourself.. most emulators have debugging capabilities that help.. :wink:
Still not as worse as:
"My compiler says my source code has an error. How can I fix this?"
My OS is Perception.
meh
Member
Member
Posts: 52
Joined: Sun Oct 21, 2007 4:30 pm

Post by meh »

It doesn't seem to link.

I'm using Windows XP, DJGPP, nasm, C++ ,and Assembly.

I have used many different bootloaders (which haven't worked by the way), but now I'm using this one: http://www.osdever.net/downloads/bootse ... ootf02.zip.
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

It would help if you pasted here the commands you use to compile your code, and the error you are receiving.
My OS is Perception.
meh
Member
Member
Posts: 52
Joined: Sun Oct 21, 2007 4:30 pm

Post by meh »

I've been using this command: ld -T link.ld -o .\compiled_kernel\KERNEL.bin loader.o kernel.o video.o.

I've not had any errors, but I've tried to link the kernel with and without the loader and the size of the files are the exactly same.
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

Can you post the contents of your link.ld file, the loader code, and the commands used to "compile" your code? (You have already posted the command you use to link the kernel.)
My OS is Perception.
meh
Member
Member
Posts: 52
Joined: Sun Oct 21, 2007 4:30 pm

Post by meh »

The link.ld file:

Code: Select all

OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS
{
.text 0x100000 :
{
code = .; _code = .; __code = .;
*(.text)
. = ALIGN(4096);
}

.data :
{
data = .; _data = .; __data = .;
*(.data)
. = ALIGN(4096);
}

.bss :
{
bss = .; _bss = .; __bss = .;
*(.bss)
. = ALIGN(4096);
}

end = .; _end = .; __end = .;
}
The loader code:

Code: Select all

[BITS 32]

[global start]
[extern _main]

start:
call _main
cli
hlt
The commands used to compile the kernel: gxx -c kernel.cpp -fno-builtin -fno-rtti -fno-exceptions

I got some of this off of a tutorial.
Pixion
Posts: 16
Joined: Thu Oct 25, 2007 8:18 pm

Post by Pixion »

Is this Brian's kernel tutorial by any chance? I had some issues with the linker script but this was due to the fact that I has to use a cross compiler.

Also, what are the errors you are getting during linking (i.e. the ld step you posted).
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

Why did you post twice? lol.. His name is Brandon btw.. aka Bran. ;)
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Pyrofan1
Member
Member
Posts: 234
Joined: Sun Apr 29, 2007 1:13 am

Post by Pyrofan1 »

Code: Select all

[BITS 32]

[global start]
[extern _main]

start:
call _main
cli
hlt
where do you set up the stack?
meh
Member
Member
Posts: 52
Joined: Sun Oct 21, 2007 4:30 pm

Post by meh »

What do you mean? :?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

AusZero wrote:What do you mean? :?
uhm, have you read Getting Started ?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
meh
Member
Member
Posts: 52
Joined: Sun Oct 21, 2007 4:30 pm

Post by meh »

Yes I have read getting started, but I don't know much about stacks.
Post Reply