diff mbox series

Add mtd-utils dependency if cfi or ubivol are set

Message ID 20171025205855.30492-1-gael.portay@savoirfairelinux.com
State Accepted
Headers show
Series Add mtd-utils dependency if cfi or ubivol are set | expand

Commit Message

Gaël PORTAY Oct. 25, 2017, 8:58 p.m. UTC
This fixes the build issue below when CONFIG_CFI or CONFIG_UBIVOL are
set but CONFIG_MTD is not.

	| In file included from handlers/flash_handler.c:44:0:
	| include/flash.h:26:24: fatal error: mtd/libmtd.h: No such file or directory
	|  #include <mtd/libmtd.h>

Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>

---

Hi all,

As said into the commit message, this fixes a build issue when the
mtd-utils package is not built as dependency.

The issue comes from the internal flash.h header which needs the header
mtd/libmtd.h from mtd-utils.

This internal header is included by these 5 following .c source files:

	$ grep -r '#include.*flash.h' .
	./core/swupdate.c:#include "flash.h"
	./corelib/stream_interface.c:#include "flash.h"
	./corelib/mtd-interface.c:#include "flash.h"
	./handlers/ubivol_handler.c:#include "flash.h"
	./handlers/flash_handler.c:#include "flash.h"

The file mtd-interface.c is compiled when CONFIG_MTD is set; this case
is handled by swupdate.inc (see python() function).

	lib-$(CONFIG_MTD)     += mtd-interface.o

Both files swupdate.c and stream_interface.c are also handled when
CONFIG_MTD is set. They include the flash.h header between the
following preprocessor block:

	#ifdef CONFIG_MTD
	#include "flash.h"
	#endif

But, concerning flash_handler.c and ubivol_handler.c they are compiled
when their option is set CONFIG_CFI and CONFIG_UBIVOL.

	obj-$(CONFIG_CFI)     += flash_handler.o
	obj-$(CONFIG_UBIVOL)  += ubivol_handler.o

Thus the python() function from swupdate.inc needs to handle those new
two cases.

Regards,
Gael

 recipes-support/swupdate/swupdate.inc | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Gaël PORTAY Oct. 25, 2017, 9:05 p.m. UTC | #1
On Wednesday, 25 October 2017 16:59:00 UTC-4, Gaël PORTAY  wrote:
> This fixes the build issue below when CONFIG_CFI or CONFIG_UBIVOL are
> set but CONFIG_MTD is not.
> 
> 	| In file included from handlers/flash_handler.c:44:0:
> 	| include/flash.h:26:24: fatal error: mtd/libmtd.h: No such file or directory
> 	|  #include <mtd/libmtd.h>
> 
> Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>
> 
> ---
> 
> Hi all,
> 
> As said into the commit message, this fixes a build issue when the
> mtd-utils package is not built as dependency.
> 
> The issue comes from the internal flash.h header which needs the header
> mtd/libmtd.h from mtd-utils.
> 
> This internal header is included by these 5 following .c source files:
> 
> 	$ grep -r '#include.*flash.h' .
> 	./core/swupdate.c:#include "flash.h"
> 	./corelib/stream_interface.c:#include "flash.h"
> 	./corelib/mtd-interface.c:#include "flash.h"
> 	./handlers/ubivol_handler.c:#include "flash.h"
> 	./handlers/flash_handler.c:#include "flash.h"
> 
> The file mtd-interface.c is compiled when CONFIG_MTD is set; this case
> is handled by swupdate.inc (see python() function).
> 
> 	lib-$(CONFIG_MTD)     += mtd-interface.o
> 
> Both files swupdate.c and stream_interface.c are also handled when
> CONFIG_MTD is set. They include the flash.h header between the
> following preprocessor block:
> 
> 	#ifdef CONFIG_MTD
> 	#include "flash.h"
> 	#endif
> 
> But, concerning flash_handler.c and ubivol_handler.c they are compiled
> when their option is set CONFIG_CFI and CONFIG_UBIVOL.
> 
> 	obj-$(CONFIG_CFI)     += flash_handler.o
> 	obj-$(CONFIG_UBIVOL)  += ubivol_handler.o
> 
> Thus the python() function from swupdate.inc needs to handle those new
> two cases.
> 
> Regards,
> Gael
> 
>  recipes-support/swupdate/swupdate.inc | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
> index 53a61ea..1431d15 100644
> --- a/recipes-support/swupdate/swupdate.inc
> +++ b/recipes-support/swupdate/swupdate.inc
> @@ -86,6 +86,13 @@ python () {
>          depends = d.getVar('DEPENDS', False)
>          d.setVar('DEPENDS', depends + ' mtd-utils')
>  
> +    if 'CONFIG_CFI=y\n' in features:
> +        depends = d.getVar('DEPENDS', False)
> +        d.setVar('DEPENDS', depends + ' mtd-utils')
> +
> +    if 'CONFIG_UBIVOL=y\n' in features:
> +        depends = d.getVar('DEPENDS', False)
> +        d.setVar('DEPENDS', depends + ' mtd-utils')
>  }
>  
>  do_configure () {
> -- 
> 2.14.2

This is for meta-swupdate.

My appologies for the subject.
Stefano Babic Oct. 30, 2017, 1:58 p.m. UTC | #2
On 25/10/2017 22:58, Gaël PORTAY wrote:
> This fixes the build issue below when CONFIG_CFI or CONFIG_UBIVOL are
> set but CONFIG_MTD is not.
> 
> 	| In file included from handlers/flash_handler.c:44:0:
> 	| include/flash.h:26:24: fatal error: mtd/libmtd.h: No such file or directory
> 	|  #include <mtd/libmtd.h>
> 
> Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>
> 
> ---
> 
> Hi all,
> 
> As said into the commit message, this fixes a build issue when the
> mtd-utils package is not built as dependency.
> 
> The issue comes from the internal flash.h header which needs the header
> mtd/libmtd.h from mtd-utils.
> 
> This internal header is included by these 5 following .c source files:
> 
> 	$ grep -r '#include.*flash.h' .
> 	./core/swupdate.c:#include "flash.h"
> 	./corelib/stream_interface.c:#include "flash.h"
> 	./corelib/mtd-interface.c:#include "flash.h"
> 	./handlers/ubivol_handler.c:#include "flash.h"
> 	./handlers/flash_handler.c:#include "flash.h"
> 
> The file mtd-interface.c is compiled when CONFIG_MTD is set; this case
> is handled by swupdate.inc (see python() function).
> 
> 	lib-$(CONFIG_MTD)     += mtd-interface.o
> 
> Both files swupdate.c and stream_interface.c are also handled when
> CONFIG_MTD is set. They include the flash.h header between the
> following preprocessor block:
> 
> 	#ifdef CONFIG_MTD
> 	#include "flash.h"
> 	#endif
> 
> But, concerning flash_handler.c and ubivol_handler.c they are compiled
> when their option is set CONFIG_CFI and CONFIG_UBIVOL.
> 
> 	obj-$(CONFIG_CFI)     += flash_handler.o
> 	obj-$(CONFIG_UBIVOL)  += ubivol_handler.o
> 
> Thus the python() function from swupdate.inc needs to handle those new
> two cases.
> 
> Regards,
> Gael
> 
>  recipes-support/swupdate/swupdate.inc | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
> index 53a61ea..1431d15 100644
> --- a/recipes-support/swupdate/swupdate.inc
> +++ b/recipes-support/swupdate/swupdate.inc
> @@ -86,6 +86,13 @@ python () {
>          depends = d.getVar('DEPENDS', False)
>          d.setVar('DEPENDS', depends + ' mtd-utils')
>  
> +    if 'CONFIG_CFI=y\n' in features:
> +        depends = d.getVar('DEPENDS', False)
> +        d.setVar('DEPENDS', depends + ' mtd-utils')
> +
> +    if 'CONFIG_UBIVOL=y\n' in features:
> +        depends = d.getVar('DEPENDS', False)
> +        d.setVar('DEPENDS', depends + ' mtd-utils')
>  }
>  
>  do_configure () {
> 

Applied to -master, -pyro and the new -rocko, thanks !

Best regards,
Stefano Babic
Gaël PORTAY Oct. 30, 2017, 5:38 p.m. UTC | #3
Hi Stefano,

On Mon, Oct 30, 2017 at 02:58:47PM +0100, Stefano Babic wrote:
> (...)
>
> Applied to -master, -pyro and the new -rocko, thanks !
> 

Thanks you!

Since I am using -morty, could I ask you to apply it to -morty as well?

I really like to use upstream layers with no additional commits :)

Thank you in advance.

King Regards,
Gael
Stefano Babic Oct. 30, 2017, 5:44 p.m. UTC | #4
On 30/10/2017 18:38, Gaël PORTAY wrote:
> Hi Stefano,
> 
> On Mon, Oct 30, 2017 at 02:58:47PM +0100, Stefano Babic wrote:
>> (...)
>>
>> Applied to -master, -pyro and the new -rocko, thanks !
>>
> 
> Thanks you!
> 
> Since I am using -morty, could I ask you to apply it to -morty as well?
> 
> I really like to use upstream layers with no additional commits :)
> 
> Thank you in advance.
> 

Done.

Best regards,
Stefano Babic
Gaël PORTAY Oct. 30, 2017, 6 p.m. UTC | #5
On Mon, Oct 30, 2017 at 06:44:36PM +0100, Stefano Babic wrote:
> On 30/10/2017 18:38, Gaël PORTAY wrote:
> > Hi Stefano,
> > 
> > On Mon, Oct 30, 2017 at 02:58:47PM +0100, Stefano Babic wrote:
> >> (...)
> >>
> >> Applied to -master, -pyro and the new -rocko, thanks !
> >>
> > 
> > Thanks you!
> > 
> > Since I am using -morty, could I ask you to apply it to -morty as well?
> > 
> > I really like to use upstream layers with no additional commits :)
> > 
> > Thank you in advance.
> > 
>

Thank you,

King Regards,
Gael
diff mbox series

Patch

diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
index 53a61ea..1431d15 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/recipes-support/swupdate/swupdate.inc
@@ -86,6 +86,13 @@  python () {
         depends = d.getVar('DEPENDS', False)
         d.setVar('DEPENDS', depends + ' mtd-utils')
 
+    if 'CONFIG_CFI=y\n' in features:
+        depends = d.getVar('DEPENDS', False)
+        d.setVar('DEPENDS', depends + ' mtd-utils')
+
+    if 'CONFIG_UBIVOL=y\n' in features:
+        depends = d.getVar('DEPENDS', False)
+        d.setVar('DEPENDS', depends + ' mtd-utils')
 }
 
 do_configure () {