Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext)
@ 2015-03-14 14:25 Yann E. MORIN
  2015-03-14 14:25 ` [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies Yann E. MORIN
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Yann E. MORIN @ 2015-03-14 14:25 UTC (permalink / raw)
  To: buildroot

Hello All!

This small series is an attempt at fixing the use of extensions, which
broke unnoticeably since we switched to using the kconfig-package
infrastructure for the linux package.

  - patches 1-2: introduce patch-dependencies (code and manual)
  - patch 3    : actually fix the extensions
  - patches 4-5: simplify adding new extensions

Changes v1 -> v2:
  - introduce patch-dependencies  (Thomas P.)
  - use that instead of custom-written rules on .stamp_patched
  - split out the 'extensions infra' from the actual extensions fix

Regards,
Yann E. MORIN.


The following changes since commit 3fd2c4d25f727c5364e52abf65c37f19fe461433:

  iotop: new package (2015-03-13 23:16:38 +0100)

are available in the git repository at:

  git://git.busybox.net/~ymorin/git/buildroot yem/kernel-ext

for you to fetch changes up to 724c084b0e9f1d98670184ab5e77a2381e04d67c:

  linux: migrate extensions to use the new infrastructure (2015-03-14 15:19:31 +0100)

----------------------------------------------------------------
Yann E. MORIN (5):
      package infra: add patch-dependencies
      docs/manual: add _PATCH_DEPENDENCIES
      linux: fix extensions
      linux: simplify adding new extensions
      linux: migrate extensions to use the new infrastructure

 docs/manual/adding-packages-generic.txt | 9 +++++++++
 linux/linux-ext-fbtft.mk                | 8 +-------
 linux/linux-ext-rtai.mk                 | 8 +-------
 linux/linux-ext-xenomai.mk              | 8 +-------
 linux/linux.mk                          | 7 +++++++
 package/pkg-generic.mk                  | 9 ++++++++-
 6 files changed, 27 insertions(+), 22 deletions(-)

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies
  2015-03-14 14:25 [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext) Yann E. MORIN
@ 2015-03-14 14:25 ` Yann E. MORIN
  2015-03-24 23:22   ` Romain Naour
                     ` (2 more replies)
  2015-03-14 14:25 ` [Buildroot] [PATCH 2/5 v2] docs/manual: add _PATCH_DEPENDENCIES Yann E. MORIN
                   ` (4 subsequent siblings)
  5 siblings, 3 replies; 16+ messages in thread
From: Yann E. MORIN @ 2015-03-14 14:25 UTC (permalink / raw)
  To: buildroot

Some packages need to vampirise files from one or more other packages.
This is the case, for example, of the Linux kernel and its /extensions/.

Add a new type of dependencies, that are guaranteed to be extracted and
patched before a package is patched.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/pkg-generic.mk | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index c1b379b..018f048 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -427,6 +427,7 @@ endif
 
 # Eliminate duplicates in dependencies
 $(2)_FINAL_DEPENDENCIES = $$(sort $$($(2)_DEPENDENCIES))
+$(2)_FINAL_PATCH_DEPENDENCIES = $$(sort $$($(2)_PATCH_DEPENDENCIES))
 
 $(2)_INSTALL_STAGING		?= NO
 $(2)_INSTALL_IMAGES		?= NO
@@ -538,6 +539,8 @@ $$($(2)_TARGET_CONFIGURE):	$$($(2)_TARGET_PATCH)
 
 $(1)-patch:		$$($(2)_TARGET_PATCH)
 $$($(2)_TARGET_PATCH):	$$($(2)_TARGET_EXTRACT)
+# Order-only dependency
+$$($(2)_TARGET_PATCH):  | $$(patsubst %,%-patch,$$($(2)_FINAL_PATCH_DEPENDENCIES))
 
 $(1)-extract:			$$($(2)_TARGET_EXTRACT)
 $$($(2)_TARGET_EXTRACT):	$$($(2)_TARGET_SOURCE)
@@ -568,8 +571,12 @@ endif
 $(1)-show-version:
 			@echo $$($(2)_VERSION)
 
-$(1)-show-depends:
+$(1)-show-build-depends:
 			@echo $$($(2)_FINAL_DEPENDENCIES)
+$(1)-show-patch-depends:
+			@echo $$($(2)_FINAL_PATCH_DEPENDENCIES)
+$(1)-show-depends:
+			@echo $$(sort $$($(2)_FINAL_DEPENDENCIES) $$($(2)_FINAL_PATCH_DEPENDENCIES))
 
 $(1)-graph-depends: graph-depends-requirements
 			@$$(INSTALL) -d $$(O)/graphs
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 2/5 v2] docs/manual: add _PATCH_DEPENDENCIES
  2015-03-14 14:25 [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext) Yann E. MORIN
  2015-03-14 14:25 ` [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies Yann E. MORIN
@ 2015-03-14 14:25 ` Yann E. MORIN
  2015-03-24 23:22   ` Romain Naour
  2015-03-14 14:25 ` [Buildroot] [PATCH 3/5 v2] linux: fix extensions Yann E. MORIN
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Yann E. MORIN @ 2015-03-14 14:25 UTC (permalink / raw)
  To: buildroot

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 docs/manual/adding-packages-generic.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/docs/manual/adding-packages-generic.txt b/docs/manual/adding-packages-generic.txt
index 6150bf7..adf4ddf 100644
--- a/docs/manual/adding-packages-generic.txt
+++ b/docs/manual/adding-packages-generic.txt
@@ -304,6 +304,15 @@ information is (assuming the package name is +libfoo+) :
   a similar way, +HOST_LIBFOO_DEPENDENCIES+ lists the dependencies for
   the current host package.
 
+* +LIBFOO_PATCH_DEPENDENCIES+ lists the dependencies (in terms of
+  package name) that are required for the current package to be
+  patched. These dependencies are guaranteed to be extracted and
+  patched before the current package is patched. In a similar way,
+  +HOST_LIBFOO_PATCH_DEPENDENCIES+ lists the dependencies for the
+  current host package.
+  This is seldom used; usually, +LIBFOO_DEPENDENCIES+ is what you
+  really want to use.
+
 * +LIBFOO_PROVIDES+ lists all the virtual packages +libfoo+ is an
   implementation of. See xref:virtual-package-tutorial[].
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 3/5 v2] linux: fix extensions
  2015-03-14 14:25 [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext) Yann E. MORIN
  2015-03-14 14:25 ` [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies Yann E. MORIN
  2015-03-14 14:25 ` [Buildroot] [PATCH 2/5 v2] docs/manual: add _PATCH_DEPENDENCIES Yann E. MORIN
@ 2015-03-14 14:25 ` Yann E. MORIN
  2015-03-24 23:22   ` Romain Naour
  2015-03-14 14:25 ` [Buildroot] [PATCH 4/5 v2] linux: simplify adding new extensions Yann E. MORIN
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Yann E. MORIN @ 2015-03-14 14:25 UTC (permalink / raw)
  To: buildroot

Since the move to the kconfig-package infra, linux extensions are
broken.

In our linux package, extensions are applied as pre-patch hooks.

Before the kconfig-package infra, we had custom rules for the
linux-*config targets, which were of the form:

    linux-menuconfig: linux-configure
        $(MAKE) -C $(LINUX_DIR) menuconfig

This caused the linux tree to be fully configured before running the
configurators, and thus linux dependencies were entirely fullfilled, and
extensions were properly applied.

Since we migrated (in dff25ea), the kconfig-package infra introduces a
(hidden, internal) intermediate step 'kconfig-fixup' and decorelates the
kconfig-part of the configuration from the actual package-part of the
configuration:

    linux-configure -------> kconfig-fixup --> .config --> $(LINUX_CONFIG_FILE)
                        /
    linux-menuconfig --'

As thus, this (very useful!) use-case breaks (starting from a clean
Buildroot tree):

    make menuconfig
        -> enable a kernel and at least one extension
        -> save and exit
    make linux-menuconfig
        -> extensions are not available

Fix that by using the newly-introduced patch-dependencies, so that
extensions are available before we try to patch the linux kernel.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
---
 linux/linux-ext-fbtft.mk   | 2 +-
 linux/linux-ext-rtai.mk    | 2 +-
 linux/linux-ext-xenomai.mk | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/linux/linux-ext-fbtft.mk b/linux/linux-ext-fbtft.mk
index 36f4fd2..6892c89 100644
--- a/linux/linux-ext-fbtft.mk
+++ b/linux/linux-ext-fbtft.mk
@@ -6,7 +6,7 @@
 
 ifeq ($(BR2_LINUX_KERNEL_EXT_FBTFT),y)
 # Add dependency to fbtft package (download helper for the fbtft source)
-LINUX_DEPENDENCIES += fbtft
+LINUX_PATCH_DEPENDENCIES += fbtft
 
 # for linux >= 3.15 install to drivers/video/fbdev/fbtft
 # for linux < 3.15 install to drivers/video/fbtft
diff --git a/linux/linux-ext-rtai.mk b/linux/linux-ext-rtai.mk
index bf998d5..942b430 100644
--- a/linux/linux-ext-rtai.mk
+++ b/linux/linux-ext-rtai.mk
@@ -6,7 +6,7 @@
 
 ifeq ($(BR2_LINUX_KERNEL_EXT_RTAI),y)
 # Add dependency to RTAI (user-space) which provide kernel patches
-LINUX_DEPENDENCIES += rtai-patch
+LINUX_PATCH_DEPENDENCIES += rtai
 
 RTAI_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_RTAI_PATCH))
 
diff --git a/linux/linux-ext-xenomai.mk b/linux/linux-ext-xenomai.mk
index 84d2c17..f6a5ffd 100644
--- a/linux/linux-ext-xenomai.mk
+++ b/linux/linux-ext-xenomai.mk
@@ -6,7 +6,7 @@
 
 ifeq ($(BR2_LINUX_KERNEL_EXT_XENOMAI),y)
 # Add dependency to xenomai (user-space) which provide ksrc part
-LINUX_DEPENDENCIES += xenomai
+LINUX_PATCH_DEPENDENCIES += xenomai
 
 # Adeos patch version
 XENOMAI_ADEOS_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH))
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 4/5 v2] linux: simplify adding new extensions
  2015-03-14 14:25 [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext) Yann E. MORIN
                   ` (2 preceding siblings ...)
  2015-03-14 14:25 ` [Buildroot] [PATCH 3/5 v2] linux: fix extensions Yann E. MORIN
@ 2015-03-14 14:25 ` Yann E. MORIN
  2015-03-26 21:54   ` Romain Naour
  2015-03-14 14:25 ` [Buildroot] [PATCH 5/5 v2] linux: migrate extensions to use the new infrastructure Yann E. MORIN
  2015-04-09 21:11 ` [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext) Thomas Petazzoni
  5 siblings, 1 reply; 16+ messages in thread
From: Yann E. MORIN @ 2015-03-14 14:25 UTC (permalink / raw)
  To: buildroot

Curently, all three linux extensions follow the same layout:
  - test if the extension is enabled
  - add itself to linux' patch-dependencies
  - declare a macro, added as the pre-patch hook

Except for the macro, all can be commonalised.

Add a simple infrastructure for that:
  - extensions declare themselves in the list of extensions
  - extensions define their macro
  - the infra adds them to the patch-dependencies and pre-patch
    hooks as appropriate

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 linux/linux.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/linux/linux.mk b/linux/linux.mk
index b1aca41..2917857 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -333,6 +333,13 @@ endef
 # included here *must* be in the same directory!
 include $(sort $(wildcard linux/linux-ext-*.mk))
 
+LINUX_PATCH_DEPENDENCIES += $(foreach ext,$(LINUX_EXTENSIONS),\
+	$(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),$(ext)))
+
+LINUX_PRE_PATCH_HOOKS += $(foreach ext,$(LINUX_EXTENSIONS),\
+	$(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),\
+		$(call UPPERCASE,$(ext))_PREPARE_KERNEL))
+
 $(eval $(kconfig-package))
 
 # Support for rebuilding the kernel after the cpio archive has
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 5/5 v2] linux: migrate extensions to use the new infrastructure
  2015-03-14 14:25 [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext) Yann E. MORIN
                   ` (3 preceding siblings ...)
  2015-03-14 14:25 ` [Buildroot] [PATCH 4/5 v2] linux: simplify adding new extensions Yann E. MORIN
@ 2015-03-14 14:25 ` Yann E. MORIN
  2015-03-26 21:55   ` Romain Naour
  2015-04-09 21:11 ` [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext) Thomas Petazzoni
  5 siblings, 1 reply; 16+ messages in thread
From: Yann E. MORIN @ 2015-03-14 14:25 UTC (permalink / raw)
  To: buildroot

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 linux/linux-ext-fbtft.mk   | 8 +-------
 linux/linux-ext-rtai.mk    | 8 +-------
 linux/linux-ext-xenomai.mk | 8 +-------
 3 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/linux/linux-ext-fbtft.mk b/linux/linux-ext-fbtft.mk
index 6892c89..3e6a3cc 100644
--- a/linux/linux-ext-fbtft.mk
+++ b/linux/linux-ext-fbtft.mk
@@ -4,9 +4,7 @@
 # Patch the linux kernel with fbtft extension
 ################################################################################
 
-ifeq ($(BR2_LINUX_KERNEL_EXT_FBTFT),y)
-# Add dependency to fbtft package (download helper for the fbtft source)
-LINUX_PATCH_DEPENDENCIES += fbtft
+LINUX_EXTENSIONS += fbtft
 
 # for linux >= 3.15 install to drivers/video/fbdev/fbtft
 # for linux < 3.15 install to drivers/video/fbtft
@@ -22,7 +20,3 @@ define FBTFT_PREPARE_KERNEL
 		>> $${dest}/Kconfig ; \
 	echo 'obj-y += fbtft/' >> $${dest}/Makefile
 endef
-
-LINUX_PRE_PATCH_HOOKS += FBTFT_PREPARE_KERNEL
-
-endif #BR2_LINUX_KERNEL_EXT_FBTFT
diff --git a/linux/linux-ext-rtai.mk b/linux/linux-ext-rtai.mk
index 942b430..07e7a19 100644
--- a/linux/linux-ext-rtai.mk
+++ b/linux/linux-ext-rtai.mk
@@ -4,9 +4,7 @@
 # Patch the linux kernel with RTAI extension
 ################################################################################
 
-ifeq ($(BR2_LINUX_KERNEL_EXT_RTAI),y)
-# Add dependency to RTAI (user-space) which provide kernel patches
-LINUX_PATCH_DEPENDENCIES += rtai
+LINUX_EXTENSIONS += rtai
 
 RTAI_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_RTAI_PATCH))
 
@@ -41,7 +39,3 @@ define RTAI_PREPARE_KERNEL
 		$(notdir $(RTAI_PATCH))
 endef
 endif
-
-LINUX_PRE_PATCH_HOOKS += RTAI_PREPARE_KERNEL
-
-endif #BR2_LINUX_EXT_RTAI
diff --git a/linux/linux-ext-xenomai.mk b/linux/linux-ext-xenomai.mk
index f6a5ffd..76a9786 100644
--- a/linux/linux-ext-xenomai.mk
+++ b/linux/linux-ext-xenomai.mk
@@ -4,9 +4,7 @@
 # Patch the linux kernel with xenomai extension
 ################################################################################
 
-ifeq ($(BR2_LINUX_KERNEL_EXT_XENOMAI),y)
-# Add dependency to xenomai (user-space) which provide ksrc part
-LINUX_PATCH_DEPENDENCIES += xenomai
+LINUX_EXTENSIONS += xenomai
 
 # Adeos patch version
 XENOMAI_ADEOS_PATCH = $(call qstrip,$(BR2_LINUX_KERNEL_EXT_XENOMAI_ADEOS_PATCH))
@@ -24,7 +22,3 @@ define XENOMAI_PREPARE_KERNEL
 		$(XENOMAI_ADEOS_OPTS) \
 		--verbose
 endef
-
-LINUX_PRE_PATCH_HOOKS += XENOMAI_PREPARE_KERNEL
-
-endif #BR2_LINUX_EXT_XENOMAI
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies
  2015-03-14 14:25 ` [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies Yann E. MORIN
@ 2015-03-24 23:22   ` Romain Naour
  2015-04-04 13:47   ` Thomas Petazzoni
  2015-04-14  0:17   ` Arnout Vandecappelle
  2 siblings, 0 replies; 16+ messages in thread
From: Romain Naour @ 2015-03-24 23:22 UTC (permalink / raw)
  To: buildroot

Hi Yann, All

Rather than dropping reviewed and tested tag without a word, I prefer to write
what I understand.
I tested the series up to patch 3/5 with xenomai extension.

Le 14/03/2015 15:25, Yann E. MORIN a ?crit :
> Some packages need to vampirise files from one or more other packages.
> This is the case, for example, of the Linux kernel and its /extensions/.
> 
> Add a new type of dependencies, that are guaranteed to be extracted and
> patched before a package is patched.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  package/pkg-generic.mk | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index c1b379b..018f048 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -427,6 +427,7 @@ endif
>  
>  # Eliminate duplicates in dependencies
>  $(2)_FINAL_DEPENDENCIES = $$(sort $$($(2)_DEPENDENCIES))
> +$(2)_FINAL_PATCH_DEPENDENCIES = $$(sort $$($(2)_PATCH_DEPENDENCIES))

After patch 3/5 applied and if xenomai extension is selected, we have "xenomai"
in LINUX_FINAL_PATCH_DEPENDENCIES.

>  
>  $(2)_INSTALL_STAGING		?= NO
>  $(2)_INSTALL_IMAGES		?= NO
> @@ -538,6 +539,8 @@ $$($(2)_TARGET_CONFIGURE):	$$($(2)_TARGET_PATCH)
>  
>  $(1)-patch:		$$($(2)_TARGET_PATCH)
>  $$($(2)_TARGET_PATCH):	$$($(2)_TARGET_EXTRACT)
> +# Order-only dependency
> +$$($(2)_TARGET_PATCH):  | $$(patsubst %,%-patch,$$($(2)_FINAL_PATCH_DEPENDENCIES))

Here LINUX_TARGET_PATCH is appended with xenomai-patch, so linux-patch can start
as soon as xenomai-patch is done.
'|' is used to not restart the build for each make invocation.

>  
>  $(1)-extract:			$$($(2)_TARGET_EXTRACT)
>  $$($(2)_TARGET_EXTRACT):	$$($(2)_TARGET_SOURCE)
> @@ -568,8 +571,12 @@ endif
>  $(1)-show-version:
>  			@echo $$($(2)_VERSION)
>  
> -$(1)-show-depends:
> +$(1)-show-build-depends:
>  			@echo $$($(2)_FINAL_DEPENDENCIES)
> +$(1)-show-patch-depends:
> +			@echo $$($(2)_FINAL_PATCH_DEPENDENCIES)
> +$(1)-show-depends:
> +			@echo $$(sort $$($(2)_FINAL_DEPENDENCIES) $$($(2)_FINAL_PATCH_DEPENDENCIES))

Here LINUX_FINAL_PATCH_DEPENDENCIES is taken into account for linux-show-depends

Before and after the patch 3/5 the result is the same for linux-show-depends:
make O=test/xenomai/ linux-show-depends
host-kmod host-lzop toolchain xenomai

After the patch 3/5, we can see that xenomai is no longer part of build
dependencies.
make O=test/xenomai/ linux-show-build-depends
host-kmod host-lzop toolchain

But it's now a patch dependencies:
make O=test/xenomai/ linux-show-patch-depends
xenomai


>  
>  $(1)-graph-depends: graph-depends-requirements
>  			@$$(INSTALL) -d $$(O)/graphs
> 

So,
    Reviewed-by: Romain Naour <romain.naour@openwide.fr>
    Tested-by: Romain Naour <romain.naour@openwide.fr>

Best regards,
Romain

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 2/5 v2] docs/manual: add _PATCH_DEPENDENCIES
  2015-03-14 14:25 ` [Buildroot] [PATCH 2/5 v2] docs/manual: add _PATCH_DEPENDENCIES Yann E. MORIN
@ 2015-03-24 23:22   ` Romain Naour
  0 siblings, 0 replies; 16+ messages in thread
From: Romain Naour @ 2015-03-24 23:22 UTC (permalink / raw)
  To: buildroot

Hi Yann, all,

Le 14/03/2015 15:25, Yann E. MORIN a ?crit :
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  docs/manual/adding-packages-generic.txt | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/docs/manual/adding-packages-generic.txt b/docs/manual/adding-packages-generic.txt
> index 6150bf7..adf4ddf 100644
> --- a/docs/manual/adding-packages-generic.txt
> +++ b/docs/manual/adding-packages-generic.txt
> @@ -304,6 +304,15 @@ information is (assuming the package name is +libfoo+) :
>    a similar way, +HOST_LIBFOO_DEPENDENCIES+ lists the dependencies for
>    the current host package.
>  
> +* +LIBFOO_PATCH_DEPENDENCIES+ lists the dependencies (in terms of
> +  package name) that are required for the current package to be
> +  patched. These dependencies are guaranteed to be extracted and
> +  patched before the current package is patched. In a similar way,
> +  +HOST_LIBFOO_PATCH_DEPENDENCIES+ lists the dependencies for the
> +  current host package.
> +  This is seldom used; usually, +LIBFOO_DEPENDENCIES+ is what you
> +  really want to use.
> +
>  * +LIBFOO_PROVIDES+ lists all the virtual packages +libfoo+ is an
>    implementation of. See xref:virtual-package-tutorial[].
>  
> 
Reviewed-by: Romain Naour <romain.naour@openwide.fr>

Best regards,
Romain

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 3/5 v2] linux: fix extensions
  2015-03-14 14:25 ` [Buildroot] [PATCH 3/5 v2] linux: fix extensions Yann E. MORIN
@ 2015-03-24 23:22   ` Romain Naour
  0 siblings, 0 replies; 16+ messages in thread
From: Romain Naour @ 2015-03-24 23:22 UTC (permalink / raw)
  To: buildroot

Hi Yann, All

Le 14/03/2015 15:25, Yann E. MORIN a ?crit :
> Since the move to the kconfig-package infra, linux extensions are
> broken.
> 
> In our linux package, extensions are applied as pre-patch hooks.
> 
> Before the kconfig-package infra, we had custom rules for the
> linux-*config targets, which were of the form:
> 
>     linux-menuconfig: linux-configure
>         $(MAKE) -C $(LINUX_DIR) menuconfig
> 
> This caused the linux tree to be fully configured before running the
> configurators, and thus linux dependencies were entirely fullfilled, and
> extensions were properly applied.
> 
> Since we migrated (in dff25ea), the kconfig-package infra introduces a
> (hidden, internal) intermediate step 'kconfig-fixup' and decorelates the
> kconfig-part of the configuration from the actual package-part of the
> configuration:
> 
>     linux-configure -------> kconfig-fixup --> .config --> $(LINUX_CONFIG_FILE)
>                         /
>     linux-menuconfig --'
> 
> As thus, this (very useful!) use-case breaks (starting from a clean
> Buildroot tree):
> 
>     make menuconfig
>         -> enable a kernel and at least one extension
>         -> save and exit
>     make linux-menuconfig
>         -> extensions are not available
> 
> Fix that by using the newly-introduced patch-dependencies, so that
> extensions are available before we try to patch the linux kernel.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
> ---

I reproduced the issue with xenomai extension:

$ make O=test/xenomai/ linux-menuconfig
[...]
/home/naourr/git/buildroot/test/xenomai/build/xenomai-2.6.4/scripts/prepare-kernel.sh
--linux=/home/naourr/git/buildroot/test/xenomai/build/linux-3.14.17 --arch=i386
--default --verbose
make:
/home/naourr/git/buildroot/test/xenomai/build/xenomai-2.6.4/scripts/prepare-kernel.sh
: commande introuvable
make: ***
[/home/naourr/git/buildroot/test/xenomai/build/linux-3.14.17/.stamp_patched]
Erreur 127

> diff --git a/linux/linux-ext-xenomai.mk b/linux/linux-ext-xenomai.mk
> index 84d2c17..f6a5ffd 100644
> --- a/linux/linux-ext-xenomai.mk
> +++ b/linux/linux-ext-xenomai.mk
> @@ -6,7 +6,7 @@
>  
>  ifeq ($(BR2_LINUX_KERNEL_EXT_XENOMAI),y)
>  # Add dependency to xenomai (user-space) which provide ksrc part
> -LINUX_DEPENDENCIES += xenomai
> +LINUX_PATCH_DEPENDENCIES += xenomai
>  
The issue is indeed fixed by this patch.

    Reviewed-by: Romain Naour <romain.naour@openwide.fr>
    Tested-by: Romain Naour <romain.naour@openwide.fr>

Best regard,
Romain

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 4/5 v2] linux: simplify adding new extensions
  2015-03-14 14:25 ` [Buildroot] [PATCH 4/5 v2] linux: simplify adding new extensions Yann E. MORIN
@ 2015-03-26 21:54   ` Romain Naour
  0 siblings, 0 replies; 16+ messages in thread
From: Romain Naour @ 2015-03-26 21:54 UTC (permalink / raw)
  To: buildroot

Hi Yann, All,

Le 14/03/2015 15:25, Yann E. MORIN a ?crit :
> Curently, all three linux extensions follow the same layout:
>   - test if the extension is enabled
>   - add itself to linux' patch-dependencies
>   - declare a macro, added as the pre-patch hook
> 
> Except for the macro, all can be commonalised.
> 
> Add a simple infrastructure for that:
>   - extensions declare themselves in the list of extensions
>   - extensions define their macro
>   - the infra adds them to the patch-dependencies and pre-patch
>     hooks as appropriate
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  linux/linux.mk | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/linux/linux.mk b/linux/linux.mk
> index b1aca41..2917857 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -333,6 +333,13 @@ endef
>  # included here *must* be in the same directory!
>  include $(sort $(wildcard linux/linux-ext-*.mk))
>  
> +LINUX_PATCH_DEPENDENCIES += $(foreach ext,$(LINUX_EXTENSIONS),\
> +	$(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),$(ext)))
> +
> +LINUX_PRE_PATCH_HOOKS += $(foreach ext,$(LINUX_EXTENSIONS),\
> +	$(if $(BR2_LINUX_KERNEL_EXT_$(call UPPERCASE,$(ext))),\
> +		$(call UPPERCASE,$(ext))_PREPARE_KERNEL))
> +
>  $(eval $(kconfig-package))
>  
>  # Support for rebuilding the kernel after the cpio archive has
> 

    Reviewed-by: Romain Naour <romain.naour@openwide.fr>

Tested with Xenomai extensions and obviously the patch 5/5 applied :)

    Tested-by: Romain Naour <romain.naour@openwide.fr>

Best regards,
Romain

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 5/5 v2] linux: migrate extensions to use the new infrastructure
  2015-03-14 14:25 ` [Buildroot] [PATCH 5/5 v2] linux: migrate extensions to use the new infrastructure Yann E. MORIN
@ 2015-03-26 21:55   ` Romain Naour
  0 siblings, 0 replies; 16+ messages in thread
From: Romain Naour @ 2015-03-26 21:55 UTC (permalink / raw)
  To: buildroot

Hi Yann, All,

Le 14/03/2015 15:25, Yann E. MORIN a ?crit :
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  linux/linux-ext-fbtft.mk   | 8 +-------
>  linux/linux-ext-rtai.mk    | 8 +-------
>  linux/linux-ext-xenomai.mk | 8 +-------
>  3 files changed, 3 insertions(+), 21 deletions(-)
> 

    Reviewed-by: Romain Naour <romain.naour@openwide.fr>

Tested with Xenomai extensions.

    Tested-by: Romain Naour <romain.naour@openwide.fr>

Best regards,
Romain

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies
  2015-03-14 14:25 ` [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies Yann E. MORIN
  2015-03-24 23:22   ` Romain Naour
@ 2015-04-04 13:47   ` Thomas Petazzoni
  2015-04-05  9:16     ` Yann E. MORIN
  2015-04-14  0:17   ` Arnout Vandecappelle
  2 siblings, 1 reply; 16+ messages in thread
From: Thomas Petazzoni @ 2015-04-04 13:47 UTC (permalink / raw)
  To: buildroot

Dear Yann E. MORIN,

On Sat, 14 Mar 2015 15:25:17 +0100, Yann E. MORIN wrote:

> -$(1)-show-depends:
> +$(1)-show-build-depends:
>  			@echo $$($(2)_FINAL_DEPENDENCIES)
> +$(1)-show-patch-depends:
> +			@echo $$($(2)_FINAL_PATCH_DEPENDENCIES)
> +$(1)-show-depends:
> +			@echo $$(sort $$($(2)_FINAL_DEPENDENCIES) $$($(2)_FINAL_PATCH_DEPENDENCIES))

I think this will break graph-depends. The python script will do "make
<foo>-show-depends" for each package. Now this will return things such
as "xenomai-patch", so the script will then try to do "make
xenomai-patch-show-depends" to recurse into the dependency tree, and
this will fail. <pkg>-show-depends should only return the name of
packages.

Also, I'm not sure about the usefulness of having separate
show-build-depends and show-patch-depends. It could have been useful if
show-depends would simply depend on them, but it doesn't work because
we want all dependencies space-separated on one line.

So, what about replacing this part with just:

$(1)-show-depends:
	@echo $$(sort $$($(2)_FINAL_DEPENDENCIES) $$(patsubst %-patch,%,$$($(2)_FINAL_PATCH_DEPENDENCIES)))

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies
  2015-04-04 13:47   ` Thomas Petazzoni
@ 2015-04-05  9:16     ` Yann E. MORIN
  2015-04-05  9:46       ` Thomas Petazzoni
  0 siblings, 1 reply; 16+ messages in thread
From: Yann E. MORIN @ 2015-04-05  9:16 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2015-04-04 15:47 +0200, Thomas Petazzoni spake thusly:
> Dear Yann E. MORIN,
> 
> On Sat, 14 Mar 2015 15:25:17 +0100, Yann E. MORIN wrote:
> 
> > -$(1)-show-depends:
> > +$(1)-show-build-depends:
> >  			@echo $$($(2)_FINAL_DEPENDENCIES)
> > +$(1)-show-patch-depends:
> > +			@echo $$($(2)_FINAL_PATCH_DEPENDENCIES)
> > +$(1)-show-depends:
> > +			@echo $$(sort $$($(2)_FINAL_DEPENDENCIES) $$($(2)_FINAL_PATCH_DEPENDENCIES))
> 
> I think this will break graph-depends. The python script will do "make
> <foo>-show-depends" for each package. Now this will return things such
> as "xenomai-patch"

No, I don't think so, because _PATCH_DEPENDENCIES contain package names,
not or internal make targets. And I can prove it:

    $ make linux-show-depends
    fbtft host-kmod host-lzop toolchain

where fbtft is a kernel extension.

Have you even tried it?  ;-p

> Also, I'm not sure about the usefulness of having separate
> show-build-depends and show-patch-depends. It could have been useful if
> show-depends would simply depend on them, but it doesn't work because
> we want all dependencies space-separated on one line.
> 
> So, what about replacing this part with just:
> 
> $(1)-show-depends:
> 	@echo $$(sort $$($(2)_FINAL_DEPENDENCIES) $$(patsubst %-patch,%,$$($(2)_FINAL_PATCH_DEPENDENCIES)))

Well, I don;t mind getting rid of the separate show-{build,patch}-depends
rules. But your proposal is wrong, since we do not have to get rid of
the trailing -patch, because it's not in there...

Regards,
Yann E. MORIN.

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

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies
  2015-04-05  9:16     ` Yann E. MORIN
@ 2015-04-05  9:46       ` Thomas Petazzoni
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Petazzoni @ 2015-04-05  9:46 UTC (permalink / raw)
  To: buildroot

Dear Yann E. MORIN,

On Sun, 5 Apr 2015 11:16:56 +0200, Yann E. MORIN wrote:

> > I think this will break graph-depends. The python script will do "make
> > <foo>-show-depends" for each package. Now this will return things such
> > as "xenomai-patch"
> 
> No, I don't think so, because _PATCH_DEPENDENCIES contain package names,
> not or internal make targets. And I can prove it:
> 
>     $ make linux-show-depends
>     fbtft host-kmod host-lzop toolchain
> 
> where fbtft is a kernel extension.

Yes, sorry, Romain explained to me on IRC where I was wrong.

> Have you even tried it?  ;-p

No, I only did a review.

> Well, I don;t mind getting rid of the separate show-{build,patch}-depends
> rules. But your proposal is wrong, since we do not have to get rid of
> the trailing -patch, because it's not in there...

Correct. I believe the show-{build,patch}-depends are not useful,
though.

I'll apply this series.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext)
  2015-03-14 14:25 [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext) Yann E. MORIN
                   ` (4 preceding siblings ...)
  2015-03-14 14:25 ` [Buildroot] [PATCH 5/5 v2] linux: migrate extensions to use the new infrastructure Yann E. MORIN
@ 2015-04-09 21:11 ` Thomas Petazzoni
  5 siblings, 0 replies; 16+ messages in thread
From: Thomas Petazzoni @ 2015-04-09 21:11 UTC (permalink / raw)
  To: buildroot

Dear Yann E. MORIN,

On Sat, 14 Mar 2015 15:25:17 +0100, Yann E. MORIN wrote:

> Yann E. MORIN (5):
>       package infra: add patch-dependencies
>       docs/manual: add _PATCH_DEPENDENCIES
>       linux: fix extensions
>       linux: simplify adding new extensions
>       linux: migrate extensions to use the new infrastructure

Thanks a lot, series applied!

I've only done one minor change: in the first patch, I got rid of
show-build-depends and show-patch-depends, and kept only show-depends.

Thanks also to Romain who did review and test the patch series, it was
definitely very useful.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies
  2015-03-14 14:25 ` [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies Yann E. MORIN
  2015-03-24 23:22   ` Romain Naour
  2015-04-04 13:47   ` Thomas Petazzoni
@ 2015-04-14  0:17   ` Arnout Vandecappelle
  2 siblings, 0 replies; 16+ messages in thread
From: Arnout Vandecappelle @ 2015-04-14  0:17 UTC (permalink / raw)
  To: buildroot

On 14/03/15 15:25, Yann E. MORIN wrote:
> Some packages need to vampirise files from one or more other packages.
> This is the case, for example, of the Linux kernel and its /extensions/.
> 
> Add a new type of dependencies, that are guaranteed to be extracted and
> patched before a package is patched.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  package/pkg-generic.mk | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index c1b379b..018f048 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -427,6 +427,7 @@ endif
>  
>  # Eliminate duplicates in dependencies
>  $(2)_FINAL_DEPENDENCIES = $$(sort $$($(2)_DEPENDENCIES))
> +$(2)_FINAL_PATCH_DEPENDENCIES = $$(sort $$($(2)_PATCH_DEPENDENCIES))
>  
>  $(2)_INSTALL_STAGING		?= NO
>  $(2)_INSTALL_IMAGES		?= NO
> @@ -538,6 +539,8 @@ $$($(2)_TARGET_CONFIGURE):	$$($(2)_TARGET_PATCH)
>  
>  $(1)-patch:		$$($(2)_TARGET_PATCH)
>  $$($(2)_TARGET_PATCH):	$$($(2)_TARGET_EXTRACT)
> +# Order-only dependency
> +$$($(2)_TARGET_PATCH):  | $$(patsubst %,%-patch,$$($(2)_FINAL_PATCH_DEPENDENCIES))
>  
>  $(1)-extract:			$$($(2)_TARGET_EXTRACT)
>  $$($(2)_TARGET_EXTRACT):	$$($(2)_TARGET_SOURCE)
> @@ -568,8 +571,12 @@ endif
>  $(1)-show-version:
>  			@echo $$($(2)_VERSION)
>  
> -$(1)-show-depends:
> +$(1)-show-build-depends:
>  			@echo $$($(2)_FINAL_DEPENDENCIES)
> +$(1)-show-patch-depends:
> +			@echo $$($(2)_FINAL_PATCH_DEPENDENCIES)
> +$(1)-show-depends:
> +			@echo $$(sort $$($(2)_FINAL_DEPENDENCIES) $$($(2)_FINAL_PATCH_DEPENDENCIES))

 I just noticed now: you added the patch dependencies to show-depends, but not
to -all-source, -all-external-deps and -all-legal-info. Isn't that wrong? Of
course, at the moment it makes no difference because it's only used for linux
extension packages and in that case the linux package is always selected anyway
so it'll end up in $(TARGETS) and get printed that way. But it just feels a bit
inconsistent.


 Regards,
 Arnout


>  
>  $(1)-graph-depends: graph-depends-requirements
>  			@$$(INSTALL) -d $$(O)/graphs
> 


-- 
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

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-04-14  0:17 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-14 14:25 [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext) Yann E. MORIN
2015-03-14 14:25 ` [Buildroot] [PATCH 1/5 v2] package infra: add patch-dependencies Yann E. MORIN
2015-03-24 23:22   ` Romain Naour
2015-04-04 13:47   ` Thomas Petazzoni
2015-04-05  9:16     ` Yann E. MORIN
2015-04-05  9:46       ` Thomas Petazzoni
2015-04-14  0:17   ` Arnout Vandecappelle
2015-03-14 14:25 ` [Buildroot] [PATCH 2/5 v2] docs/manual: add _PATCH_DEPENDENCIES Yann E. MORIN
2015-03-24 23:22   ` Romain Naour
2015-03-14 14:25 ` [Buildroot] [PATCH 3/5 v2] linux: fix extensions Yann E. MORIN
2015-03-24 23:22   ` Romain Naour
2015-03-14 14:25 ` [Buildroot] [PATCH 4/5 v2] linux: simplify adding new extensions Yann E. MORIN
2015-03-26 21:54   ` Romain Naour
2015-03-14 14:25 ` [Buildroot] [PATCH 5/5 v2] linux: migrate extensions to use the new infrastructure Yann E. MORIN
2015-03-26 21:55   ` Romain Naour
2015-04-09 21:11 ` [Buildroot] [PATCH 0/5 v2] linux: fix using extensions (branch yem/kernel-ext) Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox