0

I'd like to grab information from the shell and pass it into a kernel module through the makefile. I can do this with user space programs using -D.

Is there a similar mechanism for kernel modules? For example, if I define a makefile variable

CURRENT_DATE := '"$(shell date +"%Y%m%dT%H%M%SZ")"'

I can get a hold of that date as a string in the user space program by appending -DCURRENT_DATE to the end of the build command. Is there a way to do this with kernel modules?

2
  • I don't understand the question, You know about shell, Are you asking about building kernel modules? Have you seen kernel.org/doc/html/v5.9/kbuild/index.html Commented Dec 19, 2024 at 7:51
  • The question pertains to kernel module builds with make. Say I want to embed a variable value in the module when it's built to identify the build date. With user space programs built using make, I can pass variables with -D<var_name> and have the C program copy the string encoded as <var_name> when it starts. Is there a similar mechanism for passing variables through the build process with modules? Commented Dec 19, 2024 at 16:45

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.