Last active
February 7, 2022 09:22
-
-
Save Bassem-Ramzy/1854811c5146613676b334aa9e2b73cf to your computer and use it in GitHub Desktop.
check_linux_kernel_version_make
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In Makefile, check if the current kernel version is < 5.6, | |
# it sets `ADD_CCFLAGS_Y=-DOLD_KERNEL_FOR_PIN` | |
# Kernel Version | |
KVER := $(shell uname -r) | |
KMAJ := $(shell echo $(KVER) | \ | |
sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/') | |
KMIN := $(shell echo $(KVER) | \ | |
sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/') | |
# No Indentation Tabs/Spaces in the following ifeq lines please | |
ifeq ($(shell if [ 5 -gt $(KMAJ) ] ; then echo $$? ; fi ;),0) | |
$(eval ADD_CCFLAGS_Y=-DOLD_KERNEL_FOR_PIN) | |
endif | |
ifeq ($(shell if [ $(KMAJ) -eq 5 ] && [ 6 -ge $(KMIN) ] ; then echo $$? ; fi ;),0) | |
$(eval ADD_CCFLAGS_Y=-DOLD_KERNEL_FOR_PIN) | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment