On Thu, 01 Aug 2013 09:30:31 -0400, Jerry Stuckle wrote
> On 7/31/2013 11:12 PM, Tom H wrote:
>> On Tue, 30 Jul 2013 23:05:01 -0400, Jerry Stuckle wrote:
>>>
>>> I'm trying to compile my first module for Debian.
>>>
>>> My makefile is:
>>>
>>> obj-m = mymodule.o
>>> KVERSION = $(shell uname -r)
>>> all:
>>> make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
>>> clean:
>>> make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
>>>
>>> When I try to run make, I get the following:
>>>
>>> make -C /lib/modules/3.2.0-4-amd64/build M-/home/jerry modules
>>> make[1]: Entering directory `/usr/src/linux-headers-3.2.0-4-amd64'
>>> /usr/src/linux-headers-3.2.0-4-common/scripts/Makefile.build:44:
>>> /usr/src/linux-headers-3.2.0-4-common/scripts/basic/Makefile: No such
>>> file or directory make[5]: *** No rule to make target
>>> `/usr/src/linux-headers-3.2.0-4-common/scripts/basic/Makefile'. Stop.
>>
>> That is true -
>> /usr/src/linux-headers-3.2.0-4-common/scripts/basic/Makefile does not
>> exist.
>>
>> Is linux-kbuild-3.2 installed?
>>
>> "/usr/src/linux-headers-3.2.0-4-common/scripts" is a link to
>> "/lib/modules/linux-kbuild-3.2/scripts".
>
> Thanks for the response. Yes, linux-kbuild-3.2 is installed (and the
> symlink is correct).
This is on sid, not wheezy (I don't have a wheezy box with compilation
tools installed).
[root@localhost:/usr/src/jstuckle]# aptitude search -F '%c %p %v %V'
linux-image-3
i linux-image-3.10-1-amd64 3.10.3-1 3.10.3-1
p linux-image-3.10-1-amd64-dbg <none> 3.10.3-1
[root@localhost:/usr/src/jstuckle]# aptitude search -F '%c %p %v %V'
linux-headers-3
p linux-headers-3.10-1-all <none> 3.10.3-1
p linux-headers-3.10-1-all-amd64 <none> 3.10.3-1
i linux-headers-3.10-1-amd64 3.10.3-1 3.10.3-1
i linux-headers-3.10-1-common 3.10.3-1 3.10.3-1
[root@localhost:/usr/src/jstuckle]# aptitude search -F '%c %p %v %V'
linux-kbuild-3
i linux-kbuild-3.10 3.10-2 3.10-2
[root@localhost:/usr/src/jstuckle]# ls
/usr/src/linux-headers-3.10-1-common/scripts
basic depmod.sh genksyms Makefile.build
makelst namespace.pl
bin2c gcc-goto.sh kallsyms Makefile.clean
mksysmap patch-kernel
checkincludes.pl gcc-version.sh Kbuild.include
Makefile.host mkuboot.sh pnmtologo
checkstack.pl gcc-x86_32-has-stack-protector.sh kconfig
Makefile.lib mkversion setlocalversion
checkversion.pl gcc-x86_64-has-stack-protector.sh kernel-doc
Makefile.modinst mod ver_linux
conmakehash gen_initramfs_list.sh Lindent
Makefile.modpost module-common.lds
[root@localhost:/usr/src/jstuckle]# stat
/usr/src/linux-headers-3.10-1-common/scripts
File: ‘/usr/src/linux-headers-3.10-1-common/scripts’ ->
‘../../lib/linux-kbuild-3.10/scripts’
<snip>
I can compile a basic module using your Makefile. Can you?
[root@localhost:/usr/src/jstuckle]# ls
Makefile mymodule.c
[root@localhost:/usr/src/jstuckle]# cat Makefile
obj-m = mymodule.o
KVERSION = $(shell uname -r)
all:
make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
[root@localhost:/usr/src/jstuckle]# cat mymodule.c
#include <linux/module.h>
#include <linux/kernel.h>
MODULE_LICENSE("GPL");
int init_module(void)
{
printk(KERN_ALERT "Hello world\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_ALERT "Goodbye world\n");
}
[root@localhost:/usr/src/jstuckle]# make
make -C /lib/modules/3.10-1-amd64/build M=/usr/src/jstuckle modules
make[1]: Entering directory `/usr/src/linux-headers-3.10-1-amd64'
CC [M] /usr/src/jstuckle/mymodule.o
Building modules, stage 2.
MODPOST 1 modules
CC /usr/src/jstuckle/mymodule.mod.o
LD [M] /usr/src/jstuckle/mymodule.ko
make[1]: Leaving directory `/usr/src/linux-headers-3.10-1-amd64'
[root@localhost:/usr/src/jstuckle]# ls
Makefile modules.order Module.symvers mymodule.c mymodule.ko
mymodule.mod.c mymodule.mod.o mymodule.o
[root@localhost:/usr/src/jstuckle]# insmod mymodule.ko
[root@localhost:/usr/src/jstuckle]# grep mymodule /proc/modules
mymodule 12388 0 - Live 0xffffffffa02e5000 (PO)
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/51fc0ffc.7060...@gmail.com