In the last tutorial we didn't compile the C code. I'll give the commands for that in the next tutorial. For now you should save that file as kernel.c.
Now you have a the C part and an assembly part. What we need next is something which can link these two so that assembly code can call a C function. To link these we use linker.
Wikipedia definition:
A linker is a computer program that takes one or more object files generated by a compiler and combines them into a single executable program.
After compiling kernel.c and boot.s we will get object files kernel.o and boot.o. We are going to link these object files. To link these we need a linker script which tells how to link these files. The linker file is here. Download the code and save it as linker.ld in same folder where kernel.c and boot.s reside.
Also read more about how to write a linker script and also find out what each part of the linker file means. Read more about linker here.
Now you have a the C part and an assembly part. What we need next is something which can link these two so that assembly code can call a C function. To link these we use linker.
Wikipedia definition:
A linker is a computer program that takes one or more object files generated by a compiler and combines them into a single executable program.
After compiling kernel.c and boot.s we will get object files kernel.o and boot.o. We are going to link these object files. To link these we need a linker script which tells how to link these files. The linker file is here. Download the code and save it as linker.ld in same folder where kernel.c and boot.s reside.
Also read more about how to write a linker script and also find out what each part of the linker file means. Read more about linker here.
No comments:
Post a Comment