diff --git a/linux/linux.mk b/linux/linux.mk index bd3f2ac29..9cd54a899 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -206,6 +206,8 @@ define LINUX_CONFIGURE_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_SECURITY_NETWORK,$(@D)/.config)) $(if $(BR2_LINUX_KERNEL_APPENDED_DTB), $(call KCONFIG_ENABLE_OPT,CONFIG_ARM_APPENDED_DTB,$(@D)/.config)) + $(if $(BR2_PACKAGE_LINUX_BACKPORTS), + $(call KCONFIG_ENABLE_OPT,CONFIG_MODULES,$(@D)/.config)) yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_MAKE_FLAGS) -C $(@D) oldconfig endef diff --git a/package/Config.in b/package/Config.in index 792f39e6d..c0a1c8bf2 100644 --- a/package/Config.in +++ b/package/Config.in @@ -317,6 +317,7 @@ endif source "package/iucode-tool/Config.in" source "package/kbd/Config.in" source "package/lcdproc/Config.in" + source "package/linux-backports/Config.in" source "package/lm-sensors/Config.in" source "package/lshw/Config.in" source "package/lsuio/Config.in" diff --git a/package/linux-backports/Config.in b/package/linux-backports/Config.in new file mode 100644 index 000000000..cc4b5fa53 --- /dev/null +++ b/package/linux-backports/Config.in @@ -0,0 +1,40 @@ +config BR2_PACKAGE_LINUX_BACKPORTS + bool "linux-backports" + depends on BR2_LINUX_KERNEL + help + Compatibility driver backports (former compat-wireless). + + http://wireless.kernel.org/ + +# +# Configuration selection +# +if BR2_PACKAGE_LINUX_BACKPORTS + +choice + prompt "Backport configuration" + default BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG + +config BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG + bool "Using a defconfig" + +config BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG + bool "Using a custom config file" + +endchoice + +config BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG + string "Defconfig name" + depends on BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG + help + Name of the backports defconfig file to use, without the + leading 'defconfig-'. The defconfig is located in + defconfigs/ in the linux-backports tree. + +config BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE + string "Configuration file path" + depends on BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG + help + Path to the linux-backports configuration file + +endif diff --git a/package/linux-backports/linux-backports-0001-backports-Makefile-introduce-KROOT-and-fix-INSTALL_M.patch b/package/linux-backports/linux-backports-0001-backports-Makefile-introduce-KROOT-and-fix-INSTALL_M.patch new file mode 100644 index 000000000..daccd5785 --- /dev/null +++ b/package/linux-backports/linux-backports-0001-backports-Makefile-introduce-KROOT-and-fix-INSTALL_M.patch @@ -0,0 +1,35 @@ +From 83b3f7e3a9b2a2b3057b32fd41bed4b4503e86d3 Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Thu, 8 May 2014 15:06:15 +0200 +Subject: [PATCH 01/10] backports: Makefile: introduce KROOT and fix + INSTALL_MOD_PATH definition + +INSTALL_MOD_PATH should point to the root directory of the target +rootfs, what is KROOT. + +Signed-off-by: Samuel Martin +--- + Makefile | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index ea3982b..3ff74d9 100644 +--- a/Makefile ++++ b/Makefile +@@ -9,10 +9,11 @@ SHELL := /bin/bash + BACKPORT_PWD := $(shell pwd) + + KMODDIR ?= updates +-ifneq ($(origin KLIB), undefined) +-KMODPATH_ARG := "INSTALL_MOD_PATH=$(KLIB)" ++ifneq ($(origin KROOT), undefined) ++KMODPATH_ARG := "INSTALL_MOD_PATH=$(KROOT)" + else + KLIB := /lib/modules/$(shell uname -r)/ ++KROOT := / + KMODPATH_ARG := + endif + KLIB_BUILD ?= $(KLIB)/build/ +-- +1.9.2 + diff --git a/package/linux-backports/linux-backports-0002-backports-Makefile-introduce-KVERSION-and-rework-KLI.patch b/package/linux-backports/linux-backports-0002-backports-Makefile-introduce-KVERSION-and-rework-KLI.patch new file mode 100644 index 000000000..d827704be --- /dev/null +++ b/package/linux-backports/linux-backports-0002-backports-Makefile-introduce-KVERSION-and-rework-KLI.patch @@ -0,0 +1,38 @@ +From 0f44ff07f1a3cfd80638695d6f625f39ec8b22ef Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Thu, 8 May 2014 15:09:34 +0200 +Subject: [PATCH 02/10] backports: Makefile: introduce KVERSION and rework KLIB + definition + +Signed-off-by: Samuel Martin +--- + Makefile | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 3ff74d9..e9256e4 100644 +--- a/Makefile ++++ b/Makefile +@@ -12,10 +12,18 @@ KMODDIR ?= updates + ifneq ($(origin KROOT), undefined) + KMODPATH_ARG := "INSTALL_MOD_PATH=$(KROOT)" + else +-KLIB := /lib/modules/$(shell uname -r)/ + KROOT := / + KMODPATH_ARG := + endif ++ ++ifneq ($(origin KLIB_BUILD), undefined) ++KVERSION := $(shell $(MAKE) -C $(KLIB_BUILD) $(if $(ARCH),ARCH=$(ARCH)) \ ++ --no-print-directory -s kernelrelease) ++else ++KVERSION := $(shell uname -r) ++endif ++ ++KLIB := $(KROOT)/lib/modules/$(KVERSION) + KLIB_BUILD ?= $(KLIB)/build/ + KERNEL_CONFIG := $(KLIB_BUILD)/.config + KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile +-- +1.9.2 + diff --git a/package/linux-backports/linux-backports-0003-backports-Makefile-export-KROOT-and-KVERSION-variabl.patch b/package/linux-backports/linux-backports-0003-backports-Makefile-export-KROOT-and-KVERSION-variabl.patch new file mode 100644 index 000000000..1cfa26840 --- /dev/null +++ b/package/linux-backports/linux-backports-0003-backports-Makefile-export-KROOT-and-KVERSION-variabl.patch @@ -0,0 +1,27 @@ +From 67644fb4eb9638e941255cc37dc450b8383c83e9 Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Thu, 8 May 2014 15:10:08 +0200 +Subject: [PATCH 03/10] backports: Makefile: export KROOT and KVERSION + variables + +Signed-off-by: Samuel Martin +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index e9256e4..2f446e6 100644 +--- a/Makefile ++++ b/Makefile +@@ -29,7 +29,7 @@ KERNEL_CONFIG := $(KLIB_BUILD)/.config + KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile + CONFIG_MD5 := $(shell md5sum $(KERNEL_CONFIG) 2>/dev/null | sed 's/\s.*//') + +-export KLIB KLIB_BUILD BACKPORT_PWD KMODDIR KMODPATH_ARG ++export KLIB KLIB_BUILD BACKPORT_PWD KMODDIR KMODPATH_ARG KROOT KVERSION + + # disable built-in rules for this file + .SUFFIXES: +-- +1.9.2 + diff --git a/package/linux-backports/linux-backports-0004-backports-blacklist.sh-support-install-root-not-in.patch b/package/linux-backports/linux-backports-0004-backports-blacklist.sh-support-install-root-not-in.patch new file mode 100644 index 000000000..2ddfb8c06 --- /dev/null +++ b/package/linux-backports/linux-backports-0004-backports-blacklist.sh-support-install-root-not-in.patch @@ -0,0 +1,46 @@ +From fbab3acdb2043fb24fb557e536e15aa7c2db0a15 Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Thu, 8 May 2014 15:45:11 +0200 +Subject: [PATCH 04/10] backports: blacklist.sh: support install root not in / + +Signed-off-by: Samuel Martin +--- + Makefile.real | 2 +- + scripts/blacklist.sh | 7 ++++--- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/Makefile.real b/Makefile.real +index f60d5ca..5a25db4 100644 +--- a/Makefile.real ++++ b/Makefile.real +@@ -92,7 +92,7 @@ install: modules + @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_PWD) \ + INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG) \ + modules_install +- @./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR) ++ @./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR) $(KROOT) + @./scripts/compress_modules.sh $(KLIB)/$(KMODDIR) + @./scripts/check_depmod.sh + @/sbin/depmod -a +diff --git a/scripts/blacklist.sh b/scripts/blacklist.sh +index f941c4a..f995f11 100755 +--- a/scripts/blacklist.sh ++++ b/scripts/blacklist.sh +@@ -1,10 +1,11 @@ + #!/bin/bash + +-BLACKLIST_CONF="/etc/modprobe.d/backports.conf" +-BLACKLIST_MAP=".blacklist.map" +- + MODULE_DIR=$1 + MODULE_UPDATES=$2 ++KROOT=$3 ++ ++BLACKLIST_CONF="$KROOT/etc/modprobe.d/backports.conf" ++BLACKLIST_MAP=".blacklist.map" + + if [[ ! -d $MODULE_DIR ]]; then + exit +-- +1.9.2 + diff --git a/package/linux-backports/linux-backports-0005-backports-check_depmod.sh-support-install-root-not-i.patch b/package/linux-backports/linux-backports-0005-backports-check_depmod.sh-support-install-root-not-i.patch new file mode 100644 index 000000000..623fedebe --- /dev/null +++ b/package/linux-backports/linux-backports-0005-backports-check_depmod.sh-support-install-root-not-i.patch @@ -0,0 +1,61 @@ +From 44c7269249a5cbf4b0b96d99ec63aac04f05cebf Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Thu, 8 May 2014 15:55:31 +0200 +Subject: [PATCH 05/10] backports: check_depmod.sh: support install root not in + / + +Signed-off-by: Samuel Martin +--- + Makefile.real | 6 ++++-- + scripts/check_depmod.sh | 7 ++++--- + 2 files changed, 8 insertions(+), 5 deletions(-) + +diff --git a/Makefile.real b/Makefile.real +index 5a25db4..a12a0db 100644 +--- a/Makefile.real ++++ b/Makefile.real +@@ -6,6 +6,8 @@ else + export BACKPORTS_GIT_TRACKER_DEF= + endif + ++DEPMOD ?= /sbin/depmod ++ + # disable built-in rules for this file + .SUFFIXES: + +@@ -94,8 +96,8 @@ install: modules + modules_install + @./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR) $(KROOT) + @./scripts/compress_modules.sh $(KLIB)/$(KMODDIR) +- @./scripts/check_depmod.sh +- @/sbin/depmod -a ++ @./scripts/check_depmod.sh $(DEPMOD) $(KROOT) ++ @$(DEPMOD) -a + @./scripts/update-initramfs.sh $(KLIB) + @echo + @echo Your backported driver modules should be installed now. +diff --git a/scripts/check_depmod.sh b/scripts/check_depmod.sh +index 6123894..9f2e238 100755 +--- a/scripts/check_depmod.sh ++++ b/scripts/check_depmod.sh +@@ -6,13 +6,14 @@ + + # Seems Mandriva has an $DEPMOD_DIR but it doesn't have any files, + # so lets deal with those distributions. +-DEPMOD_CONF="/etc/depmod.conf" ++DEPMOD_CMD="${1:-depmod}" ++KROOT="${2:-/}" ++DEPMOD_CONF="$KROOT/etc/depmod.conf" + DEPMOD_CONF_TMP="$DEPMOD_CONF.backports.old" +-DEPMOD_DIR="/etc/depmod.d/" ++DEPMOD_DIR="$KROOT/etc/depmod.d/" + BACKPORT_DEPMOD_FILE="backports.conf" + GREP_REGEX_UPDATES="^[[:space:]]*search.*[[:space:]]updates\([[:space:]]\|$\)" + GREP_REGEX_SEARCH="^[[:space:]]*search[[:space:]].\+$" +-DEPMOD_CMD="depmod" + + function add_compat_depmod_conf { + echo "NOTE: Your distribution lacks an $DEPMOD_DIR directory with " +-- +1.9.2 + diff --git a/package/linux-backports/linux-backports-0006-backports-Makefile.real-use-depmod.sh-instead-of-the.patch b/package/linux-backports/linux-backports-0006-backports-Makefile.real-use-depmod.sh-instead-of-the.patch new file mode 100644 index 000000000..a03eaa750 --- /dev/null +++ b/package/linux-backports/linux-backports-0006-backports-Makefile.real-use-depmod.sh-instead-of-the.patch @@ -0,0 +1,37 @@ +From 32af7610d8db0591180d803ccd714d6bd1e7593e Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Thu, 8 May 2014 16:08:52 +0200 +Subject: [PATCH 06/10] backports: Makefile.real: use depmod.sh instead of the + depmod program + +Call depmod.sh from the kernel source tree and set all parameter to +improve cross-compilation support. + +This way, target root location, kernel version and symbol prefix are +also handled. + +Signed-off-by: Samuel Martin +--- + Makefile.real | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/Makefile.real b/Makefile.real +index a12a0db..1dc9323 100644 +--- a/Makefile.real ++++ b/Makefile.real +@@ -97,7 +97,11 @@ install: modules + @./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR) $(KROOT) + @./scripts/compress_modules.sh $(KLIB)/$(KMODDIR) + @./scripts/check_depmod.sh $(DEPMOD) $(KROOT) +- @$(DEPMOD) -a ++ @$(KMODPATH_ARGS) $(KLIB_BUILD)/scripts/depmod.sh \ ++ $(DEPMOD) \ ++ $(KVERSION) \ ++ "$(shell sed -n '/^CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX=y/ s//_/p' \ ++ $(KLIB_BUILD)/.config)" + @./scripts/update-initramfs.sh $(KLIB) + @echo + @echo Your backported driver modules should be installed now. +-- +1.9.2 + diff --git a/package/linux-backports/linux-backports-0007-backports-Makefile.real-disable-update-initramfs.sh-.patch b/package/linux-backports/linux-backports-0007-backports-Makefile.real-disable-update-initramfs.sh-.patch new file mode 100644 index 000000000..ccd276d0f --- /dev/null +++ b/package/linux-backports/linux-backports-0007-backports-Makefile.real-disable-update-initramfs.sh-.patch @@ -0,0 +1,27 @@ +From f374a3e33fac77a0d639314653194c5cf5c5c94c Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Thu, 8 May 2014 16:19:31 +0200 +Subject: [PATCH 07/10] backports: Makefile.real: disable update-initramfs.sh + execution when cross-compiling + +Signed-off-by: Samuel Martin +--- + Makefile.real | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.real b/Makefile.real +index 1dc9323..2503016 100644 +--- a/Makefile.real ++++ b/Makefile.real +@@ -102,7 +102,7 @@ install: modules + $(KVERSION) \ + "$(shell sed -n '/^CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX=y/ s//_/p' \ + $(KLIB_BUILD)/.config)" +- @./scripts/update-initramfs.sh $(KLIB) ++ @test -n "$(CROSS_COMPILE)" || ./scripts/update-initramfs.sh $(KLIB) + @echo + @echo Your backported driver modules should be installed now. + @echo Reboot. +-- +1.9.2 + diff --git a/package/linux-backports/linux-backports-0008-backports-Makefile.real-silent-reboot-message-when-c.patch b/package/linux-backports/linux-backports-0008-backports-Makefile.real-silent-reboot-message-when-c.patch new file mode 100644 index 000000000..3a3427340 --- /dev/null +++ b/package/linux-backports/linux-backports-0008-backports-Makefile.real-silent-reboot-message-when-c.patch @@ -0,0 +1,35 @@ +From d09feb79cb46c3c7c7b211043d88b3fc951f922b Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Thu, 8 May 2014 16:20:12 +0200 +Subject: [PATCH 08/10] backports: Makefile.real: silent reboot message when + cross-compiling + +Signed-off-by: Samuel Martin +--- + Makefile.real | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/Makefile.real b/Makefile.real +index 2503016..3be1913 100644 +--- a/Makefile.real ++++ b/Makefile.real +@@ -103,10 +103,12 @@ install: modules + "$(shell sed -n '/^CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX=y/ s//_/p' \ + $(KLIB_BUILD)/.config)" + @test -n "$(CROSS_COMPILE)" || ./scripts/update-initramfs.sh $(KLIB) +- @echo +- @echo Your backported driver modules should be installed now. +- @echo Reboot. +- @echo ++ @if test ! -n "$(CROSS_COMPILE)" ; then \ ++ echo ; \ ++ echo Your backported driver modules should be installed now. ; \ ++ echo Reboot. ; \ ++ echo ; \ ++ fi + + .PHONY: modules_install + modules_install: install +-- +1.9.2 + diff --git a/package/linux-backports/linux-backports-0009-backports-compress_module.sh-gzip-silently-overrides.patch b/package/linux-backports/linux-backports-0009-backports-compress_module.sh-gzip-silently-overrides.patch new file mode 100644 index 000000000..bc044f76a --- /dev/null +++ b/package/linux-backports/linux-backports-0009-backports-compress_module.sh-gzip-silently-overrides.patch @@ -0,0 +1,26 @@ +From 9f13e8636354f53ad9a82715f30bc7733daaf92f Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Wed, 7 May 2014 16:40:25 +0200 +Subject: [PATCH 09/10] backports: compress_module.sh: gzip silently overrides + existing compressed modules + +Signed-off-by: Samuel Martin +--- + scripts/compress_modules.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/compress_modules.sh b/scripts/compress_modules.sh +index b2034c2..631eec9 100755 +--- a/scripts/compress_modules.sh ++++ b/scripts/compress_modules.sh +@@ -7,6 +7,6 @@ source ./scripts/mod_helpers.sh + if test "$(mod_filename mac80211)" = "mac80211.ko.gz" ; then + for driver in $(find "$1" -type f -name *.ko); do + echo COMPRESS $driver +- gzip -9 $driver ++ gzip -f -9 $driver + done + fi +-- +1.9.2 + diff --git a/package/linux-backports/linux-backports-0010-backports-Makefile-update-help-text.patch b/package/linux-backports/linux-backports-0010-backports-Makefile-update-help-text.patch new file mode 100644 index 000000000..12b8ba82b --- /dev/null +++ b/package/linux-backports/linux-backports-0010-backports-Makefile-update-help-text.patch @@ -0,0 +1,40 @@ +From 99add35cab73b890dd6810fa303ec0c0fa06218c Mon Sep 17 00:00:00 2001 +From: Samuel Martin +Date: Thu, 8 May 2014 16:46:56 +0200 +Subject: [PATCH 10/10] backports: Makefile: update help text + +Signed-off-by: Samuel Martin +--- + Makefile | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/Makefile b/Makefile +index 2f446e6..acc0e15 100644 +--- a/Makefile ++++ b/Makefile +@@ -62,11 +62,17 @@ mrproper: + echo "/--------------" ;\ + echo "| Your kernel headers are incomplete/not installed." ;\ + echo "| Please install kernel headers, including a .config" ;\ +- echo "| file or use the KLIB/KLIB_BUILD make variables to" ;\ +- echo "| set the kernel to build against, e.g." ;\ +- echo "| make KLIB=/lib/modules/3.1.7/" ;\ +- echo "| to compile/install for the installed kernel 3.1.7" ;\ +- echo "| (that isn't currently running.)" ;\ ++ echo "| file or use the KROOT/KLIB_BUILD make variables to" ;\ ++ echo "| set the kernel to build against, e.g.:" ;\ ++ echo "| * to compile/install for the installed kernel 3.1.7" ;\ ++ echo "| (that isn't currently running.):" ;\ ++ echo "| $$ make KLIB_BUILD=/lib/modules/3.1.7/build" ;\ ++ echo "| * to cross-compile/install for an arm target in /opt/arm-dev/rootfs:" ;\ ++ echo "| $$ make \\" ;\ ++ echo "| ARCH=arm \\" ;\ ++ echo "| CROSS_COMPILE=/opt/ct-ng/arm-linux/bin/arm-linux- \\" ;\ ++ echo "| KROOT=/opt/arm-dev/rootfs \\" ;\ ++ echo "| KLIB_BUILD=/opt/arm-dev/linux" ;\ + echo "\\--" ;\ + false) + @set -e ; if [ "$$(cat .kernel_config_md5 2>/dev/null)" != "$(CONFIG_MD5)" ] ;\ +-- +1.9.2 + diff --git a/package/linux-backports/linux-backports.mk b/package/linux-backports/linux-backports.mk new file mode 100644 index 000000000..97f5ee1a4 --- /dev/null +++ b/package/linux-backports/linux-backports.mk @@ -0,0 +1,92 @@ +################################################################################ +# +# linux-backports +# +################################################################################ + +LINUX_BACKPORTS_VERSION_MAJOR = 3.15-rc1 +LINUX_BACKPORTS_VERSION = $(LINUX_BACKPORTS_VERSION_MAJOR)-1 +LINUX_BACKPORTS_SOURCE = backports-$(LINUX_BACKPORTS_VERSION).tar.xz +LINUX_BACKPORTS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/projects/backports/stable/v$(LINUX_BACKPORTS_VERSION_MAJOR) +LINUX_BACKPORTS_LICENSE = GPLv2 +LINUX_BACKPORTS_LICENSE_FILES = COPYING +LINUX_BACKPORTS_DEPENDENCIES = linux + +LINUX_BACKPORTS_MAKE_FLAGS = \ + $(LINUX_MAKE_FLAGS) \ + KLIB_BUILD=$(LINUX_DIR) \ + KROOT=$(TARGET_DIR) + +ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG),y) +LINUX_BACKPORTS_SOURCE_CONFIG = $(LINUX_BACKPORTS_DIR)/defconfigs/$(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG)) +else ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y) +LINUX_BACKPORTS_SOURCE_CONFIG = $(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE) +endif + +define LINUX_BACKPORTS_CONFIGURE_CMDS + cp $(LINUX_BACKPORTS_SOURCE_CONFIG) \ + $(@D)/defconfigs/buildroot + $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_BACKPORTS_MAKE_FLAGS) \ + -C $(@D) defconfig-buildroot + rm $(@D)/defconfigs/buildroot + yes '' | $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_BACKPORTS_MAKE_FLAGS) \ + -C $(@D) oldconfig +endef + +define LINUX_BACKPORTS_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_FLAGS) -C $(@D) + @if grep -q "=m" $(@D)/.config; then \ + $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_FLAGS) \ + -C $(@D) modules ; \ + fi +endef + +define LINUX_BACKPORTS_INSTALL_TARGET_CMDS + # Install modules and remove symbolic links pointing to build + # directories, not relevant on the target + $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_BACKPORTS_MAKE_FLAGS) \ + -C $(@D) install + @if grep -q "=m" $(@D)/.config; then \ + $(TARGET_MAKE_ENV) $(MAKE1) $(LINUX_BACKPORTS_MAKE_FLAGS) \ + -C $(@D) modules_install; \ + fi +endef + +$(eval $(generic-package)) + +ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS),y) +linux-backports-menuconfig linux-backports-xconfig linux-backports-gconfig linux-backports-nconfig: dirs linux-backports-configure + $(MAKE) $(LINUX_BACKPORTS_MAKE_FLAGS) \ + -C $(LINUX_BACKPORTS_DIR) $(subst linux-backports-,,$@) + rm -f $(LINUX_BACKPORTS_DIR)/.stamp_{built,target_installed,images_installed} + +linux-backports-savedefconfig: dirs linux-backports-configure + $(MAKE) $(LINUX_BACKPORTS_MAKE_FLAGS) \ + -C $(LINUX_BACKPORTS_DIR) $(subst linux-backports-,,$@) + +ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y) +# linux-backports does not support savedefconfig command +linux-backports-update-config: linux-backports-configure $(LINUX_BACKPORTS_DIR)/.config + cp -f $(LINUX_BACKPORTS_DIR)/.config \ + $(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE) +else +linux-backports-update-config: ; +endif +endif + +# Checks to give errors that the user can understand +ifeq ($(filter source,$(MAKECMDGOALS)),) + +ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG),y) +ifeq ($(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG)),) +$(error No linux-backports defconfig name specified, check your BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG setting) +endif +endif + +ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y) +ifeq ($(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE)),) +$(error No linux-backports configuration file specified, check your BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE setting) +endif +endif + +endif