Commit 43ca4548079386acab597d8b31b30c9440d6bc1c
1 parent
f41a8425
Attempt to make install target function.
Showing
1 changed file
with
12 additions
and
3 deletions
module/Makefile
| 1 | # Comment/uncomment the following line to disable/enable debugging | 1 | # Comment/uncomment the following line to disable/enable debugging |
| 2 | #DEBUG = y | 2 | #DEBUG = y |
| 3 | 3 | ||
| 4 | - | ||
| 5 | # Add your debugging flag (or not) to CFLAGS | 4 | # Add your debugging flag (or not) to CFLAGS |
| 6 | ifeq ($(DEBUG),y) | 5 | ifeq ($(DEBUG),y) |
| 7 | DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines | 6 | DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines |
| @@ -21,21 +20,31 @@ else | @@ -21,21 +20,31 @@ else | ||
| 21 | 20 | ||
| 22 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build | 21 | KERNELDIR ?= /lib/modules/$(shell uname -r)/build |
| 23 | PWD := $(shell pwd) | 22 | PWD := $(shell pwd) |
| 23 | +KBASE := /lib/modules/$(KVER) | ||
| 24 | +KSRC ?= $(PWD) | ||
| 25 | +KBUILD := $(KSRC) | ||
| 26 | +MOD_DIR := $(KBASE)/kernel | ||
| 27 | + | ||
| 28 | +modules: default | ||
| 24 | 29 | ||
| 25 | default: | 30 | default: |
| 26 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules | 31 | $(MAKE) -C $(KERNELDIR) M=$(PWD) modules |
| 27 | 32 | ||
| 28 | endif | 33 | endif |
| 29 | 34 | ||
| 30 | - | ||
| 31 | - | ||
| 32 | clean: | 35 | clean: |
| 33 | rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions modules.order Module.symvers | 36 | rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions modules.order Module.symvers |
| 34 | 37 | ||
| 35 | depend .depend dep: | 38 | depend .depend dep: |
| 36 | $(CC) $(CFLAGS) -M *.c > .depend | 39 | $(CC) $(CFLAGS) -M *.c > .depend |
| 37 | 40 | ||
| 41 | +install: modules | ||
| 42 | + @( [ `id -u` -ne 1 ] || { echo "Must be root to install modules"; exit 1; } ) | ||
| 43 | + rm -f $(MOD_DIR)/extra/tty0tty.ko | ||
| 44 | + $(MAKE) -C $(KERNELDIR) M=$(PWD) O=$(KBASE) modules_install | ||
| 45 | + depmod -a | ||
| 38 | 46 | ||
| 39 | ifeq (.depend,$(wildcard .depend)) | 47 | ifeq (.depend,$(wildcard .depend)) |
| 40 | include .depend | 48 | include .depend |
| 41 | endif | 49 | endif |
| 50 | + |