Re: Linux 2.6.6-rc3

From: Sam Ravnborg
Date: Wed Apr 28 2004 - 15:04:53 EST


>
> Full package:
> http://loop-aes.sourceforge.net/loop-AES/loop-AES-v2.0g.tar.bz2

Hi Jari.
I took a look at how you use the build system in the 2.6 kernel.
Inherited from the 2.4 days you assemble the commands yourself,
which is plain wrong in a 2.6 kernel.
The only sane way to build external modules with a 2.6 kernel is
to utilise the kbuild infrastructure.

For your reference here is a Makefile that I used to compile your
module (made a symling for loop-patched.c file).

To compile the kernel I used:
make -C /home/sam/bk/v2.6/ M=$PWD
[Assumes latest linus kernel - 2.6.6-rc3]

For older kernels append the modules target

This has the added benefit that Module versioning is also supported.

#########################
# Minimal kbuild Makefile for loop-AES

EXTRA_CFLAGS := $(LOOP_AES_CFLAGS)

obj-m := loop.o

i586-$(CONFIG_M586) := -i586
i586-$(CONFIG_M686) := -i586

loop-y := loop-patched.o aes$(i586-y).o glue.o md5$(i586-y).o

##########################

I see in the Makefile that you do a lot of tricks to support various
kernel versions. But they all end up in a few defines for the C compiler,
which you just needs to supply in the variable LOOP_AES_CFLAGS.
[And some file massaging whaich is done before starting the build]

What I would recommend you to do is to move all your backward compatibility
stuff and general rules to a file named 'makefile'.
Then provide individual Makefiles for each kernel version:
Makefile.2.4, Makefile.2.6
Then symlink Makfile to the right one and build the module.

This would clean up your Makefile and give you correct usage in 2.6

Sam


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