Skip to contentSkip to conversation

Added linux drivers backports project

PATCH Superseded Petr Vorel 3 participants 10 messages Jul 1, 2015 – Jul 22, 2015

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH v7 1/1 Added linux drivers backports project

https://backports.wiki.kernel.org

Cc Arnout Vandecappelle <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

---
TODO: still don't know how to handle dependency on linux .config.

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 +
 ...1-backports-add-missing-include-for-vfree.patch | 26 +++++++++
 package/linux-backports/Config.in                  | 48 ++++++++++++++++
 package/linux-backports/linux-backports.hash       |  2 +
 package/linux-backports/linux-backports.mk         | 64 ++++++++++++++++++++++
 5 files changed, 141 insertions(+)
 create mode 100644 package/linux-backports/0001-backports-add-missing-include-for-vfree.patch
 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 13a7e74..26406ec 100644
@@ -369,6 +369,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/0001-backports-add-missing-include-for-vfree.patch new file +26 -0
new file mode 100644
index 0000000..3aee980
@@ -0,0 +1,26 @@
+From e9dadfe5f446c9b2b1563ad50daf3a50b4497726 Mon Sep 17 00:00:00 2001
+From: Jonathan Liu <[email protected]>
+Date: Fri, 5 Jun 2015 23:06:53 +1000
+Subject: [PATCH] backports: add missing include for vfree
+
+Signed-off-by: Jonathan Liu <[email protected]>
+Signed-off-by: Luis R. Rodriguez <[email protected]>
+Signed-off-by: Petr Vorel <[email protected]>
+
+[ petr.vorel at gmail.com: adjusted path ]
+---
+ compat/backport-3.15.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/compat/backport-3.15.c b/compat/backport-3.15.c
+index c6f9d43..381fe65 100644
+--- a/compat/backport-3.15.c
++++ b/compat/backport-3.15.c
+@@ -15,6 +15,7 @@
+ #include <linux/string.h>
+ #include <linux/mm.h>
+ #include <linux/slab.h>
++#include <linux/vmalloc.h>
+ #include <net/net_namespace.h>
+ 
+ #if IS_ENABLED(CPTCFG_IEEE802154_6LOWPAN)
package/linux-backports/Config.in new file +48 -0

48 lines not on this page · raw message

package/linux-backports/linux-backports.hash new file +2 -0
new file mode 100644
index 0000000..6ed57f1
@@ -0,0 +1,2 @@
+# From: https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v4.0.1/sha256sums.asc
+sha256 71da08c0d2975716b57039b7b9159ab8a882252bf2cac34843b77d2dd6d4cf31  backports-4.0.1-1.tar.xz
package/linux-backports/linux-backports.mk new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
1.8.0
#1 lore raw

PATCH v7 1/1 Added linux drivers backports project

Quoted 8 lines · Petr Vorel

https://backports.wiki.kernel.org

Cc Arnout Vandecappelle <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

---
TODO: still don't know how to handle dependency on linux .config.

It took me some time, but I finally understand what the issue is here...

It's a bug in the kconfig infra. The rule for generating the .config is kind of
spliced into the the usual configure step of a package. It already has a dependency on the patch step, but it's still missing a dependency on the dependencies.

I'll cook an untested patch, could you take that up in your series? It will
allow you to get rid of the _PATCH_DEPENDENCIES.

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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw

PATCH v7 1/1 Added linux drivers backports project

Arnout, All,

On 2015-07-03 22:24 +0200, Arnout Vandecappelle spake thusly:

Quoted 10 lines · Petr Vorel
Quoted 8 lines

https://backports.wiki.kernel.org

Cc Arnout Vandecappelle <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

---
TODO: still don't know how to handle dependency on linux .config.

Quoted 3 lines

It took me some time, but I finally understand what the issue is here...

It's a bug in the kconfig infra.

No, it is not a bug, it is a feature.

I'm not kidding, Thomas DS. and I did that on-purpose; see my explanations as a reply to your proposed patch.

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v7 1/1 Added linux drivers backports project

In reply to Petr Vorel

Petr, All,

On 2015-07-02 00:58 +0200, Petr Vorel spake thusly:

Quoted 6 lines

https://backports.wiki.kernel.org

Cc Arnout Vandecappelle <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

Here's a quick and definitely not thourough review of this patch.

[--SNIP--]

package/linux-backports/0001-backports-add-missing-include-for-vfree.patch line 4

Quoted 10 lines
package/linux-backports/0001-backports-add-missing-include-for-vfree.patch new file +4 -0
new file mode 100644
index 0000000..3aee980
@@ -0,0 +1,26 @@
+From e9dadfe5f446c9b2b1563ad50daf3a50b4497726 Mon Sep 17 00:00:00 2001
+From: Jonathan Liu <[email protected]>
+Date: Fri, 5 Jun 2015 23:06:53 +1000
+Subject: [PATCH] backports: add missing include for vfree

Has this patch been pushed upstream?

[--SNIP--]

Quoted 21 lines
package/linux-backports/Config.in new file +15 -0
new file mode 100644
index 0000000..4d793b2
@@ -0,0 +1,48 @@
+comment "linux-backports needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
+
+config BR2_PACKAGE_LINUX_BACKPORTS
+	bool "linux-backports"
+	depends on BR2_LINUX_KERNEL
+	help
+          The linux-backports package includes many Linux drivers from
+          recent kernels, backported to older ones.
+
+          This version of linux-backports supports kernels starting from 3.0.
+
+	  https://backports.wiki.kernel.org
+
+if BR2_PACKAGE_LINUX_BACKPORTS

package/linux-backports/Config.in line 25

Quoted 10 lines
package/linux-backports/Config.in new file +10 -0
+
+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"

I'm a bit confused. Do you meant to differentiate between a defconfig that is bundled in linux-backports, vs. a full .config that is providd by the user? Is that all that is supported?

I would have expected that the user may either:
- use a bundled defconfig (or even full .config), or
- provide his own defconfig (or full .config),

like we do for other kconfig packages.

So, the prompts would be:

choice
bool "Linux backports configuration"

config BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG
bool "Using an in-tree defconfig file"

config BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG
bool "Using a custom (def)config file"

endchoice

Note: this is similar to the variable names in linux/Config.in which are probably a bit mis-named, but that's historical. What is important is how we use them.

package/linux-backports/Config.in line 33

Quoted 7 lines
package/linux-backports/Config.in new file +7 -0
+endchoice
+
+config BR2_PACKAGE_LINUX_BACKPORTS_CONFIG_FRAGMENT_FILES
+	string "Additional linux-backports configuration fragment files"
+	help
+	  A space-separated list of configuration fragment files,
+	  that will be merged to the main linux-backports configuration file.

Please, put the option for the fragments list after the base files, below:

package/linux-backports/Config.in line 46

Quoted 12 lines
package/linux-backports/Config.in new file +12 -0
+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 backports configuration file

... here.

package/linux-backports/Config.in line 45

Quoted 1 line
package/linux-backports/Config.in new file +1 -0
+endif

[--SNIP--]

Quoted 10 lines
package/linux-backports/linux-backports.mk new file +4 -0
new file mode 100644
index 0000000..d45166a
@@ -0,0 +1,64 @@
+################################################################################
+#
+# linux-backports
+#

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

Quoted 10 lines
package/linux-backports/linux-backports.mk new file +10 -0
+################################################################################
+
+LINUX_BACKPORTS_VERSION_MAJOR = 4.0.1
+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_DEPENDENCIES = linux
+# FIXME: does linux extracting, patching, but we need also linux to be configured.
+LINUX_BACKPORTS_PATCH_DEPENDENCIES = linux

You can drop the 'FIXME:' and just state:

# We need linux to be extracted and patch first before we are patched, # but we also need it to be built before we are configured, hence we do # need both dependencies:
LINUX_BACKPORTS_PATCH_DEPENDENCIES = linux LINUX_BACKPORTS_DEPENDENCIES = linux

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

Quoted 7 lines
package/linux-backports/linux-backports.mk new file +7 -0
+LINUX_BACKPORTS_MAKE_OPTS = \
+	$(LINUX_MAKE_FLAGS) \
+	KLIB_BUILD=$(LINUX_DIR) \
+	KLIB=$(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))

Do not use $(LINUX_BACKPORTS_DIR) but use $(@D) instead.

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

Quoted 2 lines
package/linux-backports/linux-backports.mk new file +2 -0
+else ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y)
+LINUX_BACKPORTS_SOURCE_CONFIG = $(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE)

You need to qstrip that one as well.

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

Quoted 5 lines
package/linux-backports/linux-backports.mk new file +5 -0
+endif
+
+# backports configure needs a configured kernel
+# FIXME: not used as we'd need to assign LINUX_BACKPORTS_SOURCE_CONFIG with :=,
+# but then we don't get $(LINUX_BACKPORTS_DIR) evaluated.

Would using $(@D) like I suggest above solve this issue?

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

Quoted 4 lines
package/linux-backports/linux-backports.mk new file +4 -0
+$(LINUX_BACKPORTS_SOURCE_CONFIG): linux
+
+define LINUX_BACKPORTS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) -C $(@D)

Would it work if you were to write (note the added trailing 'modules'):

    $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) \
        -C $(@D) modules

I ask, because I have a pending series that provides an infra for building kernel modules:
http://git.buildroot.org/~ymorin/git/buildroot/log/?h=yem/kernel-modules

and it looks like that would probably help you quite a lot here...

Also, you probably want to use $(LINUX_MAKE_ENV) instead of just $(TARGET_MAKE_ENV).

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

Quoted 4 lines
package/linux-backports/linux-backports.mk new file +4 -0
+endef
+
+define LINUX_BACKPORTS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) \

Ditto $(LINUX_MAKE_ENV).

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

Quoted 6 lines
package/linux-backports/linux-backports.mk new file +6 -0
+		-C $(LINUX_DIR) M=$(@D) \
+		INSTALL_MOD_DIR=backports \
+		modules_install
+endef
+
+LINUX_BACKPORTS_KCONFIG_FILE = $(LINUX_BACKPORTS_SOURCE_CONFIG)

Why don't you directly assign to LINUX_BACKPORTS_KCONFIG_FILE without using the intermediate LINUX_BACKPORTS_SOURCE_CONFIG ?

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

Quoted 8 lines
package/linux-backports/linux-backports.mk new file +8 -0
+LINUX_BACKPORTS_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CONFIG_FRAGMENT_FILES))
+LINUX_BACKPORTS_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
+LINUX_BACKPORTS_KCONFIG_OPTS = $(LINUX_BACKPORTS_MAKE_OPTS)
+
+$(eval $(kconfig-package))
+
+# Checks to give errors that the user can understand
+ifeq ($(filter source,$(MAKECMDGOALS)),)

We now have a variable that explicitly states whether we are building or not:

    ifeq ($(BR_BUILDING),y)

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

Quoted 13 lines
package/linux-backports/linux-backports.mk new file +13 -0
+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

When nesting ifeq-blocks, we like having the endif statements remind to which ifeq they apply, like so:

endif # BR_BUILDING

so the file stays readable.

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH v7 1/1 Added linux drivers backports project

Quoted 11 lines · Yann E. MORIN

Petr, All,

On 2015-07-02 00:58 +0200, Petr Vorel spake thusly:

Quoted 6 lines

https://backports.wiki.kernel.org

Cc Arnout Vandecappelle <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

Here's a quick and definitely not thourough review of this patch.

Which means you can expect a few more iterations :-(

[snip]

Quoted 11 lines

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

Quoted 3 lines
package/linux-backports/linux-backports.mk new file +3 -0
+LINUX_BACKPORTS_DEPENDENCIES = linux
+# FIXME: does linux extracting, patching, but we need also linux to be configured.
+LINUX_BACKPORTS_PATCH_DEPENDENCIES = linux

You can drop the 'FIXME:' and just state:

# We need linux to be extracted and patch first before we are patched, # but we also need it to be built before we are configured, hence we do # need both dependencies:
LINUX_BACKPORTS_PATCH_DEPENDENCIES = linux LINUX_BACKPORTS_DEPENDENCIES = linux

Actually, the _PATCH_DEPENDENCIES are not needed because of the explicit extra
dependency below. At least, I don't think the patching of backports requires linux to be extracted and patched, right?

Quoted 10 lines

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

Quoted 8 lines
package/linux-backports/linux-backports.mk new file +7 -0
+LINUX_BACKPORTS_MAKE_OPTS = \
+	$(LINUX_MAKE_FLAGS) \
+	KLIB_BUILD=$(LINUX_DIR) \
+	KLIB=$(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))

Do not use $(LINUX_BACKPORTS_DIR) but use $(@D) instead.

That's not possible, because it is used as the target of a rule in pkg-kconfig.mk.

Quoted 6 lines

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

Quoted 3 lines
package/linux-backports/linux-backports.mk new file +2 -0
+else ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y)
+LINUX_BACKPORTS_SOURCE_CONFIG = $(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE)

You need to qstrip that one as well.

Quoted 7 lines

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

Quoted 5 lines
package/linux-backports/linux-backports.mk new file +5 -0
+endif
+
+# backports configure needs a configured kernel
+# FIXME: not used as we'd need to assign LINUX_BACKPORTS_SOURCE_CONFIG with :=,
+# but then we don't get $(LINUX_BACKPORTS_DIR) evaluated.

Would using $(@D) like I suggest above solve this issue?

That would make the rule below expand to:

$(@D)/defconfigs/...: linux

and $(@D) is empty because we're not within a rule expansion. Same thing in the dependency rules in pkg-kconfig.mk.

Quoted 2 lines
Quoted 2 lines

+$(LINUX_BACKPORTS_SOURCE_CONFIG): linux

The correct dependency is the one I added with my patch (but then expanded for
linux-backports):

$(LINUX_BACKPORTS_DIR)/.config: linux

However, LINUX_BACKPORTS_DIR is not defined yet, so this rule should be added
at the end of the file, after $(eval $(kconfig-package)).

Quoted 8 lines

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

Quoted 3 lines
package/linux-backports/linux-backports.mk new file +3 -0
+
+define LINUX_BACKPORTS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) -C $(@D)

Would it work if you were to write (note the added trailing 'modules'):

    $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) \
        -C $(@D) modules

Don't you mean -C $(LINUX_DIR) M=$(@D) modules? That's what kernel-module would
add, right?

Quoted 17 lines

I ask, because I have a pending series that provides an infra for building kernel modules:
http://git.buildroot.org/~ymorin/git/buildroot/log/?h=yem/kernel-modules

and it looks like that would probably help you quite a lot here...

Also, you probably want to use $(LINUX_MAKE_ENV) instead of just $(TARGET_MAKE_ENV).

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

Quoted 4 lines
package/linux-backports/linux-backports.mk new file +4 -0
+endef
+
+define LINUX_BACKPORTS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) \

Ditto $(LINUX_MAKE_ENV).

Quoted 9 lines

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

Quoted 6 lines
package/linux-backports/linux-backports.mk new file +6 -0
+		-C $(LINUX_DIR) M=$(@D) \
+		INSTALL_MOD_DIR=backports \
+		modules_install
+endef
+
+LINUX_BACKPORTS_KCONFIG_FILE = $(LINUX_BACKPORTS_SOURCE_CONFIG)

Why don't you directly assign to LINUX_BACKPORTS_KCONFIG_FILE without using the intermediate LINUX_BACKPORTS_SOURCE_CONFIG ?

Because in linux.mk, barebox.mk and at91bootstrap3.mk these redundant
intermediate variables exist. They should be removed from there.

Regards,
Arnout

Quoted 39 lines

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

Quoted 9 lines
package/linux-backports/linux-backports.mk new file +8 -0
+LINUX_BACKPORTS_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CONFIG_FRAGMENT_FILES))
+LINUX_BACKPORTS_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
+LINUX_BACKPORTS_KCONFIG_OPTS = $(LINUX_BACKPORTS_MAKE_OPTS)
+
+$(eval $(kconfig-package))
+
+# Checks to give errors that the user can understand
+ifeq ($(filter source,$(MAKECMDGOALS)),)

We now have a variable that explicitly states whether we are building or not:

    ifeq ($(BR_BUILDING),y)

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

Quoted 13 lines
package/linux-backports/linux-backports.mk new file +13 -0
+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

When nesting ifeq-blocks, we like having the endif statements remind to which ifeq they apply, like so:

endif # BR_BUILDING

so the file stays readable.

Regards,
Yann E. MORIN.

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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
author
#5 lore raw

PATCH v7 1/1 Added linux drivers backports project

In reply to Yann E. MORIN
Quoted 1 line

Petr, All,

[--SNIP--]

Quoted 1 line

Has this patch been pushed upstream?

Patch is taken from upstream git (e9dadfe5f446c9b2b1563ad50daf3a50b4497726), but it wasn't released for backports 4.0.1. I'll create new patch (v8) where I address some of these issues. It'll be based on backports 4.1.1, which includes this patch (so removed from buildroot).

Quoted 208 lines

[--SNIP--]

Quoted 21 lines
package/linux-backports/Config.in new file +15 -0
new file mode 100644
index 0000000..4d793b2
@@ -0,0 +1,48 @@
+comment "linux-backports needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
+
+config BR2_PACKAGE_LINUX_BACKPORTS
+	bool "linux-backports"
+	depends on BR2_LINUX_KERNEL
+	help
+          The linux-backports package includes many Linux drivers from
+          recent kernels, backported to older ones.
+
+          This version of linux-backports supports kernels starting from 3.0.
+
+	  https://backports.wiki.kernel.org
+
+if BR2_PACKAGE_LINUX_BACKPORTS

package/linux-backports/Config.in line 25

Quoted 10 lines
package/linux-backports/Config.in new file +10 -0
+
+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"

I'm a bit confused. Do you meant to differentiate between a defconfig that is bundled in linux-backports, vs. a full .config that is providd by the user? Is that all that is supported?

I would have expected that the user may either:
- use a bundled defconfig (or even full .config), or
- provide his own defconfig (or full .config),

like we do for other kconfig packages.

So, the prompts would be:

choice
bool "Linux backports configuration"

config BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG
bool "Using an in-tree defconfig file"

config BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG
bool "Using a custom (def)config file"

endchoice

Note: this is similar to the variable names in linux/Config.in which are probably a bit mis-named, but that's historical. What is important is how we use them.

package/linux-backports/Config.in line 33

Quoted 7 lines
package/linux-backports/Config.in new file +7 -0
+endchoice
+
+config BR2_PACKAGE_LINUX_BACKPORTS_CONFIG_FRAGMENT_FILES
+	string "Additional linux-backports configuration fragment files"
+	help
+	  A space-separated list of configuration fragment files,
+	  that will be merged to the main linux-backports configuration file.

Please, put the option for the fragments list after the base files, below:

package/linux-backports/Config.in line 46

Quoted 12 lines
package/linux-backports/Config.in new file +12 -0
+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 backports configuration file

... here.

package/linux-backports/Config.in line 45

Quoted 1 line
package/linux-backports/Config.in new file +1 -0
+endif

[--SNIP--]

Quoted 10 lines
package/linux-backports/linux-backports.mk new file +4 -0
new file mode 100644
index 0000000..d45166a
@@ -0,0 +1,64 @@
+################################################################################
+#
+# linux-backports
+#

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

Quoted 10 lines
package/linux-backports/linux-backports.mk new file +10 -0
+################################################################################
+
+LINUX_BACKPORTS_VERSION_MAJOR = 4.0.1
+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_DEPENDENCIES = linux
+# FIXME: does linux extracting, patching, but we need also linux to be configured.
+LINUX_BACKPORTS_PATCH_DEPENDENCIES = linux

You can drop the 'FIXME:' and just state:

# We need linux to be extracted and patch first before we are patched, # but we also need it to be built before we are configured, hence we do # need both dependencies:
LINUX_BACKPORTS_PATCH_DEPENDENCIES = linux LINUX_BACKPORTS_DEPENDENCIES = linux

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

Quoted 7 lines
package/linux-backports/linux-backports.mk new file +7 -0
+LINUX_BACKPORTS_MAKE_OPTS = \
+	$(LINUX_MAKE_FLAGS) \
+	KLIB_BUILD=$(LINUX_DIR) \
+	KLIB=$(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))

Do not use $(LINUX_BACKPORTS_DIR) but use $(@D) instead.

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

Quoted 2 lines
package/linux-backports/linux-backports.mk new file +2 -0
+else ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y)
+LINUX_BACKPORTS_SOURCE_CONFIG = $(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE)

You need to qstrip that one as well.

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

Quoted 5 lines
package/linux-backports/linux-backports.mk new file +5 -0
+endif
+
+# backports configure needs a configured kernel
+# FIXME: not used as we'd need to assign LINUX_BACKPORTS_SOURCE_CONFIG with :=,
+# but then we don't get $(LINUX_BACKPORTS_DIR) evaluated.

Would using $(@D) like I suggest above solve this issue?

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

Quoted 4 lines
package/linux-backports/linux-backports.mk new file +4 -0
+$(LINUX_BACKPORTS_SOURCE_CONFIG): linux
+
+define LINUX_BACKPORTS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) -C $(@D)

Would it work if you were to write (note the added trailing 'modules'):

    $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) \
        -C $(@D) modules

I ask, because I have a pending series that provides an infra for building kernel modules:
http://git.buildroot.org/~ymorin/git/buildroot/log/?h=yem/kernel-modules

and it looks like that would probably help you quite a lot here...

Also, you probably want to use $(LINUX_MAKE_ENV) instead of just $(TARGET_MAKE_ENV).

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

Quoted 4 lines
package/linux-backports/linux-backports.mk new file +4 -0
+endef
+
+define LINUX_BACKPORTS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) \

Ditto $(LINUX_MAKE_ENV).

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

Quoted 6 lines
package/linux-backports/linux-backports.mk new file +6 -0
+		-C $(LINUX_DIR) M=$(@D) \
+		INSTALL_MOD_DIR=backports \
+		modules_install
+endef
+
+LINUX_BACKPORTS_KCONFIG_FILE = $(LINUX_BACKPORTS_SOURCE_CONFIG)

Why don't you directly assign to LINUX_BACKPORTS_KCONFIG_FILE without using the intermediate LINUX_BACKPORTS_SOURCE_CONFIG ?

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

Quoted 8 lines
package/linux-backports/linux-backports.mk new file +8 -0
+LINUX_BACKPORTS_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CONFIG_FRAGMENT_FILES))
+LINUX_BACKPORTS_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
+LINUX_BACKPORTS_KCONFIG_OPTS = $(LINUX_BACKPORTS_MAKE_OPTS)
+
+$(eval $(kconfig-package))
+
+# Checks to give errors that the user can understand
+ifeq ($(filter source,$(MAKECMDGOALS)),)

We now have a variable that explicitly states whether we are building or not:

    ifeq ($(BR_BUILDING),y)

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

Quoted 13 lines
package/linux-backports/linux-backports.mk new file +13 -0
+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

When nesting ifeq-blocks, we like having the endif statements remind to which ifeq they apply, like so:

Quoted 6 lines

endif # BR_BUILDING

so the file stays readable.

Regards,
Yann E. MORIN.

Kind regards,
Petr

#6 lore raw

PATCH v7 1/1 Added linux drivers backports project

In reply to Petr Vorel

Petr, All,

On 2015-07-02 00:58 +0200, Petr Vorel spake thusly:

Quoted 6 lines

https://backports.wiki.kernel.org

Cc Arnout Vandecappelle <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

Since there's quite some work left to be done, and we would like to have this as part of the next release, I'm adopting this patch to fix the remaining issues that Arnout and I raised earlier.

However, I have a question, see below...

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

Quoted 13 lines
package/linux-backports/linux-backports.mk new file +7 -0
new file mode 100644
index 0000000..d45166a
@@ -0,0 +1,64 @@
+################################################################################
+#
+# linux-backports
+#
+################################################################################
+
+LINUX_BACKPORTS_VERSION_MAJOR = 4.0.1

How are the versions of Linux and linux-backports related?

I.e. does linux-backports have to match the Linux version, or can we use whatever linux-backports version with whatever Linux version?

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#7 lore raw

PATCH v7 1/1 Added linux drivers backports project

Petr, All,

On 2015-07-19 15:29 +0200, Yann E. MORIN spake thusly:

Quoted 30 lines

On 2015-07-02 00:58 +0200, Petr Vorel spake thusly:

Quoted 6 lines

https://backports.wiki.kernel.org

Cc Arnout Vandecappelle <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

Since there's quite some work left to be done, and we would like to have this as part of the next release, I'm adopting this patch to fix the remaining issues that Arnout and I raised earlier.

However, I have a question, see below...

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

Quoted 13 lines
package/linux-backports/linux-backports.mk new file +7 -0
new file mode 100644
index 0000000..d45166a
@@ -0,0 +1,64 @@
+################################################################################
+#
+# linux-backports
+#
+################################################################################
+
+LINUX_BACKPORTS_VERSION_MAJOR = 4.0.1

How are the versions of Linux and linux-backports related?

Quoted 2 lines

I.e. does linux-backports have to match the Linux version, or can we use whatever linux-backports version with whatever Linux version?

Forget it, I now found the info you did put in the help text! ;-)

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
author
#8 lore raw

PATCH v7 1/1 Added linux drivers backports project

In reply to Yann E. MORIN

Hi Yann and others,

Quoted 3 lines

Since there's quite some work left to be done, and we would like to have this as part of the next release, I'm adopting this patch to fix the remaining issues that Arnout and I raised earlier.

I'm sorry, it took me a bit longer to reply, I was on holiday in the mountains, without the internet.
I'm glad you want to have linux backports in next release :-).

IMHO the main problem is linux-configure dependency - I wasn't able to trigger it. The rest should be easy to fix. I'll write a quick note to the other posts.

Kind regards,
Petr

#9 lore raw

PATCH v7 1/1 Added linux drivers backports project

Petr, All,

On 2015-07-22 00:01 +0200, Petr Vorel spake thusly:

Quoted 6 lines
Quoted 3 lines

Since there's quite some work left to be done, and we would like to have this as part of the next release, I'm adopting this patch to fix the remaining issues that Arnout and I raised earlier.

I'm sorry, it took me a bit longer to reply, I was on holiday in the mountains, without the internet.

Lucky you! :-)

Quoted 2 lines

IMHO the main problem is linux-configure dependency - I wasn't able to trigger it. The rest should be easy to fix. I'll write a quick note to the other posts.

Yup, I did solve the configury dependency. It was indeed not trivial, but most importantly, it uncovered an issue within the pkg-kconfig infra, that had to be fixed first (see my reply to your other mail).

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'