Skip to contentSkip to conversation

Makefile automagic for RedHat kernel sources

DISCUSSION Mark M. Hoffman 1 participant 1 message May 19, 2005

lore
Share & tools
lore
#0 lore raw

Hello:

There's been a lot of "I can't compile vs. RedHat" lately. I found it's because the makefile automagic chokes on version.h...

Quoted 6 lines

#include <linux/rhconfig.h>
#if defined(__module__smp)
#define UTS_RELEASE "2.4.18-19.8.0smp"
#elif defined(__module__BOOT)
#define UTS_RELEASE "2.4.18-19.8.0BOOT"
#elif defined(__module__bigmem)

Quoted 8 lines

#define UTS_RELEASE "2.4.18-19.8.0bigmem"
#elif defined(__module__debug)
#define UTS_RELEASE "2.4.18-19.8.0debug"
#else
#define UTS_RELEASE "2.4.18-19.8.0"
#endif
#define LINUX_VERSION_CODE 132114
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

... because we're doing a simple grep for UTS_RELEASE.

What if we did this instead, e.g.

Quoted 2 lines

MODPREF := /lib/modules/`$(CC) -I$(LINUX_HEADERS) -E config.c | \
grep uts_release | cut -f 2 -d '"'`

Where config.c looked like this:

Quoted 2 lines

#include <linux/version.h>
char *uts_release=UTS_RELEASE;

Similar guck for SMP and MODVER. Comments?

Regards,

Signature · 2 lines
Mark M. Hoffman
[email protected]