diff --git a/kernel/syno-dakota-1.2/Makefile b/kernel/syno-dakota-1.2/Makefile index 0cdb313b472..a20dd01436a 100644 --- a/kernel/syno-dakota-1.2/Makefile +++ b/kernel/syno-dakota-1.2/Makefile @@ -2,7 +2,7 @@ KERNEL_ARCH = dakota KERNEL_VERS = 1.2 KERNEL_BUILD = 7742 KERNEL_EXT = tbz -KERNEL_DIST = source/linux-4.4.x +KERNEL_DIST = linux-4.4.x KERNEL_BASE_ARCH = arm include ../../mk/spksrc.kernel.mk diff --git a/kernel/syno-dakota-1.2/digests b/kernel/syno-dakota-1.2/digests index e0005fa7f3b..22b30fd1f56 100644 --- a/kernel/syno-dakota-1.2/digests +++ b/kernel/syno-dakota-1.2/digests @@ -1,3 +1,3 @@ -synogpl-7742-dakota.tbz SHA1 2424a5d010114384b3a6f41e307199d9e1f120ba -synogpl-7742-dakota.tbz SHA256 68ead2d0e791b74b0a72ccfecdc2ab1801a25eb0102b0c517291064acb46abc5 -synogpl-7742-dakota.tbz MD5 b9bee48e3dca579e02d02abd898ba940 +dakota-linux-4.4.x.tbz SHA1 2424a5d010114384b3a6f41e307199d9e1f120ba +dakota-linux-4.4.x.tbz SHA256 68ead2d0e791b74b0a72ccfecdc2ab1801a25eb0102b0c517291064acb46abc5 +dakota-linux-4.4.x.tbz MD5 b9bee48e3dca579e02d02abd898ba940 diff --git a/kernel/syno-ipq806x-1.2/Makefile b/kernel/syno-ipq806x-1.2/Makefile index 30842ef873b..cf031eddb54 100644 --- a/kernel/syno-ipq806x-1.2/Makefile +++ b/kernel/syno-ipq806x-1.2/Makefile @@ -2,7 +2,7 @@ KERNEL_ARCH = ipq806x KERNEL_VERS = 1.2 KERNEL_BUILD = 7742 KERNEL_EXT = tbz -KERNEL_DIST = source/linux-4.4.x +KERNEL_DIST = linux-4.4.x KERNEL_BASE_ARCH = arm include ../../mk/spksrc.kernel.mk diff --git a/kernel/syno-ipq806x-1.2/digests b/kernel/syno-ipq806x-1.2/digests index 39015e82d35..edaf0e1d803 100644 --- a/kernel/syno-ipq806x-1.2/digests +++ b/kernel/syno-ipq806x-1.2/digests @@ -1,3 +1,3 @@ -synogpl-7742-ipq806x.tbz SHA1 a335c22c8bc67a795181c976b43ffee0ea07317d -synogpl-7742-ipq806x.tbz SHA256 e7a8bbc3129ce4dbaac5c1c054c710015d33cec448c74209805152554e9f95c3 -synogpl-7742-ipq806x.tbz MD5 c92af5840b1296d6485fddd94ead4308 +ipq806x-linux-4.4.x.tbz SHA1 a335c22c8bc67a795181c976b43ffee0ea07317d +ipq806x-linux-4.4.x.tbz SHA256 e7a8bbc3129ce4dbaac5c1c054c710015d33cec448c74209805152554e9f95c3 +ipq806x-linux-4.4.x.tbz MD5 c92af5840b1296d6485fddd94ead4308 diff --git a/kernel/syno-northstarplus-1.2/Makefile b/kernel/syno-northstarplus-1.2/Makefile index 54cfb227f91..68d501d118d 100644 --- a/kernel/syno-northstarplus-1.2/Makefile +++ b/kernel/syno-northstarplus-1.2/Makefile @@ -2,7 +2,7 @@ KERNEL_ARCH = northstarplus KERNEL_VERS = 1.2 KERNEL_BUILD = 7742 KERNEL_EXT = tbz -KERNEL_DIST = source/linux-3.6.x +KERNEL_DIST = linux-3.6.x KERNEL_CONFIG = synoconfigs/broadcom_northstarplus KERNEL_BASE_ARCH = arm diff --git a/kernel/syno-northstarplus-1.2/digests b/kernel/syno-northstarplus-1.2/digests index 5b8cbd79a60..27c38ea9b2b 100644 --- a/kernel/syno-northstarplus-1.2/digests +++ b/kernel/syno-northstarplus-1.2/digests @@ -1,3 +1,3 @@ -synogpl-7742-northstarplus.tbz SHA1 61da8ccf39672946aef45fcccb2c49a3d25e6fee -synogpl-7742-northstarplus.tbz SHA256 2f414eec8ec704a7a32b28d1aab18ebbaac65466526f3989f7b7fc73dad24078 -synogpl-7742-northstarplus.tbz MD5 e8392cd130573fb272097a300b26fd24 +northstarplus-linux-3.6.x.tbz SHA1 61da8ccf39672946aef45fcccb2c49a3d25e6fee +northstarplus-linux-3.6.x.tbz SHA256 2f414eec8ec704a7a32b28d1aab18ebbaac65466526f3989f7b7fc73dad24078 +northstarplus-linux-3.6.x.tbz MD5 e8392cd130573fb272097a300b26fd24 diff --git a/mk/spksrc.copy.mk b/mk/spksrc.copy.mk index f80d44ea375..81c865af6e2 100644 --- a/mk/spksrc.copy.mk +++ b/mk/spksrc.copy.mk @@ -62,6 +62,10 @@ ifeq ($(strip $(PLIST_TRANSFORM)),) PLIST_TRANSFORM= cat endif +ifeq ($(strip $(REQUIRE_KERNEL)),1) +DEPENDS += kernel/syno-$(TC_ARCH)-$(TC_VERS) +endif + $(INSTALL_PLIST): @(\ for depend in $(DEPENDS) ; \ diff --git a/mk/spksrc.install.mk b/mk/spksrc.install.mk index 4841c2ad89d..a308755a123 100644 --- a/mk/spksrc.install.mk +++ b/mk/spksrc.install.mk @@ -63,6 +63,8 @@ post_install_target: $(INSTALL_TARGET) $(INSTALL_PLIST): find $(INSTALL_DIR)/$(INSTALL_PREFIX)/ \! -type d -printf '%P\n' | sort | \ diff $(PRE_INSTALL_PLIST) - | grep '>' | cut -d' ' -f2- > $@ + # Generate $(PKG_NAME).plist.auto for newly added files (diff against .tmp) + comm -3 $(PRE_INSTALL_PLIST) $(INSTALL_PLIST) > $(INSTALL_PLIST).auto install_correct_lib_files: $(INSTALL_PLIST) @for pc_file in `grep -e "^lib/pkgconfig/.*\.pc$$" $(INSTALL_PLIST)` ; \ diff --git a/mk/spksrc.kernel-flags.mk b/mk/spksrc.kernel-flags.mk index a517cfd7866..1fcf139e25c 100644 --- a/mk/spksrc.kernel-flags.mk +++ b/mk/spksrc.kernel-flags.mk @@ -1,3 +1,9 @@ +# if TC_TYPE is unset then it is being +# called directly from spksrc/kernel directory +ifeq ($(strip $(TC_TYPE)),) +include $(WORK_DIR)/tc_vars.mk +endif + ifeq ($(strip $(KERNEL_NAME)),) KERNEL_NAME = syno-$(KERNEL_ARCH)-$(KERNEL_VERS) endif @@ -10,7 +16,22 @@ ifeq ($(strip $(KERNEL_DIST_FILE)),) KERNEL_DIST_FILE = $(KERNEL_ARCH)-$(KERNEL_DIST).$(KERNEL_EXT) endif +ifeq ($(strip $(KERNEL_CONFIG)),) +KERNEL_CONFIG = synoconfigs/$(KERNEL_ARCH) +endif + +# +# For DSM +# +ifeq ($(strip $(TC_TYPE)),DSM) + +ifeq ($(strip $(KERNEL_DIST_SITE)),) +KERNEL_DIST_SITE = https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/$(KERNEL_BUILD)branch/$(KERNEL_URL_DIR) +endif + +# # For DSM version >= 6.1 +# ifeq ($(shell expr "$(KERNEL_BUILD)" \>= 15152),1) ifeq ($(strip $(KERNEL_DIST_NAME)),) KERNEL_DIST_NAME = $(KERNEL_DIST).$(KERNEL_EXT) @@ -28,7 +49,9 @@ ifeq ($(strip $(KERNEL_STRIP)),) KERNEL_STRIP = 0 endif +# # For DSM version = 5.2 +# else ifeq ($(shell expr "$(KERNEL_BUILD)" \>= 5565),1) ifeq ($(strip $(KERNEL_DIST_NAME)),) KERNEL_DIST_NAME = $(KERNEL_ARCH)-source.$(KERNEL_EXT) @@ -46,7 +69,9 @@ ifeq ($(strip $(KERNEL_STRIP)),) KERNEL_STRIP = 1 endif +# # For DSM version <= 5.1 +# else ifeq ($(shell expr "$(KERNEL_BUILD)" \<= 5004),1) ifeq ($(strip $(KERNEL_DIST_NAME)),) KERNEL_DIST_NAME = synogpl-$(KERNEL_BUILD)-$(KERNEL_ARCH).$(KERNEL_EXT) @@ -65,10 +90,28 @@ KERNEL_STRIP = 1 endif endif +# +# SRM +# +else ifeq ($(strip $(TC_TYPE)),SRM) + ifeq ($(strip $(KERNEL_DIST_SITE)),) -KERNEL_DIST_SITE = https://sourceforge.net/projects/dsgpl/files/Synology%20NAS%20GPL%20Source/$(KERNEL_BUILD)branch/$(KERNEL_URL_DIR) +KERNEL_DIST_SITE = https://sourceforge.net/projects/dsgpl/files/Synology%20Router%20GPL%20Source/$(KERNEL_BUILD)branch/$(KERNEL_URL_DIR) endif -ifeq ($(strip $(KERNEL_CONFIG)),) -KERNEL_CONFIG = synoconfigs/$(KERNEL_ARCH) +ifeq ($(strip $(KERNEL_DIST_NAME)),) +KERNEL_DIST_NAME = synogpl-$(KERNEL_BUILD)-$(KERNEL_ARCH).$(KERNEL_EXT) +endif + +ifeq ($(strip $(KERNEL_URL_DIR)),) +KERNEL_URL_DIR = / +endif + +ifeq ($(strip $(KERNEL_PREFIX)),) +KERNEL_PREFIX = source/$(KERNEL_DIST) +endif + +ifeq ($(strip $(KERNEL_STRIP)),) +KERNEL_STRIP = 1 +endif endif diff --git a/mk/spksrc.kernel.mk b/mk/spksrc.kernel.mk index 416ae570623..b0f8068bb6e 100644 --- a/mk/spksrc.kernel.mk +++ b/mk/spksrc.kernel.mk @@ -9,7 +9,8 @@ include ../../mk/spksrc.kernel-flags.mk NAME = $(KERNEL_NAME) COOKIE_PREFIX = linux- URLS = $(KERNEL_DIST_SITE)/$(KERNEL_DIST_NAME) -PKG_DIR = linux +PKG_NAME = linux +PKG_DIR = $(PKG_NAME) ifneq ($(KERNEL_DIST_FILE),) LOCAL_FILE = $(KERNEL_DIST_FILE) # download.mk uses PKG_DIST_FILE @@ -28,8 +29,16 @@ EXTRACT_CMD = $(EXTRACT_CMD.$(KERNEL_EXT)) --skip-old-files --strip-components PRE_CONFIGURE_TARGET = kernel_pre_configure_target CONFIGURE_TARGET = kernel_configure_target PRE_COMPILE_TARGET = kernel_module_prepare_target +ifeq ($(strip $(REQUIRE_KERNEL_MODULE)),) COMPILE_TARGET = nop -COPY_TARGET = nop +else +COMPILE_TARGET = kernel_module_compile_target +endif +# spksrc.install.mk called for PRE_INSTALL_PLIST +# in order to generate a work*/linux.plist.auto +# later used by spksr.plist.mk to generate the +# diff based on .ko kernel objects +INSTALL_TARGET = nop ##### @@ -56,10 +65,16 @@ include ../../mk/spksrc.configure.mk compile: configure include ../../mk/spksrc.compile.mk +install: compile +include ../../mk/spksrc.install.mk + +plist: install +include ../../mk/spksrc.plist.mk + clean: rm -fr work work-* -all: compile +all: install plist ### For make digests include ../../mk/spksrc.generate-digests.mk @@ -75,8 +90,8 @@ kernel_configure_target: @$(MSG) "Updating kernel Makefile" $(RUN) sed -i -r 's,^CROSS_COMPILE\s*.+,CROSS_COMPILE\t= $(TC_PATH)$(TC_PREFIX),' Makefile $(RUN) sed -i -r 's,^ARCH\s*.+,ARCH\t= $(KERNEL_ARCH),' Makefile -# Add "+" to EXTRAVERSION for kernels version >= 4.x -ifeq ($(shell expr "$(word 1,$(subst ., ,$(TC_KERNEL)))" \>= 4),1) +# Add "+" to EXTRAVERSION for kernels version >= 4.4 +ifeq ($(call version_ge, ${TC_KERNEL}, 4.4),1) $(RUN) sed -i -r -e 's,^EXTRAVERSION\s*.+,&+,' -e 's,=\+,= \+,' Makefile endif test -e $(WORK_DIR)/arch/$(KERNEL_ARCH) || $(RUN) ln -sf $(KERNEL_BASE_ARCH) arch/$(KERNEL_ARCH) @@ -85,9 +100,9 @@ endif @$(MSG) "Applying $(KERNEL_CONFIG) configuration" $(RUN) cp $(KERNEL_CONFIG) .config @$(MSG) "Set any new symbols to their default value" -# olddefconfig is not available <= 3.2 -ifeq ($(shell printf '%s\n' "$(TC_KERNEL)" "3.3" | sort -V | head -1),$(TC_KERNEL)) - @$(MSG) "oldconfig OLD style... $(TC_KERNEL) <= 3.2" +# olddefconfig is not available < 3.8 +ifeq ($(call version_lt, ${TC_KERNEL}, 3.8),1) + @$(MSG) "oldconfig OLD style... $(TC_KERNEL) < 3.8" $(RUN) yes "" | $(MAKE) oldconfig else $(RUN) $(MAKE) olddefconfig @@ -99,7 +114,8 @@ kernel_module_prepare_target: @$(MSG) "DISTRIB_DIR = $(DISTRIB_DIR)" @$(MSG) "Prepare kernel source for module build" $(RUN) $(MAKE) modules_prepare -ifeq ($(shell expr "$(word 1,$(subst ., ,$(TC_KERNEL)))" \>= 3),1) +# Call to make kernelversion is not available for kernel <= 3.0 +ifeq ($(call version_ge, ${TC_KERNEL}, 3),1) @$(MSG) "Get kernel version" $(RUN) $(MAKE) kernelversion endif @@ -107,4 +123,14 @@ endif .PHONY: kernel_module_compile_target kernel_module_compile_target: - $(RUN) $(MAKE) modules + @for module in $(REQUIRE_KERNEL_MODULE); \ + do \ + $(MAKE) kernel_module_build module=$$module ; \ + done + +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 + $(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))) diff --git a/mk/spksrc.patch.mk b/mk/spksrc.patch.mk index cb066e6285a..9db2c247db8 100644 --- a/mk/spksrc.patch.mk +++ b/mk/spksrc.patch.mk @@ -17,7 +17,7 @@ endif # find patches into the following directory order: # patches/*.patch -# patches/kernel-$(TC_KERNEL)/*.patch +# patches/kernel-$(subst +,,$(TC_KERNEL))/*.patch ## Discard any ending + # patches/DSM-$(TCVERSION)/*.patch # patches/$(group)/*.patch # patches/$(group)-$(TCVERSION)/*.patch @@ -27,7 +27,7 @@ endif ifeq ($(strip $(PATCHES)),) PATCHES = $(foreach group,ARMv5_ARCHS ARMv7_ARCHS ARMv7L_ARCHS ARMv8_ARCHS PPC_ARCHS i686_ARCHS x64_ARCHS, \ $(foreach arch,$($(group)), \ - $(if $(filter $(ARCH),$(arch)),$(sort $(wildcard patches/*.patch patches/kernel-$(TC_KERNEL)/*.patch patches/DSM-$(TCVERSION)/*.patch patches/$(shell echo ${group} | cut -f1 -d'_'| tr '[:upper:]' '[:lower:]')/*.patch patches/$(shell echo ${group} | cut -f1 -d'_'| tr '[:upper:]' '[:lower:]')-$(TCVERSION)/*.patch patches/$(arch)/*.patch patches/$(arch)-$(TCVERSION)/*.patch)),))) + $(if $(filter $(ARCH),$(arch)),$(sort $(wildcard patches/*.patch patches/kernel-$(subst +,,$(TC_KERNEL))/*.patch patches/DSM-$(TCVERSION)/*.patch patches/$(shell echo ${group} | cut -f1 -d'_'| tr '[:upper:]' '[:lower:]')/*.patch patches/$(shell echo ${group} | cut -f1 -d'_'| tr '[:upper:]' '[:lower:]')-$(TCVERSION)/*.patch patches/$(arch)/*.patch patches/$(arch)-$(TCVERSION)/*.patch)),))) endif PATCH_COOKIE = $(WORK_DIR)/.$(COOKIE_PREFIX)patch_done diff --git a/mk/spksrc.plist.mk b/mk/spksrc.plist.mk index 32e7eb078ff..10519b41db5 100644 --- a/mk/spksrc.plist.mk +++ b/mk/spksrc.plist.mk @@ -3,6 +3,8 @@ # Variables: # PLIST_TRANSFORM Command to transform PLIST (default: cat) +INSTALL_COOKIE = $(WORK_DIR)/.$(COOKIE_PREFIX)plist_done + ifeq ($(strip $(PLIST_TRANSFORM)),) PLIST_TRANSFORM= cat endif @@ -16,7 +18,20 @@ cat_PLIST: @if [ -f PLIST ] ; \ then \ $(PLIST_TRANSFORM) PLIST ; \ + # If there is a PLIST.auto file or if parent directory is kernel \ + elif [ -f PLIST.auto -o $$(basename $$(dirname $$(pwd))) = "kernel" ] ; \ + then \ + for file in $$(cat $(WORK_DIR)/$(PKG_NAME).plist.auto | sort) ; \ + do \ + type=$$(file -F, $(INSTALL_DIR)/$(INSTALL_PREFIX)/$$file | awk -F',[[:blank:]]' '{print $$2}') ; \ + case $$type in \ + ELF*LSB[[:space:]]executable ) echo "bin:$$file" ;; \ + ELF* ) echo "lib:$$file" ;; \ + symbolic[[:space:]]link* ) echo "lnk:$$file" ;; \ + * ) echo "rsc:$$file" ;; \ + esac \ + done \ else \ $(MSG) "No PLIST for $(NAME)" >&2; \ fi - + @touch -f $(INSTALL_COOKIE) diff --git a/mk/spksrc.tc.mk b/mk/spksrc.tc.mk index b2e79476d35..435e3a62a67 100644 --- a/mk/spksrc.tc.mk +++ b/mk/spksrc.tc.mk @@ -6,6 +6,8 @@ default: all WORK_DIR := $(shell pwd)/work include ../../mk/spksrc.directories.mk +include ../../mk/spksrc.common.mk + # Configure the included makefiles URLS = $(TC_DIST_SITE)/$(TC_DIST_NAME) @@ -83,7 +85,12 @@ tc_vars: fix @echo TC_BUILD := $(TC_BUILD) @echo TC_OS_MIN_VER := $(TC_OS_MIN_VER) @echo TC_ARCH := $(TC_ARCH) +# Add "+" to EXTRAVERSION for kernels version >= 4.4 +ifeq ($(call version_ge, ${TC_KERNEL}, 4.4),1) + @echo TC_KERNEL := $(TC_KERNEL)+ +else @echo TC_KERNEL := $(TC_KERNEL) +endif @echo TC_GCC := $(TC_GCC) @echo TC_GLIBC := $(TC_GLIBC)