[Q] linker script

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.
Locked
MadZarx
Member
Member
Posts: 85
Joined: Mon Apr 01, 2013 5:06 am
Location: CMOS :D

[Q] linker script

Post 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?
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: [Q] linker script

Post 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
MadZarx
Member
Member
Posts: 85
Joined: Mon Apr 01, 2013 5:06 am
Location: CMOS :D

Re: [Q] linker script

Post 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?
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: [Q] linker script

Post 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
MadZarx
Member
Member
Posts: 85
Joined: Mon Apr 01, 2013 5:06 am
Location: CMOS :D

Re: [Q] linker script

Post 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:
Locked