LINUX_BACKPORTS_LICENSE = GPLv2
LINUX_BACKPORTS_LICENSE_FILES = COPYING
-LINUX_BACKPORTS_DEPENDENCIES = linux
-
-LINUX_BACKPORTS_MAKE_OPTS = \
- $(LINUX_MAKE_FLAGS) \
- KLIB_BUILD=$(LINUX_DIR) \
- KLIB=$(TARGET_DIR)
-
ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG),y)
LINUX_BACKPORTS_KCONFIG_FILE = $(LINUX_BACKPORTS_DIR)/defconfigs/$(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG))
else ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y)
LINUX_BACKPORTS_KCONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE))
endif
-define LINUX_BACKPORTS_BUILD_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) -C $(@D)
-endef
-
-define LINUX_BACKPORTS_INSTALL_TARGET_CMDS
- $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) \
- -C $(LINUX_DIR) M=$(@D) \
- INSTALL_MOD_DIR=backports \
- modules_install
-endef
-
LINUX_BACKPORTS_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CONFIG_FRAGMENT_FILES))
LINUX_BACKPORTS_KCONFIG_OPTS = $(LINUX_BACKPORTS_MAKE_OPTS)
+# linux-backports' build system expects the config options to be present
+# in the environment, and it is so when using their custom buildsystem,
+# because they are set in the main Makefile, which then calls a second
+# Makefile.
+#
+# In our case, we do not use that first Makefile. So, we parse the
+# .config file, filter-out comment lines and put the rest as command
+# line variables.
+#
+# LINUX_BACKPORTS_MAKE_OPTS is used by the kconfig-package infra, while
+# LINUX_BACKPORTS_MODULE_MAKE_OPTS is used by the kernel-module infra.
+#
+LINUX_BACKPORTS_MAKE_OPTS = \
+ BACKPORT_DIR=$(@D) \
+ KLIB_BUILD=$(LINUX_DIR) \
+ KLIB=$(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED) \
+ INSTALL_MOD_DIR=backports \
+ `sed -r -e '/^\#/d;' $(@D)/.config`
+
+LINUX_BACKPORTS_MODULE_MAKE_OPTS = $(LINUX_BACKPORTS_MAKE_OPTS)
+
+# This file is not automatically generated by 'oldconfig' that we use in
+# the kconfig-package infrastructure. In the linux buildsystem, it is
+# generated by running silentoldconfig, but that's not the case for
+# linux-backports: it uses a hand-crafted rule to generate that file.
+define LINUX_BACKPORTS_KCONFIG_FIXUP_CMDS
+ $(MAKE) -C $(@D) $(LINUX_BACKPORTS_MAKE_OPTS) backport-include/backport/autoconf.h
+endef
+
# Checks to give errors that the user can understand
ifeq ($(BR_BUILDING),y)
endif # BR_BUILDING
+$(eval $(kernel-module))
$(eval $(kconfig-package))
# linux-backports' own .config file needs options from the kernel's own