[Buildroot] [PATCH] package/zfs: Fix cross-platform-compilations

Romain Naour romain.naour at gmail.com
Sun Aug 22 20:52:00 UTC 2021


Hello José Luis,

Le 22/08/2021 à 22:38, José Luis Salvador Rufo a écrit :
> Hello Romain,
> 
> El dom, 22 ago 2021 a las 22:27, Romain Naour (<romain.naour at gmail.com
> <mailto:romain.naour at gmail.com>>) escribió:
> 
>     Hello José Luis,
> 
>     Le 22/08/2021 à 22:05, José Luis Salvador Rufo a écrit :
>     > This patch fixes the `make` executed from the `kernel.m4` in
>     > cross-platform-compilations environments:
>     > https://github.com/openzfs/zfs/blob/zfs-2.0.5/config/kernel.m4#L588
>     <https://github.com/openzfs/zfs/blob/zfs-2.0.5/config/kernel.m4#L588>
>     >
>     > Signed-off-by: José Luis Salvador Rufo <salvador.joseluis at gmail.com
>     <mailto:salvador.joseluis at gmail.com>>
>     > ---
>     > Hello all.
>     >
>     > @Romain Naour, this patch will fix the buildroot gitlab CI.
> 
>     Indeed it fix the issue!
> 
>     Tested-by: Romain Naour <romain.naour at gmail.com <mailto:romain.naour at gmail.com>>
> 
>     >
>     > @Philippe Serbruyns, this patch will fix your issue with your rpi4.
>     >
>     >  package/zfs/zfs.mk <http://zfs.mk> | 13 +++++++++++++
>     >  1 file changed, 13 insertions(+)
>     >
>     > diff --git a/package/zfs/zfs.mk <http://zfs.mk> b/package/zfs/zfs.mk
>     <http://zfs.mk>
>     > index 3b1afb419a..24064cba82 100644
>     > --- a/package/zfs/zfs.mk <http://zfs.mk>
>     > +++ b/package/zfs/zfs.mk <http://zfs.mk>
>     > @@ -13,6 +13,19 @@ ZFS_CPE_ID_PRODUCT = openzfs
>>     >  ZFS_AUTORECONF = YES
>>     > +# cross compile environment for linux kernel module
>     > +ZFS_MAKE_ENV = \
>     > +     HOSTCC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS)" \
>     > +     ARCH=$(KERNEL_ARCH) \
>     > +     CROSS_COMPILE="$(TARGET_CROSS)" \
>     > +     DEPMOD=$(HOST_DIR)/sbin/depmod
> 
>     You can replace all 4 lines with $(LINUX_MAKE_FLAGS) here instead.
> 
> Sorry, you can not. LINUX_MAKE_FLAGS includes INSTALL_MOD_PATH, and must be
> empty for kernel modules. If we use LINUX_MAKE_FLAGS, the module output will be
> TARGET_DIR/INSTALL_MOD_PATH, as you can see in pkg-generic.mk
> <http://pkg-generic.mk> at line 77. I already lost ~1-2h because of this :-(.

This check allow to detect issues on a build system.
Other packages building an out of tree kernel module is able to use
LINUX_MAKE_FLAGS (except linux-fusion).

>  
> The alternative to using $(LINUX_MAKE_FLAGS) is empty the INSTALL_MOD_PATH as
> follows:
> ZFS_MAKE_ENV = \
>      $(LINUX_MAKE_FLAGS) \
>      INSTALL_MOD_PATH=
> 
> What do you prefer?

If possible, a zfs patch.

Otherwise I would suggest to add a comment about the reason why LINUX_MAKE_FLAGS
can't be used.

Best regards,
Romain


> 
> 
>     > +# `./configure` will execute a `make modules` test case
>     > +ZFS_CONF_ENV = \
>     > +     HOSTCC="$(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS)" \
>     > +     ARCH=$(KERNEL_ARCH) \
>     > +     CROSS_COMPILE="$(TARGET_CROSS)" \
>     > +     DEPMOD=$(HOST_DIR)/sbin/depmod
> 
>     Same here.
> 
> 
> 
>     > +
>     >  ZFS_DEPENDENCIES = libaio openssl udev util-linux zlib
>>     >  # sysvinit installs only a commented-out modules-load.d/ config file
>     >
> 



More information about the buildroot mailing list