From: Tomek The Messenger <tomekthemessenger@gmail.com>
To: kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: How to pass flag from makefile to preprocesor when building external kernel module
Date: Fri, 21 Aug 2020 10:01:07 +0200 [thread overview]
Message-ID: <CAA4NGyuL_Hm41YOpojrQUnWUP-n0JpHHxRKfjGsoNx3mYn1gVQ@mail.gmail.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 754 bytes --]
Hi
I have problem with passing flag from makefile to .c file.
During building external kernel module my macro isn't seen by compiler. I
used plenty of ways.
First way:
ccflags-y += -DMY_FLAG
$(MAKE) -C $(KERNEL_SRC) M=$(SRC)
Second:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC) CFLAGS_my-kernel-module.o="-DMY_FLAG"
Third:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC) CFLAGS="-DMY_FLAG"
Forth:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC) ccflags-y="-DMY_FLAG"
In general I use bitbake to build external kernel modules. And I wonder if
bitbake doesn't introduce issue as some of above solution really should
work. And additionally I had to use absolute paths in headers because
relative didn't work so -I append also doesn't work:
SRC := $(shell pwd)
ccflags-y := -I$(SRC)
BR
Tomek
[-- Attachment #1.2: Type: text/html, Size: 1078 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next reply other threads:[~2020-08-21 8:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 8:01 Tomek The Messenger [this message]
2020-08-21 8:39 ` How to pass flag from makefile to preprocesor when building external kernel module Tomek The Messenger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAA4NGyuL_Hm41YOpojrQUnWUP-n0JpHHxRKfjGsoNx3mYn1gVQ@mail.gmail.com \
--to=tomekthemessenger@gmail.com \
--cc=kernelnewbies@kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).