All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v1 1/6] package/nvidia-modprobe: new package
@ 2020-08-01 21:36 Christian Stewart
  2020-08-08  7:02 ` Asaf Kahlon
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Stewart @ 2020-08-01 21:36 UTC (permalink / raw)
  To: buildroot

nvidia-modprobe package adds a utility and headers for probing the NVIDIA
hardware at runtime.

https://github.com/NVIDIA/nvidia-modprobe

Signed-off-by: Christian Stewart <christian@paral.in>
---
 package/Config.in                            |  1 +
 package/nvidia-modprobe/Config.in            | 12 ++++++
 package/nvidia-modprobe/nvidia-modprobe.hash |  3 ++
 package/nvidia-modprobe/nvidia-modprobe.mk   | 45 ++++++++++++++++++++
 4 files changed, 61 insertions(+)
 create mode 100644 package/nvidia-modprobe/Config.in
 create mode 100644 package/nvidia-modprobe/nvidia-modprobe.hash
 create mode 100644 package/nvidia-modprobe/nvidia-modprobe.mk

diff --git a/package/Config.in b/package/Config.in
index 015a7f1054..3349641371 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -501,6 +501,7 @@ endmenu
 	source "package/nanocom/Config.in"
 	source "package/neard/Config.in"
 	source "package/nvidia-driver/Config.in"
+	source "package/nvidia-modprobe/Config.in"
 	source "package/nvidia-tegra23/Config.in"
 	source "package/nvme/Config.in"
 	source "package/ofono/Config.in"
diff --git a/package/nvidia-modprobe/Config.in b/package/nvidia-modprobe/Config.in
new file mode 100644
index 0000000000..35953a33d4
--- /dev/null
+++ b/package/nvidia-modprobe/Config.in
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_NVIDIA_MODPROBE
+	bool "nvidia-modprobe"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  nvidia-modprobe package adds a utility and headers for
+	  probing the NVIDIA hardware at runtime.
+
+	  https://github.com/NVIDIA/nvidia-modprobe
+
+comment "nvidia-modprobe needs a glibc toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAN_USES_GLIBC
diff --git a/package/nvidia-modprobe/nvidia-modprobe.hash b/package/nvidia-modprobe/nvidia-modprobe.hash
new file mode 100644
index 0000000000..99908680f0
--- /dev/null
+++ b/package/nvidia-modprobe/nvidia-modprobe.hash
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256 396b4102d3075a2dee3024652fae206a1b38ace54b8efb1e2c20757a11ec19f1  nvidia-modprobe-450.57.tar.gz
+sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
diff --git a/package/nvidia-modprobe/nvidia-modprobe.mk b/package/nvidia-modprobe/nvidia-modprobe.mk
new file mode 100644
index 0000000000..7eeee6716c
--- /dev/null
+++ b/package/nvidia-modprobe/nvidia-modprobe.mk
@@ -0,0 +1,45 @@
+################################################################################
+#
+# nvidia-modprobe
+#
+################################################################################
+
+NVIDIA_MODPROBE_VERSION = 450.57
+NVIDIA_MODPROBE_SITE = $(call github,NVIDIA,nvidia-modprobe,$(NVIDIA_MODPROBE_VERSION))
+NVIDIA_MODPROBE_LICENSE = GPL-2
+NVIDIA_MODPROBE_LICENSE_FILES = COPYING
+
+NVIDIA_MODPROBE_DEPENDENCIES = host-pkgconf
+NVIDIA_MODPROBE_INSTALL_STAGING = YES
+
+define NVIDIA_MODPROBE_BUILD_CMDS
+	mkdir -p $(@D)/bin
+	$(TARGET_MAKE_ENV) $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
+		-I $(@D)/common-utils -I $(@D)/modprobe-utils \
+		-o $(@D)/bin/nvidia-modprobe \
+		-DNV_LINUX=true -DPROGRAM_NAME=\"nvidia-modprobe\" \
+		-DNVIDIA_VERSION=\"$(NVIDIA_MODPROBE_VERSION)\" \
+		$(@D)/nvidia-modprobe.c $(@D)/modprobe-utils/nvidia-modprobe-utils.c \
+		$(@D)/modprobe-utils/pci-sysfs.c $(@D)/common-utils/common-utils.c \
+		$(@D)/common-utils/msg.c $(@D)/common-utils/nvgetopt.c
+endef
+
+define NVIDIA_MODPROBE_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 644 $(@D)/modprobe-utils/nvidia-modprobe-utils.h \
+		$(STAGING_DIR)/usr/include/nvidia-modprobe-utils/nvidia-modprobe-utils.h
+	$(INSTALL) -D -m 644 $(@D)/modprobe-utils/pci-enum.h \
+		$(STAGING_DIR)/usr/include/nvidia-modprobe-utils/pci-enum.h
+	$(INSTALL) -D -m 644 $(@D)/common-utils/common-utils.h \
+		$(STAGING_DIR)/usr/include/nvidia-modprobe-utils/nvidia-common-utils.h
+	$(INSTALL) -D -m 644 $(@D)/common-utils/msg.h \
+		$(STAGING_DIR)/usr/include/nvidia-modprobe-utils/msg.h
+	$(INSTALL) -D -m 644 $(@D)/common-utils/nvgetopt.h \
+		$(STAGING_DIR)/usr/include/nvidia-modprobe-utils/nvgetopt.h
+endef
+
+define NVIDIA_MODPROBE_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 $(@D)/bin/nvidia-modprobe \
+		$(TARGET_DIR)/usr/bin/nvidia-modprobe
+endef
+
+$(eval $(generic-package))
-- 
2.27.0

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

* [Buildroot] [PATCH v1 1/6] package/nvidia-modprobe: new package
  2020-08-01 21:36 [Buildroot] [PATCH v1 1/6] package/nvidia-modprobe: new package Christian Stewart
@ 2020-08-08  7:02 ` Asaf Kahlon
  2020-08-08 11:29   ` Christian Stewart
  0 siblings, 1 reply; 5+ messages in thread
From: Asaf Kahlon @ 2020-08-08  7:02 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, Aug 2, 2020 at 12:36 AM Christian Stewart <christian@paral.in> wrote:
>
> nvidia-modprobe package adds a utility and headers for probing the NVIDIA
> hardware at runtime.
>
> https://github.com/NVIDIA/nvidia-modprobe
>
> Signed-off-by: Christian Stewart <christian@paral.in>
> ---
>  package/Config.in                            |  1 +
>  package/nvidia-modprobe/Config.in            | 12 ++++++
>  package/nvidia-modprobe/nvidia-modprobe.hash |  3 ++
>  package/nvidia-modprobe/nvidia-modprobe.mk   | 45 ++++++++++++++++++++
>  4 files changed, 61 insertions(+)
>  create mode 100644 package/nvidia-modprobe/Config.in
>  create mode 100644 package/nvidia-modprobe/nvidia-modprobe.hash
>  create mode 100644 package/nvidia-modprobe/nvidia-modprobe.mk
>
> diff --git a/package/Config.in b/package/Config.in
> index 015a7f1054..3349641371 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -501,6 +501,7 @@ endmenu
>         source "package/nanocom/Config.in"
>         source "package/neard/Config.in"
>         source "package/nvidia-driver/Config.in"
> +       source "package/nvidia-modprobe/Config.in"
>         source "package/nvidia-tegra23/Config.in"
>         source "package/nvme/Config.in"
>         source "package/ofono/Config.in"
> diff --git a/package/nvidia-modprobe/Config.in b/package/nvidia-modprobe/Config.in
> new file mode 100644
> index 0000000000..35953a33d4
> --- /dev/null
> +++ b/package/nvidia-modprobe/Config.in
> @@ -0,0 +1,12 @@
> +config BR2_PACKAGE_NVIDIA_MODPROBE
> +       bool "nvidia-modprobe"
> +       depends on BR2_TOOLCHAIN_HAS_THREADS
> +       depends on BR2_TOOLCHAIN_USES_GLIBC
> +       help
> +         nvidia-modprobe package adds a utility and headers for
> +         probing the NVIDIA hardware at runtime.
> +
> +         https://github.com/NVIDIA/nvidia-modprobe
> +
> +comment "nvidia-modprobe needs a glibc toolchain w/ threads"
> +       depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAN_USES_GLIBC
> diff --git a/package/nvidia-modprobe/nvidia-modprobe.hash b/package/nvidia-modprobe/nvidia-modprobe.hash
> new file mode 100644
> index 0000000000..99908680f0
> --- /dev/null
> +++ b/package/nvidia-modprobe/nvidia-modprobe.hash
> @@ -0,0 +1,3 @@
> +# Locally computed:
> +sha256 396b4102d3075a2dee3024652fae206a1b38ace54b8efb1e2c20757a11ec19f1  nvidia-modprobe-450.57.tar.gz
> +sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
> diff --git a/package/nvidia-modprobe/nvidia-modprobe.mk b/package/nvidia-modprobe/nvidia-modprobe.mk
> new file mode 100644
> index 0000000000..7eeee6716c
> --- /dev/null
> +++ b/package/nvidia-modprobe/nvidia-modprobe.mk
> @@ -0,0 +1,45 @@
> +################################################################################
> +#
> +# nvidia-modprobe
> +#
> +################################################################################
> +
> +NVIDIA_MODPROBE_VERSION = 450.57
> +NVIDIA_MODPROBE_SITE = $(call github,NVIDIA,nvidia-modprobe,$(NVIDIA_MODPROBE_VERSION))
> +NVIDIA_MODPROBE_LICENSE = GPL-2
> +NVIDIA_MODPROBE_LICENSE_FILES = COPYING
> +
> +NVIDIA_MODPROBE_DEPENDENCIES = host-pkgconf
> +NVIDIA_MODPROBE_INSTALL_STAGING = YES
> +
> +define NVIDIA_MODPROBE_BUILD_CMDS
> +       mkdir -p $(@D)/bin
> +       $(TARGET_MAKE_ENV) $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
> +               -I $(@D)/common-utils -I $(@D)/modprobe-utils \
> +               -o $(@D)/bin/nvidia-modprobe \
> +               -DNV_LINUX=true -DPROGRAM_NAME=\"nvidia-modprobe\" \
> +               -DNVIDIA_VERSION=\"$(NVIDIA_MODPROBE_VERSION)\" \
> +               $(@D)/nvidia-modprobe.c $(@D)/modprobe-utils/nvidia-modprobe-utils.c \
> +               $(@D)/modprobe-utils/pci-sysfs.c $(@D)/common-utils/common-utils.c \
> +               $(@D)/common-utils/msg.c $(@D)/common-utils/nvgetopt.c
> +endef
> +
> +define NVIDIA_MODPROBE_INSTALL_STAGING_CMDS
> +       $(INSTALL) -D -m 644 $(@D)/modprobe-utils/nvidia-modprobe-utils.h \
> +               $(STAGING_DIR)/usr/include/nvidia-modprobe-utils/nvidia-modprobe-utils.h
> +       $(INSTALL) -D -m 644 $(@D)/modprobe-utils/pci-enum.h \
> +               $(STAGING_DIR)/usr/include/nvidia-modprobe-utils/pci-enum.h
> +       $(INSTALL) -D -m 644 $(@D)/common-utils/common-utils.h \
> +               $(STAGING_DIR)/usr/include/nvidia-modprobe-utils/nvidia-common-utils.h
> +       $(INSTALL) -D -m 644 $(@D)/common-utils/msg.h \
> +               $(STAGING_DIR)/usr/include/nvidia-modprobe-utils/msg.h
> +       $(INSTALL) -D -m 644 $(@D)/common-utils/nvgetopt.h \
> +               $(STAGING_DIR)/usr/include/nvidia-modprobe-utils/nvgetopt.h
> +endef
> +
> +define NVIDIA_MODPROBE_INSTALL_TARGET_CMDS
> +       $(INSTALL) -m 0755 $(@D)/bin/nvidia-modprobe \
> +               $(TARGET_DIR)/usr/bin/nvidia-modprobe
> +endef

Why do you prefer to call the compiler explicitly instead of using the Makefile?
I tested this package with the following change, and it seems to work fine:
define NVIDIA_MODPROBE_BUILD_CMDS
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
endef

define NVIDIA_MODPROBE_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) PREFIX=$(TARGET_DIR)
$(MAKE) -C $(@D) install
endef

Maybe I miss something?
> +
> +$(eval $(generic-package))
> --
> 2.27.0
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

Regards,
Asaf.

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

* [Buildroot] [PATCH v1 1/6] package/nvidia-modprobe: new package
  2020-08-08  7:02 ` Asaf Kahlon
@ 2020-08-08 11:29   ` Christian Stewart
  2020-08-08 13:56     ` Asaf Kahlon
  2020-08-08 14:28     ` Thomas Petazzoni
  0 siblings, 2 replies; 5+ messages in thread
From: Christian Stewart @ 2020-08-08 11:29 UTC (permalink / raw)
  To: buildroot

Hi Asaf,

On Sat, Aug 8, 2020 at 12:03 AM Asaf Kahlon <asafka7@gmail.com> wrote:
> > +define NVIDIA_MODPROBE_INSTALL_TARGET_CMDS
> > +       $(INSTALL) -m 0755 $(@D)/bin/nvidia-modprobe \
> > +               $(TARGET_DIR)/usr/bin/nvidia-modprobe
> > +endef
>
> Why do you prefer to call the compiler explicitly instead of using the Makefile?
> I tested this package with the following change, and it seems to work fine:
> define NVIDIA_MODPROBE_BUILD_CMDS
> $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
> endef
>
> define NVIDIA_MODPROBE_INSTALL_TARGET_CMDS
> $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) PREFIX=$(TARGET_DIR)
> $(MAKE) -C $(@D) install
> endef
>
> Maybe I miss something?

You tested this?... I don't think so. It doesn't work:

   LINK         _out/Linux_x86_64/nvidia-modprobe.unstripped
/bin/sh: build/nvidia-modprobe-450.57/_out/Linux_x86_64/gen-manpage-opts:
cannot execute binary file: Exec format error
make[2]: *** [Makefile:149: _out/Linux_x86_64/options.1.inc] Error 126

The package as-is from GitHub has an extremely convoluted Makefile
which does not do what we want in Buildroot.

Best regards,
Christian

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

* [Buildroot] [PATCH v1 1/6] package/nvidia-modprobe: new package
  2020-08-08 11:29   ` Christian Stewart
@ 2020-08-08 13:56     ` Asaf Kahlon
  2020-08-08 14:28     ` Thomas Petazzoni
  1 sibling, 0 replies; 5+ messages in thread
From: Asaf Kahlon @ 2020-08-08 13:56 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat, Aug 8, 2020 at 2:29 PM Christian Stewart <christian@paral.in> wrote:
>
> Hi Asaf,
>
> On Sat, Aug 8, 2020 at 12:03 AM Asaf Kahlon <asafka7@gmail.com> wrote:
> > > +define NVIDIA_MODPROBE_INSTALL_TARGET_CMDS
> > > +       $(INSTALL) -m 0755 $(@D)/bin/nvidia-modprobe \
> > > +               $(TARGET_DIR)/usr/bin/nvidia-modprobe
> > > +endef
> >
> > Why do you prefer to call the compiler explicitly instead of using the Makefile?
> > I tested this package with the following change, and it seems to work fine:
> > define NVIDIA_MODPROBE_BUILD_CMDS
> > $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
> > endef
> >
> > define NVIDIA_MODPROBE_INSTALL_TARGET_CMDS
> > $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) PREFIX=$(TARGET_DIR)
> > $(MAKE) -C $(@D) install
> > endef
> >
> > Maybe I miss something?
>
> You tested this?... I don't think so. It doesn't work:
>
>    LINK         _out/Linux_x86_64/nvidia-modprobe.unstripped
> /bin/sh: build/nvidia-modprobe-450.57/_out/Linux_x86_64/gen-manpage-opts:
> cannot execute binary file: Exec format error
> make[2]: *** [Makefile:149: _out/Linux_x86_64/options.1.inc] Error 126
>
> The package as-is from GitHub has an extremely convoluted Makefile
> which does not do what we want in Buildroot.
Yeah, you seem to be right.
I tested it with another toolchain, but it indeed does not work on the
jetsontx2 toolchain...

>
> Best regards,
> Christian

Asaf

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

* [Buildroot] [PATCH v1 1/6] package/nvidia-modprobe: new package
  2020-08-08 11:29   ` Christian Stewart
  2020-08-08 13:56     ` Asaf Kahlon
@ 2020-08-08 14:28     ` Thomas Petazzoni
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2020-08-08 14:28 UTC (permalink / raw)
  To: buildroot

On Sat, 8 Aug 2020 04:29:43 -0700
Christian Stewart <christian@paral.in> wrote:

> > Maybe I miss something?  
> 
> You tested this?... I don't think so. It doesn't work:
> 
>    LINK         _out/Linux_x86_64/nvidia-modprobe.unstripped
> /bin/sh: build/nvidia-modprobe-450.57/_out/Linux_x86_64/gen-manpage-opts:
> cannot execute binary file: Exec format error
> make[2]: *** [Makefile:149: _out/Linux_x86_64/options.1.inc] Error 126
> 
> The package as-is from GitHub has an extremely convoluted Makefile
> which does not do what we want in Buildroot.

The Makefile is not that convoluted, and we definitely want to use it.
The above error is due to the fact that the gen-manpage-opts tool needs
to be built for the host.

Two solutions:

 - Set HOST_CC and other variables properly when building.

 - Don't build the manpage, which should be doable by calling the
   appropriate make target.

Also, you have host-pkgconf as a dependency, and it doesn't seem to be
needed.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2020-08-08 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01 21:36 [Buildroot] [PATCH v1 1/6] package/nvidia-modprobe: new package Christian Stewart
2020-08-08  7:02 ` Asaf Kahlon
2020-08-08 11:29   ` Christian Stewart
2020-08-08 13:56     ` Asaf Kahlon
2020-08-08 14:28     ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.