364.12

parent 0a050a90
......@@ -113,10 +113,10 @@ MANPAGE_install: $(MANPAGE)
$(MKDIR) $(MANDIR)
$(INSTALL) $(INSTALL_BIN_ARGS) $< $(MANDIR)/$(notdir $<)
$(NVIDIA_MODPROBE): $(OBJS)
$(eval $(call DEBUG_INFO_RULES, $(NVIDIA_MODPROBE)))
$(NVIDIA_MODPROBE).unstripped: $(OBJS)
$(call quiet_cmd,LINK) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ \
$(BIN_LDFLAGS)
$(call quiet_cmd,STRIP_CMD) $@
# define the rule to build each object file
$(foreach src,$(SRC),$(eval $(call DEFINE_OBJECT_RULE,TARGET,$(src))))
......
/*
* Copyright (C) 2010-2012 NVIDIA Corporation
* Copyright (C) 2010-2015 NVIDIA Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
......@@ -40,8 +40,12 @@
#define ARRAY_LEN(_arr) (sizeof(_arr) / sizeof(_arr[0]))
#ifndef NV_MIN
#define NV_MIN(x,y) ((x) < (y) ? (x) : (y))
#endif
#ifndef NV_MAX
#define NV_MAX(x,y) ((x) > (y) ? (x) : (y))
#endif
#define TAB " "
#define BIGTAB " "
......
......@@ -57,6 +57,7 @@
#define NV_UVM_MODULE_NAME "nvidia-uvm"
#define NV_UVM_DEVICE_NAME "/dev/nvidia-uvm"
#define NV_UVM_TOOLS_DEVICE_NAME "/dev/nvidia-uvm-tools"
#define NV_MODESET_MODULE_NAME "nvidia-modeset"
......@@ -71,6 +72,8 @@
#define NV_PCI_VENDOR_ID 0x10DE
#define NV_MIN(a, b) (((a) < (b)) ? (a) : (b))
/*
* Construct the nvidia kernel module name based on the input
* module instance provided. If an error occurs, the null
......@@ -297,10 +300,13 @@ static int modprobe_helper(const int print_errors, const char *module_name)
size_t n;
n = fread(modprobe_path, 1, sizeof(modprobe_path), fp);
if (n >= 1)
{
modprobe_path[n - 1] = '\0';
}
/*
* Null terminate the string, but make sure 'n' is in the range
* [0, sizeof(modprobe_path)-1].
*/
n = NV_MIN(n, sizeof(modprobe_path) - 1);
modprobe_path[n] = '\0';
/*
* If str was longer than a line, we might still have a
......@@ -639,7 +645,7 @@ done:
/*
* Attempt to create the NVIDIA Unified Memory device file
*/
int nvidia_uvm_mknod(int minor)
int nvidia_uvm_mknod(int base_minor)
{
int major = get_chardev_major(NV_UVM_MODULE_NAME);
......@@ -648,7 +654,8 @@ int nvidia_uvm_mknod(int minor)
return 0;
}
return mknod_helper(major, minor, NV_UVM_DEVICE_NAME, NULL);
return mknod_helper(major, base_minor, NV_UVM_DEVICE_NAME, NULL) &&
mknod_helper(major, base_minor + 1, NV_UVM_TOOLS_DEVICE_NAME, NULL);
}
......
......@@ -58,7 +58,7 @@
int nvidia_modprobe(const int print_errors, int module_instance);
int nvidia_mknod(int minor, int module_instance);
int nvidia_uvm_modprobe(const int print_errors);
int nvidia_uvm_mknod(int minor);
int nvidia_uvm_mknod(int base_minor);
int nvidia_modeset_modprobe(void);
int nvidia_modeset_mknod(void);
......
......@@ -73,6 +73,7 @@ MKDIR ?= mkdir -p
RM ?= rm -f
TOUCH ?= touch
WHOAMI ?= whoami
HARDLINK ?= ln -f
HOSTNAME_CMD ?= hostname
DATE ?= date
GZIP_CMD ?= gzip
......@@ -151,6 +152,13 @@ endif
OUTPUTDIR ?= _out/$(TARGET_OS)_$(TARGET_ARCH)
OUTPUTDIR_ABSOLUTE ?= $(CURDIR)/$(OUTPUTDIR)
NV_SEPARATE_DEBUG_INFO ?=
NV_KEEP_UNSTRIPPED_BINARIES ?=
DO_STRIP ?=
ifneq ($(DEBUG),1)
DO_STRIP = 1
endif
NV_QUIET_COMMAND_REMOVED_TARGET_PREFIX ?=
CFLAGS += $(CC_ONLY_CFLAGS)
......@@ -288,6 +296,7 @@ quiet_LINK = $(call define_quiet_cmd,LINK ,$@)
quiet_HOST_LINK = $(call define_quiet_cmd,HOST_LINK ,$@)
quiet_M4 = $(call define_quiet_cmd,M4 ,$<)
quiet_STRIP_CMD = $(call define_quiet_cmd,STRIP ,$@)
quiet_HARDLINK = $(call define_quiet_cmd,HARDLINK ,$@)
##############################################################################
# Tell gmake to delete the target of a rule if it has changed and its
......@@ -383,6 +392,32 @@ define DEFINE_OBJECT_RULE
$$(eval $$(call DEFINE_OBJECT_RULE_WITH_DIR,$(1),$(2),$(OUTPUTDIR)))
endef
# This is a function that will generate rules to build
# files with separate debug information, if so requested.
#
# It takes one parameter: (1) Name of unstripped binary
#
# When used, the target for linking should be named (1).unstripped
#
# If separate debug information is requested, it will
# generate a rule to build one from the unstripped binary.
# If requested, it will also retain the unstripped binary.
define DEBUG_INFO_RULES
$(1): $(1).unstripped
ifneq ($(or $(DO_STRIP),$(NV_SEPARATE_DEBUG_INFO)),)
$$(call quiet_cmd,STRIP_CMD) -o $$@ $$<
else
$$(call quiet_cmd,HARDLINK) $$^ $$@
endif
ifeq ($(NV_SEPARATE_DEBUG_INFO),1)
$(1).debug: $(1).unstripped
$$(call quiet_cmd,STRIP_CMD) --only-keep-debug -o $$@ $$<
$(1): $(1).debug
endif
ifneq ($(NV_KEEP_UNSTRIPPED_BINARIES),1)
.INTERMEDIATE: $(1).unstripped
endif
endef
##############################################################################
# STAMP_C - this is a source file that is generated during the build
......
NVIDIA_VERSION = 361.28
NVIDIA_VERSION = 364.12
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment