linux-backports (new package) and misc related fixes (branch yem/linux-backports)
v8 cover linux-backports (new package) and misc related fixes (branch yem/linux-backports)
Hello All!
This series introduces linux-backports, which contains drivers from recent kernels, backported unto older kernels (down to 3.0).
The series starts by fixing a shortcoming in the pkg-kconfig infra, then does a bit of eye-candy in the Linux package, and finally introduces linux-backports.
The thirs patch, linux-backports itself, uses a pure generic package, and does not make use of the kernel-module infra, while the fourth and latest patch converts it over to the kernel-module infra.
I'm not sure using the kernel-module infra is worth it, because it does not gain us much in this case. Yet, it makes for a slightly more beautiful .mk (IMHO!), even if a bit longer (+4 lines).
In the end, using it or not is the same to me (with a very slight preference for using it, of course, but I won't mind either way).
Thanks go to Petr for doing the initial packaging of linux-backports, and Arnout for suggesting the fix in patch 1. :-)
Regards,
Yann E. MORIN.
The following changes since commit 1f640a4e7a42667a88101f6ceb787fbb118a6acf:
zedboard: Switch to U-Boot 2015.07 (2015-07-22 14:31:55 +0200)
are available in the git repository at:
git://git.busybox.net/~ymorin/git/buildroot yem/linux-backports
for you to fetch changes up to 200f17ef13ac12610b33139a1b1f8820fc0c85bd:
package/linux-backports: switch to using the kernel-module infra (2015-07-22 16:44:57 +0200)
----------------------------------------------------------------
Petr Vorel (1):
package/linux-backports: new package
Yann E. MORIN (3):
core/pkg-kconfig: do not override @D
package/linux: trash stderr in LINUX_VERSION_PROBED package/linux-backports: switch to using the kernel-module infra
linux/linux.mk | 2 +- package/Config.in | 1 + package/linux-backports/Config.in | 52 ++++++++++++++++++ package/linux-backports/linux-backports.hash | 2 + package/linux-backports/linux-backports.mk | 81 ++++++++++++++++++++++++++++ package/pkg-kconfig.mk | 16 +++--- 6 files changed, 146 insertions(+), 8 deletions(-) create mode 100644 package/linux-backports/Config.in create mode 100644 package/linux-backports/linux-backports.hash create mode 100644 package/linux-backports/linux-backports.mk
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v8 1/4 core/pkg-kconfig: do not override @D
Currently, we override @D for the kconfig configurators, so the fixup commands can use $(@D); otherwise @D would be simply '.' because it is not a real file in the package build dir.
However, this breaks the soon-to-be-introduced linux-backports package, which needs to have a dependency on the linux package to be configured.
The underlying reason is that @D is an automatic variable that is always set by make to the directory part of the target of the rule. However, automatic variables loose their "automatic" property when they are manually set.
Furthermore, a variable that is defined for a rule is inherited by all dependencies of that rule, so our manually-set @D is inherited all the way down the dependency chain of linux-backports, down to the linux' own .config rule, which is thus run with @D pointing to linux-backports' build dir, not linux'.
Fix that by using a "static pattern rule", redirecting the configurators to an intermediate stamp-like file which path is in the package build dir, so we get a valid @D from the onset, without having to manually fiddle with it.
Thanks to Arnout for suggesting that in the first place. Sorry I did reject it as "too complex" when it was in fact the best solution.
--- package/pkg-kconfig.mk | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
package/pkg-kconfig.mk +9 -7
@@ -104,15 +104,16 @@ endif # that is clean wrt. our requirements. # # Because commands in $(1)_FIXUP_KCONFIG are probably using $(@D), we -# fake it for the configurators (otherwise it is set to just '.', i.e. -# the current directory where make is run, which happens to be in -# $(TOPDIR), because the target of the rule is not an actual file, so -# does not have any path component). +# need to have a valid @D set. But, because the configurators rules are +# not real files and do not contain the path to the package build dir, +# @D would be just '.' in this case. So, we use an intermediate rule +# with a stamp-like file which path is in the package build dir, so we +# end up having a valid @D. # -$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): @D=$$($(2)_DIR) -$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $$($(2)_DIR)/.stamp_kconfig_fixup_done +$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $(1)-%: $$($(2)_DIR)/.kconfig_editor_% +$$($(2)_DIR)/.kconfig_editor_%: $$($(2)_DIR)/.stamp_kconfig_fixup_done $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \ - $$($(2)_KCONFIG_OPTS) $$(subst $(1)-,,$$@) + $$($(2)_KCONFIG_OPTS) $$(*) rm -f $$($(2)_DIR)/.stamp_{kconfig_fixup_done,configured,built} rm -f $$($(2)_DIR)/.stamp_{target,staging,images}_installed $$(call $(2)_FIXUP_DOT_CONFIG)
@@ -169,6 +170,7 @@ endif # package enabled $(1)-update-defconfig \ $(1)-savedefconfig \ $(1)-check-configuration-done \ + $$($(2)_DIR)/.kconfig_editor_% \ $$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)) endef # inner-kconfig-package
Signature · 1 line
1.9.1
PATCH v8 2/4 package/linux: trash stderr in LINUX_VERSION_PROBED
In reply to Yann E. MORINThe Linux buildsystem tries to run the compiler even just for 'kernelrelease' (which we store in LINUX_VERSION_PROBED) and we sometimes need to use it before the toolchain is available; thus we get spurious errors on stderr.
Consign stderr to oblivion when computing the 'kernelrelease'.
--- linux/linux.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux/linux.mk +1 -1
@@ -76,7 +76,7 @@ LINUX_MAKE_ENV = \ # Get the real Linux version, which tells us where kernel modules are # going to be installed in the target filesystem. -LINUX_VERSION_PROBED = `$(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease` +LINUX_VERSION_PROBED = `$(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null` ifeq ($(BR2_LINUX_KERNEL_USE_INTREE_DTS),y) KERNEL_DTS_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTS_NAME))
Signature · 1 line
1.9.1
PATCH v8 3/4 package/linux-backports: new package
In reply to Yann E. MORINFrom: Petr Vorel <[email protected]>
https://backports.wiki.kernel.org
---
Changes v7 -> v8: (Yann)
- fix option ordering and prompts in Config.in
- drop editors, only menuconfig is available
- add licensing information
- bump to 4.1.1-1, drop 4.0.1-1 patch
- move custom error message before call to kconfig-package
- use $(BR_BUILDING) instead of custom, wrong test on 'make source'
- drop intermediate variable to set LINUX_BACKPORTS_KCONFIG_FILE
- qstrip all variables from Config.in
- fix dependencies (tricky, needs kernel to be configured)
- check kernel is >= 3.0
Changes v6->v7:
* Bump version to lastest stable 4.0.1-1.
* Update to current version of kconfig-package.
* Add option to specify config fragments.
* Include upstream patch to fix build error.
Changes v5->v6:
Added changes by Arnout Vandecappelle in Mon Apr 20 21:46:34 UTC 2015:
* linux-backports.mk: $(LINUX_BACKPORTS_KCONFIG_FILE): linux
this doesn't help: we'd need to use:
LINUX_BACKPORTS_KCONFIG_FILE := $(LINUX_BACKPORTS_DIR)/defconfigs/$(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG)) but then we don't get value for $(LINUX_BACKPORTS_DIR) nor $(@D).
* linux-backports.mk: LINUX_BACKPORTS_PATCH_DEPENDENCIES = linux
This also does not help, it does linux extracting, patching, but we
need also configuring. We'd need something like
LINUX_BACKPORTS_CONFIGURE_DEPENDENCIES to be implemented.
* Config.in: info about support from kernel 3.0.
* Config.in: help text wrapped to 72 columns.
Changes v4->v5:
* Added changes made by Thomas Petazzoni in Sun, 19 Apr 2015 11:03:26 +0200.
Changes v3->v4:
* Define LINUX_BACKPORTS_MAKE_ENV instead of LINUX_BACKPORTS_MAKE_OPTS, remove TARGET_MAKE_ENV from it.
* Add nconfig to LINUX_BACKPORTS_KCONFIG_EDITORS.
* Clean formating of build commands.
--- package/Config.in | 1 + package/linux-backports/Config.in | 52 +++++++++++++++++ package/linux-backports/linux-backports.hash | 2 + package/linux-backports/linux-backports.mk | 85 ++++++++++++++++++++++++++++ 4 files changed, 140 insertions(+) create mode 100644 package/linux-backports/Config.in create mode 100644 package/linux-backports/linux-backports.hash create mode 100644 package/linux-backports/linux-backports.mk
package/Config.in +1 -0
@@ -372,6 +372,7 @@ endif source "package/kbd/Config.in" source "package/lcdproc/Config.in" source "package/libump/Config.in" + source "package/linux-backports/Config.in" source "package/lirc-tools/Config.in" source "package/lm-sensors/Config.in" source "package/lshw/Config.in"
package/linux-backports/Config.in new file +52 -0
52 lines not on this page · raw message
package/linux-backports/linux-backports.hash new file +2 -0
@@ -0,0 +1,2 @@ +# From: https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v4.1.1/sha256sums.asc +sha256 7fca160665b801796ce50def18f2fd6def1c4452290e93ec5332444fb2021bd6 backports-4.1.1-1.tar.xz
package/linux-backports/linux-backports.mk new file +85 -0
85 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v8 3/4 package/linux-backports: new package
Dear Yann E. MORIN,
Quoted 1 line · Yann E. MORIN
+linux-backports-check-kernel-version: $(BUILD_DIR)/linux-$(call qstrip,$(BR2_LINUX_KERNEL_VERSION))/.config
Doesn't this fail really badly if:
LINUX_OVERRIDE_SRCDIR = <some value>
?
In this case, $(LINUX_DIR) is $(BUILD_DIR)/linux-custom/ and not $(BUILD_DIR)/linux-$(call qstrip,$(BR2_LINUX_KERNEL_VERSION)).
Argh :-/
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v8 4/4 package/linux-backports: switch to using the kernel-module infra
In reply to Yann E. MORIN--- package/linux-backports/linux-backports.mk | 32 +++++++++++++----------------- 1 file changed, 14 insertions(+), 18 deletions(-)
package/linux-backports/linux-backports.mk +14 -18
@@ -11,33 +11,28 @@ LINUX_BACKPORTS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/projects/backports/stab 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_MAKE_OPTS = \ + BACKPORT_DIR=$(@D) \ + KLIB_BUILD=$(LINUX_DIR) \ + KLIB=$(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED) \ + `sed -r -e '/^\#/d;' $(@D)/.config` + +LINUX_BACKPORTS_MODULE_MAKE_OPTS = $(LINUX_BACKPORTS_MAKE_OPTS) + +define LINUX_BACKPORTS_AUTOCONF + $(MAKE) -C $(@D) $(LINUX_BACKPORTS_MAKE_OPTS) backport-include/backport/autoconf.h +endef +LINUX_BACKPORTS_POST_CONFIGURE_HOOKS += LINUX_BACKPORTS_AUTOCONF + # Checks to give errors that the user can understand ifeq ($(BR_BUILDING),y)
@@ -55,6 +50,7 @@ endif endif # BR_BUILDING +$(eval $(kernel-module)) $(eval $(kconfig-package)) # linux-backports' own .config file needs options from the kernel's own
Signature · 1 line
1.9.1
PATCH v8 4/4 package/linux-backports: switch to using the kernel-module infra
Dear Yann E. MORIN,
package/linux-backports/linux-backports.mk LINUX_BACKPORTS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/projects/backports/stab · line 27
Quoted 5 lines · Yann E. MORIN
package/linux-backports/linux-backports.mk +5
-0+LINUX_BACKPORTS_MAKE_OPTS = \ + BACKPORT_DIR=$(@D) \ + KLIB_BUILD=$(LINUX_DIR) \ + KLIB=$(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED) \ + `sed -r -e '/^\#/d;' $(@D)/.config`
For sure this last line needs a comment.
Quoted 1 line
+LINUX_BACKPORTS_MODULE_MAKE_OPTS = $(LINUX_BACKPORTS_MAKE_OPTS)
What is this useful for?
package/linux-backports/linux-backports.mk LINUX_BACKPORTS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/projects/backports/stab · line 34
Quoted 4 lines
package/linux-backports/linux-backports.mk +4
-0+define LINUX_BACKPORTS_AUTOCONF + $(MAKE) -C $(@D) $(LINUX_BACKPORTS_MAKE_OPTS) backport-include/backport/autoconf.h +endef +LINUX_BACKPORTS_POST_CONFIGURE_HOOKS += LINUX_BACKPORTS_AUTOCONF
Also a comment above this would be good to have.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
v8 cover linux-backports (new package) and misc related fixes (branch yem/linux-backports)
In reply to Yann E. MORINDear Yann E. MORIN,
Quoted 3 lines · Yann E. MORIN
Yann E. MORIN (3):
core/pkg-kconfig: do not override @D package/linux: trash stderr inLINUX_VERSION_PROBED
I've applied those two preparations patches.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com