How to see the preprocessed output of a module source file
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>。
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.
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
participants (3)
-
Aruna Hewapathirane -
Daniel Baluta -
Shiyao Ma