All of lore.kernel.org
 help / color / mirror / Atom feed
* How to see the preprocessed output of a module source file
@ 2015-11-02 12:02 Shiyao Ma
  2015-11-02 13:08 ` Daniel Baluta
  2015-11-02 13:41 ` Aruna Hewapathirane
  0 siblings, 2 replies; 3+ messages in thread
From: Shiyao Ma @ 2015-11-02 12:02 UTC (permalink / raw)
  To: kernelnewbies

Hi,


Say I am writing a module. Instead of directly compile it into a ko file,
I'd like to see the preprocessed output of that file, similarly the way
it's done in gcc -E.


Regards.

-- 

????????????????https://introo.me <http://introo.me>?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151102/24deac96/attachment.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* How to see the preprocessed output of a module source file
  2015-11-02 12:02 How to see the preprocessed output of a module source file Shiyao Ma
@ 2015-11-02 13:08 ` Daniel Baluta
  2015-11-02 13:41 ` Aruna Hewapathirane
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Baluta @ 2015-11-02 13:08 UTC (permalink / raw)
  To: kernelnewbies

On Mon, Nov 2, 2015 at 2:02 PM, Shiyao Ma <i@introo.me> wrote:
> Hi,
>
>
> Say I am writing a module. Instead of directly compile it into a ko file,
> I'd like to see the preprocessed output of that file, similarly the way it's
> done in gcc -E.

Use make V=1 path/to/your/module.ko

and see the exact gcc command line used to compile the module. Replace
-c with -E :).

thanks,
Daniel.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* How to see the preprocessed output of a module source file
  2015-11-02 12:02 How to see the preprocessed output of a module source file Shiyao Ma
  2015-11-02 13:08 ` Daniel Baluta
@ 2015-11-02 13:41 ` Aruna Hewapathirane
  1 sibling, 0 replies; 3+ messages in thread
From: Aruna Hewapathirane @ 2015-11-02 13:41 UTC (permalink / raw)
  To: kernelnewbies

>> On Mon, Nov 2, 2015 at 7:02 AM, Shiyao Ma <i@introo.me> wrote:
>> Hi,
>> Say I am writing a module. Instead of directly compile it into a ko
file, I'd like to see the preprocessed output of that file,
>> similarly the way it's done in gcc -E.

lets say you have a module named shiyao.c the makefile will look similar
to:

-----------------------------------------------------------------------------
obj-m += shiyao.o

KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD       := $(shell pwd)

all:
    $(MAKE) -C $(KERNELDIR) M=$(PWD)

clean:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) clean
-----------------------------------------------------------------------------

change the target all to:

all:
    $(MAKE) -C $(KERNELDIR) M=$(PWD) *shiyao.i*

run make as usual then open shiyao.i in vi(m) or your preferred editor -
done !

Thank's - Aruna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20151102/de16c4fb/attachment.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-02 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-02 12:02 How to see the preprocessed output of a module source file Shiyao Ma
2015-11-02 13:08 ` Daniel Baluta
2015-11-02 13:41 ` Aruna Hewapathirane

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.