Skip to content

Commit

Permalink
kernel.mk: Force setting TC_KERNEL with trailing + sign >= 4
Browse files Browse the repository at this point in the history
The lack of commiting to exporting TC_KERNEL with the trailing
'+' sign on kernels >= 4 to match Synology kernel EXTRA
versioning complexifies the code throughout the Makefiles.

This adds-up the '+' extra-version sign and alleviate the
usage of multi-calls to version_*
  • Loading branch information
th0ma7 committed Mar 30, 2021
1 parent ec576da commit 1abbe08
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 32 deletions.
13 changes: 1 addition & 12 deletions cross/rtl8812au/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,16 @@ CONFIGURE_TARGET = nop
COMPILE_TARGET = rtl8812au_compile
INSTALL_TARGET = rtl8812au_install

#UNSUPPORTED_ARCHS = $(ARMv5_ARCHS) $(PPC_ARCHS)

include ../../mk/spksrc.cross-cc.mk

ifeq ($(call version_ge, ${TC_KERNEL}, 4),1)
PLIST_TRANSFORM = sed -e 's%@TC_KERNEL@%$(TC_KERNEL)+%'
else
PLIST_TRANSFORM = sed -e 's%@TC_KERNEL@%$(TC_KERNEL)%'
endif

.PHONY: rtl8812au_compile
rtl8812au_compile:
$(RUN) ARCH=$(TC_ARCH) CROSS_COMPILE=$(TC_PATH)$(TC_PREFIX) KSRC=$(WORK_DIR)/linux make modules

.PHONY: rtl8812au_install
rtl8812au_install:
# Add "+" to EXTRAVERSION for kernels version >= 4.x
ifeq ($(call version_ge, ${TC_KERNEL}, 4),1)
$(RUN) mkdir -p $(INSTALL_DIR)$(INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)+/kernel/drivers/net/wireless/
@install -p -m 644 $(WORK_DIR)/$(PKG_DIR)/88XXau.ko $(INSTALL_DIR)$(INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)+/kernel/drivers/net/wireless/
else
$(RUN) mkdir -p $(INSTALL_DIR)$(INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)/kernel/drivers/net/wireless/
@install -p -m 644 $(WORK_DIR)/$(PKG_DIR)/88XXau.ko $(INSTALL_DIR)$(INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)/kernel/drivers/net/wireless/
endif
$(RUN) $(STRIP) --strip-debug $(INSTALL_DIR)$(INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)/kernel/drivers/net/wireless/88XXau.ko
21 changes: 7 additions & 14 deletions cross/rtl8814au/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,26 @@ CONFIGURE_TARGET = nop
COMPILE_TARGET = rtl8814au_compile
INSTALL_TARGET = rtl8814au_install

#UNSUPPORTED_ARCHS = $(ARMv5_ARCHS) $(PPC_ARCHS)

include ../../mk/spksrc.cross-cc.mk

ifeq ($(call version_ge, ${TC_KERNEL}, 4),1)
PLIST_TRANSFORM = sed -e 's%@TC_KERNEL@%$(TC_KERNEL)+%'
else
PLIST_TRANSFORM = sed -e 's%@TC_KERNEL@%$(TC_KERNEL)%'
endif

.PHONY: rtl8814au_compile
rtl8814au_compile:
$(RUN) ARCH=$(TC_ARCH) CROSS_COMPILE=$(TC_PATH)$(TC_PREFIX) KSRC=$(WORK_DIR)/linux make modules

.PHONY: rtl8814au_install
rtl8814au_install:
# Add "+" to EXTRAVERSION for kernels version >= 4.x
ifeq ($(call version_ge, ${TC_KERNEL}, 4),1)
$(RUN) mkdir -p $(INSTALL_DIR)$(INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)+/kernel/drivers/net/wireless/
@install -p -m 644 $(WORK_DIR)/$(PKG_DIR)/8814au.ko $(INSTALL_DIR)$(INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)+/kernel/drivers/net/wireless/
else
$(RUN) mkdir -p $(INSTALL_DIR)$(INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)/kernel/drivers/net/wireless/
@install -p -m 644 $(WORK_DIR)/$(PKG_DIR)/8814au.ko $(INSTALL_DIR)$(INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)/kernel/drivers/net/wireless/
endif
$(RUN) $(STRIP) --strip-debug $(INSTALL_DIR)$(INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)/kernel/drivers/net/wireless/8814au.ko

#################
# TODO:
# 1) faire pointer le Makefile vers les cross-compilers - DONE
# 2) faire patch pour desactiver -Wimplicit-fallthrough=0 (rtl8812au uniquement) - TODO
# 3) AJOUTER $(STRIP) --strip-debug - TODO
# 2) faire patch pour desactiver -Wimplicit-fallthrough=0 (rtl8812au uniquement) - DONE
# 3) AJOUTER $(STRIP) --strip-debug - DONE
# 4) corriger le tc_vars pour TC_KERNEL avec + pour simplifier le code - DONE
# 5) corriger le spkclean vs REQUIRE_KERNEL - *TODO*
# 5) Repenser l'approche pour TC_TYPE - *TODO*
#################
6 changes: 0 additions & 6 deletions mk/spksrc.kernel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,5 @@ kernel_module_build:
@$(MSG) Building kernel module module=$(module)
$(RUN) LDFLAGS="" $(MAKE) -C $(WORK_DIR)/linux INSTALL_MOD_PATH=$(STAGING_INSTALL_PREFIX) modules M=$(word 2,$(subst :, ,$(module))) $(firstword $(subst :, ,$(module)))=m $(lastword $(subst :, ,$(module))).ko
$(RUN) cat $(word 2,$(subst :, ,$(module)))/modules.order >> $(WORK_DIR)/linux/modules.order
# Install in directory tree with + suffix for kernels >= 4.0
ifeq ($(call version_ge, ${TC_KERNEL}, 4),1)
$(RUN) mkdir -p $(STAGING_INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)+/kernel/$(word 2,$(subst :, ,$(module)))
install -m 644 $(WORK_DIR)/linux/$(word 2,$(subst :, ,$(module)))/$(lastword $(subst :, ,$(module))).ko $(STAGING_INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)+/kernel/$(word 2,$(subst :, ,$(module)))
else
$(RUN) mkdir -p $(STAGING_INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)/kernel/$(word 2,$(subst :, ,$(module)))
install -m 644 $(WORK_DIR)/linux/$(word 2,$(subst :, ,$(module)))/$(lastword $(subst :, ,$(module))).ko $(STAGING_INSTALL_PREFIX)/lib/modules/$(TC_KERNEL)/kernel/$(word 2,$(subst :, ,$(module)))
endif

0 comments on commit 1abbe08

Please sign in to comment.