You are not logged in.
Pages: 1
Hello,
I am trying to compile a kernel module using the following makefile,
TARGET = printk_user
obj-m := $(TARGET).o
KERNEL_VERSION=$(shell uname -r)
KDIR = /lib/modules/$(KERNEL_VERSION)/build
PWD = $(shell pwd)
all: printk
printk:
$(MAKE) -C $(KDIR) M=$(PWD) modules
clean:
$(MAKE) -C $(KDIR) M=$(PWD) clean
However the build directory doesn't seem to exist as it does in other distributions. The following error output is received,
make -C /lib/modules/4.19.2-arch1-1-ARCH/build M=/home/afx/kernPrintk modules
make[1]: *** /lib/modules/4.19.2-arch1-1-ARCH/build: No such file or directory. Stop.
make: *** [makefile:11: printk] Error 2
I saw a post where it was suggested to install kernel-devel package but I couldn't find any version of this in the pac repos.
Feel free to tell me to rtfm but I couldn't find anything about it in the wiki short of recompiling the entire kernel LFS style.
Thanks
Last edited by afx (2018-11-21 05:56:05)
Offline
IIRC, perhaps you looking for linux-headers package instead?
Offline
You cannot possibly have seen a recommendation for "kernel-devel" since our kernel is named "linux" and any suffix would need to follow that.
$ pacman -S linux<TAB>
linux linux-docs linux-hardened-docs linux-lts linux-tools-meta
linux-api-headers linuxdoc-tools linux-hardened-headers linux-lts-docs linux-zen
linux-atm linux-firmware linux-headers linux-lts-headers linux-zen-docs
linuxconsole linux-hardened linux_logo linuxsampler linux-zen-headers
Signs point to "linux-headers". Tab-complete is amazing and undervalued.
Last edited by eschwartz (2018-11-21 05:52:26)
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Thank you both it was linux-headers I needed. I didn't say it was a good tip @eschwartz.
tab-complete is undervalued, i was trying to find it with pkgfile which may have been overkill for that.
Offline
pkgfile will try to match it strictly as a file by default, and therefore not find it -- which means you likely want to use -d and end with a directory component "/" in order for it to match correctly.
You can also search for a common, well-known file unique to the Linux headers, like Kconfig.
$ pkgfile Kconfig
core/linux-firmware
core/linux-headers
core/linux-lts-headers
extra/linux-hardened-headers
extra/linux-zen-headers
community/wireguard-dkms
Or use regex mode (which will allow matching anywhere on the filepath rather than just the last filename component or the full path) *and* directory matching:
$ pkgfile --verbose --regex --directories "4.19.2-arch1-1-ARCH/build/$"
core/linux-docs 4.19.2.arch1-1 /usr/lib/modules/4.19.2-arch1-1-ARCH/build/
core/linux-headers 4.19.2.arch1-1 /usr/lib/modules/4.19.2-arch1-1-ARCH/build/
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Pages: 1