mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Axel Weiss <aweiss@informatik.hu-berlin.de>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: compiling external modules
Date: Sat, 17 Apr 2004 01:24:33 +0200	[thread overview]
Message-ID: <200404170124.33903.aweiss@informatik.hu-berlin.de> (raw)
In-Reply-To: <20040416205157.GD2697@mars.ravnborg.org>

On Friday 16 April 2004 22:51, Sam Ravnborg wrote:
> On Fri, Apr 16, 2004 at 10:09:56PM +0200, Axel Weiss wrote:
> > 2. 2.6 compilation requires root privileges for compilation, 2.4 does
> > not.
>
> I never ever compile as root - so something is broken here.

Oh, yes! This is the old weird thing! SuSE uses to install kernel sources
in /usr/src, and I blindly followed :( fixed now :).

So, finally, we have a nice Makefile suitable for 2.4 and 2.6 (>= 2.6.6) kernels:

#/***************************************************************************
# *                                                                         *
# *   This program is free software; you can redistribute it and/or modify  *
# *   it under the terms of the GNU General Public License as published by  *
# *   the Free Software Foundation; either version 2 of the License, or     *
# *   (at your option) any later version.                                   *
# *                                                                         *
# ***************************************************************************/
#
#  (C) 2004 by Axel Weiss (aweiss@informatik.hu-berlin.de)
#
#
#  Template Makefile for external module compilation
#
#  replace <mod-name> with the prefix of the target module
#  replace <mod-object-list> with the list of object files to be linked together
#  replace <mod-export-list> with all symbol-exporting object filenames
#  additionally specify EXTRA_CFLAGS, if needed
#

KDIR      := /lib/modules/$(shell uname -r)/build
PWD       := $(shell pwd)
KERNEL_24 := $(if $(wildcard $(KDIR)/Rules.make),1,0)

obj-m           := <mod-name>.o
<mod-name>-objs := <mod-object-list>

.PHONY: all clean modules_install

ifeq ($(KERNEL_24),0)
ifeq ($(KERNELRELEASE),)
all:
	$(MAKE) -C $(KDIR) M=$(PWD)
clean modules_install:
	$(MAKE) -C $(KDIR) M=$(PWD) $@
endif # ifeq ($(KERNELRELEASE),)

else  ### ifeq ($(KERNEL_24),0)

ifneq ($(KERNELRELEASE),)

export-objs := <mod-export-list>

include $(KDIR)/Rules.make
adc64_bm.o: $(<mod-name>-objs)
	$(Q)$(LD) $(LD_RFLAG) -r -o $@ $(<mod-name>-objs)
else  # ifneq ($(KERNELRELEASE),)
all:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
modules_install:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) $@
clean:
	rm -f *.ko *.o .*.cmd .*.o.flags *.mod.c
endif # ifneq ($(KERNELRELEASE),)
endif ### ifeq ($(KERNEL_24),0)
# end of Makefile Template

Regards, thanks for your helpful advice and

have a nice weekend,

Axel


  parent reply	other threads:[~2004-04-16 23:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-16 15:41 Axel Weiss
2004-04-16 16:54 ` Sam Ravnborg
2004-04-16 20:09   ` Axel Weiss
2004-04-16 20:51     ` Sam Ravnborg
2004-04-16 21:04       ` Sam Ravnborg
2004-04-16 23:24       ` Axel Weiss [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-04-15 21:05 Axel Weiss
2004-04-15 21:59 ` Sam Ravnborg
2004-04-16  7:22   ` Duncan Sands
2004-04-16 12:06   ` Axel Weiss
2004-04-16 12:34     ` Axel Weiss
2004-04-16 16:55     ` Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200404170124.33903.aweiss@informatik.hu-berlin.de \
    --to=aweiss@informatik.hu-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®