Page 1 of 2
Kernel will not boot
Posted: Wed Oct 31, 2007 9:30 pm
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.
Posted: Wed Oct 31, 2007 9:52 pm
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.)
Posted: Wed Oct 31, 2007 9:55 pm
by Brynet-Inc
What is with first time posters?
Do they honestly think we can read minds? and/or access their source code just by concentrating "
really really hard"?
AusZero, Try diagnosing the issue yourself.. most emulators have debugging capabilities that help..
Posted: Wed Oct 31, 2007 10:04 pm
by AndrewAPrice
Brynet-Inc wrote:What is with first time posters?
Do they honestly think we can read minds? and/or access their source code just by concentrating "
really really hard"?
AusZero, Try diagnosing the issue yourself.. most emulators have debugging capabilities that help..
Still not as worse as:
"My compiler says my source code has an error. How can I fix this?"
Posted: Wed Oct 31, 2007 10:10 pm
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.
Posted: Wed Oct 31, 2007 10:11 pm
by AndrewAPrice
It would help if you pasted here the commands you use to compile your code, and the error you are receiving.
Posted: Wed Oct 31, 2007 10:17 pm
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.
Posted: Wed Oct 31, 2007 11:55 pm
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.)
Posted: Thu Nov 01, 2007 11:30 am
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.
Posted: Thu Nov 01, 2007 3:55 pm
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).
Posted: Thu Nov 01, 2007 4:24 pm
by Brynet-Inc
Why did you post twice? lol.. His name is Brandon btw.. aka Bran.
Posted: Thu Nov 01, 2007 5:02 pm
by Pyrofan1
Code: Select all
[BITS 32]
[global start]
[extern _main]
start:
call _main
cli
hlt
where do you set up the stack?
Posted: Thu Nov 01, 2007 5:19 pm
by meh
What do you mean?
Posted: Thu Nov 01, 2007 5:29 pm
by Combuster
AusZero wrote:What do you mean?
uhm, have you read
Getting Started ?
Posted: Thu Nov 01, 2007 10:20 pm
by meh
Yes I have read getting started, but I don't know much about stacks.