Why isn't the kernel module Makefile recognizing any files in the directory?

646 views Asked by At

I'm just starting to work on kernel module programming and I'm having a hard time getting the makefile to properly compile the c files. I'm using Manjaro 5.4

When I execute make in the same directory as the code and this Makefile:

obj-m += hello1.o

PATH = /usr/lib/modules/$(shell uname -r)/build

all:
    $(MAKE) -C $(PATH) M=$(PWD) modules

clean:
    $(MAKE) -C $(PATH) M=$(PWD) clean

I get the output of

make -C /usr/lib/modules/5.4.67-1-MANJARO/build M=/home/aidan/Documents/kernelProgramming/hw2 modules
make: make: No such file or directory
make: *** [Makefile:7: all] Error 127

I've checked I have all the correct headers installed

pacman -Qs "^linux"
local/cpupower 5.7-1 (linux-tools)
    Linux kernel tool to examine and tune power saving related features of your processor
local/efibootmgr 17-2
    Linux user-space application to modify the EFI Boot Manager
local/flatpak 1.8.1-1
    Linux application sandboxing and distribution framework (formerly xdg-app)
local/iptables 1:1.8.5-2
    Linux kernel packet control tool (using legacy interface)
local/keyutils 1.6.3-1
    Linux Key Management Utilities
local/kmod 27-2
    Linux kernel module management tools and library
local/ladspa 1.15-2
    Linux Audio Developer's Simple Plugin API (LADSPA)
local/lib32-keyutils 1.6.3-1
    Linux Key Management Utilities (32-bit)
local/liburing 0.7-2
    Linux-native io_uring I/O access library
local/linux-api-headers 5.8-1
    Kernel headers sanitized for use in userspace
local/linux-firmware 20200923.r1716.afbfb5f-1
    Firmware files for Linux (Manjaro Overlay Package)
local/linux-lts-headers 1:5.4-3
    Header files and scripts for building modules for the latest LTS kernel (metapackage)
local/linux54 5.4.67-1
    The Linux54 kernel and modules
local/linux54-headers 5.4.67-1
    Header files and scripts for building modules for Linux54 kernel
local/lirc 1:0.10.1-6
    Linux Infrared Remote Control utilities
local/man-pages 5.08-1
    Linux man pages
local/python-distro 1.5.0-1
    Linux OS platform information API
local/tlp 1.3.1-2
    Linux Advanced Power Management

And the path /usr/lib/modules/5.4.67-1-MANJARO/build looks like this:

$ ls
arch   crypto   include  kernel    mm              samples   sound  virt
block  drivers  init     lib       Module.symvers  scripts   tools
certs  fs       Kconfig  Makefile  net             security  usr

I'm quite stumped and I cannot find out the reason why it gives me that error.

0

There are 0 answers