RE: [BUG] module_init_tools 0.9.10

From: Eng Se-Hsieng (g0202512@nus.edu.sg)
Date: Thu Mar 13 2003 - 05:10:03 EST


Dear Kai,

This is in relation to your suggestions to get a module working in 2.5
kernels.

After tweaking my Makefile, I managed to get it working for 2.5.59 but
now it no longer compiles under 2.5.64!

Here is my "tweaked" Makefile which compiled and loaded fine for 2.5.59.
Grateful if you could kindly suggest how to adapt it to 2.5.64 as I
really need to get it working. When compiling, vermagic.o can no longer
be found.

Many thanks.

Regards,
Se-Hsieng

# Start of Makefile
include ../config.mk

# Options
# -DD_DEBUG enables debug messages
OPTIONS = -DD_DEBUG

#CFLAGS = -O2 -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe
CFLAGS = -O2 -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe
-DKBUILD_MODNAME=nokia_cs

MODFLAGS = -D__KERNEL__ -DMODULE

INCDIRS = -I../include -I$(LINUX)/include $(DBE) $(DBM)

L_TARGET := nokia_cs.a

# Module settings

MODULE = nokia_cs.o
MODDIR = $(ROOTDIR)/lib/modules/$(OS_RELEASE)

# Locations ##############################################

srcs = dllc.c dmodule.c dtools.c dserial.c
hdrs = $(wildcard *.h)
objs = dllc.o dmodule.o dtools.o dserial.o

# ALL_O := $(objs) $(L_TARGET)
ALL_O := $(objs) $(L_TARGET) $(LINUX)/init/vermagic.o

# helps ##################################################

REALOPTS = $(CFLAGS) $(MODFLAGS) $(INCDIRS) $(OPTIONS)

# Targets ################################################

all : $(MODULE)

run : install
        /etc/rc.d/init.d/pcmcia restart

$(srcs) : $(hdrs)

$(objs) : $(srcs)
        $(CC) $(REALOPTS) -c $(patsubst %.o, %.c, $@)
        chmod -x $@

$(MODULE) : $(objs) $(L_TARGET)
        $(LD) -m elf_i386 -r -o $@ $(ALL_O)
        chmod -x $@

install : $(MODULE)
        echo "Installing module ("$(MODULE)" to "$(MODDIR)"/pcmcia)"
        mkdir -p $(MODDIR)/pcmcia
        cp -p $(MODULE) $(MODDIR)/pcmcia
        mkdir -p $(ROOTDIR)/etc/pcmcia/bin
        cp ../bin/$(SMAC2) $(ROOTDIR)/etc/pcmcia/bin/smac2.bin

uninstall :
        echo "Uninstalling module ("$(MODULE)" from "$(MODDIR)"/pcmcia)"
        rm $(MODDIR)/pcmcia/$(MODULE)
        rm $(ROOTDIR)/etc/pcmcia/bin/smac2.bin

clean:
        rm -f core *.o *~

-----Original Message-----
From: Kai Germaschewski [mailto:kai-germaschewski@uiowa.edu]
Sent: Sunday, March 02, 2003 3:06 AM
To: Eng Se-Hsieng
Subject: Re: [BUG] module_init_tools 0.9.10

On Fri, 28 Feb 2003, Eng Se-Hsieng wrote:

> I'm afraid I don't understand how to apply the solution you gave
> below.
> Could you please help advise me on how I may modify my Makefile in
order
> to allow the driver and module and work?

Put something like the following into your your_driver/Makefile

---
KERNELSRC=/lib/modules/`uname -r`/build

all: make -C $(KERNELSRC) SUBDIRS=$$PWD modules

obj-m := test.o

test-objs := test1.o test2.o ---

and then just do "make".

If your kernel source isn't pointed to by /lib/modules/`uname -r`/build, override with "make KERNELSRC=/where/the/source/is"

HTH,

--Kai

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:34 EST