parent
bc67ec46be
commit
82cdb7a660
@ -0,0 +1,36 @@
|
||||
CURR_DIR :=$(shell pwd)
|
||||
|
||||
export CURR_DIR
|
||||
|
||||
.PHONY: get_version
|
||||
|
||||
all: clean get_version get_options
|
||||
|
||||
get_version:
|
||||
@if [ ! -d $(KERNEL_SOURCE)/ ]; then \
|
||||
echo "";\
|
||||
echo "$(KERNEL_SOURCE) directory does not exist. Please edit the file 'config'";\
|
||||
echo "in this directory and set KERNEL_SOURCE to the correct location of your ";\
|
||||
echo "kernel source.";\
|
||||
echo "";\
|
||||
echo "You are currently running kernel version `uname -r`, the source code should";\
|
||||
echo "be for this version.";\
|
||||
echo "";\
|
||||
exit 1;\
|
||||
fi
|
||||
@if [ ! -f $(KERNEL_SOURCE)/include/linux/version.h ]; then \
|
||||
echo "$(KERNEL_SOURCE)/include/linux/version.h is missing. Please run make config";\
|
||||
echo "in your kernel source tree";\
|
||||
exit 1;\
|
||||
fi
|
||||
|
||||
$(CC) -I$(KERNEL_SOURCE)/include get_version.c -o get_version
|
||||
|
||||
get_options:
|
||||
$(MAKE) -f $(CURR_DIR)/Makefile.get_options -C $(KERNEL_SOURCE) get_version_target
|
||||
|
||||
clean:
|
||||
$(RM) get_version make.opts
|
||||
|
||||
distclean: clean
|
||||
|
@ -0,0 +1,11 @@
|
||||
KERNEL_VERSION := $(shell $(CURR_DIR)/get_version)
|
||||
KERNEL_RELEASE := $(shell echo $(KERNEL_VERSION) | cut -d\" -f2| cut -c-5)
|
||||
|
||||
include Makefile
|
||||
|
||||
get_version_target:
|
||||
echo "KERNEL_RELEASE=$(KERNEL_VERSION)" >> $(CURR_DIR)/make.opts
|
||||
echo "KERNEL_CFLAGS='$(CFLAGS)'" >> $(CURR_DIR)/make.opts
|
||||
# echo "KERNEL_CC='$(CC)'" >> $(CURR_DIR)/make.opts
|
||||
echo "KERNEL_MODFLAGS='$(MODFLAGS)'" >> $(CURR_DIR)/make.opts
|
||||
|
@ -0,0 +1,6 @@
|
||||
#include <linux/version.h>
|
||||
#include <stdio.h>
|
||||
main()
|
||||
{
|
||||
printf("%s", UTS_RELEASE);
|
||||
}
|
Loading…
Reference in new issue