Modifying Makefile for driver built for UBUNTU

Another newbie :slight_smile:

I’m trying to install a driver written for UBUNTU on OpenSuse 11.4. When running “make all” I get an error saying KERNELDIR is invalid. I don’t know what the OpenSuse path should be for KERNELDIR and MODULE_INSTALLDIR. Any suggestions would be appreciated. Following is the Makefile.

Makefile for uio48

ifneq ($(KERNELRELEASE),) # called by kbuild
obj-m := uio48.o
else # called from command line
KERNELDIR := /lib/modules/$(KERNEL_VERSION)/build
PWD := $(shell pwd)
MODULE_INSTALLDIR = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/gpio/

$(MAKE) -C $(KERNELDIR) M=$(PWD) modules

uio48io.o: uio48io.c uio48.h Makefile
gcc -c $(EXTRA_CFLAGS) uio48io.c

all: default install poll flash

rm -f $(MODULE_INSTALLDIR)uio48.ko
install -c -m 0644 uio48.ko $(MODULE_INSTALLDIR)
/sbin/depmod -a

rm -f $(MODULE_INSTALLDIR)uio48.ko
/sbin/depmod -a

flash: flash.c uio48.h uio48io.o Makefile
gcc -static flash.c uio48io.o -o flash
chmod a+x flash

poll: poll.c uio48.h uio48io.o Makefile
gcc -D_REENTRANT -static poll.c uio48io.o -o poll -lpthread
chmod a+x poll


rm -rf *.o ~ core .depend ..cmd *.ko *.mod.c .tmp_versions /dev/uio48?

rm -rf ioctl poll flash Module.* *.o ~ core .depend ..cmd *.ko *.mod.c *.order .tmp_versions /dev/uio48?

I’m assuming it’s a WS16C48? It’s a little bit different building kernel modules, easier to build as an rpm :wink:
Now that being said the code is old and the 11.4 kernel is different so the code needs to be patched;
SUSE Paste

I have a kmp module built, I’m guessing you need the other items built as well poll and flash?

Here are the rpms; Search Results
You need to select the one uio48-kmp-<your_kernel> matching your kernel from the output of;

uname -a

The uio48-2.6-1.1 one contains linuxuio48.pdf, flash and poll.