Skip to content

Instantly share code, notes, and snippets.

@clarkli86
Created July 27, 2016 04:53
Show Gist options
  • Save clarkli86/1600f581cc0d70279ff0aa9fffcb79ea to your computer and use it in GitHub Desktop.
Save clarkli86/1600f581cc0d70279ff0aa9fffcb79ea to your computer and use it in GitHub Desktop.
Build ko outside kernel source tree
# Run me as
# ARCH=arm CROSS_COMPILE=~/buildroot-2016.05/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi- make
# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
obj-m := kobject.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
KERNELDIR ?= ../../output/build/linux-4.5.3/
PWD := $(shell pwd)
default:
»·······$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment