Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/zfs: fix cross-compilation
@ 2022-07-20 15:24 Michael Zimmermann
  2022-07-23 12:42 ` Arnout Vandecappelle
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Zimmermann @ 2022-07-20 15:24 UTC (permalink / raw)
  To: buildroot; +Cc: Michael Zimmermann, José Luis Salvador Rufo

Currently, the kernel module gets built using the host-compiler(from the
user distro, not from buildroot). That might work when target and host
arch are the same but during cross compilation that results in the
message `Unable to build an empty module.` because tests for compiling
modules fail due to missing headers.

Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
---
 package/zfs/zfs.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk
index 07ce3295ec..30f966bdeb 100644
--- a/package/zfs/zfs.mk
+++ b/package/zfs/zfs.mk
@@ -57,6 +57,9 @@ else
 ZFS_CONF_OPTS += --disable-pam
 endif
 
+ZFS_CONF_ENV += $(LINUX_MAKE_FLAGS)
+ZFS_MAKE_ENV += $(LINUX_MAKE_FLAGS)
+
 # ZFS userland tools are unfunctional without the Linux kernel modules.
 ZFS_MODULE_SUBDIRS = \
 	module/avl \
-- 
2.37.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/zfs: fix cross-compilation
  2022-07-20 15:24 [Buildroot] [PATCH 1/1] package/zfs: fix cross-compilation Michael Zimmermann
@ 2022-07-23 12:42 ` Arnout Vandecappelle
  2022-07-23 13:41   ` Arnout Vandecappelle
  0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2022-07-23 12:42 UTC (permalink / raw)
  To: Michael Zimmermann, buildroot; +Cc: José Luis Salvador Rufo



On 20/07/2022 17:24, Michael Zimmermann wrote:
> Currently, the kernel module gets built using the host-compiler(from the
> user distro, not from buildroot). 

  That shouldn't happen. The kernel-module infrastructure passes 
LINUX_MAKE_FLAGS in the environment already. And if the module were built during 
the userspace build stage, that one already has the cross-compiler as well 
through the autotools infrastructure.

  Can you give a bit more detail about the config where you get the issue, and 
how exactly it fails?

  Regards,
  Arnout

> That might work when target and host
> arch are the same but during cross compilation that results in the
> message `Unable to build an empty module.` because tests for compiling
> modules fail due to missing headers.
> 
> Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
> ---
>   package/zfs/zfs.mk | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk
> index 07ce3295ec..30f966bdeb 100644
> --- a/package/zfs/zfs.mk
> +++ b/package/zfs/zfs.mk
> @@ -57,6 +57,9 @@ else
>   ZFS_CONF_OPTS += --disable-pam
>   endif
>   
> +ZFS_CONF_ENV += $(LINUX_MAKE_FLAGS)
> +ZFS_MAKE_ENV += $(LINUX_MAKE_FLAGS)
> +
>   # ZFS userland tools are unfunctional without the Linux kernel modules.
>   ZFS_MODULE_SUBDIRS = \
>   	module/avl \
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/zfs: fix cross-compilation
  2022-07-23 12:42 ` Arnout Vandecappelle
@ 2022-07-23 13:41   ` Arnout Vandecappelle
  2022-07-24 14:35     ` Yann E. MORIN
  0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2022-07-23 13:41 UTC (permalink / raw)
  To: Michael Zimmermann, buildroot; +Cc: José Luis Salvador Rufo


On 23/07/2022 14:42, Arnout Vandecappelle wrote:
>
>
> On 20/07/2022 17:24, Michael Zimmermann wrote:
>> Currently, the kernel module gets built using the host-compiler(from the
>> user distro, not from buildroot). 
>
>  That shouldn't happen. The kernel-module infrastructure passes 
> LINUX_MAKE_FLAGS in the environment already. And if the module were built 
> during the userspace build stage, that one already has the cross-compiler as 
> well through the autotools infrastructure.
>
>  Can you give a bit more detail about the config where you get the issue, and 
> how exactly it fails?

  It's actually easy to reproduce, just change the architecture to anything 
other than x86.


  I've looked around a bit and it seems to me that zfs already builds the kernel 
module from the autotools infrastructure, so we're actually building it twice. I 
think we should therefore remove the kernel-module infra for this package, and 
instead add a dependency on linux and copy this part:

# If the package is enabled, ensure the kernel will support modules
ifeq ($$(BR2_PACKAGE_$(2)),y)
LINUX_NEEDS_MODULES = y
endif


  Regards,
  Arnout


>
>  Regards,
>  Arnout
>
>> That might work when target and host
>> arch are the same but during cross compilation that results in the
>> message `Unable to build an empty module.` because tests for compiling
>> modules fail due to missing headers.
>>
>> Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
>> ---
>>   package/zfs/zfs.mk | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk
>> index 07ce3295ec..30f966bdeb 100644
>> --- a/package/zfs/zfs.mk
>> +++ b/package/zfs/zfs.mk
>> @@ -57,6 +57,9 @@ else
>>   ZFS_CONF_OPTS += --disable-pam
>>   endif
>>   +ZFS_CONF_ENV += $(LINUX_MAKE_FLAGS)
>> +ZFS_MAKE_ENV += $(LINUX_MAKE_FLAGS)
>> +
>>   # ZFS userland tools are unfunctional without the Linux kernel modules.
>>   ZFS_MODULE_SUBDIRS = \
>>       module/avl \
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/zfs: fix cross-compilation
  2022-07-23 13:41   ` Arnout Vandecappelle
@ 2022-07-24 14:35     ` Yann E. MORIN
  2023-06-07 12:43       ` Alexander Mukhin
  2023-06-08 17:50       ` [Buildroot] [PATCH] package/zfs: not using kernel-module infra José Luis Salvador Rufo
  0 siblings, 2 replies; 7+ messages in thread
From: Yann E. MORIN @ 2022-07-24 14:35 UTC (permalink / raw)
  To: Arnout Vandecappelle
  Cc: Michael Zimmermann, José Luis Salvador Rufo, buildroot

Michael, All,

On 2022-07-23 15:41 +0200, Arnout Vandecappelle spake thusly:
> On 23/07/2022 14:42, Arnout Vandecappelle wrote:
> >On 20/07/2022 17:24, Michael Zimmermann wrote:
> >>Currently, the kernel module gets built using the host-compiler(from the
> >>user distro, not from buildroot).
>  It's actually easy to reproduce, just change the architecture to anything
> other than x86.
> 
>  I've looked around a bit and it seems to me that zfs already builds the
> kernel module from the autotools infrastructure, so we're actually building
> it twice.

I checked, and it is not possible to tell the zfs buildsystem to not
build it.

> I think we should therefore remove the kernel-module infra for
> this package, and instead add a dependency on linux and copy this part:
> 
> # If the package is enabled, ensure the kernel will support modules
> ifeq ($$(BR2_PACKAGE_$(2)),y)
> LINUX_NEEDS_MODULES = y
> endif

... and add linux to ZFS_DEPDENDENCIES

So, I've marked the patch as changes requested in patchwork.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/zfs: fix cross-compilation
  2022-07-24 14:35     ` Yann E. MORIN
@ 2023-06-07 12:43       ` Alexander Mukhin
  2023-06-08 17:50       ` [Buildroot] [PATCH] package/zfs: not using kernel-module infra José Luis Salvador Rufo
  1 sibling, 0 replies; 7+ messages in thread
From: Alexander Mukhin @ 2023-06-07 12:43 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: José Luis Salvador Rufo, Michael Zimmermann, buildroot

Yann, All,

Noticed the same issue on x86-64 without cross-compiling. Here again the host
compiler was used instead of toolchain. The build failed because the host
compiler was older and did not support some fancy flags.

Host: Debian 11.7 x86_64
Host gcc: 10.2.1
Toolchain: x86-64--glibc--bleeding-edge-2022.08-1
Toolchain gcc: 12.2.0

The patch proposed by Michael Zimmermann fixed the issue.

-- 
Alexander.

On Sun, Jul 24, 2022 at 04:35:33PM +0200, Yann E. MORIN wrote:
> Michael, All,
> 
> On 2022-07-23 15:41 +0200, Arnout Vandecappelle spake thusly:
> > On 23/07/2022 14:42, Arnout Vandecappelle wrote:
> > >On 20/07/2022 17:24, Michael Zimmermann wrote:
> > >>Currently, the kernel module gets built using the host-compiler(from the
> > >>user distro, not from buildroot).
> >  It's actually easy to reproduce, just change the architecture to anything
> > other than x86.
> > 
> >  I've looked around a bit and it seems to me that zfs already builds the
> > kernel module from the autotools infrastructure, so we're actually building
> > it twice.
> 
> I checked, and it is not possible to tell the zfs buildsystem to not
> build it.
> 
> > I think we should therefore remove the kernel-module infra for
> > this package, and instead add a dependency on linux and copy this part:
> > 
> > # If the package is enabled, ensure the kernel will support modules
> > ifeq ($$(BR2_PACKAGE_$(2)),y)
> > LINUX_NEEDS_MODULES = y
> > endif
> 
> ... and add linux to ZFS_DEPDENDENCIES
> 
> So, I've marked the patch as changes requested in patchwork.
> 
> Regards,
> Yann E. MORIN.
> 
> -- 
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
> | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
> '------------------------------^-------^------------------^--------------------'
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH] package/zfs: not using kernel-module infra
  2022-07-24 14:35     ` Yann E. MORIN
  2023-06-07 12:43       ` Alexander Mukhin
@ 2023-06-08 17:50       ` José Luis Salvador Rufo
  2023-07-27  7:13         ` Thomas Petazzoni via buildroot
  1 sibling, 1 reply; 7+ messages in thread
From: José Luis Salvador Rufo @ 2023-06-08 17:50 UTC (permalink / raw)
  To: buildroot
  Cc: Michael Zimmermann, José Luis Salvador Rufo, Yann E . MORIN

zfs already builds the kernel module from the autotools infrastructure.

Signed-off-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com>
---
 package/zfs/Config.in | 1 +
 package/zfs/zfs.mk    | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/package/zfs/Config.in b/package/zfs/Config.in
index 6209c5865b..3bd9f8ab02 100644
--- a/package/zfs/Config.in
+++ b/package/zfs/Config.in
@@ -11,6 +11,7 @@ config BR2_PACKAGE_ZFS
 	depends on BR2_PACKAGE_HAS_UDEV
 	depends on BR2_USE_MMU  # util-linux (libblkid)
 	depends on BR2_TOOLCHAIN_HAS_THREADS  # libtirpc
+	select BR2_LINUX_NEEDS_MODULES # not using kernel-module infra
 	select BR2_PACKAGE_UTIL_LINUX
 	select BR2_PACKAGE_UTIL_LINUX_LIBBLKID
 	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
diff --git a/package/zfs/zfs.mk b/package/zfs/zfs.mk
index e99413e611..50c1866045 100644
--- a/package/zfs/zfs.mk
+++ b/package/zfs/zfs.mk
@@ -15,7 +15,7 @@ ZFS_CPE_ID_PRODUCT = openzfs
 # 0001-removal-of-LegacyVersion-broke-ax_python_dev.m4.patch
 ZFS_AUTORECONF = YES
 
-ZFS_DEPENDENCIES = libaio openssl udev util-linux zlib libcurl
+ZFS_DEPENDENCIES = libaio openssl udev util-linux zlib libcurl linux
 
 # sysvinit installs only a commented-out modules-load.d/ config file
 ZFS_CONF_OPTS = \
@@ -87,5 +87,6 @@ define ZFS_LINUX_CONFIG_FIXUPS
 	$(call KCONFIG_ENABLE_OPT,CONFIG_ZLIB_INFLATE)
 endef
 
-$(eval $(kernel-module))
+# ZFS autotools will compile the kernel modules, so there is not needed to execute
+# $(eval $(kernel-module))
 $(eval $(autotools-package))
-- 
2.41.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH] package/zfs: not using kernel-module infra
  2023-06-08 17:50       ` [Buildroot] [PATCH] package/zfs: not using kernel-module infra José Luis Salvador Rufo
@ 2023-07-27  7:13         ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-07-27  7:13 UTC (permalink / raw)
  To: José Luis Salvador Rufo
  Cc: Michael Zimmermann, Yann E . MORIN, buildroot

On Thu,  8 Jun 2023 19:50:16 +0200
José Luis Salvador Rufo <salvador.joseluis@gmail.com> wrote:

> zfs already builds the kernel module from the autotools infrastructure.
> 
> Signed-off-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com>
> ---
>  package/zfs/Config.in | 1 +
>  package/zfs/zfs.mk    | 5 +++--
>  2 files changed, 4 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-07-27  7:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-20 15:24 [Buildroot] [PATCH 1/1] package/zfs: fix cross-compilation Michael Zimmermann
2022-07-23 12:42 ` Arnout Vandecappelle
2022-07-23 13:41   ` Arnout Vandecappelle
2022-07-24 14:35     ` Yann E. MORIN
2023-06-07 12:43       ` Alexander Mukhin
2023-06-08 17:50       ` [Buildroot] [PATCH] package/zfs: not using kernel-module infra José Luis Salvador Rufo
2023-07-27  7:13         ` Thomas Petazzoni via buildroot

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