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

José Luis Salvador Rufo salvador.joseluis at gmail.com
Sun Aug 22 21:27:27 UTC 2021


Hello Romain Naour,

El dom, 22 ago 2021 a las 22:52, Romain Naour (<romain.naour at gmail.com>)
escribió:

> 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.
>
Here is the "problem":

https://github.com/openzfs/zfs/blob/zfs-2.0.5/module/Makefile.in#L79
> INSTALL_MOD_PATH=$(DESTDIR)$(INSTALL_MOD_PATH)

and

https://git.buildroot.net/buildroot/tree/package/pkg-generic.mk?h=2021.08-rc2#n77
> $(if $(filter end,$(1)),$(call
step_check_build_dir_one,$(3),$(TARGET_DIR)/$(O))))

Buildroot already does that, so when `make modules_install` is executed,
the output modules directory will be TARGET_DIR/TARGET_DIR/INSTALL_MOD_PATH.

I have no idea who is the one that must change its behavior. :-(
Any suggestions on how to proceed?

Maybe I can unexport DESTDIR before `make modules_install`...

Attached alternative patch with LINUX_MAKE_FLAGS and empty INSTALL_MOD_PATH.

>
> 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
> >     >
> >
>
>
Greetings!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210822/8367845a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: package-zfs-Fix-cross-platform-compilations.patch
Type: text/x-patch
Size: 577 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20210822/8367845a/attachment.bin>


More information about the buildroot mailing list