Having some trouble with 'ld'
Posted: Wed Dec 03, 2003 12:00 am
*Ignore this if you don't wanna read it, its just some background info*
Ok, for my science fair project(due in 2 days) I have chosen to write a very simple OS and run a small PI calculation on it and compare the speeds to Window$ and Linux... So all I really want to do is have a simple 'boot off disk' little OS. I found a tutorial and I also bought the book 'Operating System Design and Implementation' by Andrew S. Tenenbaum(he wrote minix).. I know java like the back of my hand but that doesnt really help me here. I have enough knowledge in C amd C++ to do basic stuff like input and output and such. I can write the rest of it myself(Except fot timing things, have no clue how to get current system time).
*end possible ignore*
So heres my problem... The tutorial is a little outdated and I get an error when using ld like the tutorial says. Heres the part of the tutorial that tells me to do this(Taken from planetsourcecode.com):
"Now, lets compile this code.
Compile the ASM code like this:
NASM -f coff kernel.asm
That should create an output file called kernel.o
Compile our C code like this:
gcc -O3 -c kernel_c.c
That will output a kernel_c.o
Link the 2 files like this:
ld -Ttext 0xFF800000 --oformat binary -o kernel.bin kernel.o kernel_c.o
You should get a warning that says it cant find the entry symbol start. This is what you want
Linking those produces a flat binary called kernel.bin
This is your operating system. "
Now the problem is with the ld command(ld -Ttext 0xFF800000 --oformat binary -o kernel.bin kernel.o kernel_c.o) I don't remember the error exactly(if you need me to I can go check it) but it said something like 'kernel.o is unknown format' Thank you soo much for all your help.. Oh yeah and if you wanna check out the tutorial, it's at http://www.planet-source-code.com/vb/sc ... 3&lngWId=3
Thank you for your time,
Chris
Ok, for my science fair project(due in 2 days) I have chosen to write a very simple OS and run a small PI calculation on it and compare the speeds to Window$ and Linux... So all I really want to do is have a simple 'boot off disk' little OS. I found a tutorial and I also bought the book 'Operating System Design and Implementation' by Andrew S. Tenenbaum(he wrote minix).. I know java like the back of my hand but that doesnt really help me here. I have enough knowledge in C amd C++ to do basic stuff like input and output and such. I can write the rest of it myself(Except fot timing things, have no clue how to get current system time).
*end possible ignore*
So heres my problem... The tutorial is a little outdated and I get an error when using ld like the tutorial says. Heres the part of the tutorial that tells me to do this(Taken from planetsourcecode.com):
"Now, lets compile this code.
Compile the ASM code like this:
NASM -f coff kernel.asm
That should create an output file called kernel.o
Compile our C code like this:
gcc -O3 -c kernel_c.c
That will output a kernel_c.o
Link the 2 files like this:
ld -Ttext 0xFF800000 --oformat binary -o kernel.bin kernel.o kernel_c.o
You should get a warning that says it cant find the entry symbol start. This is what you want
Linking those produces a flat binary called kernel.bin
This is your operating system. "
Now the problem is with the ld command(ld -Ttext 0xFF800000 --oformat binary -o kernel.bin kernel.o kernel_c.o) I don't remember the error exactly(if you need me to I can go check it) but it said something like 'kernel.o is unknown format' Thank you soo much for all your help.. Oh yeah and if you wanna check out the tutorial, it's at http://www.planet-source-code.com/vb/sc ... 3&lngWId=3
Thank you for your time,
Chris