[PATCH] kbuild: using well known kernel symbols as module names.

Ustyugov Roman
2005-09-20T09:28:49Z

Here is a Thayumanavar's (thayumk@gmail.com) patch with small changes. I have
to use double quotes, but not single ones.
Problem was solved.

--- linux/scripts/Makefile.lib.orig 2005-03-02 10:38:09.000000000 +0300
+++ linux/scripts/Makefile.lib 2005-09-20 13:14:13.000000000 +0400
@@ -96,7 +96,7 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F
# than one module. In that case KBUILD_MODNAME will be set to foo_bar,
# where foo and bar are the name of the modules.
basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F)))
-modname_flags = $(if $(filter 1,$(words
$(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname))))
+modname_flags = $(if $(filter 1,$(words $(modname))),-D"DUM(a)=\#a"
-D"KBUILD_MODNAME=DUM($(subst $(comma),_,$(subst -,_,$(modname))))")

_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o)
_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
--- linux/scripts/mod/modpost.c.orig 2005-07-23 04:41:06.000000000 +0400
+++ linux/scripts/mod/modpost.c 2005-09-20 13:19:21.000000000 +0400
@@ -575,7 +575,7 @@ add_header(struct buffer *b, struct modu
buf_printf(b, "#undef unix\n"); /* We have a module called "unix" */
buf_printf(b, "struct module __this_module\n");
buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) =
{\n");
- buf_printf(b, " .name = __stringify(KBUILD_MODNAME),\n");
+ buf_printf(b, " .name = KBUILD_MODNAME,\n");
if (mod->has_init)
buf_printf(b, " .init = init_module,\n");
if (mod->has_cleanup)

--
RomanU