| Message ID | 20251124183534.870124-2-ross.burton@arm.com |
|---|---|
| State | New |
| Headers | show |
| Series | [kernel-module-hello-world,1/2] hello-world: some cleanups | expand |
Acked-by: Bruce Ashfield <bruce.ashfield@gmail.com> On Mon, Nov 24, 2025 at 1:35 PM Ross Burton <ross.burton@arm.com> wrote: > Use KERNEL_SRC to specify the location of the kernel source tree, to > match module.bbclass in OpenEmbedded Core. > > Also add a modules_install target. > > Signed-off-by: Ross Burton <ross.burton@arm.com> > --- > Makefile | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/Makefile b/Makefile > index e357001..b6fa870 100644 > --- a/Makefile > +++ b/Makefile > @@ -1,11 +1,12 @@ > -KERNELRELEASE ?= `uname -r` > -KERNEL_DIR ?= /lib/modules/$(KERNELRELEASE)/build > -PWD := $(shell pwd) > -obj-m := hello-world.o > +obj-m := hello-world.o > +KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build > +SRC := $(shell pwd) > > all: > - @echo "Building hello-world kernel module..." > - $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules > + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules > + > +modules_install: > + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install > > clean: > - make -C $(KERNEL_DIR) M=$(PWD) clean > + make -C $(KERNEL_SRC) M=$(PWD) clean > -- > 2.43.0 > >
diff --git a/Makefile b/Makefile index e357001..b6fa870 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,12 @@ -KERNELRELEASE ?= `uname -r` -KERNEL_DIR ?= /lib/modules/$(KERNELRELEASE)/build -PWD := $(shell pwd) -obj-m := hello-world.o +obj-m := hello-world.o +KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build +SRC := $(shell pwd) all: - @echo "Building hello-world kernel module..." - $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules + +modules_install: + $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install clean: - make -C $(KERNEL_DIR) M=$(PWD) clean + make -C $(KERNEL_SRC) M=$(PWD) clean
Use KERNEL_SRC to specify the location of the kernel source tree, to match module.bbclass in OpenEmbedded Core. Also add a modules_install target. Signed-off-by: Ross Burton <ross.burton@arm.com> --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)