buildroot/package/nvidia-driver/0001-use-LDFLAGS.patch
Yann E. MORIN c464f96004 package/nvidia-driver: update version
This new version brings in support for egl-wayland, the EGL extensions
aimed at making it possible to implement Wayland servers and clients. As
such, nvidia-driver becomes the second EGL implementation in Buildroot
that can act as a libegl provider with egl-wayland extensions.

In this version, it becomes possible to use our kernel-module infra,
with just a little few minor tricks: we need just specify the Linux
source and build trees (they are the same for us) and the list of
modules to build. We still need a little patch against the Kbuild files.

We also get rid of the LIBS_NO_VERSION trick and always use complete
filenames, as more libs are now packaged with different version in their
filenames, and even some with no version at all.

When installing libs, we switch from a shell loop to a make foreach
loop, which is easier to handle. It has the side-effect (and advantage)
of displaying the install commands for each library, rather than a
single biggish one, so it is easier to see what goes wrong. This also
means that an error in each phase of the install (the copy of the files
then each symlink) can be caught more easily (it was not previously):
each sequence is now its own make command; we need not use "|| exit 1"
after each command, even in a if block, because the if blocks returns
with the exit code of the last command in it; e.g. if an ln fails, the
if-block in which it is enclosed will return the exit code of ln, and
make will catch it.

Similarly for the X driver modules and each of the programs installed:
we now can catch any failure in the isntall of those.

All of this somewhat simplifies the .mk. It is a little bit longer, but
the structure is saner and more explicit.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-09-20 21:15:25 +02:00

49 lines
2 KiB
Diff

kernel: use LDFLAGS when linking modules
Currently, linking module objects is simply using $(LD), assuming that
the default emulation is correct for the current architecture.
However, that might not be the case when the toolchain default is not
the same as the current arch. For example, if the toolchain defaults to
i386 and is capable of x86_64, and we're targetting x86_64 (or the
opposite), the link would fail because the ld emulation is incorrect:
.../i686-pc-linux-gnu-ld: Relocatable linking with relocations from
format elf64-x86-64 (.../nvidia-driver-370.23/kernel/nvidia/nv-frontend.o)
to format elf32-i386 (.../nvidia-driver-370.23/kernel/nvidia/nv-interface.o)
is not supported
Add use of $(LDFLAGS) when doing the link, as the kernel provides the
proper emulation in those.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
Issue reported upstream:
https://devtalk.nvidia.com/default/topic/958653/
diff -durN nvidia-driver-370.23.orig/kernel/nvidia/nvidia.Kbuild nvidia-driver-370.23/kernel/nvidia/nvidia.Kbuild
--- nvidia-driver-370.23.orig/kernel/nvidia/nvidia.Kbuild 2016-08-09 01:57:50.000000000 +0200
+++ nvidia-driver-370.23/kernel/nvidia/nvidia.Kbuild 2016-08-20 12:25:02.780233423 +0200
@@ -87,7 +87,7 @@
always += $(NVIDIA_INTERFACE)
$(obj)/$(NVIDIA_INTERFACE): $(addprefix $(obj)/,$(NVIDIA_OBJECTS))
- $(LD) -r -o $@ $^
+ $(LD) $(LDFLAGS) -r -o $@ $^
#
diff -durN nvidia-driver-370.23.orig/kernel/nvidia-modeset/nvidia-modeset.Kbuild nvidia-driver-370.23/kernel/nvidia-modeset/nvidia-modeset.Kbuild
--- nvidia-driver-370.23.orig/kernel/nvidia-modeset/nvidia-modeset.Kbuild 2016-08-09 01:43:19.000000000 +0200
+++ nvidia-driver-370.23/kernel/nvidia-modeset/nvidia-modeset.Kbuild 2016-08-20 12:25:39.596772662 +0200
@@ -70,7 +70,7 @@
always += $(NVIDIA_MODESET_INTERFACE)
$(obj)/$(NVIDIA_MODESET_INTERFACE): $(addprefix $(obj)/,$(NVIDIA_MODESET_OBJECTS))
- $(LD) -r -o $@ $^
+ $(LD) $(LDFLAGS) -r -o $@ $^
#
# Register the conftests needed by nvidia-modeset.ko