uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
34
pkgs/os-specific/linux/usbip/default.nix
Normal file
34
pkgs/os-specific/linux/usbip/default.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ lib, stdenv, fetchpatch, kernel, udev, autoconf, automake, libtool, hwdata, kernelOlder }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "usbip-${kernel.name}";
|
||||
|
||||
src = kernel.src;
|
||||
|
||||
patches = lib.optionals (kernelOlder "5.4") [
|
||||
# fixes build with gcc8
|
||||
./fix-snprintf-truncation.patch
|
||||
# fixes build with gcc9
|
||||
./fix-strncpy-truncation.patch
|
||||
] ++ kernel.patches;
|
||||
|
||||
nativeBuildInputs = [ autoconf automake libtool ];
|
||||
buildInputs = [ udev ];
|
||||
|
||||
NIX_CFLAGS_COMPILE = [ "-Wno-error=address-of-packed-member" ];
|
||||
|
||||
preConfigure = ''
|
||||
cd tools/usb/usbip
|
||||
./autogen.sh
|
||||
'';
|
||||
|
||||
configureFlags = [ "--with-usbids-dir=${hwdata}/share/hwdata/" ];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/torvalds/linux/tree/master/tools/usb/usbip";
|
||||
description = "allows to pass USB device from server to client over the network";
|
||||
license = with licenses; [ gpl2Only gpl2Plus ];
|
||||
platforms = platforms.linux;
|
||||
broken = kernelOlder "4.10";
|
||||
};
|
||||
}
|
||||
13
pkgs/os-specific/linux/usbip/fix-snprintf-truncation.patch
Normal file
13
pkgs/os-specific/linux/usbip/fix-snprintf-truncation.patch
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c
|
||||
index 8159fd98680b..7d6eb3e3fe1e 100644
|
||||
--- a/tools/usb/usbip/libsrc/vhci_driver.c
|
||||
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
|
||||
@@ -111,7 +111,7 @@ static int parse_status(const char *value)
|
||||
static int refresh_imported_device_list(void)
|
||||
{
|
||||
const char *attr_status;
|
||||
- char status[MAX_STATUS_NAME+1] = "status";
|
||||
+ char status[MAX_STATUS_NAME+2] = "status";
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < vhci_driver->ncontrollers; i++) {
|
||||
37
pkgs/os-specific/linux/usbip/fix-strncpy-truncation.patch
Normal file
37
pkgs/os-specific/linux/usbip/fix-strncpy-truncation.patch
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
diff --git a/tools/usb/usbip/libsrc/usbip_common.c b/tools/usb/usbip/libsrc/usbip_common.c
|
||||
index bb424638d75b..2fc5837e609a 100644
|
||||
--- a/tools/usb/usbip/libsrc/usbip_common.c
|
||||
+++ b/tools/usb/usbip/libsrc/usbip_common.c
|
||||
@@ -226,8 +226,8 @@ int read_usb_device(struct udev_device *sdev, struct usbip_usb_device *udev)
|
||||
path = udev_device_get_syspath(sdev);
|
||||
name = udev_device_get_sysname(sdev);
|
||||
|
||||
- strncpy(udev->path, path, SYSFS_PATH_MAX);
|
||||
- strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE);
|
||||
+ strncpy(udev->path, path, SYSFS_PATH_MAX-1);
|
||||
+ strncpy(udev->busid, name, SYSFS_BUS_ID_SIZE-1);
|
||||
|
||||
sscanf(name, "%u-%u", &busnum, &devnum);
|
||||
udev->busnum = busnum;
|
||||
diff --git a/tools/usb/usbip/libsrc/usbip_device_driver.c b/tools/usb/usbip/libsrc/usbip_device_driver.c
|
||||
index 5a3726eb44ab..95b416af8b99 100644
|
||||
--- a/tools/usb/usbip/libsrc/usbip_device_driver.c
|
||||
+++ b/tools/usb/usbip/libsrc/usbip_device_driver.c
|
||||
@@ -91,7 +91,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
|
||||
copy_descr_attr16(dev, &descr, idProduct);
|
||||
copy_descr_attr16(dev, &descr, bcdDevice);
|
||||
|
||||
- strncpy(dev->path, path, SYSFS_PATH_MAX);
|
||||
+ strncpy(dev->path, path, SYSFS_PATH_MAX-1);
|
||||
|
||||
dev->speed = USB_SPEED_UNKNOWN;
|
||||
speed = udev_device_get_sysattr_value(sdev, "current_speed");
|
||||
@@ -110,7 +110,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
|
||||
dev->busnum = 0;
|
||||
|
||||
name = udev_device_get_sysname(plat);
|
||||
- strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE);
|
||||
+ strncpy(dev->busid, name, SYSFS_BUS_ID_SIZE-1);
|
||||
return 0;
|
||||
err:
|
||||
fclose(fd);
|
||||
Loading…
Add table
Add a link
Reference in a new issue