Skip to contentSkip to conversation

Added linux drivers backports project

PATCH New Petr Vorel 3 participants 6 messages Apr 15, 2015 – Apr 17, 2015

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

cover Added linux drivers backports project

Hi there,

this is a patch adding [1] to buildroot. Backports provide drivers released on newer kernels backported for usage on older kernels. This is very handy, for those which have to use and old kernel (some SoC requires this).

This project was discussed more than one year ago [2], but nothing was actually implemented.

I plan further improvements:

* Allow to use different versions
There are stable releases, snapshot based on current linux-next and some archived versions based on linux-next. Although it's recommended to use the latest stable version, some people prefer / need different version.

* Version check
For kernel versions older than 3.0 version backports-3.14 is needed, kernels < 2.6.26 aren't supported.

* Custom patches
Ekvivalent of BR2_LINUX_KERNEL_PATCH.

* Custom repository version
Ekvivalent of BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION.

Credits: I got inspired by implementation in gfiber project (but rewrited).

Kind regards,
Petr

[1] https://backports.wiki.kernel.org
[2] http://lists.busybox.net/pipermail/buildroot/2013-December/084663.html
[3] https://gfiber.googlesource.com/buildroot/+/gfiber-openbox-2/package/backports/backports.mk

Petr Vorel (1):
Added linux drivers backports project

 package/Config.in                            |  1 +
 package/linux-backports/Config.in            | 36 ++++++++++++++
 package/linux-backports/linux-backports.hash |  2 +
 package/linux-backports/linux-backports.mk   | 73 ++++++++++++++++++++++++++++
 4 files changed, 112 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
Signature · 1 line
1.8.0
author
#1 lore raw

PATCH 1/1 Added linux drivers backports project

https://backports.wiki.kernel.org

---
 package/Config.in                            |  1 +
 package/linux-backports/Config.in            | 36 ++++++++++++++
 package/linux-backports/linux-backports.hash |  2 +
 package/linux-backports/linux-backports.mk   | 73 ++++++++++++++++++++++++++++
 4 files changed, 112 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
index 34b6017..c8e24a7 100644
@@ -365,6 +365,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/lirc-tools/Config.in"
 	source "package/lm-sensors/Config.in"
 	source "package/lshw/Config.in"
package/linux-backports/Config.in new file +36 -0
new file mode 100644
index 0000000..c108b59
@@ -0,0 +1,36 @@
+config BR2_PACKAGE_LINUX_BACKPORTS
+	bool "Linux kernel driver backports"
+	help
+	  The backports package includes many Linux drivers from recent
+	  kernels, backported to older ones.
+
+	  https://backports.wiki.kernel.org
+
+if BR2_PACKAGE_LINUX_BACKPORTS
+
+choice
+	prompt "Linux kernel driver backports 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. The defconfig is located
+          in defconfigs/ directory in the 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 kernel configuration file
+
+endif
package/linux-backports/linux-backports.hash new file +2 -0
new file mode 100644
index 0000000..6b8cb4f
@@ -0,0 +1,2 @@
+# From: https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.19-rc1/sha256sums.asc
+sha256 d782422d664b84128154fc5d0e9b8cd04bb208e53546d68856ad3f7f53f7de98  backports-3.19-rc1-1.tar.xz
package/linux-backports/linux-backports.mk new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
1.8.0
#2 lore raw

PATCH 1/1 Added linux drivers backports project

Quoted 18 lines · Petr Vorel

https://backports.wiki.kernel.org

---
 package/Config.in                            |  1 +
 package/linux-backports/Config.in            | 36 ++++++++++++++
 package/linux-backports/linux-backports.hash |  2 +
 package/linux-backports/linux-backports.mk   | 73 ++++++++++++++++++++++++++++
 4 files changed, 112 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 +0 -0
index 34b6017..c8e24a7 100644

package/Config.in endif · line 368

Quoted 4 lines
package/Config.in +1 -0
@@ -365,6 +365,7 @@ endif
 	source "package/iucode-tool/Config.in"
 	source "package/kbd/Config.in"
 	source "package/lcdproc/Config.in"
+	source "package/linux-backports/Config.in"

I would say that this package fits better in the linux extensions menu. Even if
you just consider this package as a set of kernel modules, I think that from a users perspective it fits better together with the kernel. But also, if you ever want to add the possibility to link the backported drivers in the kernel itself (which I believe is supported by backports), then you really need it to be a kernel extension.

The opinion of other developers may differ, though.

package/linux-backports/Config.in line 2

Quoted 11 lines
package/Config.in +0 -0
 	source "package/lirc-tools/Config.in"
 	source "package/lm-sensors/Config.in"
 	source "package/lshw/Config.in"
package/linux-backports/Config.in new file +2 -0
new file mode 100644
index 0000000..c108b59
@@ -0,0 +1,36 @@
+config BR2_PACKAGE_LINUX_BACKPORTS
+	bool "Linux kernel driver backports"

This package should depend on BR2_LINUX_KERNEL, with the appropriate comment.
However, if it moves to the kernel extension then that's implicit.

Quoted 22 lines
package/linux-backports/Config.in new file +22 -0
+	help
+	  The backports package includes many Linux drivers from recent
+	  kernels, backported to older ones.
+
+	  https://backports.wiki.kernel.org
+
+if BR2_PACKAGE_LINUX_BACKPORTS
+
+choice
+	prompt "Linux kernel driver backports 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"

package/linux-backports/Config.in line 34

Quoted 10 lines
package/linux-backports/Config.in new file +10 -0
+	depends on BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG
+	help
+          Name of the backports defconfig file to use. The defconfig is located
+          in defconfigs/ directory in the 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 kernel configuration file

s/kernel/backports/

Quoted 16 lines
package/linux-backports/Config.in new file +2 -0
+
+endif
package/linux-backports/linux-backports.hash new file +2 -0
new file mode 100644
index 0000000..6b8cb4f
@@ -0,0 +1,2 @@
+# From: https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.19-rc1/sha256sums.asc
+sha256 d782422d664b84128154fc5d0e9b8cd04bb208e53546d68856ad3f7f53f7de98  backports-3.19-rc1-1.tar.xz
package/linux-backports/linux-backports.mk new file +0 -0
new file mode 100644
index 0000000..f49cd7d

package/linux-backports/linux-backports.mk line 1

Quoted 1 line
package/linux-backports/linux-backports.mk new file +1 -0
@@ -0,0 +1,73 @@
+LINUX_BACKPORTS_VERSION  = 3.19-rc1

We prefer "stable" versions rather than rc's.

package/linux-backports/linux-backports.mk line 5

Quoted 4 lines
package/linux-backports/linux-backports.mk new file +4 -0
+LINUX_BACKPORTS_REVISION = 1
+LINUX_BACKPORTS_SOURCE   = backports-$(LINUX_BACKPORTS_VERSION)-$(LINUX_BACKPORTS_REVISION).tar.xz
+LINUX_BACKPORTS_SITE     = $(BR2_KERNEL_MIRROR)/linux/kernel/projects/backports/stable/v$(LINUX_BACKPORTS_VERSION)
+LINUX_BACKPORTS_DEPENDENCIES = linux

If it's a kernel extension this will be implicit.

Quoted 7 lines
package/linux-backports/linux-backports.mk new file +7 -0
+
+LINUX_BACKPORTS_MAKE_FLAGS = \
+	$(TARGET_MAKE_ENV) \
+	$(LINUX_MAKE_FLAGS) \
+	KLIB_BUILD=$(LINUX_DIR) \
+	KLIB=$(TARGET_DIR)
+

package/linux-backports/linux-backports.mk line 22

Quoted 10 lines
package/linux-backports/linux-backports.mk new file +10 -0
+
+ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG),y)
+LINUX_BACKPORTS_SOURCE_CONFIG = $(@D)/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
+	$(INSTALL) -m 0644 $(LINUX_BACKPORTS_SOURCE_CONFIG) $(@D)/.config
+	$(LINUX_BACKPORTS_MAKE_FLAGS) $(MAKE) -C $(@D) olddefconfig

LINUX_MAKE_FLAGS are normally passed as arguments to make. So I'd remove
TARGET_MAKE_ENV from LINUX_BACKPORTS_MAKE_FLAGS and turn the make commands into

	$(LINUX_BACKPORTS_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_FLAGS) \
		...

That said, we now have a kconfig package infrastructure and this package should
make use of it. Then these commands are no longer needed, but you do have to define LINUX_BACKPORTS_KCONFIG_OPTS = LINUX_BACKPORTS_MAKE_FLAGS

Quoted 4 lines
package/linux-backports/linux-backports.mk new file +4 -0
+endef
+
+define LINUX_BACKPORTS_BUILD_CMDS
+	$(LINUX_BACKPORTS_MAKE_FLAGS) $(MAKE) -C $(@D)

package/linux-backports/linux-backports.mk line 36

Quoted 10 lines
package/linux-backports/linux-backports.mk new file +10 -0
+endef
+
+define LINUX_BACKPORTS_INSTALL_TARGET_CMDS
+	$(LINUX_BACKPORTS_MAKE_FLAGS) $(MAKE) -C $(LINUX_DIR) M=$(@D) \
+		INSTALL_MOD_DIR=backports \
+		modules_install
+endef
+
+$(eval $(generic-package))
+

Replace with $(kconfig-package), remove all the following and just set
LINUX_BACKPORTS_KCONFIG_EDITORS and LINUX_BACKPORTS_KCONFIG_FILE.

Regards,
Arnout

Quoted 38 lines
package/linux-backports/linux-backports.mk new file +37 -0
+ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS),y)
+linux-backports-menuconfig linux-backports-xconfig linux-backports-gconfig linux-backports-nconfig: 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: 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-update-config: linux-backports-configure $(LINUX_BACKPORTS_DIR)/.config
+	cp -f $(LINUX_BACKPORTS_DIR)/.config $(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE)
+
+linux-backports-update-defconfig: linux-backports-savedefconfig
+	cp -f $(LINUX_BACKPORTS_DIR)/defconfig $(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE)
+else
+linux-backports-update-config: ;
+linux-backports-update-defconfig: ;
+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 kernel 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 kernel configuration file specified, check your BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE setting)
+endif
+endif
+
+endif
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#3 lore raw

PATCH 1/1 Added linux drivers backports project

Dear Arnout Vandecappelle,

Quoted 8 lines · Arnout Vandecappelle

I would say that this package fits better in the linux extensions menu. Even if
you just consider this package as a set of kernel modules, I think that from a users perspective it fits better together with the kernel. But also, if you ever want to add the possibility to link the backported drivers in the kernel itself (which I believe is supported by backports), then you really need it to be a kernel extension.

The opinion of other developers may differ, though.

While I do understand the reasoning, I'm not so sure about the conclusion. The linux extension stuff is really for things that needed to be tightly integrated with the kernel build process, because it requires patching the kernel (xenomai, rtai, etc.).

Here, it is much more like lttng-modules, or linux-fusion, cryptodev-linux, ktap, sysdig and so on: a bunch of external modules that can be built with no problem as separate packages from the kernel.

So I would actually tend to prefer keeping linux-backports as a package in package/, like the author did.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
author
#4 lore raw

PATCH 1/1 Added linux drivers backports project

In reply to Arnout Vandecappelle

Thanks for comments, I'll create new version tonight.

Quoted 3 lines

I would say that this package fits better in the linux extensions menu. Even if
you just consider this package as a set of kernel modules, I think that from a users perspective it fits better together with the kernel.

Sounds reasonable, I'll do it.

Quoted 4 lines

But also, if you ever
want to add the possibility to link the backported drivers in the kernel itself (which I believe is supported by backports), then you really need it to be a kernel extension.

Not sure, I have to explore it.

Quoted 2 lines
Quoted 1 line

+LINUX_BACKPORTS_VERSION = 3.19-rc1

We prefer "stable" versions rather than rc's.

Ok, let it be 3.18.1. I just find 3.19-rc1 on
http://drvbp1.linux-foundation.org/~mcgrof/rel-html/backports/ (Temporary backports release page, linked from homepage), I considered it as stable enough.

Quoted 1 line

LINUX_MAKE_FLAGS are normally passed as arguments to make. So I'd remove

I do probably something wrong: content of $(LINUX_MAKE_FLAGS) aren't added, so at least CROSS_COMPILE is missing. But That's for $(kconfig-package). It might not be needed for linux extension.

Quoted 3 lines

TARGET_MAKE_ENV from LINUX_BACKPORTS_MAKE_FLAGS and turn the make commands into

	$(LINUX_BACKPORTS_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_FLAGS) \
		...

Ok.

Quoted 18 lines

Replace with $(kconfig-package), remove all the following and just set
LINUX_BACKPORTS_KCONFIG_EDITORS and LINUX_BACKPORTS_KCONFIG_FILE.

Quoted 5 lines
package/linux-backports/linux-backports.mk new file +5 -0
+# 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 kernel defconfig name specified, check your BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG setting)

package/linux-backports/linux-backports.mk line 73

Quoted 10 lines
package/linux-backports/linux-backports.mk new file +10 -0
+endif
+endif
+
+ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y)
+ifeq ($(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE)),)
+$(error No kernel configuration file specified, check your BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE setting)
+endif
+endif
+
+endif

I'd keep the error messages as indication for user.

Kind regards,
Petr

#5 lore raw

PATCH 1/1 Added linux drivers backports project

Quoted 6 lines · Petr Vorel

Thanks for comments, I'll create new version tonight.

Quoted 3 lines

I would say that this package fits better in the linux extensions menu. Even if
you just consider this package as a set of kernel modules, I think that from a users perspective it fits better together with the kernel.

Sounds reasonable, I'll do it.

Well, Thomas disagrees, so I guess you shouldn't.

Anyway, if it does become a Linux extension, the package will stay. One of the
Kconfig options (the package or the linux extension) will be a blind option, and at that time we can still choose which one will be blind.

[snip]

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
package/linux-backports/linux-backports.mk new file +8 -0
+# 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 kernel defconfig name specified, check your BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG setting)
+endif
+endif
+
Quoted 8 lines
Quoted 7 lines

package/linux-backports/linux-backports.mk line 73

Quoted 7 lines
package/linux-backports/linux-backports.mk new file +7 -0
+ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y)
+ifeq ($(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE)),)
+$(error No kernel configuration file specified, check your BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE setting)
+endif
+endif
+
+endif

I'd keep the error messages as indication for user.

If you use kconfig-package you should never get these messages because it
already has that check, on line 70-74:

# FOO_KCONFIG_FILE is required
ifndef $(2)_KCONFIG_FILE
$$(error Internal error: no value specified for $(2)_KCONFIG_FILE) endif

Oh, now I see that Yann's patch to convert this to ifeq hasn't been applied
yet... So yes in that case the custom check should stay.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F