Re: [RFC] kernel-headers and /lib/modules/*/build -> ?
In article <[🔎] 3B8D2CC0.39C182E1@iiic.ethz.ch>,
Michel Dänzer <daenzer@debian.org> wrote:
>After Manoj bashed my bug #110400, I discussed the matter with him on IRC and
>he asked me to bring it up here.
>
>The goal of my proposal is to enable the user to install a kernel-image and
>the accompanying kernel-headers and when running that kernel, just invoke make
>to build modules for it.
>
>Now before I get flamed for the technical changes this would involve, I'd like
>to ask if that's a worthwhile goal at all. :)
It wouldn't be too hard, but currently an unpacked (and configured) kernel
or a set of kernel-header-files doesn't tell you HOW the kernel was
compiled - with what compiler, what CFLAGS, etc.
With the following patch you can simply write a modules Makefile
like this:
# makefile
KVER=$(shell uname -r)
KSRC=/lib/modules/build/$(KVER)
include $(KSRC)/include/linux/config.mak
# Here VERSION, ARCH, CC, HOSTCC, LD, CPP, AR, CFLAGS, AFLAGS etc are set
I've proposed the patch on linux-kernel some time ago but didn't
get too much feedback. As a result no existing stand-alone modules
use this, alas.
# linux-2.2.19-config.mak.patch
--- linux-2.2.19.orig/Makefile Mon Apr 9 13:01:37 2001
+++ linux-2.2.19/Makefile Mon Apr 9 13:20:21 2001
@@ -325,7 +325,8 @@
MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
endif
-modules: include/config/MARKER $(patsubst %, _mod_%, $(SUBDIRS))
+modules: include/config/MARKER $(patsubst %, _mod_%, $(SUBDIRS)) \
+ include/linux/config.mak
$(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h
$(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules
@@ -380,6 +381,31 @@
@exit 1
endif
+include/linux/config.mak: ./Makefile
+ @echo "VERSION = $(VERSION)" > .mak
+ @echo "PATCHLEVEL = $(PATCHLEVEL)" >> .mak
+ @echo "SUBLEVEL = $(SUBLEVEL)" >> .mak
+ @echo "EXTRAVERSION = $(EXTRAVERSION)" >> .mak
+ @echo "ARCH = $(ARCH)" >> .mak
+ @echo "HOSTCC = $(HOSTCC)" >> .mak
+ @echo "HOSTCFLAGS = $(HOSTCFLAGS)" >> .mak
+ @echo "CROSS_COMPILE = $(CROSS_COMPILE)" >> .mak
+ @echo "AS = $(AS)" >> .mak
+ @echo "LD = $(LD)" >> .mak
+ @echo "CC = $(CC)" >> .mak
+ @echo "CPP = $(CPP)" >> .mak
+ @echo "AR = $(AR)" >> .mak
+ @echo "NM = $(NM)" >> .mak
+ @echo "STRIP = $(STRIP)" >> .mak
+ @echo "OBJCOPY = $(OBJCOPY)" >> .mak
+ @echo "OBJDUMP = $(OBJDUMP)" >> .mak
+ @echo "MAKE = $(MAKE)" >> .mak
+ @echo "GENKSYMS = $(GENKSYMS)" >> .mak
+ @echo "CFLAGS = $(CFLAGS)" >> .mak
+ @echo "AFLAGS = $(AFLAGS)" >> .mak
+ @echo "MODFLAGS = $(MODFLAGS)" >> .mak
+ @mv -f .mak $@
+
clean: archclean
rm -f kernel/ksyms.lst include/linux/compile.h
rm -f core `find . -name '*.[oas]' ! \( -regex '.*lxdialog/.*' \
@@ -398,6 +424,7 @@
mrproper: clean archmrproper
rm -f include/linux/autoconf.h include/linux/version.h
+ rm -f include/linux/config.mak
rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
Mike.
--
"Answering above the the original message is called top posting. Sometimes
also called the Jeopardy style. Usenet is Q & A not A & Q." -- Bob Gootee
Reply to: