开发者

Adding a .S file to the linux kernel code

I'm trying to add a new assembly (.S) file to the Linux kernel. It may be a dumb question, but I can't seem to find how and where to add such files to the make files. I've looked at code examples of current .S files, but I can't find where they are assembled and linked to the vmlinux binary.

Any hints would be appericiated.

Tha开发者_StackOverflow社区nks!


Just add the corresponding .o result to some rule. There are implicit rules for the .S -> .o translation.


look in

arch/i386/boot

and it's included Makefile.

It's a bit dirty, but they do it there - sort of. It's for the boot portion, so it may not be in the "kernel proper".

Have you concidered doing this inside a giagantic "asm" block in a .c file?

The reason this is so uncommon in the kernel, is that the kernel is really meant to be processor independent. So aside for some very select areas, there is little assembly - and when there is - it's all done in "asm" blocks inside .c files.


Why would you want to do such a thing besides supporting a new processor ?? You can to the same as arch/x86/kernel/entry_32.S.

Nevertheless, I think that you don't have a good reason to add a .S file. I'm sure you could do otherwise, it's really not hard to mix C and asm.

The real question you should ask is: "I'm trying to do this... I think about adding a .S file, what do you guys think ?"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜