Page 1 of 1

[Q] linker script

Posted: Wed Jul 03, 2013 9:36 am
by MadZarx
Hello
After building a cross compiler I built the example given in the tutorials and everything was perfect but I couldn't understand anything about the codes in boot.s and the linker script. I just wanted to build a very simple kernel that only shows a Hello kernel. I wrote the assembly for the kernel loader with nasm syntax but it didn't compiled with 'as' and I changed something and then I was able to build it. But my other problem was that I didn't know how to write a suitable linker script. I used the one in osdever example but when I wanted to link every thing it sayed that undefined refrence to k_main.
Can anyone help me with the assembly kernel loader and linker script please?

Re: [Q] linker script

Posted: Wed Jul 03, 2013 10:00 am
by AJ
Hi,

boot.s and link.ld in the BareBones tutorial are extremely heavily commented - what is it you don't understand about them. It sounds like you have made arbitrary changes without understanding what you are doing (or even done a "mix and match" of two separate cut and paste tutorials). Some more experimentation / background reading are required.

What are the reasons for your changes and have you read documentation for your toolchain? For example, if you have used an alternative assembler, you will need to ensure that the same symbols are generated. Try using objdump on your object files to check this.

Cheers,
Adam

Re: [Q] linker script

Posted: Wed Jul 03, 2013 12:49 pm
by MadZarx
Yeah I know its well documented but its very different than other tutorials look how easy this is http://www.osdever.net/tutorials/view/w ... e-c-kernel. Anyway my problem isn't about assembly at all. My main problem is the linker script. The wiki's doc about linker script is not enough. I haven't ever experienced working with gcc toolkit cuz I program in windows but I decided to choose linux cuz development in linux is faster and better. Any way is there a good refrence or tutorial about the linker script?

Re: [Q] linker script

Posted: Wed Jul 03, 2013 1:05 pm
by AJ
MadZarx wrote:I decided to choose linux cuz development in linux is faster and better.
Only if you know how to use the toolchain.

http://www.lmgtfy.com/?q=linker+scripts

Cheers,
Adam

Re: [Q] linker script

Posted: Wed Jul 03, 2013 1:51 pm
by MadZarx
AJ wrote:
MadZarx wrote:I decided to choose linux cuz development in linux is faster and better.
Only if you know how to use the toolchain.

http://www.lmgtfy.com/?q=linker+scripts

Cheers,
Adam
Oh :oops: Okay thanks 8) :mrgreen: