about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2022-06-04 07:47:40 +0100
committerSergei Trofimovich <slyich@gmail.com>2022-06-04 08:11:56 +0100
commit473bca4bd27738f487d134e0b3f79305dca09ef0 (patch)
tree6fdd775e564dd63e9ae8e6e43b1b0faf9b128d80
parent99b94f9522a37a305bc32f598c61d20fb9e53ff6 (diff)
linuxPackages_hardkernel_latest.usbip: pull upstream fix for -fno-common toolchains
Without the change builds fails on upstream -gcc-10 as:

    ld: tools/usb/usbip/libsrc/vhci_driver.c:18: multiple definition of
      `udev_context'; tools/usb/usbip/libsrc/usbip_host_common.c:38: first defined here
-rw-r--r--pkgs/os-specific/linux/kernel/linux-hardkernel-4.14.nix10
-rw-r--r--pkgs/os-specific/linux/usbip/default.nix4
2 files changed, 11 insertions, 3 deletions
diff --git a/pkgs/os-specific/linux/kernel/linux-hardkernel-4.14.nix b/pkgs/os-specific/linux/kernel/linux-hardkernel-4.14.nix
index 70ac299f16199..69bbdf648d226 100644
--- a/pkgs/os-specific/linux/kernel/linux-hardkernel-4.14.nix
+++ b/pkgs/os-specific/linux/kernel/linux-hardkernel-4.14.nix
@@ -1,4 +1,4 @@
-{ buildPackages, fetchFromGitHub, perl, buildLinux, libelf, util-linux, ... } @ args:
+{ buildPackages, fetchFromGitHub, fetchurl, perl, buildLinux, libelf, util-linux, kernelPatches ? [], ... } @ args:
 
 buildLinux (args // rec {
   version = "4.14.180-176";
@@ -16,6 +16,14 @@ buildLinux (args // rec {
     sha256 = "0n7i7a2bkrm9p1wfr20h54cqm32fbjvwyn703r6zm1f6ivqhk43v";
   };
 
+  kernelPatches = args.kernelPatches ++ [{
+    name = "usbip-tools-fno-common";
+    patch = fetchurl {
+      url = "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=d5efc2e6b98fe661dbd8dd0d5d5bfb961728e57a";
+      hash = "sha256-1CXYCV5zMLA4YdbCr8cO2N4CHEDzQChS9qbKYHPm3U4=";
+    };
+  }];
+
   defconfig = "odroidxu4_defconfig";
 
   # This extraConfig is (only) required because the gator module fails to build as-is.
diff --git a/pkgs/os-specific/linux/usbip/default.nix b/pkgs/os-specific/linux/usbip/default.nix
index 43c22a8fd12af..cadf38b106ccc 100644
--- a/pkgs/os-specific/linux/usbip/default.nix
+++ b/pkgs/os-specific/linux/usbip/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, kernel, udev, autoconf, automake, libtool, hwdata, kernelOlder }:
+{ lib, stdenv, fetchpatch, kernel, udev, autoconf, automake, libtool, hwdata, kernelOlder }:
 
 stdenv.mkDerivation {
   name = "usbip-${kernel.name}";
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
     ./fix-snprintf-truncation.patch
     # fixes build with gcc9
     ./fix-strncpy-truncation.patch
-  ];
+  ] ++ kernel.patches;
 
   nativeBuildInputs = [ autoconf automake libtool ];
   buildInputs = [ udev ];